2020-08-20 15:39:02 +02:00
|
|
|
local ParentScreen = require "scenes.overworld.screens.parent"
|
|
|
|
local PauseScreen = ParentScreen:extend()
|
|
|
|
|
|
|
|
local ListBox = require "core.modules.menusystem.listbox"
|
|
|
|
local Widget = require "core.modules.menusystem.widgets"
|
|
|
|
|
|
|
|
local Emblem = require "game.modules.gui.emblem"
|
|
|
|
|
|
|
|
local menu = require "game.modules.menus.fancy"
|
|
|
|
local baseMenu = require "game.modules.menus.parents.menu"
|
|
|
|
local baseWidget = require "game.modules.menus.parents.widget"
|
|
|
|
|
2020-08-23 10:40:06 +02:00
|
|
|
local CharacterMenu = baseMenu:extend()
|
2020-08-20 15:39:02 +02:00
|
|
|
local CharacterWidget = baseWidget:extend()
|
|
|
|
|
2020-08-23 10:40:06 +02:00
|
|
|
local TeamWidget = menu.BaseWidget:extend()
|
2020-08-26 18:38:40 +02:00
|
|
|
local ViewWidget = menu.BaseWidget:extend()
|
2020-08-20 15:39:02 +02:00
|
|
|
|
2020-08-26 18:38:40 +02:00
|
|
|
function PauseScreen:new(scene, menu, widget)
|
|
|
|
self.menuSelected = menu or "main"
|
|
|
|
self.widgetSelected = widget
|
|
|
|
self.widget = widget
|
2020-08-20 15:39:02 +02:00
|
|
|
PauseScreen.super.new(self, scene)
|
|
|
|
end
|
|
|
|
|
|
|
|
function PauseScreen:setMenu()
|
|
|
|
menu.FancyMenu(self.scene, "main", 16, 48, 128, 8, false)
|
2020-08-23 10:40:06 +02:00
|
|
|
TeamWidget(self.scene)
|
2020-08-23 10:19:27 +02:00
|
|
|
menu.BaseWidget(self.scene, "main", "Quest", ">")
|
2020-08-20 15:39:02 +02:00
|
|
|
menu.BaseWidget(self.scene, "main", "Items", ">")
|
|
|
|
menu.BaseWidget(self.scene, "main", "Chao", ">")
|
|
|
|
menu.BaseWidget(self.scene, "main", "Encylopedia", ">")
|
|
|
|
menu.BaseWidget(self.scene, "main", "Options", ">")
|
2020-08-23 10:19:27 +02:00
|
|
|
menu.BaseWidget(self.scene, "main", "Save / Exit", ">")
|
|
|
|
menu.BaseWidget(self.scene, "main", "Resume", ">")
|
2020-08-20 15:39:02 +02:00
|
|
|
|
2020-08-23 10:40:06 +02:00
|
|
|
CharacterMenu(self.scene)
|
2020-08-26 18:38:40 +02:00
|
|
|
for i, name in ipairs(game.characters.team) do
|
|
|
|
CharacterWidget(self.scene, name)
|
|
|
|
end
|
2020-08-23 10:19:27 +02:00
|
|
|
|
2020-08-26 18:38:40 +02:00
|
|
|
self.scene.menusystem.menus[self.menuSelected]:getFocus()
|
|
|
|
if (self.widgetSelected ~= nil) then
|
|
|
|
self.scene.menusystem.menus[self.menuSelected].widget.selected = self.widgetSelected
|
|
|
|
end
|
2020-08-20 15:39:02 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function PauseScreen:draw()
|
|
|
|
self.scene.assets.fonts["SA2font"]:print("MAIN MENU", 158, 16)
|
|
|
|
end
|
|
|
|
|
2020-08-23 10:40:06 +02:00
|
|
|
-- 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
|
|
|
|
|
2020-08-20 15:39:02 +02:00
|
|
|
-- Hero custom widget
|
|
|
|
--
|
|
|
|
function CharacterWidget:new(scene, name)
|
|
|
|
self.charName = name
|
|
|
|
self.emblem = Emblem(game.characters.list[name], scene)
|
|
|
|
self.font2 = scene.assets.fonts["hudnbrs_small"]
|
|
|
|
CharacterWidget.super.new(self, scene, "character")
|
|
|
|
end
|
|
|
|
|
|
|
|
function CharacterWidget:drawCanvas()
|
|
|
|
local character = game.characters.list[self.charName]
|
|
|
|
self.font:setFilter("shadow")
|
|
|
|
local debut = 0
|
|
|
|
local xDebut = 32
|
|
|
|
self.font:draw(character.fullname, xDebut, debut, -1, "left")
|
|
|
|
local yLvl = debut + 16
|
|
|
|
local xLvl = xDebut
|
|
|
|
self.scene.assets.images["lvl"]:draw(xLvl, yLvl)
|
|
|
|
self.scene.assets.images["exp"]:draw(xLvl, yLvl + 10)
|
|
|
|
self.font2:print(character.level, xLvl + 19, yLvl, "left")
|
|
|
|
local expString = character.exp .. "/" .. character.exp_next
|
|
|
|
self.font2:print(expString, xLvl + 19, yLvl + 10, "left")
|
|
|
|
--text, x, y, limit, align
|
|
|
|
end
|
|
|
|
|
|
|
|
function CharacterWidget:draw(x, y)
|
|
|
|
self.emblem:draw(x, y+6)
|
|
|
|
if self.canvas.texture ~= nil then
|
|
|
|
love.graphics.draw(self.canvas.texture, x - self.ox, y - self.oy)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-08-26 18:38:40 +02:00
|
|
|
function CharacterWidget:action()
|
|
|
|
self.scene.screens.mainmenu.character(self.scene, self.charName)
|
|
|
|
end
|
|
|
|
|
2020-08-23 10:40:06 +02:00
|
|
|
-- Team Widget
|
|
|
|
--
|
|
|
|
|
|
|
|
function TeamWidget:new(scene)
|
|
|
|
TeamWidget.super.new(self, scene, "main", "Team", ">")
|
|
|
|
end
|
|
|
|
|
|
|
|
function TeamWidget:action()
|
|
|
|
self.scene.menusystem.menus["character"]:getFocus()
|
|
|
|
end
|
|
|
|
|
2020-08-26 18:38:40 +02:00
|
|
|
-- View Widget
|
|
|
|
function ViewWidget:new(scene, name, view)
|
|
|
|
TeamWidget.super.new(self, scene, "main", name, ">")
|
|
|
|
self.nextView = view
|
|
|
|
end
|
|
|
|
|
|
|
|
function ViewWidget:action()
|
|
|
|
self.scene.screens.mainmenu[self.nextView](self.scene)
|
|
|
|
end
|
|
|
|
|
2020-08-20 15:39:02 +02:00
|
|
|
return PauseScreen
|