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
			NovaAPI.SetTMPText(self._mapNode.txtName, mapCharCfg.Name)
			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
return PotentialBookCharItemCtrl
