去掉hartmodel

This commit is contained in:
2025-06-06 16:26:13 +08:00
parent f9b3f56a04
commit fee9fc9852
7 changed files with 73 additions and 136 deletions

View File

@@ -1,19 +1,13 @@
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, } from "../common/config/BoxSet";
import { HeroInfo, HeroList, HeroPos, HeroSet, HeroUpInfo } from "../common/config/heroSet";
import { Hero } from "../hero/Hero";
import { smc } from "../common/SingletonModuleComp";
import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
import { GameEvent } from "../common/config/GameEvent";
import { HeroModelComp } from "../hero/HeroModelComp";
import { HeroViewComp } from "../hero/HeroViewComp";
import { oops } from "db://oops-framework/core/Oops";
import { FightSet } from "../common/config/Mission";
import { HartModelComp } from "../hero/HartModelComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -46,45 +40,45 @@ export class MissionHeroCompComp extends CCComp {
test_call(){
this.addHero(5010)
}
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("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
// 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("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).excludeOf(HartModelComp))
for(let hero of heros){
let hv = hero.get(HeroViewComp)
if(hv.fight_pos==0){
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);
});
}
// let heros=ecs.query(ecs.allOf(HeroModelComp))
// for(let hero of heros){
// let hv = hero.get(HeroViewComp)
// if(hv.fight_pos==0){
// 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){
// this.node.getChildByName("location").active=false
// console.log("call_hero",args)
@@ -113,10 +107,10 @@ export class MissionHeroCompComp extends CCComp {
get_info_and_remove(fight_pos:number,uuid:number){
let info:any={ap:0,hp:0,lv:0}
let heros=ecs.query(ecs.allOf(HeroModelComp).excludeOf(HartModelComp))
let heros=ecs.query(ecs.allOf(HeroModelComp))
for(let hero of heros){
if(hero.get(HeroViewComp).fight_pos==fight_pos){
let hv = hero.get(HeroViewComp)
let hv = hero.get(HeroViewComp)
if(hv.fight_pos==fight_pos&&!hv.is_master){
// let AP_UP_RATE = hv.hero_uuid === uuid ? FightSet.AP_UPDATE_RATE : FightSet.AP_CHANGE_RATE;
// let heroUpData = HeroUpInfo[hv.hero_uuid] || {}
// let o_ap_rate = heroUpData.ap_up_rate || 0 //被替换 升级的英雄额外被替换攻击增长比率