Пример #1
0
 //Chck if the players is in the given panel
 private bool IsPlayerInTeamPanel(MatchLobbyPlayer p, RectTransform panel)
 {
     //Check for every child to check if the match lobby player exists within
     foreach (RectTransform t in panel)
     {
         if (t.GetComponent <MatchLobbyPlayer>() == p)
         {
             //Found the player so return
             return(true);
         }
     }
     //No player found
     return(false);
 }
Пример #2
0
    /// <summary>
    /// Adds a lobby object to the correct team frame and sets up UI references. After this call the lobby player is compleatly setted up
    /// </summary>
    /// <param name="player">The lobby object we want to add to the ui frame</param>
    public void AddLobbyPlayer(MatchLobbyPlayer player)
    {
        //Sets the reference to button and adds it to the correct team panel
        player.SetReadyButtonReference(m_readyButton);
        player.SetMapSwitchButtonReference(m_selectionHandler.m_left, m_selectionHandler.m_right);
        switch (player.Team)
        {
        case ETeams.CrazyPeople:
            player.transform.SetParent(m_PayerList_Team1, false);
            break;

        case ETeams.FireFighters:
            player.transform.SetParent(m_PayerList_Team2, false);
            break;
        }
    }
Пример #3
0
    /// <summary>
    /// Ajust the players lobby object to be on the right team panel in the UI
    /// </summary>
    /// <param name="player">The match lobby object to modify/check/adjust</param>
    public void SwitchLobbyPlayerTeamPanel(MatchLobbyPlayer player)
    {
        switch (player.Team)
        {
        case ETeams.CrazyPeople:
            //Check if the player is still in the wrong panel if so then ajust
            if (IsPlayerInTeamPanel(player, m_PayerList_Team2))
            {
                player.transform.SetParent(m_PayerList_Team1, false);
            }
            break;

        case ETeams.FireFighters:
            //Check if the player is still in the wrong panel if so then ajust
            if (IsPlayerInTeamPanel(player, m_PayerList_Team1))
            {
                player.transform.SetParent(m_PayerList_Team2, false);
            }
            break;
        }
    }
Пример #4
0
 //Helper to instantiate a lobby player and init it
 private void CreateLobbyPlayer()
 {
     m_matchLobbyPlayer = Instantiate(m_LobbyPlayerPref).GetComponent <MatchLobbyPlayer>();
     m_matchLobbyPlayer.InitForPlayer(this);
 }