2021-08-21 17:00:42 +02:00
|
|
|
local Scene = require "game.scenes"
|
2021-08-15 16:26:05 +02:00
|
|
|
local menu = require "scenes.menus.mainmenu.menu"
|
2020-08-01 10:31:09 +02:00
|
|
|
|
|
|
|
local DebugMenu = Scene:extend()
|
2021-08-15 16:26:05 +02:00
|
|
|
local panels = require "scenes.menus.mainmenu.infopanel"
|
2020-08-01 10:31:09 +02:00
|
|
|
|
2021-04-03 20:03:55 +02:00
|
|
|
local gui = require "game.modules.gui"
|
2021-04-04 13:17:12 +02:00
|
|
|
local MenuBack = require "game.modules.gui.menuback"
|
2021-04-03 20:03:55 +02:00
|
|
|
|
2021-05-05 11:41:25 +02:00
|
|
|
local TweenManager = require "birb.classes.time"
|
2021-04-05 14:20:25 +02:00
|
|
|
|
2020-08-01 10:31:09 +02:00
|
|
|
function DebugMenu:new()
|
|
|
|
DebugMenu.super.new(self)
|
2021-04-04 13:17:12 +02:00
|
|
|
menu.commons.MainMenu(self, "BaseMenu")
|
2021-04-05 14:20:25 +02:00
|
|
|
menu.StartGameWidget(self, "BaseMenu")
|
2021-08-15 16:26:05 +02:00
|
|
|
menu.commons.SceneWidget(self, "BaseMenu", scenes.menus.options, "Options")
|
2021-04-03 20:03:55 +02:00
|
|
|
self:buildDebugMenu()
|
2021-04-05 12:29:45 +02:00
|
|
|
menu.TitleWidget(self, "BaseMenu")
|
2021-04-11 10:32:49 +02:00
|
|
|
self.menusystem.menus["BaseMenu"]:setCancelWidget()
|
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")
|
2021-04-11 10:32:49 +02:00
|
|
|
self.menusystem:setSoundFromSceneAssets("mBeep")
|
2020-08-02 08:30:19 +02:00
|
|
|
|
|
|
|
self.panel = panels.Gamedata()
|
2021-04-04 13:17:12 +02:00
|
|
|
|
|
|
|
self.borderY = 30
|
|
|
|
self.borders = gui.newBorder(424, 30, 8)
|
|
|
|
self.backImage = love.graphics.newImage("assets/artworks/back.png")
|
|
|
|
|
|
|
|
self.back = MenuBack()
|
2021-04-05 14:20:25 +02:00
|
|
|
self.tweens = TweenManager(self)
|
2020-08-01 10:31:09 +02:00
|
|
|
end
|
|
|
|
|
2021-04-03 20:03:55 +02:00
|
|
|
function DebugMenu:buildDebugMenu()
|
|
|
|
if (core.debug.active) then
|
|
|
|
self:addSubMenu("debug", "BaseMenu", "Debug Menu")
|
|
|
|
self:buildBattleMenu()
|
|
|
|
--self:buildOverworldMenu()
|
|
|
|
self:buildSaveMenu()
|
|
|
|
self:buildOtherMenu()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-08-01 10:31:09 +02:00
|
|
|
function DebugMenu:buildOverworldMenu()
|
2021-04-03 20:03:55 +02:00
|
|
|
self:addSubMenu("overworld", "debug", "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()
|
2021-04-03 20:03:55 +02:00
|
|
|
self:addSubMenu("combat", "debug", "Battle System")
|
2020-08-04 17:50:03 +02:00
|
|
|
self:addSubMenu("launchBattle", "combat", "Launch Battle")
|
|
|
|
|
2021-05-15 21:43:15 +02:00
|
|
|
local listCat = core.datas:getCategories("battles")
|
2020-08-04 17:50:03 +02:00
|
|
|
for i,battleCat in ipairs(listCat) do
|
|
|
|
self:addBattles(battleCat)
|
|
|
|
end
|
|
|
|
|
2021-08-15 16:26:05 +02:00
|
|
|
menu.commons.SceneWidget(self, "combat", scenes.menus.debug.battleBack, "Background Viewer")
|
|
|
|
menu.commons.SceneWidget(self, "combat", scenes.menus.debug.animation, "Animation Viewer")
|
|
|
|
menu.commons.SceneWidget(self, "combat", scenes.menus.debug.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)
|
|
|
|
|
2021-05-15 21:43:15 +02:00
|
|
|
for i,battleName in ipairs(core.datas:getFromCategory("battles", battleCat)) do
|
|
|
|
local data = core.datas:get("battles", battleName)
|
2020-08-04 17:50:03 +02:00
|
|
|
menu.commons.SceneWidget(self, menuName, scenes.cbs, "Launch " .. battleName, data)
|
|
|
|
end
|
2020-08-01 10:31:09 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function DebugMenu:buildSaveMenu()
|
2021-04-03 20:03:55 +02:00
|
|
|
self:addSubMenu("save", "debug", "Save System", panels.Gamedata, nil)
|
2020-08-19 20:44:38 +02:00
|
|
|
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)
|
2021-05-15 21:43:15 +02:00
|
|
|
for j, item in ipairs(core.datas:getFromCategory("items", pocket.name)) do
|
|
|
|
menu.ItemWidget(self, pocket.name, core.datas:get("items", item))
|
2020-08-15 22:43:46 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-08-01 10:31:09 +02:00
|
|
|
function DebugMenu:buildOtherMenu()
|
2021-04-03 20:03:55 +02:00
|
|
|
self:addSubMenu("other", "debug", "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
|
2021-04-04 13:17:12 +02:00
|
|
|
self.back:update(dt)
|
2021-04-05 14:20:25 +02:00
|
|
|
self.tweens:update(dt)
|
2020-08-01 10:31:09 +02:00
|
|
|
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
|
2021-04-05 21:10:18 +02:00
|
|
|
--self.menusystem.menus[submenu]:setPanel(panel, panelArgument)
|
2020-08-19 20:44:38 +02:00
|
|
|
end
|
2020-08-01 10:31:09 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function DebugMenu:draw()
|
2021-04-04 13:17:12 +02:00
|
|
|
love.graphics.setColor(1, 1, 1, 1)
|
|
|
|
love.graphics.rectangle("fill", 0, 0, 424, 240)
|
|
|
|
self.back:draw()
|
|
|
|
utils.graphics.resetColor()
|
|
|
|
love.graphics.draw(self.backImage, 0, 0)
|
2020-08-02 08:30:19 +02:00
|
|
|
|
2021-04-05 14:20:25 +02:00
|
|
|
if (self.menusystem.isActive) then
|
2020-08-02 08:30:19 +02:00
|
|
|
self.panel:draw(240, 48)
|
2020-08-01 10:31:09 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-04-05 14:20:25 +02:00
|
|
|
function DebugMenu:drawOverTransition()
|
|
|
|
love.graphics.draw(self.borders, 0, self.borderY, 0, 1, -1)
|
|
|
|
love.graphics.draw(self.borders, 424, 240 - self.borderY, 0, -1, 1)
|
|
|
|
self.assets.fonts["small"]:draw("v" .. game.version, 424 - 44, 240 + 10 - self.borderY)
|
|
|
|
end
|
|
|
|
|
2020-08-01 10:31:09 +02:00
|
|
|
return DebugMenu;
|