32 lines
836 B
Lua
32 lines
836 B
Lua
local StepParent = require "game.events.event.parent"
|
|
local DialogBox = StepParent:extend()
|
|
|
|
local Talkies = require('core.libs.talkies')
|
|
|
|
function DialogBox:new(controller, args)
|
|
DialogBox.super.new(self, controller, args)
|
|
Talkies.font = love.graphics.newFont("assets/gui/fonts/PixelOperator.ttf", 16)
|
|
end
|
|
|
|
function DialogBox:start()
|
|
Talkies.say(self.arguments.title, self.arguments.message)
|
|
end
|
|
|
|
function DialogBox:update(dt)
|
|
Talkies.update(dt)
|
|
|
|
if (not Talkies.isOpen()) then
|
|
self:finish()
|
|
end
|
|
local keys = self.events.scene.sources[1].keys
|
|
if (keys["up"].isPressed) then Talkies.prevOption()
|
|
elseif (keys["down"].isPressed) then Talkies.nextOption()
|
|
elseif (keys["A"].isPressed) then Talkies.onAction()
|
|
end
|
|
end
|
|
|
|
function DialogBox:draw()
|
|
Talkies.draw()
|
|
end
|
|
|
|
return DialogBox;
|