import { _decorator, instantiate, Prefab, 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 } from "../common/config/BoxSet"; import { smc } from "../common/SingletonModuleComp"; import { HeroSelect } from "../hero/HeroSelect"; import { MSklist, SkillSet } from "../common/config/SkillSet"; import { MSCard } from "./MSCard"; const { ccclass, property } = _decorator; /** 视图层对象 */ @ccclass('MissionHomeComp') @ecs.register('MissionHome', false) export class MissionHomeComp extends CCComp { heros:any[]=[]; heros_pos:any=[ {uuid:0,px:-300}, {uuid:0,px:-200}, {uuid:0,px:-100}, {uuid:0,px:0}, {uuid:0,px:100}, ] /** 视图层逻辑代码分离演示 */ 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() } load_hero_card(){ let hc:number =HeroList.length let parent= this.node.getChildByName("heros").getChildByName("view").getChildByName("content") let height=Math.ceil(hc / 4)*135 parent.getComponent(UITransform).width=height for (let i = 0; i < hc; i++) { let hcc =ecs.getEntity(HeroSelect) hcc.load(HeroList[i],parent) } } load_skill_card(){ let ms_num:number =MSklist.length let parent= this.node.getChildByName("skills").getChildByName("view").getChildByName("content") let height=ms_num*135 parent.getComponent(UITransform).width=height for (let i = 0; i < ms_num; i++) { let msc =ecs.getEntity(MSCard) msc.load(MSklist[i],parent,2) } } start_mission(e:any,args:any) { console.log("mission home start_mission") for(let i=0;i