local CookingSlot = {} local CookManager = require("GamePlay.CookSystem.CookManager") local Utils = require("GamePlay.Utils") local ESlateVisibility = import("ESlateVisibility") function CookingSlot:ctor() self.material = "500001" end function CookingSlot:OnInitialized() self.MainBtn.OnClicked:Add(function() CookManager:AddCookMaterial(self.material) self:ConsumeMaterial() end) self:SetCookMaterial("400009") end function CookingSlot:SetCookMaterial(material) self.material = material self:RefreshDisplay() end function CookingSlot:SetEmpty() self.CookingMaterialImg:SetVisibility(ESlateVisibility.Collapsed) end function CookingSlot:RefreshDisplay() self:SetEmpty() if not self.material then return end local config = Utils.GetHomelandItemDesc(self.material) if config == nil then return end self.CookingMaterialImg:SetBrushFromSoftTexture(config.DisplayResource, true) self.CookingMaterialImg:SetVisibility(ESlateVisibility.SelfHitTestInvisible) end function CookingSlot:ConsumeMaterial() if self.material == nil then return end local item = self.material self:SetCookMaterial(nil) return item end return Class(nil, nil, CookingSlot)