From ea64303410e552ad5b786162401b82b010c86c7d Mon Sep 17 00:00:00 2001 From: panw Date: Thu, 15 May 2025 16:27:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E5=8F=AC=E5=94=A4=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=88=B0=E7=89=B9=E5=AE=9A=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=20=20=E5=8F=96=E6=B6=88=E7=B1=BB=E5=9E=8B=E4=B8=8E=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/resources/gui/role_controller.prefab | 12 +++++---- assets/script/game/map/MissionHeroComp.ts | 29 ++++++++++++++------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/assets/resources/gui/role_controller.prefab b/assets/resources/gui/role_controller.prefab index b4b55879..431b543e 100644 --- a/assets/resources/gui/role_controller.prefab +++ b/assets/resources/gui/role_controller.prefab @@ -13531,7 +13531,7 @@ } ], "_interactable": true, - "_transition": 0, + "_transition": 3, "_normalColor": { "__type__": "cc.Color", "r": 255, @@ -13575,11 +13575,13 @@ }, { "__type__": "cc.ClickEvent", - "target": null, + "target": { + "__id__": 2 + }, "component": "", - "_componentId": "", - "handler": "", - "customEventData": "" + "_componentId": "0e186v7IoJEnZ9QdXVZry2W", + "handler": "call_hero", + "customEventData": "0" }, { "__type__": "cc.PrefabInfo", diff --git a/assets/script/game/map/MissionHeroComp.ts b/assets/script/game/map/MissionHeroComp.ts index 81d6226b..23703380 100644 --- a/assets/script/game/map/MissionHeroComp.ts +++ b/assets/script/game/map/MissionHeroComp.ts @@ -23,6 +23,7 @@ export class MissionHeroCompComp extends CCComp { 1:{pos:v3(-270,205,0),has:false}, 2:{pos:v3(-270,65,0),has:false}, } + current_hero_uuid:number=0 onLoad(){ this.on(GameEvent.UseHeroCard,this.show_heros_pos,this) } @@ -41,31 +42,41 @@ export class MissionHeroCompComp extends CCComp { test_call(){ this.addHero(5010) } - show_heros_pos(){ + show_heros_pos(event: string, args: any){ + console.log("show_heros_pos",args) + + this.current_hero_uuid=args.uuid this.node.getChildByName("herospos").active=true } call_hero(event: string, args: any){ + this.node.getChildByName("herospos").active=false + console.log("call_hero",args) + let hero_pos=0 + if(args.hero_pos){ + hero_pos=args.hero_pos + } this.timer.reset() let hero_list =HeroList let x=RandomManager.instance.getRandomInt(0,hero_list.length,1) - let uuid=args.uuid - console.log("call_hero",uuid) - this.addHero(uuid) + // let uuid=args.uuid + // console.log("call_hero",uuid) + this.addHero(this.current_hero_uuid,hero_pos) } /** 添加玩家 */ - private addHero(uuid:number=1001) { + private addHero(uuid:number=1001,hero_pos:number=0) { console.log("call_hero addHero",uuid) let info:any={ap:0,hp:0} - if(this.start_pos[HeroInfo[uuid].type].has){ - info=this.get_info_and_remove(HeroInfo[uuid].type,uuid) + if(this.start_pos[hero_pos].has){ + info=this.get_info_and_remove(hero_pos,uuid) } let hero = ecs.getEntity(Hero); let scale = 1 - let pos:Vec3 = this.start_pos[HeroInfo[uuid].type].pos; + let pos:Vec3 = this.start_pos[hero_pos].pos; console.log("hero load0",pos,this.start_pos) hero.load(pos,scale,uuid,info); - this.start_pos[HeroInfo[uuid].type].has=true + this.start_pos[hero_pos].has=true + this.current_hero_uuid=0 } get_info_and_remove(type:number,uuid:number){