import { _decorator } from "cc"; import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { Checkpoint } from "../Checkpoint"; import { CheckpointViewController } from "./CheckpointViewController"; const { ccclass, property } = _decorator; /** 关卡显示组件 */ @ccclass('CheckpointViewComp') // 定义为 Cocos Creator 组件 @ecs.register('CheckpointView', false) // 定义为 ECS 组件 export class CheckpointViewComp extends CCComp { // /** 角色动画资源管理 */ // loader: RoleViewLoader = null!; // /** 角色动画规则管理 */ // animator: RoleViewAnimator = null!; /** 关卡控制器 */ controller: CheckpointViewController = null!; /** 视图层逻辑代码分离演示 */ onLoad() { const checkpoint = this.ent as Checkpoint; // this.loader = this.node.addComponent(RoleViewLoader); // this.node.emit("load", role); // this.animator = this.spine.getComponent(RoleViewAnimator)!; // this.animator.role = role; this.controller = this.node.addComponent(CheckpointViewController); this.controller.checkpoint = checkpoint; // this.on(RoleEvent.ChangeJob, this.onHandler, this); } // /** 业务层全局消息通知视图层逻辑处理,两层之间逻辑解耦合演示 */ // private onHandler(event: string, args: any) { // switch (event) { // case RoleEvent.ChangeJob: // this.animator.refresh(); // break; // } // } reset() { this.node.destroy(); } }