dd
This commit is contained in:
@@ -60,15 +60,15 @@ export class CardComp extends CCComp {
|
||||
this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros()
|
||||
}
|
||||
check_heros(){
|
||||
let heros=ecs.query(ecs.allOf(HeroModelComp))
|
||||
for(let hero of heros){
|
||||
if(hero.get(HeroViewComp).hero_uuid == this.c_uuid){
|
||||
return "升级"
|
||||
}
|
||||
if(hero.get(HeroViewComp).type==HeroInfo[this.c_uuid].type){
|
||||
return "替换"
|
||||
}
|
||||
}
|
||||
// let heros=ecs.query(ecs.allOf(HeroModelComp))
|
||||
// for(let hero of heros){
|
||||
// if(hero.get(HeroViewComp).hero_uuid == this.c_uuid){
|
||||
// return "升级"
|
||||
// }
|
||||
// if(hero.get(HeroViewComp).type==HeroInfo[this.c_uuid].type){
|
||||
// return "替换"
|
||||
// }
|
||||
// }
|
||||
return "召唤"
|
||||
}
|
||||
use_card(){
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _decorator, Sprite, SpriteFrame, v3, Vec3 } from "cc";
|
||||
import { _decorator, resources, Sprite, SpriteAtlas, 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";
|
||||
@@ -51,14 +51,36 @@ export class MissionHeroCompComp extends CCComp {
|
||||
this.node.getChildByName("location").active=true
|
||||
}
|
||||
update_fight_hero_info(){
|
||||
var icon_path = "game/heros/herois"
|
||||
this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos1").getChildByName("hero").active=false
|
||||
this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos2").getChildByName("hero").active=false
|
||||
this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos3").getChildByName("hero").active=false
|
||||
|
||||
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("location").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
|
||||
this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos1").getChildByName("hero").active=true
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos1").getChildByName("hero").getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[hv.hero_uuid].path);
|
||||
});
|
||||
}
|
||||
if(hv.fight_pos==1){
|
||||
this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos2").getChildByName("hero").active=true
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos2").getChildByName("hero").getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[hv.hero_uuid].path);
|
||||
});
|
||||
}
|
||||
if(hv.fight_pos==2){
|
||||
this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos3").getChildByName("hero").active=true
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos3").getChildByName("hero").getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[hv.hero_uuid].path);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
call_hero(event: string, args: any){
|
||||
|
||||
Reference in New Issue
Block a user