feat: add a better menu structure outside debug

This commit is contained in:
Kazhnuz 2021-04-03 20:03:55 +02:00
parent 5f18f79ed6
commit 801e332b69
6 changed files with 31 additions and 16 deletions

View file

@ -27,10 +27,13 @@ local Game = require "game"
scenes = require "scenes"
function love.load()
core = Core(true)
core = Core(false)
game = Game()
if (core.debug.active) then
scenes.debug.menu()
else
scenes.title()
end
end
function love.update(dt)

View file

@ -6,9 +6,11 @@ function ParentPanel:new()
end
function ParentPanel:draw(x, y, w, h)
if (core.debug.active) then
love.graphics.draw(self.panelBackground, x, y)
self:drawContent(x+8, y+8)
end
end
function ParentPanel:drawContent(x, y)

View file

@ -6,16 +6,16 @@ local panels = require "scenes.debug.menu.infopanel"
local battleutils = require "game.utils.battle"
local itemutils = require "game.utils.items"
local gui = require "game.modules.gui"
function DebugMenu:new()
DebugMenu.super.new(self)
self.assets:batchImport("scenes.debug.commons.assets")
menu.commons.DebugMenu(self, "BaseMenu")
menu.commons.SceneWidget(self, "BaseMenu", scenes.title, "Launch Game")
self:buildBattleMenu()
self:buildOverworldMenu()
self:buildSaveMenu()
self:buildOtherMenu()
menu.commons.SceneWidget(self, "BaseMenu", scenes.overworld, "Start playing")
menu.commons.SceneWidget(self, "BaseMenu", scenes.options, "Options")
self:buildDebugMenu()
menu.commons.SceneWidget(self, "BaseMenu", scenes.title, "Return to title")
menu.ExitWidget(self, "BaseMenu")
self.menusystem.menus["BaseMenu"]:finalize()
@ -25,13 +25,23 @@ function DebugMenu:new()
self.panel = panels.Gamedata()
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()
self:addSubMenu("overworld", "BaseMenu", "Overworld")
self:addSubMenu("overworld", "debug", "Overworld")
menu.commons.SceneWidget(self, "overworld", scenes.overworld, "Launch Overworld")
end
function DebugMenu:buildBattleMenu()
self:addSubMenu("combat", "BaseMenu", "Battle System")
self:addSubMenu("combat", "debug", "Battle System")
self:addSubMenu("launchBattle", "combat", "Launch Battle")
local listCat = battleutils.listCategories()
@ -54,7 +64,7 @@ function DebugMenu:addBattles(battleCat)
end
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("team", "save", "Team Formation", panels.Team, nil)
menu.ChangeLeaderWidget(self, "team")
@ -88,7 +98,7 @@ function DebugMenu:addInventory()
end
function DebugMenu:buildOtherMenu()
self:addSubMenu("other", "BaseMenu", "Other gameplay")
self:addSubMenu("other", "debug", "Other gameplay")
self:addSubMenu("battle", "other", "Sonic Battle Maps")
local mapList = require "datas.gamedata.maps.battle"
for i, name in ipairs(mapList) do
@ -117,8 +127,8 @@ end
function DebugMenu:draw()
if (self.menusystem.isActive) then
self.assets.fonts["small"]:print("## SONIC RADIANCE - DEBUG MENU ##", 424/2, 8, "center")
self.assets.fonts["small"]:print("v" .. game.version, 424 - 8, 240 - 22, "right")
self.assets.fonts["small"]:print("## SONIC RADIANCE - MAIN MENU ##", 424/2, 8, "center")
self.assets.fonts["small"]:print("v" .. game.version, 424 - 8, 240 - 20, "right")
self.panel:draw(240, 48)
end