//销毁指定窗口所有窗口 public static async ETTask DestroyWindowExceptNames(this UIManagerComponent self, string[] type_names = null) { Dictionary <string, bool> dict_ui_names = new Dictionary <string, bool>(); if (type_names != null) { for (int i = 0; i < type_names.Length; i++) { dict_ui_names[type_names[i]] = true; } } var keys = self.windows.Keys.ToArray(); using (ListComponent <ETTask> TaskScheduler = ListComponent <ETTask> .Create()) { for (int i = self.windows.Count - 1; i >= 0; i--) { if (!dict_ui_names.ContainsKey(keys[i])) { TaskScheduler.Add(self.DestroyWindow(keys[i])); } } await ETTaskHelper.WaitAll(TaskScheduler); } }
public static async ETTask DestroyAllWindow(this UIManagerComponent self) { var keys = self.windows.Keys.ToArray(); using (ListComponent <ETTask> TaskScheduler = ListComponent <ETTask> .Create()) { for (int i = self.windows.Count - 1; i >= 0; i--) { TaskScheduler.Add(self.DestroyWindow(self.windows[keys[i]].Name)); } await ETTaskHelper.WaitAll(TaskScheduler); } }
/// <summary> /// 销毁隐藏状态的窗口 /// </summary> /// <param name="self"></param> public static async ETTask DestroyUnShowWindow(this UIManagerComponent self) { using (ListComponent <ETTask> TaskScheduler = ListComponent <ETTask> .Create()) { foreach (var key in self.windows.Keys.ToList()) { if (!self.windows[key].Active) { TaskScheduler.Add(self.DestroyWindow(key)); } } await ETTaskHelper.WaitAll(TaskScheduler); } }
//销毁指定层级外层级所有窗口 public static async ETTask DestroyWindowExceptLayer(this UIManagerComponent self, UILayerNames layer) { var keys = self.windows.Keys.ToArray(); using (ListComponent <ETTask> TaskScheduler = ListComponent <ETTask> .Create()) { for (int i = self.windows.Count - 1; i >= 0; i--) { if (self.windows[keys[i]].Layer != layer) { TaskScheduler.Add(self.DestroyWindow(keys[i])); } } await ETTaskHelper.WaitAll(TaskScheduler); } }
public static async ETTask DestroyWindow <T>(this UIManagerComponent self) where T : Entity { string ui_name = typeof(T).Name; await self.DestroyWindow(ui_name); }