From 48c963425709dcd449fa5bc98049d2393dfd56ef Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期一, 27 八月 2018 15:43:31 +0800
Subject: [PATCH] 2948 移除多个子界面动画

---
 System/WindowBase/Window.cs |   43 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/System/WindowBase/Window.cs b/System/WindowBase/Window.cs
index 08490aa..e6373a3 100644
--- a/System/WindowBase/Window.cs
+++ b/System/WindowBase/Window.cs
@@ -38,6 +38,7 @@
         }
 
         public bool playAnimation { get; set; }
+        public bool executedActiveWindow { get; set; }
 
         internal Window Open()
         {
@@ -65,6 +66,7 @@
                 Debug.Log(ex.StackTrace);
             }
 
+            executedActiveWindow = false;
             RectTransform parent = null;
             try
             {
@@ -151,6 +153,7 @@
                 windowState = WindowState.Closing;
             }
 
+            executedActiveWindow = false;
             return this;
         }
 
@@ -207,6 +210,7 @@
             try
             {
                 OnAfterClose();
+                executedActiveWindow = false;
             }
             catch (System.Exception ex)
             {
@@ -237,6 +241,11 @@
         public virtual void CloseClick()
         {
             CloseImmediately();
+        }
+
+        public void ChildActive()
+        {
+            OnActived();
         }
 
         protected virtual void LateUpdate()
@@ -350,6 +359,7 @@
                     try
                     {
                         OnAfterClose();
+                        executedActiveWindow = false;
                     }
                     catch (System.Exception ex)
                     {
@@ -400,6 +410,7 @@
                 try
                 {
                     OnAfterClose();
+                    executedActiveWindow = false;
                 }
                 catch (System.Exception ex)
                 {
@@ -439,7 +450,37 @@
 
             try
             {
-                OnActived();
+                var isChildWindow = WindowConfig.Get().IsChildWindow(this.gameObject.name);
+                if (isChildWindow)
+                {
+                    var parentName = string.Empty;
+                    WindowConfig.Get().FindParentWindow(this.gameObject.name, out parentName);
+                    var parentWindow = WindowCenter.Instance.Get(parentName);
+                    if (parentWindow != null && parentWindow.executedActiveWindow)
+                    {
+                        OnActived();
+                        executedActiveWindow = true;
+                    }
+                }
+                else
+                {
+                    OnActived();
+                    executedActiveWindow = true;
+                    var childWindows = WindowConfig.Get().FindChildWindows(this.gameObject.name);
+                    var isParentWindow = childWindows != null;
+                    if (isParentWindow)
+                    {
+                        foreach (var child in childWindows)
+                        {
+                            var window = WindowCenter.Instance.Get(child);
+                            if (window != null && !window.executedActiveWindow)
+                            {
+                                window.ChildActive();
+                            }
+                        }
+                    }
+                }
+
             }
             catch (Exception ex)
             {

--
Gitblit v1.8.0