81 lines
1.8 KiB
Lua
81 lines
1.8 KiB
Lua
local DataTableUtils = require("Utils.DataTableUtils")
|
|
local Emitter = require("Utils.Emitter")
|
|
local EPreCookSlotType = import("EPreCookSlotType")
|
|
|
|
--- @class PreCookSlot
|
|
local PreCookSlot = {}
|
|
|
|
function PreCookSlot:OnInitialized()
|
|
self.slot_item_id = nil
|
|
self.is_slot_item_active = false
|
|
|
|
self.BtnMain.OnClicked:Add(function() self:BP_EmitLuaEvent("PreCookSlotClicked") end)
|
|
end
|
|
|
|
function PreCookSlot:Construct()
|
|
|
|
end
|
|
|
|
function PreCookSlot:Destruct()
|
|
|
|
end
|
|
|
|
function PreCookSlot:Reset()
|
|
|
|
|
|
end
|
|
|
|
function PreCookSlot:GetSlotType()
|
|
return self.PreCookSlotType
|
|
end
|
|
|
|
function PreCookSlot:GetSlotItemID()
|
|
return self.slot_item_id
|
|
end
|
|
|
|
function PreCookSlot:SetPreCookItemID(pre_cook_item_id)
|
|
self:Reset()
|
|
if not pre_cook_item_id then return end
|
|
|
|
local row_data = DataTableUtils.GetDataTableRow("PreCookItemConfig", pre_cook_item_id)
|
|
if not row_data then
|
|
return
|
|
end
|
|
|
|
self.SlotImg:SetBrushFromSoftTexture(row_data.DisplayResource, true)
|
|
self.slot_item_id = pre_cook_item_id
|
|
end
|
|
|
|
function PreCookSlot:SetPreCookTool(pre_cook_tool_id)
|
|
self:SetPreCookItemID(pre_cook_tool_id)
|
|
end
|
|
|
|
function PreCookSlot:SetPreCookContainer(pre_cook_container_id)
|
|
self:SetPreCookItemID(pre_cook_container_id)
|
|
end
|
|
|
|
function PreCookSlot:ActiveToolSlot()
|
|
self:PlayAnimation(self.Anim_UseTool, 0, 1, 0, 5, false)
|
|
end
|
|
|
|
function PreCookSlot:DeactiveToolSlot()
|
|
self:PlayAnimation(self.Anim_UseTool, 0, 1, 1, 1, false)
|
|
end
|
|
|
|
|
|
function PreCookSlot:PushSlotItem()
|
|
self:PlayAnimation(self.Anim_PushItem, 0, 1, 0, 1, false)
|
|
end
|
|
|
|
function PreCookSlot:ActiveContainerSlot()
|
|
self:PlayAnimation(self.Anim_PushItem, 0, 1, 0, 1, false)
|
|
end
|
|
|
|
function PreCookSlot:DeactiveContianerSlot()
|
|
print("PreCookSlot:DeactiveContianerSlot")
|
|
self:PlayAnimation(self.Anim_PushItem, 0, 1, 1, 1, false)
|
|
end
|
|
|
|
|
|
|
|
return Class(nil, nil, PreCookSlot) |