dd
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { _decorator, v3, Vec3 } from "cc";
|
||||
import { _decorator, Sprite, SpriteFrame, v3, Vec3 } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { BoxSet, GameSet } from "../common/config/BoxSet";
|
||||
@@ -10,6 +10,7 @@ import { RandomManager } from "db://oops-framework/core/common/random/RandomMana
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { HeroModelComp } from "../hero/HeroModelComp";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -44,10 +45,21 @@ export class MissionHeroCompComp extends CCComp {
|
||||
}
|
||||
show_heros_pos(event: string, args: any){
|
||||
console.log("show_heros_pos",args)
|
||||
|
||||
this.current_hero_uuid=args.uuid
|
||||
this.update_fight_hero_info()
|
||||
this.node.getChildByName("herospos").active=true
|
||||
}
|
||||
update_fight_hero_info(){
|
||||
let heros=ecs.query(ecs.allOf(HeroModelComp))
|
||||
for(let hero of heros){
|
||||
let hv = hero.get(HeroViewComp)
|
||||
if(hv.fight_pos==0){
|
||||
let icon=this.node.getChildByName("herospos").getChildByName("heropos1").getChildByName("hero").getChildByName("icon")
|
||||
let icon_frame=oops.res.get(HeroInfo[hv.hero_uuid].icon,SpriteFrame)!
|
||||
icon.getComponent(Sprite).spriteFrame=icon_frame
|
||||
}
|
||||
}
|
||||
}
|
||||
call_hero(event: string, args: any){
|
||||
this.node.getChildByName("herospos").active=false
|
||||
console.log("call_hero",args)
|
||||
@@ -63,16 +75,12 @@ export class MissionHeroCompComp extends CCComp {
|
||||
/** 添加玩家 */
|
||||
private addHero(uuid:number=1001,fight_pos:number=0) {
|
||||
console.log("call_hero addHero",uuid)
|
||||
let info:any={ap:0,hp:0}
|
||||
if(this.start_pos[fight_pos].has){
|
||||
info=this.get_info_and_remove(fight_pos,uuid)
|
||||
}
|
||||
let info:any=this.get_info_and_remove(fight_pos,uuid)
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
let pos:Vec3 = this.start_pos[fight_pos].pos;
|
||||
console.log("hero load0",pos,this.start_pos)
|
||||
hero.load(pos,scale,uuid,info,fight_pos);
|
||||
this.start_pos[fight_pos].has=true
|
||||
this.current_hero_uuid=0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user