Skip to content

Commit

Permalink
Upload
Browse files Browse the repository at this point in the history
  • Loading branch information
VoidmatrixHeathcliff committed Feb 26, 2021
1 parent 2a7a7b0 commit efcbf77
Show file tree
Hide file tree
Showing 47 changed files with 1,273 additions and 1 deletion.
1 change: 1 addition & 0 deletions Archive/archive - 空白存档.data
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
return{main_table={_dialogue_list_index=1,_dialogue_text_index=1,choice=0,},}
1 change: 1 addition & 0 deletions Archive/archive.data
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
return{main_table={choice=0,_dialogue_text_index=1,_dialogue_list_index=1,},}
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
# Dragon-Knight
《巨龙与骑士》EtherEngine 示例游戏

### 《巨龙与骑士》[EtherEngine](https://github.com/VoidmatrixHeathcliff/EtherEngine) 示例游戏

+ 本项目仅做代码交流使用,所使用的图片和字体文件请勿随意商用

+ 源代码位于 `Script` 文件夹下,同文件夹下的 `ESBuilder.exe` 运行后可将源代码编译为字节码文件

+ 游戏存档位于 `Archive` 文件夹下,删除 `archive.data` 并将文件 `archive - 空白存档.data` 重命名为 `archive.data` 可以重置游戏进程

+ 游戏中展示了 **音乐播放****存档****视觉小说类场景渲染****弹幕射击类游戏** 等功能的实现

+ 游戏代码可能并不与最新版本的 [EtherEngine](https://github.com/VoidmatrixHeathcliff/EtherEngine) 兼容,如需尝试请下载示例源码运行或下载 `Release` 版本运行

## 示例图片

![示例图片](示例图片.jpg)
Binary file added Resource/Audio/bgm_1.ogg
Binary file not shown.
Binary file added Resource/Audio/bgm_2.ogg
Binary file not shown.
Binary file added Resource/Audio/keyboard.wav
Binary file not shown.
Binary file added Resource/Font/SIMYOU.TTF
Binary file not shown.
Binary file added Resource/Font/YGYCY.ttf
Binary file not shown.
Binary file added Resource/Image/Background/Road_Morning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/Image/Character/WarriorAngry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/Image/Character/WarriorNormal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/Image/Character/WarriorSad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/Image/Character/WarriorScared.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/Image/choice_hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/Image/choice_idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resource/Image/textbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SDL2.dll
Binary file not shown.
Binary file added SDL2_gfx.dll
Binary file not shown.
Binary file added SDL2_image.dll
Binary file not shown.
Binary file added SDL2_mixer.dll
Binary file not shown.
Binary file added SDL2_ttf.dll
Binary file not shown.
140 changes: 140 additions & 0 deletions Script/ArchiveManager.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
--[[ 存档管理器 ]] --
ArchiveManager = {}

-- 归档
local _archive = nil

-- 归档文件名称
local _archive_name = nil

-- 当前选中的Table
local _current_table = nil

--[[
打开指定名称的归档文件
参数:无
返回值:无
--]]
function ArchiveManager.OpenArchive(name)
_archive = require(name)
_archive_name = name
end

--[[
检查指定名称的Table是否存在
参数:Table名称
返回值:是否存在
--]]
function ArchiveManager.HashTable(name)
if _archive[name] then return true else return false end
end

--[[
新建指定名称的Table
参数:Table名称
返回值:无
--]]
function ArchiveManager.NewTable(name)
assert(_archive, "ArchiveManager.NewTable():未打开归档文件")
assert(type(name) == "string", "ArchiveManager.NewTable():参数必须为string类型")
assert(not _archive[name], "ArchiveManager.NewTable():指定名称的Table已存在")
_archive[name] = {}
end

--[[
删除指定名称的Table
参数:Table名称
返回值:无
--]]
function ArchiveManager.DeleteTable(name)
assert(_archive, "ArchiveManager.DeleteTable():未打开归档文件")
assert(type(name) == "string", "ArchiveManager.DeleteTable():参数必须为string类型")
assert(_archive[name], "ArchiveManager.DeleteTable():指定名称的Table不存在")
_archive[name] = nil
end

--[[
选中指定名称的Table
参数:Table名称
返回值:无
--]]
function ArchiveManager.SelectTable(name)
assert(_archive, "ArchiveManager.SelectTable():未打开归档文件")
assert(type(name) == "string", "ArchiveManager.SelectTable():参数必须为string类型")
assert(_archive[name], "ArchiveManager.SelectTable():指定名称的Table不存在")
_current_table = _archive[name]
end

--[[
设置当前选中Table的数据
参数:键,值
返回值:无
--]]
function ArchiveManager.SetData(key, value)
assert(_archive, "ArchiveManager.SetData():未打开归档文件")
assert(_current_table, "ArchiveManager.SetData():未选中数据存储表")
assert(type(key) == "string", "ArchiveManager.SetData():key必须为string类型")
assert(type(value) == "nil" or type(value) == "boolean" or type(value) == "number" or type(value) == "string",
"ArchiveManager.SetData():value必须为nil、boolean、number、string类型中的一个")
_current_table[key] = value
end

--[[
获取当前选中Table的指定键对应的值
参数:键
返回值:键对应的值
--]]
function ArchiveManager.GetData(key)
assert(_archive, "ArchiveManager.GetData():未打开归档文件")
assert(_current_table, "ArchiveManager.GetData():未选中数据存储表")
assert(type(key) == "string", "ArchiveManager.GetData():key必须为string类型")
return _current_table[key]
end

--[[
转储当前归档到文件
参数:无
返回值:无
--]]
function ArchiveManager.DumpArchive()
assert(_archive, "ArchiveManager.DumpArchive():未打开归档文件")
local _file = io.open("./Archive/".._archive_name..".data", "w+")
local _content = "return{"
for name, table in pairs(_archive) do
if table then
_content = _content..name.."={"
for key, value in pairs(table) do
if value then
_content = _content..key.."="
if type(value) == "boolean" then
if value then
_content = _content.."true,"
else
_content = _content.."false,"
end
elseif type(value) == "string" then
_content = _content.."\""..value.."\","
else
_content = _content..value..","
end
end
end
_content = _content.."},"
end
end
_content = _content.."}"
_file:write(_content)
_file:close()
end

--[[
关闭已打开的归档文件
参数:无
返回值:无
--]]
function ArchiveManager.CloseArchive()
assert(_archive, "ArchiveManager.CloseArchive():未打开归档文件")
_archive = nil
end

return ArchiveManager
101 changes: 101 additions & 0 deletions Script/BattleScene_Hard.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
SceneManager = require("SceneManager")
ArchiveManager = require("ArchiveManager")

BattleScene_Hard = {}

BattleScene_Hard.name = "BattleScene_Hard"

local _FONT_ = nil

local _TEXTS_ = {"这里是极度困难的战斗场景……", "虽然还没有开发完成,但是你绝对无法通过~", "Enjoy Ether !"}

local _TEXT_SHOW_DELAY_ = 360

local _RECTS_TEXT_ = nil

local _window_width, _window_height = GetWindowSize()

local _image_Text_1 = nil
local _image_Text_2 = nil
local _image_Text_3 = nil

local _texture_Text_1 = nil
local _texture_Text_2 = nil
local _texture_Text_3 = nil

local _width_image_text_1, _height_image_text_1 = nil, nil
local _width_image_text_2, _height_image_text_2 = nil, nil
local _width_image_text_3, _height_image_text_3 = nil, nil

local _timer_show = 0

local _alpha = 255

local function _FadeOut()
SetDrawColor({r = 0, g = 0, b = 0, a = 15})
for i = 1, 100 do
FillRectangle({x = 0, y = 0, w = _window_width, h = _window_height})
UpdateWindow()
Sleep(10)
end
end

function BattleScene_Hard.Init()
SceneManager.ClearWindowWhenUpdate = false

_FONT_ = LoadFont("./Resource/Font/YGYCY.TTF", 60)

_image_Text_1 = CreateUTF8TextImageBlended(_FONT_, _TEXTS_[1], {r = 147, g = 202, b = 118, a = 255})
_image_Text_2 = CreateUTF8TextImageBlended(_FONT_, _TEXTS_[2], {r = 147, g = 202, b = 118, a = 255})
_image_Text_3 = CreateUTF8TextImageBlended(_FONT_, _TEXTS_[3], {r = 243, g = 152, b = 0, a = 255})
_texture_Text_1 = CreateTexture(_image_Text_1)
_texture_Text_2 = CreateTexture(_image_Text_2)
_texture_Text_3 = CreateTexture(_image_Text_3)

_width_image_text_1, _height_image_text_1 = GetImageSize(_image_Text_1)
_width_image_text_2, _height_image_text_2 = GetImageSize(_image_Text_2)
_width_image_text_3, _height_image_text_3 = GetImageSize(_image_Text_3)
_RECTS_TEXT_ = {
{x = _window_width / 2 - _width_image_text_1 / 2, y = _window_height / 2 - _height_image_text_1 / 2 - 100, w = _width_image_text_1, h = _height_image_text_1},
{x = _window_width / 2 - _width_image_text_2 / 2, y = _window_height / 2 + _height_image_text_1 / 2 + 50, w = _width_image_text_2, h = _height_image_text_2},
{x = _window_width / 2 - _width_image_text_3 / 2, y = _window_height / 2 + _height_image_text_1 / 2 + 200, w = _width_image_text_3, h = _height_image_text_3}
}
end

function BattleScene_Hard.Update()
UpdateEvent()

if _alpha > 0 then _alpha = _alpha - 5 end
if _timer_show > _TEXT_SHOW_DELAY_ then
_FadeOut()
SceneManager.SetQuitHandler(function() return true end)
SceneManager.Quit()
return
else
_timer_show = _timer_show + 1
end

CopyTexture(_texture_Text_1, _RECTS_TEXT_[1])
CopyTexture(_texture_Text_2, _RECTS_TEXT_[2])
CopyTexture(_texture_Text_3, _RECTS_TEXT_[3])
SetDrawColor({r = 0, g = 0, b = 0, a = _alpha})
FillRectangle({x = 0, y = 0, w = _window_width, h = _window_height})
end

function BattleScene_Hard.Unload()
ArchiveManager.SetData("_dialogue_list_index", 1)
ArchiveManager.SetData("_dialogue_text_index", 1)
ArchiveManager.SetData("choice", 0)
ArchiveManager.DumpArchive()
ArchiveManager.CloseArchive()

UnloadFont(_FONT_)
DestroyTexture(_texture_Text_1)
DestroyTexture(_texture_Text_2)
DestroyTexture(_texture_Text_3)
UnloadImage(_image_Text_1)
UnloadImage(_image_Text_2)
UnloadImage(_image_Text_3)
end

return BattleScene_Hard
Loading

0 comments on commit efcbf77

Please sign in to comment.