AboutViewComp.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-04-07 17:49:55
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-05-16 11:30:03
  6. * @Description:
  7. */
  8. import { _decorator } from "cc";
  9. import { oops } from "db://oops-framework/core/Oops";
  10. import { ecs } from "db://oops-framework/libs/ecs/ECS";
  11. import { CCComp } from "db://oops-framework/module/common/CCComp";
  12. import { UIID } from "../config/GameUIConfig";
  13. import { CCVMParentComp } from "db://oops-framework/module/common/CCVMParentComp";
  14. import { TableGameConfig } from "../table/TableGameConfig";
  15. const { ccclass, property } = _decorator;
  16. /** 视图层对象 */
  17. @ccclass('AboutViewComp')
  18. @ecs.register('AboutView', false)
  19. export class aboutViewComp extends CCVMParentComp {
  20. data: any = {
  21. gameName: "",
  22. version: "",
  23. companyName: "",
  24. }
  25. private _tsGameConfig = new TableGameConfig();
  26. /** 视图层逻辑代码分离演示 */
  27. start() {
  28. // const entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
  29. this.setButton();
  30. this._tsGameConfig.init(1);
  31. console.log("game_config", this._tsGameConfig);
  32. this.data.gameName = this._tsGameConfig.gameName;
  33. this.data.version = this._tsGameConfig.gameVersion;
  34. this.data.companyName = this._tsGameConfig.gameCompanyName;
  35. }
  36. /** 视图对象通过 ecs.Entity.remove(aboutUsViewComp) 删除组件是触发组件处理自定义释放逻辑 */
  37. reset() {
  38. this.node.destroy();
  39. }
  40. btn_back() {
  41. oops.gui.remove(UIID.AboutUs);
  42. }
  43. }