65 lines
1.8 KiB
TypeScript
65 lines
1.8 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 {
|
|
this.on(GameEvent.MissionEnd,this.mission_end,this)
|
|
}
|
|
/** 视图层逻辑代码分离演示 */
|
|
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, {})
|
|
this.node.active=false;
|
|
}
|
|
mission_end(){
|
|
this.node.active=true
|
|
}
|
|
|
|
load_ui_heros(){
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
|
reset() {
|
|
this.node.destroy();
|
|
}
|
|
} |