public void SetIndexToFriend() { if (friend == null) { GameObject prefab = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_friend"); GameObject panel = GameObject.Instantiate(prefab) as GameObject; friend = new a3_friend(panel.transform); friend.setPerent(con); } current = friend; }
private void OnSwitch(TabControl t) { int index = t.getSeletedIndex(); if (current != null) { if (currentTeam != null && teamList != null) { currentTeam.onClose(); currentTeam.gameObject.SetActive(false); teamList.onClose(); teamList.gameObject.SetActive(false); } current.onClose(); current.gameObject.SetActive(false); } if (index == 0) { if (legion == null) { GameObject prefab = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_legion"); GameObject panel = GameObject.Instantiate(prefab) as GameObject; legion = new a3_legion(panel.transform); legion.setPerent(con); legion.transform.localPosition = Vector3.zero; } current = legion; } else if (index == 1) { SetIndexToFriend(); } else { if (currentTeam == null) { GameObject prefab = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_currentTeamPanel"); GameObject panel = GameObject.Instantiate(prefab) as GameObject; currentTeam = new a3_currentTeamPanel(panel.transform); currentTeam.setPerent(con); } if (teamList == null) { GameObject prefab = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_teamPanel"); GameObject panel = GameObject.Instantiate(prefab) as GameObject; teamList = new a3_teamPanel(panel.transform); teamList.setPerent(con); } if (TeamProxy.getInstance().joinedTeam&& TeamProxy.getInstance().MyTeamData != null) { current = currentTeam; currentTeam.gameObject.SetActive(true); teamList.gameObject.SetActive(false); } else { current = teamList; currentTeam.gameObject.SetActive(false); teamList.gameObject.SetActive(true); } TeamProxy.getInstance().SetTeamPanelInfo(); } if (current != null) { current.onShowed(); current.visiable = true; } }