public void ShowUI(UIConst.UIName name, System.Action afterAct = null, ShowUIArg arg = null) { if (uiDic.ContainsKey(name)) { if (uiDic[name] == null) { BaseUI newUI = GameObject.Instantiate( AssetLoader.GetGameObject(UIConst.UIPrefabBundleDic[name], UIConst.UIPrefabNameDic[name])).GetComponent <BaseUI>(); uiDic[name] = newUI; } uiDic[name].gameObject.SetActive(true); uiDic[name].transform.SetAsLastSibling(); uiDic[name].Init(arg); } else { BaseUI newUI = GameObject.Instantiate( AssetLoader.GetGameObject(UIConst.UIPrefabBundleDic[name], UIConst.UIPrefabNameDic[name])).GetComponent <BaseUI>(); newUI.Init(arg); uiDic.Add(name, newUI); } if (afterAct != null) { afterAct(); } }
public virtual void Init(ShowUIArg arg) { if (arg == null) { return; } }
public void ShowUI(UIConst.UIName name, ShowUIArg arg = null, System.Action afterAct = null) { BaseUI uiToShow; if (uiDic.ContainsKey(name)) { if (uiDic[name] == null) { BaseUI newUI = ResourcesLoaderHelper.Instance.LoadAndGetInstance(UIConst.UIPrefabNameDic[name]).GetComponent <BaseUI>(); uiDic[name] = newUI; } uiDic[name].gameObject.SetActive(true); uiDic[name].transform.SetAsLastSibling(); uiDic[name].Init(arg); uiToShow = uiDic[name]; } else { BaseUI newUI = ResourcesLoaderHelper.Instance.LoadAndGetInstance(UIConst.UIPrefabNameDic[name]).GetComponent <BaseUI>(); newUI.Init(arg); uiDic.Add(name, newUI); uiToShow = newUI; } uiToShow.Show(afterAct); }