PGRData/Script/matrix/xui/xuidoomsday/XUiGridDoomsdayResourceAllot.lua
2024-09-01 22:49:41 +02:00

28 lines
804 B
Lua

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)
self.TxtTool.text = count .. XDoomsdayConfigs.GetNumberText(-self.AllotCount, false, false, true)
end,
"_Count"
)
end
function XUiGridDoomsdayResourceAllot:SetAllotCount(count)
self.AllotCount = count
self:RefreshCount()
end
return XUiGridDoomsdayResourceAllot