Files
heros/assets/script/game/map/MissionHomeComp.ts
2025-03-18 10:22:09 +08:00

65 lines
1.9 KiB
TypeScript

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 { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { smc } from "../common/SingletonModuleComp";
import { GameEvent } from "../common/config/GameEvent";
import { MissionComp } from "./MissionComp";
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 {
}
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
this.load_ui_heros()
}
to_start(){
}
start_mission() {
for(let i=0;i<this.heros.length;i++){
this.heros[i].to_destroy()
}
this.heros=[]
this.heros_pos=[
{uuid:0,px:-100},
{uuid:0,px:-200},
{uuid:0,px:-300},
]
oops.message.dispatchEvent(GameEvent.MissionStart, {})
let mission=this.node.parent.getChildByName("mission").getComponent(MissionComp)
mission.node.active = true;
mission.mission_start()
smc.mission.play = true;
this.node.active=false;
}
load_ui_heros(){
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}