feat: add a better menu structure outside debug
This commit is contained in:
parent
5f18f79ed6
commit
801e332b69
6 changed files with 31 additions and 16 deletions
|
@ -27,10 +27,13 @@ local Game = require "game"
|
||||||
scenes = require "scenes"
|
scenes = require "scenes"
|
||||||
|
|
||||||
function love.load()
|
function love.load()
|
||||||
core = Core(true)
|
core = Core(false)
|
||||||
game = Game()
|
game = Game()
|
||||||
|
if (core.debug.active) then
|
||||||
scenes.debug.menu()
|
scenes.debug.menu()
|
||||||
|
else
|
||||||
|
scenes.title()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.update(dt)
|
function love.update(dt)
|
||||||
|
|
|
@ -6,8 +6,10 @@ function ParentPanel:new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ParentPanel:draw(x, y, w, h)
|
function ParentPanel:draw(x, y, w, h)
|
||||||
|
if (core.debug.active) then
|
||||||
love.graphics.draw(self.panelBackground, x, y)
|
love.graphics.draw(self.panelBackground, x, y)
|
||||||
self:drawContent(x+8, y+8)
|
self:drawContent(x+8, y+8)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ParentPanel:drawContent(x, y)
|
function ParentPanel:drawContent(x, y)
|
||||||
|
|
|
@ -6,16 +6,16 @@ local panels = require "scenes.debug.menu.infopanel"
|
||||||
local battleutils = require "game.utils.battle"
|
local battleutils = require "game.utils.battle"
|
||||||
local itemutils = require "game.utils.items"
|
local itemutils = require "game.utils.items"
|
||||||
|
|
||||||
|
local gui = require "game.modules.gui"
|
||||||
|
|
||||||
function DebugMenu:new()
|
function DebugMenu:new()
|
||||||
DebugMenu.super.new(self)
|
DebugMenu.super.new(self)
|
||||||
self.assets:batchImport("scenes.debug.commons.assets")
|
self.assets:batchImport("scenes.debug.commons.assets")
|
||||||
menu.commons.DebugMenu(self, "BaseMenu")
|
menu.commons.DebugMenu(self, "BaseMenu")
|
||||||
menu.commons.SceneWidget(self, "BaseMenu", scenes.title, "Launch Game")
|
menu.commons.SceneWidget(self, "BaseMenu", scenes.overworld, "Start playing")
|
||||||
self:buildBattleMenu()
|
|
||||||
self:buildOverworldMenu()
|
|
||||||
self:buildSaveMenu()
|
|
||||||
self:buildOtherMenu()
|
|
||||||
menu.commons.SceneWidget(self, "BaseMenu", scenes.options, "Options")
|
menu.commons.SceneWidget(self, "BaseMenu", scenes.options, "Options")
|
||||||
|
self:buildDebugMenu()
|
||||||
|
menu.commons.SceneWidget(self, "BaseMenu", scenes.title, "Return to title")
|
||||||
menu.ExitWidget(self, "BaseMenu")
|
menu.ExitWidget(self, "BaseMenu")
|
||||||
|
|
||||||
self.menusystem.menus["BaseMenu"]:finalize()
|
self.menusystem.menus["BaseMenu"]:finalize()
|
||||||
|
@ -25,13 +25,23 @@ function DebugMenu:new()
|
||||||
self.panel = panels.Gamedata()
|
self.panel = panels.Gamedata()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function DebugMenu:buildDebugMenu()
|
||||||
|
if (core.debug.active) then
|
||||||
|
self:addSubMenu("debug", "BaseMenu", "Debug Menu")
|
||||||
|
self:buildBattleMenu()
|
||||||
|
--self:buildOverworldMenu()
|
||||||
|
self:buildSaveMenu()
|
||||||
|
self:buildOtherMenu()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function DebugMenu:buildOverworldMenu()
|
function DebugMenu:buildOverworldMenu()
|
||||||
self:addSubMenu("overworld", "BaseMenu", "Overworld")
|
self:addSubMenu("overworld", "debug", "Overworld")
|
||||||
menu.commons.SceneWidget(self, "overworld", scenes.overworld, "Launch Overworld")
|
menu.commons.SceneWidget(self, "overworld", scenes.overworld, "Launch Overworld")
|
||||||
end
|
end
|
||||||
|
|
||||||
function DebugMenu:buildBattleMenu()
|
function DebugMenu:buildBattleMenu()
|
||||||
self:addSubMenu("combat", "BaseMenu", "Battle System")
|
self:addSubMenu("combat", "debug", "Battle System")
|
||||||
self:addSubMenu("launchBattle", "combat", "Launch Battle")
|
self:addSubMenu("launchBattle", "combat", "Launch Battle")
|
||||||
|
|
||||||
local listCat = battleutils.listCategories()
|
local listCat = battleutils.listCategories()
|
||||||
|
@ -54,7 +64,7 @@ function DebugMenu:addBattles(battleCat)
|
||||||
end
|
end
|
||||||
|
|
||||||
function DebugMenu:buildSaveMenu()
|
function DebugMenu:buildSaveMenu()
|
||||||
self:addSubMenu("save", "BaseMenu", "Save System", panels.Gamedata, nil)
|
self:addSubMenu("save", "debug", "Save System", panels.Gamedata, nil)
|
||||||
self:addSubMenu("characters", "save", "Characters", panels.Gamedata, nil)
|
self:addSubMenu("characters", "save", "Characters", panels.Gamedata, nil)
|
||||||
self:addSubMenu("team", "save", "Team Formation", panels.Team, nil)
|
self:addSubMenu("team", "save", "Team Formation", panels.Team, nil)
|
||||||
menu.ChangeLeaderWidget(self, "team")
|
menu.ChangeLeaderWidget(self, "team")
|
||||||
|
@ -88,7 +98,7 @@ function DebugMenu:addInventory()
|
||||||
end
|
end
|
||||||
|
|
||||||
function DebugMenu:buildOtherMenu()
|
function DebugMenu:buildOtherMenu()
|
||||||
self:addSubMenu("other", "BaseMenu", "Other gameplay")
|
self:addSubMenu("other", "debug", "Other gameplay")
|
||||||
self:addSubMenu("battle", "other", "Sonic Battle Maps")
|
self:addSubMenu("battle", "other", "Sonic Battle Maps")
|
||||||
local mapList = require "datas.gamedata.maps.battle"
|
local mapList = require "datas.gamedata.maps.battle"
|
||||||
for i, name in ipairs(mapList) do
|
for i, name in ipairs(mapList) do
|
||||||
|
@ -117,8 +127,8 @@ end
|
||||||
|
|
||||||
function DebugMenu:draw()
|
function DebugMenu:draw()
|
||||||
if (self.menusystem.isActive) then
|
if (self.menusystem.isActive) then
|
||||||
self.assets.fonts["small"]:print("## SONIC RADIANCE - DEBUG MENU ##", 424/2, 8, "center")
|
self.assets.fonts["small"]:print("## SONIC RADIANCE - MAIN MENU ##", 424/2, 8, "center")
|
||||||
self.assets.fonts["small"]:print("v" .. game.version, 424 - 8, 240 - 22, "right")
|
self.assets.fonts["small"]:print("v" .. game.version, 424 - 8, 240 - 20, "right")
|
||||||
|
|
||||||
self.panel:draw(240, 48)
|
self.panel:draw(240, 48)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue