PGRData/Script/matrix/xui/xuidoomsday/XUiGridDoomsdayResourceAllot.lua

29 lines
804 B
Lua
Raw Normal View History

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