public static async ETTask CloseWindowByLayer(this UIManagerComponent self, UILayerNames layer, params string[] except_ui_names) { Dictionary <string, bool> dict_ui_names = null; if (except_ui_names != null && except_ui_names.Length > 0) { dict_ui_names = new Dictionary <string, bool>(); for (int i = 0; i < except_ui_names.Length; i++) { dict_ui_names[except_ui_names[i]] = true; } } using (ListComponent <ETTask> TaskScheduler = ListComponent <ETTask> .Create()) { foreach (var item in self.windows) { if (item.Value.Layer == layer && (dict_ui_names == null || !dict_ui_names.ContainsKey(item.Key))) { TaskScheduler.Add(self.CloseWindow(item.Key)); } } await ETTaskHelper.WaitAll(TaskScheduler); } }
public static async ETTask DestroyWindow(this UIManagerComponent self, string ui_name) { var target = self.GetWindow(ui_name); if (target != null) { await self.CloseWindow(ui_name); Game.EventSystem.Publish(new UIEventType.InnerDestroyWindow() { target = target }); self.windows.Remove(target.Name); target.Dispose(); } }
public static async ETTask CloseWindow <T>(this UIManagerComponent self) { string ui_name = typeof(T).Name; await self.CloseWindow(ui_name); }
public static async ETTask CloseWindow(this UIManagerComponent self, Entity window) { string ui_name = window.GetType().Name; await self.CloseWindow(ui_name); }