local StarCell = class("StarCell", BaseCell) function StarCell:init() local uiMap = self:getUIMap() self.starImgs = {} for i = 1, 5 do self.starImgs[i] = uiMap["star_cell.star_img_" .. i] end end function StarCell:refresh(currStar, showStar0) local starType = math.ceil(currStar / 5) for i, v in ipairs(self.starImgs) do local star = (currStar - 1)%5 + 1 if showStar0 and currStar == 0 and i == 1 then v:setActive(true) v:setSprite(GFunc.getStarImg(starType, currStar)) elseif currStar > 0 and i <= star then v:setActive(true) v:setSprite(GFunc.getStarImg(starType)) else v:setActive(false) end end self.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout() end function StarCell:setActive(active) self.baseObject:setActive(active) end return StarCell