public void OpenShop() { if (uiShop != null) { uiShop.OpenFrame(); } else { int index = GetLobbyPanelPathIndex(eUIType.Type_Shop); LoadAssetbundle.LoadPrefabCB loadUICompleteCB = new LoadAssetbundle.LoadPrefabCB(LoadUICompleteCB); PrefabManager.Instance.LoadPrefab(lobbyPanelPathArray[index].path, System.Guid.NewGuid(), loadUICompleteCB, eUIType.Type_Shop, true); } }
private void LoadUICompleteCB(GameObject gameObj, System.Guid uid, params object[] param) { if (gameObj != null) { GameObject createObj = Instantiate(gameObj) as GameObject; createObj.transform.parent = rootPanel.transform; createObj.transform.localPosition = Vector3.zero; createObj.transform.localScale = gameObj.transform.localScale; switch ((eUIType)param[0]) { case eUIType.Type_Lobby: uiLobby = createObj.GetComponent <UILobby>(); break; case eUIType.Type_MessageBox: uiMessageBox = createObj.GetComponent <UIMessageBox>(); break; case eUIType.Type_GameReady: uiGameReady = createObj.GetComponent <UIGameReady>(); if (param.Length > 1 && (bool)param[1]) { uiGameReady.OpenFrame(); } break; case eUIType.Type_Hero: uiHeroList = createObj.GetComponent <UIHeroList>(); if (param.Length > 1 && (bool)param[1]) { uiHeroList.OpenFrame(); } break; case eUIType.Type_Tower: uiTowerList = createObj.GetComponent <UITowerList>(); if (param.Length > 1 && (bool)param[1]) { uiTowerList.OpenFrame(); } break; case eUIType.Type_Waiting: uiWaiting = createObj.GetComponent <UIWaiting>(); break; case eUIType.Type_Base: uiBaseInfo = createObj.GetComponent <UIBaseInfo>(); if (param.Length > 1 && (bool)param[1]) { uiBaseInfo.OpenFrame(); } break; case eUIType.Type_Option: uiGameOption = createObj.GetComponent <UIGameOption>(); if (param.Length > 1 && (bool)param[1]) { uiGameOption.OpenFrame(); } break; case eUIType.Type_Shop: uiShop = createObj.GetComponent <UIShop>(); if (param.Length > 1 && (bool)param[1]) { uiShop.OpenFrame(); } break; } } }