2019-08-16 22:37:43 +02:00
|
|
|
local VictoryScreen = Object:extend()
|
|
|
|
|
|
|
|
local TweenManager = require "game.modules.tweenmanager"
|
|
|
|
|
|
|
|
local BATTLECOMPLETE_START = 2
|
|
|
|
local BATTLECOMPLETE_STOP = 4
|
|
|
|
|
2019-08-31 21:03:17 +02:00
|
|
|
local gui = require "game.modules.gui"
|
|
|
|
|
|
|
|
local tw, th = 280, 64
|
|
|
|
|
2019-08-16 22:37:43 +02:00
|
|
|
function VictoryScreen:new(scene)
|
|
|
|
self.scene = scene
|
|
|
|
self.assets = scene.assets
|
|
|
|
|
|
|
|
self.tweens = TweenManager(self)
|
|
|
|
|
|
|
|
self.vignetteOpacity = 0
|
|
|
|
self.labelOpacity = 0
|
|
|
|
|
|
|
|
local _, height = core.screen:getDimensions()
|
|
|
|
self.labelY = height/2
|
|
|
|
|
|
|
|
self.tweens:newTween(0, 0.6, {vignetteOpacity=0.75}, 'inExpo')
|
|
|
|
self.tweens:newTween(0, 0.6, {labelOpacity=1}, 'inExpo')
|
|
|
|
self.tweens:newTween(0.9, 0.4, {labelY=32}, 'inExpo')
|
|
|
|
|
2019-08-31 21:03:17 +02:00
|
|
|
self.textBox = gui.newTextBox("assets/gui/dialogbox.png", tw, th)
|
|
|
|
self.tbSize = 0.6
|
|
|
|
self.tbOpacity = 0
|
|
|
|
|
|
|
|
self.tweens:newTween(1.4, 0.4, {tbSize=1, tbOpacity=1}, 'inExpo')
|
2019-08-16 22:37:43 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function VictoryScreen:update(dt)
|
|
|
|
self.tweens:update(dt)
|
|
|
|
end
|
|
|
|
|
|
|
|
function VictoryScreen:draw()
|
|
|
|
love.graphics.setColor(0, 0, 0, self.vignetteOpacity)
|
|
|
|
|
|
|
|
local width, height = core.screen:getDimensions()
|
|
|
|
love.graphics.rectangle("fill", 0, 0, width, height)
|
|
|
|
|
2019-08-31 21:03:17 +02:00
|
|
|
love.graphics.setColor(1, 1, 1, self.labelOpacity)
|
2019-08-16 22:37:43 +02:00
|
|
|
local w, h = self.assets.images["battlecompleted"]:getDimensions()
|
|
|
|
self.assets.images["battlecompleted"]:draw(width/2, self.labelY, 0, 1, 1, w/2, h/2)
|
2019-08-31 21:03:17 +02:00
|
|
|
|
|
|
|
--love.graphics.setColor(1, 1, 1, self.tbOpacity)
|
|
|
|
--love.graphics.draw(self.textBox, width/2, height/2 - 32, 0, self.tbSize, self.tbSize, tw/2, th/2)
|
|
|
|
|
2019-08-16 22:37:43 +02:00
|
|
|
utils.graphics.resetColor()
|
|
|
|
end
|
|
|
|
|
|
|
|
return VictoryScreen
|