From 4493647b726de207f4628a7cce86d75ebb73ddea Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 12 二月 2019 10:08:16 +0800
Subject: [PATCH] 3335 重构窗口管理

---
 System/WindowBase/PopupWindowsProcessor.cs |   64 +++++++++++++++++++++++++++----
 1 files changed, 55 insertions(+), 9 deletions(-)

diff --git a/System/WindowBase/PopupWindowsProcessor.cs b/System/WindowBase/PopupWindowsProcessor.cs
index 8c829db..2b9f670 100644
--- a/System/WindowBase/PopupWindowsProcessor.cs
+++ b/System/WindowBase/PopupWindowsProcessor.cs
@@ -5,17 +5,37 @@
 
 public class PopupWindowsProcessor : SingletonMonobehaviour<PopupWindowsProcessor>
 {
-    List<string> popupWindowQueue = new List<string>();
-    string currentWindow = string.Empty;
+    List<PopupWindow> popupWindowQueue = new List<PopupWindow>();
+    PopupWindow currentWindow;
 
-    public void Add(string name)
+    public void Add(string name, int functionId = 0)
     {
-        popupWindowQueue.Add(name);
+        var popupWindow = new PopupWindow()
+        {
+            window = name,
+            functionId = functionId,
+        };
+
+        if (popupWindowQueue.Contains(popupWindow))
+        {
+            popupWindowQueue.Remove(popupWindow);
+        }
+
+        popupWindowQueue.Add(popupWindow);
     }
 
-    public void Remove(string name)
+    public void Remove(string name, int functionId = 0)
     {
-        popupWindowQueue.Remove(name);
+        var popupWindow = new PopupWindow()
+        {
+            window = name,
+            functionId = functionId,
+        };
+
+        if (popupWindowQueue.Contains(popupWindow))
+        {
+            popupWindowQueue.Remove(popupWindow);
+        }
     }
 
     private void LateUpdate()
@@ -50,16 +70,42 @@
             return;
         }
 
-        if (!string.IsNullOrEmpty(currentWindow))
+        if (currentWindow != default(PopupWindow))
         {
-            if (!WindowCenter.Instance.IsOpen(currentWindow)
+            if (!WindowCenter.Instance.IsOpen(currentWindow.window)
                 && !WindowCenter.Instance.ExistAnyFullScreenOrMaskWin())
             {
                 currentWindow = popupWindowQueue[0];
                 popupWindowQueue.RemoveAt(0);
-                WindowCenter.Instance.Open(currentWindow);
+                WindowCenter.Instance.Open(currentWindow.window, false, currentWindow.functionId);
             }
         }
+        else
+        {
+            if (!WindowCenter.Instance.ExistAnyFullScreenOrMaskWin())
+            {
+                currentWindow = popupWindowQueue[0];
+                popupWindowQueue.RemoveAt(0);
+                WindowCenter.Instance.Open(currentWindow.window, false, currentWindow.functionId);
+            }
+        }
+
+    }
+
+    public struct PopupWindow
+    {
+        public string window;
+        public int functionId;
+
+        public static bool operator ==(PopupWindow lhs, PopupWindow rhs)
+        {
+            return lhs.window == rhs.window && lhs.functionId == rhs.functionId;
+        }
+
+        public static bool operator !=(PopupWindow lhs, PopupWindow rhs)
+        {
+            return lhs.window != rhs.window || lhs.functionId != rhs.functionId;
+        }
 
     }
 

--
Gitblit v1.8.0