main.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { _decorator, Component, game, Node} from 'cc';
  2. import { config } from './config';
  3. import { tools } from './tools';
  4. import { uiManager } from './manager/uiManager';
  5. import { home } from './ui/home/home';
  6. import { loading_view } from './ui/loading_view';
  7. import { SdkUtil } from './sdkUtil';
  8. const { ccclass, property } = _decorator;
  9. @ccclass('main')
  10. export class main extends Component {
  11. @property(Node) home_node:Node = null;
  12. @property(Node) ui_parent = null;
  13. @property(Node) laoding_view_wait = null;
  14. @property(Node) send_msg_wait = null;
  15. protected start(): void {
  16. game.frameRate = 61; //修复 iphone 15 抖动问题
  17. // PhysicsSystem2D.instance.fixedTimeStep = 1 / 60;
  18. SdkUtil.init()
  19. tools.init(this.node)
  20. this.home_node.removeAllChildren()
  21. uiManager.Instance().init(this.ui_parent,this.laoding_view_wait,this.send_msg_wait)
  22. this.showLoadingView()
  23. }
  24. private showLoadingView() {
  25. uiManager.Instance().showUi(config.UI.loading_view, this.node, (node:Node)=>{
  26. node.getComponent(loading_view).startLoading((v:loading_view)=>{
  27. this.showHomeView(()=>{
  28. v.close()
  29. })
  30. })
  31. })
  32. }
  33. private showHomeView(cb) {
  34. uiManager.Instance().showUi(config.UI.home,this.home_node,(node:Node)=>{
  35. node.getComponent(home).init()
  36. cb && cb()
  37. })
  38. }
  39. }