Files
StellaSora_DataLua/lua/game/ui/soldier/template/soldierchargridctrl.lua
T
SL1900 8c4bd41668 Update - 1.13.0.124
EN: 1.13.0.124
CN: 1.13.0.124
JP: 1.13.0.128
KR: 1.13.0.130
2026-07-21 12:30:00 +09:00

44 lines
1.5 KiB
Lua

local SoldierCharGridCtrl = class("SoldierCharGridCtrl", BaseCtrl)
local RootPath = "Icon/SoldierOtherIcon/"
SoldierCharGridCtrl._mapNodeConfig = {
img_rarity = {sComponentName = "Image"},
img_icon = {sComponentName = "Image"},
txtCount = {sComponentName = "TMP_Text"},
imgInBattle = {},
imgMask = {},
txtInBattle = {
sComponentName = "TMP_Text",
sLanguageId = "Soldier_InBattle"
},
StarRoot = {},
Star = {nCount = 5}
}
SoldierCharGridCtrl._mapEventConfig = {
SoldierHandbookStrategyCard_Selected = "OnEvent_SoldierHandbookStrategyCard_Selected"
}
SoldierCharGridCtrl._mapRedDotConfig = {}
function SoldierCharGridCtrl:SetItem(nRarity, nCount, sIcon, nStar, bMask, bInBattle)
self:SetPngSprite(self._mapNode.img_rarity, RootPath .. AllEnum.SoldierChessRarityIcon[nRarity] .. AllEnum.SoldierChessIconSurfix.S)
if sIcon ~= nil and sIcon ~= "" then
self:SetPngSprite(self._mapNode.img_icon, sIcon)
end
if 0 < nCount then
self._mapNode.txtCount.gameObject:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.txtCount, nCount)
else
self._mapNode.txtCount.gameObject:SetActive(false)
end
self._mapNode.imgInBattle:SetActive(bInBattle)
self._mapNode.imgMask:SetActive(bMask)
if nStar ~= nil and 0 < nStar then
self._mapNode.StarRoot.gameObject:SetActive(true)
for i = 1, #self._mapNode.Star do
local star = self._mapNode.Star[i]
star.gameObject:SetActive(nStar >= i)
end
else
self._mapNode.StarRoot.gameObject:SetActive(false)
end
end
return SoldierCharGridCtrl