import { _decorator, instantiate, Prefab, resources, Sprite, SpriteAtlas, UITransform } 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 { HeroInfo, HeroList } from "../common/config/heroSet"; import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; import { UiHeroComp } from "../hero/UiHeroComp"; import { BoxSet, GameSet } from "../common/config/BoxSet"; import { smc } from "../common/SingletonModuleComp"; import { HeroSelect } from "../hero/HeroSelect"; import { HeroSelectComp } from "../hero/HeroSelectComp"; import { MBSet } from "../common/config/MissionSet"; import { GameEvent } from "../common/config/GameEvent"; const { ccclass, property } = _decorator; /** 视图层对象 */ @ccclass('MissionHomeComp') @ecs.register('MissionHome', false) export class MissionHomeComp extends CCComp { heros:any[]=[]; heros_pos:any=[ {uuid:0,px:-100}, {uuid:0,px:-200}, {uuid:0,px:-300}, ] protected onLoad(): void { oops.message.on("hero_card_select", this.select_hero, this); oops.message.on("hero_card_cancel_select", this.cancel_hero, this); } /** 视图层逻辑代码分离演示 */ start() { // var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象 // this.on(ModuleEvent.Cmd, this.onHandler, this); this.load_hero_card() this.load_ui_heros() // this.load_skill_card() // this.select_skill() this.init_buff() } to_start(){ this.show_heros() } start_mission() { if (this.heros.length <=0 ) { oops.gui.toast("请先选择英雄") return } this.hide_heros() for(let i=0;i(HeroSelect) hcc.load(HeroList[i],parent) // } } // for (let i = 0; i < hc; i++) { // if (HeroInfo[HeroList[i]].quality==2) { // let hcc =ecs.getEntity(HeroSelect) // hcc.load(HeroList[i],parent) // } // } // for (let i = 0; i < hc; i++) { // if (HeroInfo[HeroList[i]].quality==1) { // let hcc =ecs.getEntity(HeroSelect) // hcc.load(HeroList[i],parent) // } // } this.update_hero_cards() } update_hero_cards(){ let loaded:any = ecs.query(ecs.allOf(HeroSelectComp)); for(let i=0;i