public void SetUI(System.Type loadUI) { if (Assembly .GetAssembly(typeof(UIBase)) .GetTypes() .Where(t => t.IsSubclassOf(typeof(UIBase))).Contains(loadUI)) { if (this.UIActive()) { currentUI.Destroy(); } else if (loadUI == typeof(StartMenu) && overlay != null) { overlay.Destroy(); } this.gameObject.AddComponent(loadUI); UIBase cUI = this.gameObject.GetComponent(loadUI) as UIBase; cUI.Load(); if (loadUI != typeof(Overlay)) { currentUI = cUI; } else { overlay = cUI; } } }
public static void DestroyUI(UIBase ui) { ClearUI(ui); ui.Destroy(); activeUis.Remove(ui.Identifier); uiLookup.Remove(ui.Identifier); }
static int Destroy(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UIBase obj = (UIBase)ToLua.CheckObject(L, 1, typeof(UIBase)); obj.Destroy(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }