sonic-radiance/sonic-radiance.love/scenes/debug/menu/init.lua

106 lines
3.5 KiB
Lua
Raw Normal View History

2020-08-01 10:31:09 +02:00
local Scene = require "core.modules.scenes"
local menu = require "scenes.debug.menu.menu"
local DebugMenu = Scene:extend()
2020-08-02 08:30:19 +02:00
local panels = require "scenes.debug.menu.infopanel"
2020-08-01 10:31:09 +02:00
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")
2020-08-01 10:31:09 +02:00
self:buildBattleMenu()
self:buildOverworldMenu()
self:buildSaveMenu()
self:buildOtherMenu()
2020-08-01 16:06:08 +02:00
menu.commons.SceneWidget(self, "BaseMenu", scenes.options, "Options")
2020-08-01 10:31:09 +02:00
menu.ExitWidget(self, "BaseMenu")
self.menusystem:activate()
self.menusystem:switchMenu("BaseMenu")
2020-08-02 08:30:19 +02:00
self.panel = panels.Gamedata()
2020-08-01 10:31:09 +02:00
end
function DebugMenu:buildOverworldMenu()
self:addSubMenu("overworld", "BaseMenu", "Overworld")
menu.commons.SceneWidget(self, "overworld", scenes.overworld, "Launch Overworld")
2020-08-01 10:31:09 +02:00
menu.commons.SubMenuWidget(self, "overworld", "BaseMenu", "Back")
end
function DebugMenu:buildBattleMenu()
self:addSubMenu("combat", "BaseMenu", "Battle System")
menu.commons.SceneWidget(self, "combat", scenes.cbs, "Launch Battle")
2020-08-01 14:01:08 +02:00
menu.commons.SceneWidget(self, "combat", scenes.debug.viewers.battleBack, "Background Viewer")
2020-08-01 10:31:09 +02:00
menu.commons.SubMenuWidget(self, "combat", "BaseMenu", "Back")
end
function DebugMenu:buildSaveMenu()
self:addSubMenu("save", "BaseMenu", "Save System")
2020-08-02 08:30:19 +02:00
self:addSubMenu("characters", "save", "Characters")
for name, data in pairs(game.characters.list) do
self:addCharacterMenu(name, data)
end
2020-08-02 09:59:47 +02:00
self:addSubMenu("load", "save", "Load Saves")
for i=1, game.slotNumber do
menu.LoadWidget(self, "load", i)
end
menu.SaveWidget(self, "save")
2020-08-01 10:31:09 +02:00
menu.commons.SubMenuWidget(self, "save", "BaseMenu", "Back")
2020-08-02 08:30:19 +02:00
menu.commons.SubMenuWidget(self, "characters", "save", "Back")
2020-08-02 09:59:47 +02:00
menu.commons.SubMenuWidget(self, "load", "save", "Back")
2020-08-02 08:30:19 +02:00
end
function DebugMenu:addCharacterMenu(name, data)
2020-08-02 10:33:31 +02:00
self:addSubMenu(name, "characters", data.fullname, panels.Character, data)
menu.SubMenuWidget(self, name, "characters", "Back", panels.Gamedata, nil)
2020-08-01 10:31:09 +02:00
end
function DebugMenu:buildOtherMenu()
self:addSubMenu("other", "BaseMenu", "Other gameplay")
self:addSubMenu("battle", "other", "Sonic Battle Maps")
local mapList = require "datas.gamedata.maps.battle"
for i, name in ipairs(mapList) do
local mapData = require("datas.gamedata.maps.battle." .. name)
local trueName = mapData.name
menu.commons.SceneWidget(self, "battle", scenes.test, trueName, name)
end
menu.commons.SceneWidget(self, "other", scenes.test2, "Shadow Shot Maps")
2020-08-01 10:31:09 +02:00
menu.commons.SubMenuWidget(self, "battle", "other", "Back")
2020-08-01 10:31:09 +02:00
menu.commons.SubMenuWidget(self, "other", "BaseMenu", "Back")
end
function DebugMenu:update(dt)
if (love.keyboard.isDown("space") and (not self.menusystem.isActive)) then
self.menusystem:activate()
end
end
2020-08-02 10:33:31 +02:00
function DebugMenu:addSubMenu(submenu, parent, name, panel, panelArgument)
2020-08-01 10:31:09 +02:00
local parent = parent or "BaseMenu"
menu.commons.DebugMenu(self, submenu)
2020-08-02 10:33:31 +02:00
if (panel == nil) then
menu.commons.SubMenuWidget(self, parent, submenu, name .. " >")
else
menu.SubMenuWidget(self, parent, submenu, name .. " >", panel, panelArgument)
end
2020-08-01 10:31:09 +02:00
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")
2020-08-02 08:30:19 +02:00
self.panel:draw(240, 48)
2020-08-01 10:31:09 +02:00
end
end
return DebugMenu;