main.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { _decorator, Component, 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/loading_view';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('main')
  9. export class main extends Component {
  10. @property(Node) home_node:Node = null;
  11. @property(Node) ui_parent = null;
  12. @property(Node) laoding_view_wait = null;
  13. @property(Node) send_msg_wait = null;
  14. protected start(): void {
  15. // game.frameRate = 60;
  16. // PhysicsSystem2D.instance.fixedTimeStep = 1 / 60;
  17. tools.init(this.node)
  18. this.home_node.removeAllChildren()
  19. uiManager.Instance().init(this.ui_parent,this.laoding_view_wait,this.send_msg_wait)
  20. this.showLoadingView()
  21. }
  22. showLoadingView() {
  23. uiManager.Instance().showUi(config.UI.loading_view, this.node, (node:Node)=>{
  24. node.getComponent(loading_view).startLoading(()=>{
  25. this.showHomeView()
  26. })
  27. })
  28. }
  29. showHomeView() {
  30. uiManager.Instance().showUi(config.UI.home,this.home_node,(node:Node)=>{
  31. node.getComponent(home).init()
  32. this.home_node.active = true
  33. })
  34. }
  35. }