parent
1136bc1fd6
commit
722c69d733
3 changed files with 26 additions and 6 deletions
|
@ -86,9 +86,7 @@ function ListBox:keyreleased(key, code)
|
|||
end
|
||||
|
||||
if key == "B" then
|
||||
if (self.widget.cancel >= 1 and self.widget.cancel <= #self.widget.list) then
|
||||
self.widget.list[self.widget.cancel]:action("key")
|
||||
end
|
||||
self:cancelAction()
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -126,7 +126,7 @@ end
|
|||
-- Send actions to the widgets
|
||||
|
||||
function Menu:cancelAction()
|
||||
if (self.widget.cancel ~= 0) then
|
||||
if (self.widget.cancel >= 1 and self.widget.cancel <= #self.widget.list) then
|
||||
self.widget.list[self.widget.cancel]:action("key")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,8 +10,10 @@ local menu = require "game.modules.menus.fancy"
|
|||
local baseMenu = require "game.modules.menus.parents.menu"
|
||||
local baseWidget = require "game.modules.menus.parents.widget"
|
||||
|
||||
local CharacterMenu = baseMenu:extend()
|
||||
local CharacterWidget = baseWidget:extend()
|
||||
|
||||
local TeamWidget = menu.BaseWidget:extend()
|
||||
--local PauseMenu =
|
||||
|
||||
function PauseScreen:new(scene)
|
||||
|
@ -20,7 +22,7 @@ end
|
|||
|
||||
function PauseScreen:setMenu()
|
||||
menu.FancyMenu(self.scene, "main", 16, 48, 128, 8, false)
|
||||
menu.BaseWidget(self.scene, "main", "Team", ">")
|
||||
TeamWidget(self.scene)
|
||||
menu.BaseWidget(self.scene, "main", "Quest", ">")
|
||||
menu.BaseWidget(self.scene, "main", "Items", ">")
|
||||
menu.BaseWidget(self.scene, "main", "Chao", ">")
|
||||
|
@ -29,7 +31,7 @@ function PauseScreen:setMenu()
|
|||
menu.BaseWidget(self.scene, "main", "Save / Exit", ">")
|
||||
menu.BaseWidget(self.scene, "main", "Resume", ">")
|
||||
|
||||
baseMenu(self.scene, "character", 168, 40, 248, 168, 4)
|
||||
CharacterMenu(self.scene)
|
||||
CharacterWidget(self.scene, "sonic")
|
||||
CharacterWidget(self.scene, "tails")
|
||||
CharacterWidget(self.scene, "amy")
|
||||
|
@ -42,6 +44,15 @@ function PauseScreen:draw()
|
|||
self.scene.assets.fonts["SA2font"]:print("MAIN MENU", 158, 16)
|
||||
end
|
||||
|
||||
-- Character menu
|
||||
function CharacterMenu:new(scene)
|
||||
CharacterMenu.super.new(self, scene, "character", 168, 40, 248, 168, 4)
|
||||
end
|
||||
|
||||
function CharacterMenu:cancelAction()
|
||||
self.scene.menusystem.menus["main"]:getFocus()
|
||||
end
|
||||
|
||||
-- Hero custom widget
|
||||
--
|
||||
function CharacterWidget:new(scene, name)
|
||||
|
@ -74,4 +85,15 @@ function CharacterWidget:draw(x, y)
|
|||
end
|
||||
end
|
||||
|
||||
-- Team Widget
|
||||
--
|
||||
|
||||
function TeamWidget:new(scene)
|
||||
TeamWidget.super.new(self, scene, "main", "Team", ">")
|
||||
end
|
||||
|
||||
function TeamWidget:action()
|
||||
self.scene.menusystem.menus["character"]:getFocus()
|
||||
end
|
||||
|
||||
return PauseScreen
|
||||
|
|
Loading…
Reference in a new issue