2023-07-14 19:35:33 +00:00
|
|
|
local XUiGridDoomsdayResourceAllot = XClass(nil, "XUiGridDoomsdayResourceAllot")
|
|
|
|
|
|
|
|
function XUiGridDoomsdayResourceAllot:Refresh(resource)
|
|
|
|
self.Resource = resource
|
|
|
|
|
|
|
|
self.RImgTool:SetRawImage(XDoomsdayConfigs.ResourceConfig:GetProperty(resource:GetProperty("_CfgId"), "Icon"))
|
|
|
|
|
|
|
|
self:RefreshCount()
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiGridDoomsdayResourceAllot:RefreshCount()
|
|
|
|
self.AllotCount = self.AllotCount or 0
|
|
|
|
|
|
|
|
self.Parent:BindViewModelPropertyToObj(
|
|
|
|
self.Resource,
|
|
|
|
function(count)
|
2024-09-01 20:49:41 +00:00
|
|
|
self.TxtTool.text = count .. XDoomsdayConfigs.GetNumberText(-self.AllotCount, false, false, true)
|
2023-07-14 19:35:33 +00:00
|
|
|
end,
|
|
|
|
"_Count"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiGridDoomsdayResourceAllot:SetAllotCount(count)
|
|
|
|
self.AllotCount = count
|
|
|
|
self:RefreshCount()
|
|
|
|
end
|
|
|
|
|
|
|
|
return XUiGridDoomsdayResourceAllot
|