Start.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { LQCollideSystem } from "./Collide/lq_collide_system/lq_collide_system";
  2. import { UIList } from "./Core/Ui/UIDef";
  3. import { UILayerNames, UILayers } from "./Core/Ui/UILayers";
  4. import { UIMgr } from "./Core/Ui/UIMgr";
  5. import bullet from "./game/bullet";
  6. import { ConfigMgr } from "./game/cfg/configMgr";
  7. import { Barrage } from "./game/nest/barrage";
  8. import { LevelMgr } from "./levelMgr";
  9. const {ccclass, property} = cc._decorator;
  10. @ccclass
  11. export default class Start extends cc.Component {
  12. /*===========================自动绑定组件开始===========================*/
  13. /*自动生成*/
  14. @property({type:cc.Node, displayName:""})
  15. private $bulletLayer_node:cc.Node = null;
  16. /*自动生成*/
  17. @property({type:cc.Node, displayName:""})
  18. private $level_node:cc.Node = null;
  19. /*自动生成*/
  20. @property({type:cc.Label, displayName:""})
  21. private $levelTitle_lb:cc.Label = null;
  22. /*自动生成*/
  23. @property({type:cc.Node, displayName:""})
  24. private $ui_node:cc.Node = null;
  25. /*===========================自动绑定组件结束===========================*/
  26. /*===========================自动生成按钮事件开始==========================*/
  27. /*===========================自动生成按钮事件结束==========================*/
  28. @property(cc.Prefab) bulletPrefab:cc.Prefab = null;
  29. static inst: Start;
  30. constructor(){
  31. super();
  32. }
  33. protected async onLoad(): Promise<void> {
  34. Start.inst = this;
  35. // let node = new cc.Node()
  36. UIMgr.inst.setup(this.$ui_node, UILayerNames.length, UILayerNames);
  37. LQCollideSystem.is_enable = true;
  38. cc.director.getPhysicsManager().enabled = true;
  39. cc.director.getPhysicsManager().gravity = cc.v2(0, 0);
  40. await ConfigMgr.inst.init();
  41. LevelMgr.inst.parent = this.$level_node;
  42. LevelMgr.inst.title = this.$levelTitle_lb
  43. LevelMgr.inst.begin();
  44. // this.testUI();
  45. Barrage.inst.parent = this.$bulletLayer_node;
  46. UIMgr.inst.showUI(UIList.debug);
  47. }
  48. private testUI() {
  49. UIMgr.inst.showUI(UIList.loading);
  50. UIMgr.inst.showUI(UIList.loading);
  51. setTimeout(() => {
  52. UIMgr.inst.hideUI(UIList.loading);
  53. }, 10000);
  54. }
  55. }