Files
SL1900 5e0d58cfad Initial version - 1.2.0.60
EN: 1.2.0.60
CN: 1.2.0.61
JP: 1.2.0.63
KR: 1.2.0.67
2025-12-03 01:00:00 +09:00

36 lines
1.1 KiB
Lua

local TemplateCoinCtrl = class("TemplateCoinCtrl", BaseCtrl)
TemplateCoinCtrl._mapNodeConfig = {
imgIcon = {sComponentName = "Image"},
txtCount = {sComponentName = "TMP_Text"}
}
TemplateCoinCtrl._mapEventConfig = {}
function TemplateCoinCtrl:SetCoin(nTid, nCount, bThousands, nMaxCount)
if nTid then
self:SetSprite_Coin(self._mapNode.imgIcon, nTid)
end
if nCount then
if bThousands then
if nMaxCount < nCount then
NovaAPI.SetTMPText(self._mapNode.txtCount, self:ThousandsNumber(nMaxCount) .. "+")
else
NovaAPI.SetTMPText(self._mapNode.txtCount, self:ThousandsNumber(nCount))
end
else
NovaAPI.SetTMPText(self._mapNode.txtCount, nCount)
end
end
end
function TemplateCoinCtrl:SetCoinWithColor(nTid, nCount, bThousands, bEnough)
if nTid then
self:SetSprite_Coin(self._mapNode.imgIcon, nTid)
end
if nCount then
local txt = bThousands and self:ThousandsNumber(nCount) or nCount
NovaAPI.SetTMPText(self._mapNode.txtCount, txt)
if not bEnough then
NovaAPI.SetTMPColor(self._mapNode.txtCount, Red_Unable)
end
end
end
return TemplateCoinCtrl