引导系统基本完成,开始制作 引导步骤
This commit is contained in:
@@ -23,7 +23,6 @@ export class MissionHeroCompComp extends CCComp {
|
||||
current_hero_num:number=-1
|
||||
heros:any=[]
|
||||
onLoad(){
|
||||
this.on(GameEvent.UseHeroCard,this.call_hero,this)
|
||||
this.on(GameEvent.FightReady,this.fight_ready,this)
|
||||
this.on(GameEvent.Zhaohuan,this.zhao_huan,this)
|
||||
this.on(GameEvent.FightEnd,this.clear_heros,this)
|
||||
@@ -69,53 +68,7 @@ export class MissionHeroCompComp extends CCComp {
|
||||
this.addHero(args.uuid,false)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
call_hero(event: string, args: any){
|
||||
// console.log("[MissionHeroComp]:call_hero",this.heros,this.current_hero_num,args)
|
||||
|
||||
// 尝试升级现有英雄
|
||||
if (this.tryUpgradeExistingHero(args.uuid)) {
|
||||
return
|
||||
}
|
||||
|
||||
// 添加新英雄
|
||||
this.addNewHero(args.uuid)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 尝试升级现有英雄
|
||||
* @param uuid 英雄UUID
|
||||
* @returns 是否成功升级
|
||||
*/
|
||||
private tryUpgradeExistingHero(uuid: number): boolean {
|
||||
for (let i = 0; i < this.heros.length; i++) {
|
||||
// console.log("[MissionHeroComp]:tryUpgradeExistingHero",this.heros,i,uuid)
|
||||
if (this.heros[i].uuid === uuid) {
|
||||
this.heros[i].count++
|
||||
smc.vmdata[`hero${i+1}`].count=this.heros[i].count
|
||||
oops.message.dispatchEvent(GameEvent.HeroLvUp, { uuid: uuid })
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加新英雄到当前槽位
|
||||
* @param uuid 英雄UUID
|
||||
*/
|
||||
private addNewHero(uuid: number) {
|
||||
this.current_hero_num++
|
||||
if(this.current_hero_num >= FightSet.HERO_MAX_NUM) return
|
||||
this.current_hero_uuid = uuid
|
||||
this.heros[this.current_hero_num].uuid = uuid
|
||||
this.heros[this.current_hero_num].count = 1
|
||||
this.heros[this.current_hero_num].quality = QualitySet.GREEN
|
||||
this.addHero(uuid, false)
|
||||
}
|
||||
|
||||
/** 添加英雄 */
|
||||
private addHero(uuid:number=1001,is_zhaohuan:boolean=false) {
|
||||
|
||||
Reference in New Issue
Block a user