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-04 17:50:03 +02:00
|
|
|
local battleutils = require "game.utils.battle"
|
2020-08-15 22:43:46 +02:00
|
|
|
local itemutils = require "game.utils.items"
|
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")
|
2020-08-01 12:50:11 +02:00
|
|
|
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")
|
|
|
|
|
2020-08-19 20:44:38 +02:00
|
|
|
self.menusystem.menus["BaseMenu"]:finalize()
|
2020-08-01 10:31:09 +02:00
|
|
|
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")
|
2020-08-01 16:57:12 +02:00
|
|
|
menu.commons.SceneWidget(self, "overworld", scenes.overworld, "Launch Overworld")
|
2020-08-01 10:31:09 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function DebugMenu:buildBattleMenu()
|
|
|
|
self:addSubMenu("combat", "BaseMenu", "Battle System")
|
2020-08-04 17:50:03 +02:00
|
|
|
self:addSubMenu("launchBattle", "combat", "Launch Battle")
|
|
|
|
|
|
|
|
local listCat = battleutils.listCategories()
|
|
|
|
for i,battleCat in ipairs(listCat) do
|
|
|
|
self:addBattles(battleCat)
|
|
|
|
end
|
|
|
|
|
2020-08-01 14:01:08 +02:00
|
|
|
menu.commons.SceneWidget(self, "combat", scenes.debug.viewers.battleBack, "Background Viewer")
|
2020-08-04 12:27:33 +02:00
|
|
|
menu.commons.SceneWidget(self, "combat", scenes.debug.viewers.choregraphy, "Ennemies' Action Viewer")
|
2020-08-04 17:50:03 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function DebugMenu:addBattles(battleCat)
|
|
|
|
local menuName = "b_" .. battleCat
|
|
|
|
self:addSubMenu(menuName, "launchBattle", battleCat)
|
|
|
|
|
|
|
|
for i,battleName in ipairs(battleutils.getBattleFromCategory(battleCat)) do
|
|
|
|
local data = battleutils.getBattleData(battleCat, battleName)
|
|
|
|
menu.commons.SceneWidget(self, menuName, scenes.cbs, "Launch " .. battleName, data)
|
|
|
|
end
|
2020-08-01 10:31:09 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function DebugMenu:buildSaveMenu()
|
2020-08-19 20:44:38 +02:00
|
|
|
self:addSubMenu("save", "BaseMenu", "Save System", panels.Gamedata, nil)
|
|
|
|
self:addSubMenu("characters", "save", "Characters", panels.Gamedata, nil)
|
2020-08-02 23:47:42 +02:00
|
|
|
self:addSubMenu("team", "save", "Team Formation", panels.Team, nil)
|
|
|
|
menu.ChangeLeaderWidget(self, "team")
|
2020-08-02 08:30:19 +02:00
|
|
|
for name, data in pairs(game.characters.list) do
|
|
|
|
self:addCharacterMenu(name, data)
|
2020-08-02 23:47:42 +02:00
|
|
|
menu.AddRemoveWidget(self, "team", data)
|
2020-08-02 08:30:19 +02:00
|
|
|
end
|
|
|
|
|
2020-08-15 22:43:46 +02:00
|
|
|
self:addInventory()
|
|
|
|
|
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-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)
|
2020-08-02 23:47:42 +02:00
|
|
|
menu.LevelUpWidget(self, name, data)
|
2020-08-01 10:31:09 +02:00
|
|
|
end
|
|
|
|
|
2020-08-15 22:43:46 +02:00
|
|
|
function DebugMenu:addInventory()
|
|
|
|
self:addSubMenu("inventory", "save", "Inventory")
|
|
|
|
for i,pocket in ipairs(game.loot.inventory) do
|
|
|
|
self:addSubMenu(pocket.name, "inventory", pocket.fullname)
|
|
|
|
for j, item in ipairs(itemutils.getItemsFromCategory(pocket.name)) do
|
|
|
|
menu.ItemWidget(self, pocket.name, itemutils.getItemData(pocket.name, item))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-08-01 10:31:09 +02:00
|
|
|
function DebugMenu:buildOtherMenu()
|
|
|
|
self:addSubMenu("other", "BaseMenu", "Other gameplay")
|
2020-08-02 10:18:40 +02:00
|
|
|
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
|
|
|
|
|
2020-08-01 12:53:06 +02:00
|
|
|
menu.commons.SceneWidget(self, "other", scenes.test2, "Shadow Shot Maps")
|
2020-08-01 10:31:09 +02:00
|
|
|
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"
|
2020-08-19 20:44:38 +02:00
|
|
|
self.menusystem.menus[parent]:addSubMenu(submenu, name)
|
|
|
|
if (panel ~= nil) then
|
|
|
|
self.menusystem.menus[submenu]:setPanel(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;
|