刀光预研

初步实现了刀光交互效果
This commit is contained in:
2025-08-27 00:56:05 +08:00
parent bda98b0cce
commit be6e40383d
24 changed files with 479 additions and 16 deletions

View File

@ -1,8 +1,15 @@
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()
@ -18,18 +25,57 @@ function PreCookSlot:Reset()
end
function PreCookSlot:SetPreCookToolID(pre_cook_tool_id)
self:Reset()
if not pre_cook_tool_id then return end
function PreCookSlot:GetSlotType()
return self.PreCookSlotType
end
local row_data = DataTableUtils.GetDataTableRow("PreCookItemConfig", pre_cook_tool_id)
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)
print("PreCookSlot:SetPreCookToolID", row_data)
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)