AliensGlobalInstance.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * @Author: super_javan 296652579@qq.com
  3. * @Date: 2025-01-01 09:28:17
  4. * @LastEditors: super_javan 296652579@qq.com
  5. * @LastEditTime: 2025-01-01 18:28:17
  6. * @FilePath: /MoveCarUnscrew/assets/module_movecar/Script/AliensGlobalInstance.ts
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. import { _decorator, assetManager, Camera, Component, find, Label, Node, Prefab } from 'cc';
  10. const { ccclass, property } = _decorator;
  11. @ccclass('AliensGlobalInstance')
  12. export class AliensGlobalInstance extends Component {
  13. private static _instance: AliensGlobalInstance;
  14. public static get instance() {
  15. if (this._instance) {
  16. return this._instance;
  17. }
  18. this._instance = new AliensGlobalInstance();
  19. return this._instance;
  20. }
  21. public async initUI() {
  22. this.camera = find("Canvas/Camera").getComponent(Camera)!;
  23. this.levels = find("Canvas/Scene/Levels");
  24. this.homeUI = find("Canvas/GameUI/HomeUI");
  25. this.battleUI = find("Canvas/GameUI/BattleUI");
  26. this.bottomBtn = find("Canvas/GameUI/BattleUI/BottomBtns");
  27. this.topLeftNode = find("Canvas/GameUI/TopLeft");
  28. this.titleLvl = find("Canvas/GameUI/BattleUI/TitleLvl");
  29. this.aimNode = find("Canvas/GameUI/BattleUI/Aim");
  30. this.aimTarget = find("Canvas/GameUI/BattleUI/AimTarget");
  31. this.radarNode = find("Canvas/GameUI/BattleUI/Radar");
  32. this.renderNode = find("Canvas/GameUI/BattleUI/Render");
  33. }
  34. public camera: Camera = null!; //相机
  35. public levels: Node = null!;
  36. public homeUI: Node = null!;
  37. public battleUI: Node = null!;
  38. public bottomBtn: Node = null!; //底部按钮
  39. public topLeftNode: Node = null!;
  40. public titleLvl: Node = null!; //标题
  41. public aimNode: Node = null!; //瞄准节点
  42. public aimTarget: Node = null!; //瞄准放大节点
  43. public radarNode: Node = null!; //侦擦节点
  44. public renderNode: Node = null!; //渲染节点
  45. }