CCVMParentComp.ts 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * @Author: dgflash
  3. * @Date: 2021-11-11 19:05:32
  4. * @LastEditors: dgflash
  5. * @LastEditTime: 2022-07-25 17:05:53
  6. */
  7. import { _decorator } from 'cc';
  8. import { ecs } from '../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS';
  9. import VMParent from '../../../../../extensions/oops-plugin-framework/assets/libs/model-view/VMParent';
  10. const { ccclass, property } = _decorator;
  11. /**
  12. * Cocos Creator Component + ECS Comp + VM VMParent
  13. * 使用方法:
  14. * 1、对象拥有Cocos引擎组件功能、ECS 组件全局访问功能、显示对象与数据结构绑定功能
  15. * 2、网络游戏,优先有数据对象,然后才创建视图组件,在释放视图组件时,不释放数据对象
  16. * 3、对象自带监听、释放、发送全局消息功能
  17. * 4、对象管理的所有节点摊平,直接通过节点名获取cc.Node对象(节点名不能有重名)
  18. */
  19. @ccclass('CCVMParentComp')
  20. export abstract class CCVMParentComp extends VMParent implements ecs.IComp {
  21. static tid: number = -1;
  22. static compName: string;
  23. canRecycle!: boolean;
  24. ent!: ecs.Entity;
  25. abstract reset(): void;
  26. }