/// <summary> /// 加载window /// </summary> /// <param name="windowName"></param> void LoadWindow(string windowName) { string path = PathManager.GetWindowPath(windowName); var obj = ResourceManager.Load <GameObject>(path); var windowObj = PoolManager.InstantiateGameObject(obj, PoolType.Window); windowObj.transform.SetParent(MainCanvas.transform, false); UIWindowBase window = windowObj.GetComponent <UIWindowBase>(); _windowDict.Add(windowObj.name, window); var uiDict = window.LoadAllUI(); RegistUI(window, uiDict); window.Init(); }
public static UIWindowBase CreateUIWindow(string l_UIname) { GameObject l_UItmp = GameObjectManager.CreatGameObject(l_UIname, s_Instance.gameObject); UIWindowBase l_UIbase = l_UItmp.GetComponent <UIWindowBase>(); UISystemEvent.Dispatch(l_UIbase, UIEvent.OnInit); //派发OnInit事件 try{ l_UIbase.Init(); } catch (Exception e) { Debug.LogError("OnInit Exception: " + e.ToString()); } AddHideUI(l_UIbase); return(l_UIbase); }
public static UIWindowBase CreateUIWindow(string UIName) { GameObject UItmp = GameObjectManager.CreateGameObject(UIName, s_UIManagerGo); UIWindowBase UIbase = UItmp.GetComponent <UIWindowBase>(); UISystemEvent.Dispatch(UIbase, UIEvent.OnInit); //派发OnInit事件 try{ UIbase.Init(GetUIID(UIName)); } catch (Exception e) { Debug.LogError("OnInit Exception: " + e.ToString()); } AddHideUI(UIbase); s_UILayerManager.SetLayer(UIbase); //设置层级 return(UIbase); }