28 lines
654 B
Lua
28 lines
654 B
Lua
|
|
-- 锅的控件
|
||
|
|
local CookingPot = {}
|
||
|
|
local Emitter = require("Utils.Emitter")
|
||
|
|
|
||
|
|
function CookingPot:ctor()
|
||
|
|
self.cook_slot_clicked_handle = nil
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
function CookingPot:Construct()
|
||
|
|
self.cook_slot_clicked_handle = Emitter.OnEvent(
|
||
|
|
"cook_slot_clicked",
|
||
|
|
function(slot) self:OnCookSlotClicked(slot) end
|
||
|
|
)
|
||
|
|
end
|
||
|
|
|
||
|
|
function CookingPot:Destruct()
|
||
|
|
Emitter.OffEvent("cook_slot_clicked", self.cook_slot_clicked_handle)
|
||
|
|
end
|
||
|
|
|
||
|
|
function CookingPot:OnCookSlotClicked(slot)
|
||
|
|
local item = slot:ConsumeMaterial()
|
||
|
|
if item == nil then end
|
||
|
|
self:PlayAnimation(self.Anim_Cook, 0, 1, 0, 1, false)
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
return Class(nil, nil, CookingPot)
|