diff --git a/sonic-radiance.love/scenes/debug/commons/menu.lua b/sonic-radiance.love/scenes/debug/commons/menu.lua index d60d79f..3e89687 100644 --- a/sonic-radiance.love/scenes/debug/commons/menu.lua +++ b/sonic-radiance.love/scenes/debug/commons/menu.lua @@ -6,6 +6,7 @@ local Widget = require "core.modules.menusystem.widgets" menu.DebugMenu = ListBox:extend() menu.DebugWidget = Widget.Text:extend() menu.SubMenuWidget = menu.DebugWidget:extend() +menu.SceneWidget = menu.DebugWidget:extend() local CONST = {} CONST.MENU = {} @@ -56,5 +57,15 @@ function menu.SubMenuWidget:action() self.scene.menusystem:switchMenu(self.newmenu) end +-- SceneWidget +function menu.SceneWidget:new(scene, menuName, newScene, newSceneName) + menu.SceneWidget.super.new(self, scene, menuName, newSceneName) + self.newScene = newScene +end + +function menu.SceneWidget:action() + self.newScene() +end + return menu diff --git a/sonic-radiance.love/scenes/debug/menu/init.lua b/sonic-radiance.love/scenes/debug/menu/init.lua index 37886aa..d42bb81 100644 --- a/sonic-radiance.love/scenes/debug/menu/init.lua +++ b/sonic-radiance.love/scenes/debug/menu/init.lua @@ -7,7 +7,7 @@ function DebugMenu:new() DebugMenu.super.new(self) self.assets:batchImport("scenes.debug.commons.assets") menu.commons.DebugMenu(self, "BaseMenu") - menu.SceneWidget(self, "BaseMenu", scenes.title, "Launch Game") + menu.commons.SceneWidget(self, "BaseMenu", scenes.title, "Launch Game") self:buildBattleMenu() self:buildOverworldMenu() self:buildSaveMenu() @@ -35,7 +35,7 @@ end function DebugMenu:buildBattleMenu() self:addSubMenu("combat", "BaseMenu", "Battle System") - menu.SceneWidget(self, "combat", scenes.cbs, "Launch Battle") + menu.commons.SceneWidget(self, "combat", scenes.cbs, "Launch Battle") menu.commons.SubMenuWidget(self, "combat", "BaseMenu", "Back") end @@ -47,7 +47,7 @@ end function DebugMenu:buildOtherMenu() self:addSubMenu("other", "BaseMenu", "Other gameplay") - menu.SceneWidget(self, "other", scenes.test, "Minigame Engine") + menu.commons.SceneWidget(self, "other", scenes.test, "Minigame Engine") menu.commons.SubMenuWidget(self, "other", "BaseMenu", "Back") end diff --git a/sonic-radiance.love/scenes/debug/menu/menu.lua b/sonic-radiance.love/scenes/debug/menu/menu.lua index 609ae60..630ff18 100644 --- a/sonic-radiance.love/scenes/debug/menu/menu.lua +++ b/sonic-radiance.love/scenes/debug/menu/menu.lua @@ -3,7 +3,6 @@ local menu = {} menu.commons = commons menu.ExitWidget = commons.DebugWidget:extend() menu.ShowBackgroundWidget = commons.DebugWidget:extend() -menu.SceneWidget = commons.DebugWidget:extend() -- ExitWidget function menu.ExitWidget:new(scene, menuName) @@ -23,14 +22,4 @@ function menu.ShowBackgroundWidget:action() self.scene.menusystem:deactivate() end --- SceneWidget -function menu.SceneWidget:new(scene, menuName, newScene, newSceneName) - menu.SceneWidget.super.new(self, scene, menuName, newSceneName) - self.newScene = newScene -end - -function menu.SceneWidget:action() - self.newScene() -end - return menu