battlesystem: create builder for skill menu

This commit is contained in:
Kazhnuz 2019-03-31 17:07:45 +02:00
parent d77dc0057c
commit 5ab143e5f4

View file

@ -32,22 +32,23 @@ function MenuConstructor:buildBaseMenu(character)
for i,v in ipairs(BaseMenu) do for i,v in ipairs(BaseMenu) do
CharMenuWidget(self.controller, "BaseMenu", v, "", character) CharMenuWidget(self.controller, "BaseMenu", v, "", character)
end end
self.controller.menusystem.menus["BaseMenu"]:setCancelWidget()
end end
function MenuConstructor:set(currentCharacter) function MenuConstructor:set(currentCharacter)
self:reconstruct(currentCharacter) self:reconstruct(currentCharacter)
end end
function MenuConstructor:getSkillList() function MenuConstructor:buildSkillMenu()
CharacterMenu(self.controller, "SkillMenu", MENUPOS_X1 - 16, MENUPOS_Y)
local list = game.characters:getSkillList(self.character.charid) local list = game.characters:getSkillList(self.character.charid)
local skillmenu = {}
for k,v in pairs(list) do for k,v in pairs(list) do
table.insert(skillmenu, k) CharMenuWidget(self.controller, "SkillMenu", k, "", character)
end end
CharMenuWidget(self.controller, "Back", v, "", character)
table.insert(skillmenu, "back") self.controller.menusystem.menus["SkillMenu"]:setCancelWidget()
return skillmenu
end end
function MenuConstructor:unset( ) function MenuConstructor:unset( )
@ -135,4 +136,15 @@ function CharMenuWidget:action()
self.scene.menusystem:reset() self.scene.menusystem:reset()
end end
-- Submenu Widget
function SubMenuWidget:new(scene, menu_name, label, newmenu, character)
SubMenuWidget.super.new(self, scene, menu_name, label, "", character)
self.newmenu = newmenu or "BaseMenu"
end
function SubMenuWidget:action()
self.scene.menusystem:switchMenu(newmenu)
end
return MenuConstructor return MenuConstructor