future 1 éve
szülő
commit
94e756a9ca
1 módosított fájl, 13 hozzáadás és 4 törlés
  1. 13 4
      assets/script/main.ts

+ 13 - 4
assets/script/main.ts

@@ -13,6 +13,9 @@ export class main extends Component {
     @property(Node) ui_parent = null;
     @property(Node) laoding_view_wait = null;
     @property(Node) send_msg_wait = null;
+
+    private m_home_view:Node = null
+
     protected start(): void {
         game.frameRate = 61;  //修复 iphone 15 抖动问题
         // PhysicsSystem2D.instance.fixedTimeStep = 1 / 60;
@@ -21,10 +24,11 @@ export class main extends Component {
         this.home_node.removeAllChildren()
         uiManager.Instance().init(this.ui_parent,this.laoding_view_wait,this.send_msg_wait)
 
+        this.preloadHomeView()
         this.showLoadingView()
     }
 
-    showLoadingView() {
+    private showLoadingView() {
         uiManager.Instance().showUi(config.UI.loading_view, this.node, (node:Node)=>{
             node.getComponent(loading_view).startLoading(()=>{
                 this.showHomeView()
@@ -32,12 +36,17 @@ export class main extends Component {
         })
     }
 
-    showHomeView() {
+    private preloadHomeView() {
+        this.home_node.active = false
         uiManager.Instance().showUi(config.UI.home,this.home_node,(node:Node)=>{
-            node.getComponent(home).init()
-            this.home_node.active = true
+            this.m_home_view = node
         })
     }
+
+    private showHomeView() {
+        this.m_home_view.getComponent(home).init()
+        this.home_node.active = true
+    }
 }