AboutViewComp.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { _decorator } from "cc";
  2. import { oops } from "db://oops-framework/core/Oops";
  3. import { ecs } from "db://oops-framework/libs/ecs/ECS";
  4. import { CCComp } from "db://oops-framework/module/common/CCComp";
  5. import { UIID } from "../config/GameUIConfig";
  6. import { CCVMParentComp } from "db://oops-framework/module/common/CCVMParentComp";
  7. const { ccclass, property } = _decorator;
  8. /** 视图层对象 */
  9. @ccclass('AboutViewComp')
  10. @ecs.register('AboutView', false)
  11. export class aboutViewComp extends CCVMParentComp {
  12. data: any = {
  13. gameName: "",
  14. version: "",
  15. companyName: "",
  16. }
  17. /** 视图层逻辑代码分离演示 */
  18. start() {
  19. // const entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
  20. this.setButton();
  21. this.data.gameName = oops.config.game.gameName;
  22. this.data.version = oops.config.game.gameVersion;
  23. this.data.companyName = oops.config.game.gameCompanyName;
  24. }
  25. /** 视图对象通过 ecs.Entity.remove(aboutUsViewComp) 删除组件是触发组件处理自定义释放逻辑 */
  26. reset() {
  27. this.node.destroy();
  28. }
  29. btn_back() {
  30. oops.gui.remove(UIID.AboutUs);
  31. }
  32. }