//Main Function public Window CreateWindow(WindowType type, string openParam, object closeParam, Window.VoidHandle openHandle) { Window wnd = WindowManager.instance.FindWindow(type); if (wnd != null) { wnd.show = true; if (openHandle != null) { openHandle(); } wnd.Show(); } else { wnd = UIHelper.CreateWindow(type, openParam, closeParam, openHandle); } return(wnd); }
public static Window CreateWindow(WindowType type, string openParam, object closeParam, Window.VoidHandle openHandle) { Window wnd = Activator.CreateInstance(Type.GetType(WindowManager.instance.GetWindowTypeName(type))) as Window; WindowManager.instance.Insert(wnd); //异步模式 //wnd.wnd_load_handle = delegate(UnityEngine.Object obj) //{ // if (obj == null) // { // return; // } // if (wnd == null) // { // return; // } // wnd.Open_param = openParam; // wnd.Close_param = closeParam; // GameObject go = Instantiate(obj) as GameObject; // wnd.OnLoad(go); //}; //Create GameObj //默认 Window的 名字 和类的名字相同 UnityEngine.Object obj = CreateUIGameObject(type.ToString(), wnd.wnd_load_handle); if (obj == null) { Debug.Log("窗口为空"); return(null); } if (wnd == null) { return(null); } wnd.Open_param = openParam; wnd.Close_param = closeParam; GameObject go = obj as GameObject; if (go != null) { wnd.OnLoad(go); } else { Debug.LogError("obj is null or empty!" + go.name); return(null); } if (openHandle != null) { openHandle(); } return(wnd); }
public Window CreateWindow(WindowType winType, Window.VoidHandle openHandle) { return(CreateWindow(winType, null, null, openHandle)); }