public void UpdatePartyIndex(int index, int playerId, string name, int level, string className) { index--; if (index >= 0 && index < 10) { if (playerId == 0 || string.IsNullOrEmpty(name)) { if (m_partyPlayers[index] != null) { int oldPlayerId = m_partyPlayers[index].GetPlayerId(); m_playerIndexMapping.Remove(oldPlayerId); m_partyPlayers[index].gameObject.SetActive(false); } } else if (m_partyPlayers[index] != null) { int oldPlayerId = m_partyPlayers[index].GetPlayerId(); m_playerIndexMapping.Remove(oldPlayerId); ResetPartyPlayer(index, playerId, name); } else { PartyPlayerUI partyPlayerObject = Resources.Load <PartyPlayerUI>("Prefabs" + SLASH + "PartyPlayerUI"); if (partyPlayerObject != null) { PartyPlayerUI partyPlayer = Instantiate(partyPlayerObject, PartyPosition(index), Quaternion.identity); partyPlayer.gameObject.transform.SetParent(gameObject.transform); m_partyPlayers[index] = partyPlayer; ResetPartyPlayer(index, playerId, name); } } } }
public List <PartyPlayerUI> GetAllPartyPlayers() { List <PartyPlayerUI> partyPlayerList = new List <PartyPlayerUI>(); for (int index = 1; index <= 10; ++index) { PartyPlayerUI partyPlayer = GetPartyPlayer(index); if (partyPlayer != null) { partyPlayerList.Add(partyPlayer); } } return(partyPlayerList); }