battlesystem: initial signal sending use in widgets

This commit is contained in:
Kazhnuz 2019-03-31 16:57:57 +02:00
parent 67ef04bcc8
commit 5aa8b2da36

View file

@ -222,6 +222,8 @@ end
function CharMenuWidget:new(scene, menu_name, label1, label2, character) function CharMenuWidget:new(scene, menu_name, label1, label2, character)
self.character = character self.character = character
self.menuname = menu_name
self.scene = scene
local menu = scene.menusystem.menus[menu_name] or error("menu " ..menu_name .. " doesn't exist") local menu = scene.menusystem.menus[menu_name] or error("menu " ..menu_name .. " doesn't exist")
local font = scene.assets.fonts["small"] local font = scene.assets.fonts["small"]
CharMenuWidget.super.new(self, menu, font, label1) CharMenuWidget.super.new(self, menu, font, label1)
@ -241,4 +243,9 @@ function CharMenuWidget:drawCanvas()
self.font:print(self.label2, self.width - 9, h, "right") self.font:print(self.label2, self.width - 9, h, "right")
end end
function CharMenuWidget:action()
self.character:getSignal(self.menuname, self.label)
self.scene.menusystem:reset()
end
return MenuConstructor return MenuConstructor