public static UIWindowBase CreateUIWindow(string UIName) { GameObject UItmp = GameObjectManager.CreateGameObjectByPool(UIName, UIManagerGo); UIWindowBase UIWIndowBase = UItmp.GetComponent <UIWindowBase>(); UISystemEvent.Dispatch(UIWIndowBase, UIEvent.OnInit); //派发OnInit事件 UIWIndowBase.windowStatus = UIWindowBase.WindowStatus.Create; try { UIWIndowBase.InitWindow(GetUIID(UIName)); } catch (Exception e) { Debug.LogError(UIName + "OnInit Exception: " + e.ToString()); } AddHideUI(UIWIndowBase); UILayerManager.SetLayer(UIWIndowBase); //设置层级 return(UIWIndowBase); }
public static void DestroyUI(UIWindowBase UI) { Debug.Log("UIManager DestroyUI " + UI.name); if (GetIsExitsHide(UI)) { RemoveHideUI(UI); } else if (GetIsExits(UI)) { RemoveUI(UI); } UISystemEvent.Dispatch(UI, UIEvent.OnDestroy); //派发OnDestroy事件 try { UI.DestroyUI(); } catch (Exception e) { Debug.LogError("OnDestroy :" + e.ToString()); } Destroy(UI.gameObject); }
//刷新是主动调用 public void Refresh(params object[] args) { UISystemEvent.Dispatch(this, UIEvent.OnRefresh); OnRefresh(); }
//开始调用进入动画 public void StartEnterAnim(UIWindowBase UIbase, UICallBack callBack, params object[] objs) { UISystemEvent.Dispatch(UIbase, UIEvent.OnStartEnterAnim); StartCoroutine(UIbase.EnterAnim(EndEnterAnim, callBack, objs)); }