local StarCell = class("StarCell", BaseCell)

function StarCell:init()
	local uiMap = self:getUIMap()
	self.starBg = uiMap["cell.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
	self.descTx = uiMap["cell.desc_tx"]
	self.lockImg = uiMap["cell.lock_img"]

	self.baseObject:addClickListener(function()
		local list = GFunc.getConstValueList("hero_skill_click")
		local skillList = self.heroEntity:getRogueSkillList()
		local skillId = skillList[list[self.idx]][2]
		local cfg = ConfigManager:getConfig("skill_rogue")[skillId]
		ModuleManager.HeroManager:showHeroSkillInfoUI(self.heroEntity, list[self.idx], cfg.buff_id)
	end)
end

function StarCell:refresh(heroEntity, idx)
	self.heroEntity = heroEntity
	if not self.heroEntity then
		return
	end
	self.idx = idx

	local star = self.heroEntity:getStar()
	self.starBg:refresh(idx)
	if idx <= star then
		self.baseObject:setSprite(GConst.ATLAS_PATH.COMMON, "common_bg_7")
	else
		self.baseObject:setSprite(GConst.ATLAS_PATH.COMMON, "common_bg_8")
	end
	self.lockImg:setActive(idx > star)

	local skillStr = ModuleManager.HeroManager:getHeroSkillDesc(self.heroEntity:getCfgId(), idx)
	self.descTx:setText(skillStr)
end

return StarCell