再来一局 完善, todo : mission 添加自定义的 定时运行队列 方便销毁
This commit is contained in:
@@ -33,13 +33,18 @@ export class HeroUiComp extends CCComp {
|
||||
onLoad() {
|
||||
this.on(GameEvent.FightReady,this.fight_ready,this)
|
||||
this.on(GameEvent.UseHeroCard,this.get_hero,this)
|
||||
this.on(GameEvent.FightEnd,this.fight_end,this)
|
||||
// this.node.getChildByName("icon").getChildByName("cd").active=false
|
||||
}
|
||||
start(){
|
||||
this.fight_ready()
|
||||
|
||||
}
|
||||
|
||||
fight_end(){
|
||||
this.heroes=[]
|
||||
this.clearAllHeroIcons()
|
||||
|
||||
}
|
||||
fight_ready(){
|
||||
console.log("[HeroUiComp]: fight_ready",this.node)
|
||||
this.heroes = []
|
||||
@@ -200,6 +205,30 @@ export class HeroUiComp extends CCComp {
|
||||
.to(0.15, { scale: v3(1, 1, 1) }, { easing: 'backOut' })
|
||||
.start()
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空英雄图标
|
||||
* @param heroIndex 英雄索引
|
||||
*/
|
||||
private clearHeroIcon(heroIndex: number) {
|
||||
const heroNodeName = this.HERO_NODE_NAMES[heroIndex]
|
||||
const heroNode = this.node.getChildByName(heroNodeName)
|
||||
if (!heroNode) return
|
||||
|
||||
const iconNode = heroNode.getChildByName("icon")
|
||||
if (iconNode) {
|
||||
iconNode.active = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空所有英雄图标
|
||||
*/
|
||||
public clearAllHeroIcons() {
|
||||
for (let i = 0; i < this.MAX_HEROES; i++) {
|
||||
this.clearHeroIcon(i)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user