2020-08-01 10:31:09 +02:00
|
|
|
local commons = require "scenes.debug.commons.menu"
|
2021-04-04 13:17:12 +02:00
|
|
|
local listMenu = require "game.modules.menus.fancy"
|
2020-08-19 20:44:38 +02:00
|
|
|
|
2021-04-05 12:29:45 +02:00
|
|
|
local defTransitions = require "core.modules.transitions"
|
|
|
|
local radTransitions = require "game.modules.transitions"
|
|
|
|
|
2020-08-01 10:31:09 +02:00
|
|
|
local menu = {}
|
|
|
|
menu.commons = commons
|
2021-04-04 13:17:12 +02:00
|
|
|
menu.ExitWidget = listMenu.BaseWidget:extend()
|
|
|
|
menu.SaveWidget = listMenu.BaseWidget:extend()
|
|
|
|
menu.LoadWidget = listMenu.BaseWidget:extend()
|
|
|
|
menu.LevelUpWidget = listMenu.BaseWidget:extend()
|
|
|
|
menu.AddRemoveWidget = listMenu.BaseWidget:extend()
|
|
|
|
menu.ChangeLeaderWidget = listMenu.BaseWidget:extend()
|
|
|
|
menu.ItemWidget = listMenu.BaseWidget:extend()
|
2021-04-05 12:29:45 +02:00
|
|
|
menu.TitleWidget = listMenu.BaseWidget:extend()
|
2021-04-05 14:20:25 +02:00
|
|
|
menu.StartGameWidget = listMenu.BaseWidget:extend()
|
|
|
|
|
|
|
|
|
|
|
|
-- TitleWidget
|
|
|
|
function menu.StartGameWidget:new(scene, menuName)
|
|
|
|
local str = "Start game"
|
|
|
|
if (game.exists) then
|
|
|
|
str = "Continue game"
|
|
|
|
end
|
|
|
|
menu.TitleWidget.super.new(self, scene, menuName, str, "")
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.StartGameWidget:action()
|
|
|
|
core.screen:startTransition(defTransitions.circle, defTransitions.default, function() scenes.overworld() end, 424/2, 240/2)
|
|
|
|
self.scene.tweens:newTween(0, 0.5, {borderY = 0}, "inOutQuart")
|
|
|
|
end
|
2021-04-05 12:29:45 +02:00
|
|
|
|
|
|
|
-- TitleWidget
|
|
|
|
function menu.TitleWidget:new(scene, menuName)
|
|
|
|
menu.TitleWidget.super.new(self, scene, menuName, "Return to Title", "")
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.TitleWidget:action()
|
|
|
|
core.screen:startTransition(defTransitions.circle, radTransitions.borders, function() scenes.title(true) end, 424/2, 240/2)
|
|
|
|
end
|
2020-08-01 10:31:09 +02:00
|
|
|
|
|
|
|
-- ExitWidget
|
|
|
|
function menu.ExitWidget:new(scene, menuName)
|
2020-08-19 20:44:38 +02:00
|
|
|
menu.ExitWidget.super.new(self, scene, menuName, "Exit", "")
|
2020-08-01 10:31:09 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function menu.ExitWidget:action()
|
|
|
|
love.event.quit("000")
|
|
|
|
end
|
|
|
|
|
2020-08-02 09:59:47 +02:00
|
|
|
-- Save game
|
|
|
|
function menu.SaveWidget:new(scene, menuName)
|
2020-08-19 20:44:38 +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-19 20:44:38 +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 23:47:42 +02:00
|
|
|
-- Level Up
|
|
|
|
function menu.LevelUpWidget:new(scene, menuName, character)
|
2020-08-19 20:44:38 +02:00
|
|
|
menu.LevelUpWidget.super.new(self, scene, menuName, "Levelup to", character.level + 1)
|
2020-08-02 23:47:42 +02:00
|
|
|
self.character = character
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.LevelUpWidget:action()
|
|
|
|
self.character:levelUp()
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Add Remove Widget
|
|
|
|
function menu.AddRemoveWidget:new(scene, menuName, character)
|
2020-08-19 20:44:38 +02:00
|
|
|
menu.AddRemoveWidget.super.new(self, scene, menuName, "Add/Remove", character.name)
|
2020-08-02 23:47:42 +02:00
|
|
|
self.character = character
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.AddRemoveWidget:action()
|
|
|
|
game.characters:addOrRemoveToTeam(self.character.simplename)
|
|
|
|
end
|
|
|
|
|
|
|
|
--Change Team Leader
|
|
|
|
function menu.ChangeLeaderWidget:new(scene, menuName)
|
2020-08-19 20:44:38 +02:00
|
|
|
menu.ChangeLeaderWidget.super.new(self, scene, menuName, "Change active character", "")
|
2020-08-02 23:47:42 +02:00
|
|
|
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)
|
2020-08-19 20:44:38 +02:00
|
|
|
menu.ItemWidget.super.new(self, scene, menuName, itemdata.fullname, "")
|
2020-08-15 22:43:46 +02:00
|
|
|
self.category = menuName
|
|
|
|
self.itemName = itemdata.name
|
|
|
|
end
|
|
|
|
|
|
|
|
function menu.ItemWidget:action()
|
|
|
|
game.loot:addItem(self.category, self.itemName, 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2020-08-01 10:31:09 +02:00
|
|
|
return menu
|