2020-08-20 10:17:46 +02:00
|
|
|
local RadianceListMenu = require "game.modules.menus.list"
|
|
|
|
local PauseMenu = RadianceListMenu.ListMenu:extend()
|
2020-08-16 10:52:00 +02:00
|
|
|
|
2020-08-20 10:17:46 +02:00
|
|
|
local ResumeWidget = RadianceListMenu.DualTextWidget:extend()
|
|
|
|
local RestartWidget = RadianceListMenu.DualTextWidget:extend()
|
|
|
|
local ExitWidget = RadianceListMenu.DualTextWidget:extend()
|
2020-08-16 10:52:00 +02:00
|
|
|
|
2020-08-20 10:17:46 +02:00
|
|
|
local WIDTH = 80
|
|
|
|
|
2020-08-16 10:52:00 +02:00
|
|
|
function PauseMenu:new(subgame)
|
2020-08-20 10:17:46 +02:00
|
|
|
local x, y
|
|
|
|
x = 424/2 - WIDTH/2
|
|
|
|
y = 240/2 - (3*17)/2
|
2020-08-16 10:52:00 +02:00
|
|
|
|
2020-08-20 10:17:46 +02:00
|
|
|
PauseMenu.super.new(self, subgame, "pauseMenu", x, y, WIDTH, 3, true)
|
2020-08-16 10:52:00 +02:00
|
|
|
|
2020-08-20 10:17:46 +02:00
|
|
|
self:setSound(self.scene.assets.sfx["navigate"])
|
2020-08-16 10:52:00 +02:00
|
|
|
self.isActive = false
|
|
|
|
self.isVisible = false
|
|
|
|
|
2020-08-20 10:17:46 +02:00
|
|
|
ResumeWidget(subgame)
|
|
|
|
self:setCancelWidget()
|
|
|
|
RestartWidget(subgame)
|
|
|
|
ExitWidget(subgame)
|
2020-08-16 10:52:00 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
--- MENU WIDGETS
|
|
|
|
|
2020-08-20 10:17:46 +02:00
|
|
|
function ResumeWidget:new(scene)
|
|
|
|
ResumeWidget.super.new(self, scene, "pauseMenu", "Resume", "")
|
2020-08-16 10:52:00 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function ResumeWidget:action()
|
|
|
|
self.menu.isActive = false
|
|
|
|
self.menu.isVisible = false
|
2020-08-20 10:17:46 +02:00
|
|
|
self.scene.world.isActive = true
|
|
|
|
self.scene.assets.isActive = true
|
|
|
|
self.scene:flushKeys()
|
2020-08-16 10:52:00 +02:00
|
|
|
end
|
|
|
|
|
2020-08-20 10:17:46 +02:00
|
|
|
function RestartWidget:new(scene)
|
|
|
|
ResumeWidget.super.new(self, scene, "pauseMenu", "Restart", "")
|
2020-08-16 10:52:00 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function RestartWidget:action()
|
2020-08-20 10:17:46 +02:00
|
|
|
self.scene:restartLevel()
|
2020-08-16 10:52:00 +02:00
|
|
|
self.menu.isActive = false
|
|
|
|
self.menu.isVisible = false
|
2020-08-20 10:17:46 +02:00
|
|
|
self.scene.world.isActive = true
|
|
|
|
self.scene.assets.isActive = true
|
|
|
|
self.scene:flushKeys()
|
2020-08-16 10:52:00 +02:00
|
|
|
end
|
|
|
|
|
2020-08-20 10:17:46 +02:00
|
|
|
function ExitWidget:new(scene)
|
|
|
|
ExitWidget.super.new(self, scene, "pauseMenu", "Exit", "")
|
2020-08-16 10:52:00 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function ExitWidget:action()
|
2020-08-20 10:17:46 +02:00
|
|
|
self.scene:exitLevel()
|
2020-08-16 10:52:00 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
return PauseMenu
|