2020-08-01 10:31:09 +02:00
|
|
|
local commons = require "scenes.debug.commons.menu"
|
|
|
|
local menu = {}
|
|
|
|
menu.commons = commons
|
|
|
|
menu.ExitWidget = commons.DebugWidget:extend()
|
|
|
|
menu.ShowBackgroundWidget = commons.DebugWidget:extend()
|
2020-08-02 09:59:47 +02:00
|
|
|
menu.SaveWidget = commons.DebugWidget:extend()
|
|
|
|
menu.LoadWidget = commons.DebugWidget:extend()
|
2020-08-02 23:47:42 +02:00
|
|
|
menu.LevelUpWidget = commons.DebugWidget:extend()
|
|
|
|
menu.AddRemoveWidget = commons.DebugWidget:extend()
|
|
|
|
menu.ChangeLeaderWidget = commons.DebugWidget:extend()
|
2020-08-02 10:33:31 +02:00
|
|
|
menu.SubMenuWidget = commons.SubMenuWidget:extend()
|
2020-08-15 22:43:46 +02:00
|
|
|
menu.ItemWidget = commons.DebugWidget:extend()
|
2020-08-01 10:31:09 +02:00
|
|
|
|
|
|
|
-- ExitWidget
|
|
|
|
function menu.ExitWidget:new(scene, menuName)
|
|
|
|
menu.ExitWidget.super.new(self, scene, menuName, "Exit")
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.ExitWidget:action()
|
|
|
|
love.event.quit("000")
|
|
|
|
end
|
|
|
|
|
|
|
|
-- ShowBackground
|
|
|
|
function menu.ShowBackgroundWidget:new(scene, menuName)
|
|
|
|
menu.ShowBackgroundWidget.super.new(self, scene, menuName, "Show Background")
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.ShowBackgroundWidget:action()
|
|
|
|
self.scene.menusystem:deactivate()
|
|
|
|
end
|
|
|
|
|
2020-08-02 09:59:47 +02:00
|
|
|
-- Save game
|
|
|
|
function menu.SaveWidget:new(scene, menuName)
|
2020-08-02 10:33:31 +02:00
|
|
|
menu.SaveWidget.super.new(self, scene, menuName, "Save game")
|
2020-08-02 09:59:47 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function menu.SaveWidget:action()
|
|
|
|
game:write()
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Save game
|
|
|
|
function menu.LoadWidget:new(scene, menuName, slot)
|
2020-08-02 10:33:31 +02:00
|
|
|
menu.LoadWidget.super.new(self, scene, menuName, "Load file " .. slot)
|
2020-08-02 09:59:47 +02:00
|
|
|
self.slot = slot
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.LoadWidget:action()
|
|
|
|
game:read(self.slot)
|
|
|
|
end
|
|
|
|
|
2020-08-02 10:33:31 +02:00
|
|
|
-- Submenu
|
|
|
|
function menu.SubMenuWidget:new(scene, menu_name, newmenu, name, panel, panelArgument)
|
|
|
|
menu.SubMenuWidget.super.new(self, scene, menu_name, newmenu, name)
|
|
|
|
self.panel = panel
|
|
|
|
self.panelArgument = panelArgument
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.SubMenuWidget:action()
|
|
|
|
self.scene.menusystem:switchMenu(self.newmenu)
|
|
|
|
self.scene.panel = self.panel(self.panelArgument)
|
|
|
|
end
|
|
|
|
|
2020-08-02 23:47:42 +02:00
|
|
|
-- Level Up
|
|
|
|
function menu.LevelUpWidget:new(scene, menuName, character)
|
|
|
|
menu.ShowBackgroundWidget.super.new(self, scene, menuName, "Level Up")
|
|
|
|
self.character = character
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.LevelUpWidget:action()
|
|
|
|
self.character:levelUp()
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Add Remove Widget
|
|
|
|
function menu.AddRemoveWidget:new(scene, menuName, character)
|
|
|
|
menu.AddRemoveWidget.super.new(self, scene, menuName, "Add/Remove " .. character.name)
|
|
|
|
self.character = character
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.AddRemoveWidget:action()
|
|
|
|
game.characters:addOrRemoveToTeam(self.character.simplename)
|
|
|
|
end
|
|
|
|
|
|
|
|
--Change Team Leader
|
|
|
|
function menu.ChangeLeaderWidget:new(scene, menuName)
|
|
|
|
menu.ShowBackgroundWidget.super.new(self, scene, menuName, "Change active character")
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.ChangeLeaderWidget:action()
|
|
|
|
game.characters:setActiveCharacter(1)
|
|
|
|
end
|
2020-08-02 10:33:31 +02:00
|
|
|
|
2020-08-15 22:43:46 +02:00
|
|
|
-- ItemWidget
|
|
|
|
function menu.ItemWidget:new(scene, menuName, itemdata)
|
|
|
|
menu.ItemWidget.super.new(self, scene, menuName, itemdata.fullname)
|
|
|
|
self.category = menuName
|
|
|
|
self.itemName = itemdata.name
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.ItemWidget:action()
|
|
|
|
game.loot:addItem(self.category, self.itemName, 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2020-08-02 09:59:47 +02:00
|
|
|
|
2020-08-01 10:31:09 +02:00
|
|
|
return menu
|