chore: make the scene change widget a common element
This commit is contained in:
parent
4b9ba5eed6
commit
0984ce370e
3 changed files with 14 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue