Ejemplo n.º 1
0
 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);
             }
         }
     }
 }
Ejemplo n.º 2
0
    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);
    }