红点
This commit is contained in:
parent
b2dba1de2e
commit
e2ef9ea208
@ -70,6 +70,13 @@ function HeroComp:init()
|
||||
self.heroBgSpineObj[index]:playAnim("idle", true, false)
|
||||
end
|
||||
end
|
||||
|
||||
self:bind(DataManager.CollectionData, "dirtyHero", function()
|
||||
self:refreshCollectEntrance()
|
||||
end)
|
||||
self:bind(DataManager.HeroData, "isDirty", function()
|
||||
self:refreshCollectEntrance()
|
||||
end)
|
||||
end
|
||||
|
||||
function HeroComp:refresh(battleType)
|
||||
@ -77,6 +84,7 @@ function HeroComp:refresh(battleType)
|
||||
|
||||
self:clearAdapt()
|
||||
self:adapt()
|
||||
self:refreshCollectEntrance()
|
||||
if self.battleType == GConst.BattleConst.FORMATION_TYPE.STAGE then
|
||||
self:refreshStageFormation()
|
||||
elseif self.battleType == GConst.BattleConst.FORMATION_TYPE.ARENA_ATTACK then
|
||||
@ -91,7 +99,6 @@ function HeroComp:refreshStageFormation()
|
||||
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.MAIN_BTN_2))
|
||||
self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png")
|
||||
self.curFormation = DataManager.FormationData:getStageFormation()
|
||||
self.btnCollection:setVisible(DataManager.CollectionData:isOpen(GConst.CollectionConst.TYPE.HERO))
|
||||
|
||||
self.onClickUseFunc = function(id, type)
|
||||
ModuleManager.FormationManager:upHeroToStageFormation(id, type)
|
||||
@ -105,7 +112,6 @@ function HeroComp:refreshArenaFightFormation()
|
||||
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_10))
|
||||
self.rimgTopBG:setTexture("assets/arts/textures/background/arena/arena_bg_2.png")
|
||||
self.curFormation = DataManager.FormationData:getArenaAttackFormation()
|
||||
self.btnCollection:setVisible(false)
|
||||
|
||||
self.onClickUseFunc = function(id, type)
|
||||
DataManager.FormationData:upHeroToFormation(self.battleType, type, id)
|
||||
@ -120,7 +126,6 @@ function HeroComp:refreshArenaDefendFormation()
|
||||
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_9))
|
||||
self.rimgTopBG:setTexture("assets/arts/textures/background/arena/arena_bg_2.png")
|
||||
self.curFormation = DataManager.FormationData:getArenaDefendFormation()
|
||||
self.btnCollection:setVisible(false)
|
||||
|
||||
self.onClickUseFunc = function(id, type)
|
||||
DataManager.FormationData:upHeroToFormation(self.battleType, type, id)
|
||||
@ -279,4 +284,18 @@ function HeroComp:getHeroCell(heroId)
|
||||
return targetCell
|
||||
end
|
||||
|
||||
-- 刷新图鉴入口
|
||||
function HeroComp:refreshCollectEntrance()
|
||||
if self.battleType == GConst.BattleConst.FORMATION_TYPE.STAGE then
|
||||
self.btnCollection:setVisible(DataManager.CollectionData:isOpen(GConst.CollectionConst.TYPE.HERO))
|
||||
if DataManager.CollectionData:hasRedPoint(GConst.CollectionConst.TYPE.HERO) then
|
||||
self.btnCollection:addRedPoint(25, 30, 0.6)
|
||||
else
|
||||
self.btnCollection:removeRedPoint()
|
||||
end
|
||||
else
|
||||
self.btnCollection:setVisible(false)
|
||||
end
|
||||
end
|
||||
|
||||
return HeroComp
|
||||
@ -6,6 +6,11 @@ local CollectionBaseEntity = class("CollectionBaseEntity", BaseData)
|
||||
function CollectionBaseEntity:init(data)
|
||||
end
|
||||
|
||||
-- 是否有红点
|
||||
function CollectionBaseEntity:hasRedPoint()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取当前收集值
|
||||
function CollectionBaseEntity:getCurCollectPoint()
|
||||
return nil
|
||||
|
||||
@ -61,6 +61,11 @@ function CollectionData:getCollectEntity(type)
|
||||
return self.dataCollects[type]
|
||||
end
|
||||
|
||||
-- 是否有红点
|
||||
function CollectionData:hasRedPoint(type)
|
||||
return self.dataCollects[type]:hasRedPoint()
|
||||
end
|
||||
|
||||
-- 获取当前收集值
|
||||
function CollectionData:getCurCollectPoint(type)
|
||||
return self.dataCollects[type]:getCurCollectPoint()
|
||||
|
||||
@ -9,6 +9,26 @@ function CollectionHeroEntity:init(data)
|
||||
self.curPoint = data.point
|
||||
end
|
||||
|
||||
-- 是否有红点
|
||||
function CollectionHeroEntity:hasRedPoint()
|
||||
|
||||
-- 可领点数
|
||||
for idx, data in pairs(self:getCollectList()) do
|
||||
if self:getCanCollectPoint(data.id) > 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- 可领奖励
|
||||
for id, data in pairs(self:getRewardList()) do
|
||||
if self:isMeetTargetPoint(id) and not self:isRewardReceived(id) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- 获取当前收集值
|
||||
function CollectionHeroEntity:getCurCollectPoint()
|
||||
return self.curPoint
|
||||
|
||||
@ -173,6 +173,10 @@ function HeroData:getRp()
|
||||
end
|
||||
end
|
||||
|
||||
if DataManager.CollectionData:hasRedPoint(GConst.CollectionConst.TYPE.HERO) then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user