Files
StellaSora_DataLua/lua/game/ui/startowerbook/potential/potentialbookcharitemctrl.lua
T
SL1900 35c8d87e86 Update - 1.4.0.73
EN: 1.4.0.73
CN: 1.4.0.74
JP: 1.4.0.77
KR: 1.4.0.80
2025-12-25 19:00:00 +09:00

68 lines
2.5 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
local PotentialBookCharItemCtrl = class("PotentialBookCharItemCtrl", BaseCtrl)
PotentialBookCharItemCtrl._mapNodeConfig = {
imgNormal = {},
imgChar = {sComponentName = "Image"},
imgLockMask = {sComponentName = "Image"},
goUnlock = {},
txtName = {sComponentName = "TMP_Text"},
txtCollect = {sComponentName = "TMP_Text"},
txtLock = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Book_Char_Lock"
},
imgEmpty = {},
txtEmpty = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Book_FateCard_Empty"
},
redDotChar = {}
}
PotentialBookCharItemCtrl._mapEventConfig = {}
PotentialBookCharItemCtrl._mapRedDotConfig = {}
function PotentialBookCharItemCtrl:InitItem(nCharId)
self.nCharId = nCharId
self.nElement = 0
local bUnlock = PlayerData.Char:CheckCharUnlock(nCharId)
self._mapNode.imgEmpty.gameObject:SetActive(nCharId == 0)
self._mapNode.imgNormal.gameObject:SetActive(nCharId ~= 0)
self._mapNode.imgNormal.gameObject:SetActive(nCharId ~= 0)
self._mapNode.imgLockMask.gameObject:SetActive(nCharId ~= 0 and not bUnlock)
self._mapNode.goUnlock.gameObject:SetActive(nCharId ~= 0 and bUnlock)
self._mapNode.imgLockMask.gameObject:SetActive(not bUnlock)
self._mapNode.imgChar.gameObject:SetActive(bUnlock)
if nCharId ~= 0 then
local mapCharCfg = ConfigTable.GetData_Character(nCharId)
if mapCharCfg ~= nil then
self.nElement = mapCharCfg.EET
local sName = self:_temp_proc_name(mapCharCfg.Name)
NovaAPI.SetTMPText(self._mapNode.txtName, sName)
local nSkinId = mapCharCfg.DefaultSkinId
local mapSkin = ConfigTable.GetData_CharacterSkin(nSkinId)
self:SetPngSprite(self._mapNode.imgChar, mapSkin.Icon .. AllEnum.CharHeadIconSurfix.GC)
self:SetPngSprite(self._mapNode.imgLockMask, mapSkin.Icon .. AllEnum.CharHeadIconSurfix.GC)
self:RefreshCount()
end
end
RedDotManager.RegisterNode(RedDotDefine.StarTowerBook_Potential_Char, {
self.nElement,
self.nCharId
}, self._mapNode.redDotChar, nil, nil, true)
end
function PotentialBookCharItemCtrl:RefreshCount()
local nCount, nAllCount = PlayerData.StarTowerBook:GetCharPotentialCount(self.nCharId)
NovaAPI.SetTMPText(self._mapNode.txtCollect, string.format("%s/%s", nCount, nAllCount))
end
function PotentialBookCharItemCtrl:Awake()
self.tbRedDotRegister = {}
end
function PotentialBookCharItemCtrl:OnDisable()
end
function PotentialBookCharItemCtrl:_temp_proc_name(sName)
local _sName = string.gsub(sName, "%(", [[
(]])
local _sName = string.gsub(_sName, "", "\n")
return _sName
end
return PotentialBookCharItemCtrl