This commit is contained in:
2025-05-23 16:23:16 +08:00
parent 2c3f682b18
commit 85856ccc28
3 changed files with 6495 additions and 700 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -60,15 +60,15 @@ export class CardComp extends CCComp {
this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros() this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros()
} }
check_heros(){ check_heros(){
let heros=ecs.query(ecs.allOf(HeroModelComp)) // let heros=ecs.query(ecs.allOf(HeroModelComp))
for(let hero of heros){ // for(let hero of heros){
if(hero.get(HeroViewComp).hero_uuid == this.c_uuid){ // if(hero.get(HeroViewComp).hero_uuid == this.c_uuid){
return "升级" // return "升级"
} // }
if(hero.get(HeroViewComp).type==HeroInfo[this.c_uuid].type){ // if(hero.get(HeroViewComp).type==HeroInfo[this.c_uuid].type){
return "替换" // return "替换"
} // }
} // }
return "召唤" return "召唤"
} }
use_card(){ use_card(){

View File

@@ -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 { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { BoxSet, GameSet } from "../common/config/BoxSet"; import { BoxSet, GameSet } from "../common/config/BoxSet";
@@ -51,14 +51,36 @@ export class MissionHeroCompComp extends CCComp {
this.node.getChildByName("location").active=true this.node.getChildByName("location").active=true
} }
update_fight_hero_info(){ 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)) let heros=ecs.query(ecs.allOf(HeroModelComp))
for(let hero of heros){ for(let hero of heros){
let hv = hero.get(HeroViewComp) let hv = hero.get(HeroViewComp)
if(hv.fight_pos==0){ if(hv.fight_pos==0){
let icon=this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos1").getChildByName("hero").getChildByName("icon") this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos1").getChildByName("hero").active=true
let icon_frame=oops.res.get(HeroInfo[hv.hero_uuid].icon,SpriteFrame)! resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
icon.getComponent(Sprite).spriteFrame=icon_frame 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){ call_hero(event: string, args: any){