SettingViewComp.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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('SettingViewComp')
  10. @ecs.register('SettingView', false)
  11. export class SettingViewComp extends CCVMParentComp {
  12. data: any = {
  13. nickName: "金砖大王",
  14. uid: "1234567890"
  15. }
  16. /** 视图层逻辑代码分离演示 */
  17. start() {
  18. // const entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
  19. this.setButton();
  20. }
  21. /** 视图对象通过 ecs.Entity.remove(SettingViewComp) 删除组件是触发组件处理自定义释放逻辑 */
  22. reset() {
  23. this.node.destroy();
  24. }
  25. private btn_about() {
  26. oops.gui.open(UIID.AboutUs);
  27. }
  28. private btn_close() {
  29. oops.gui.remove(UIID.Setting);
  30. }
  31. private btn_cache() {
  32. oops.gui.toast("清理成功");
  33. }
  34. }