/// <summary>
    /// for teams, NOT USED
    /// </summary>
    void DrawTeam(Vector2 position, Vector2 scale, vp_MPTeam team)
    {
        Color col = (team != null ? team.Color * (Color.white * 0.35f) : Color.white);

        col.a = 0.75f;
        col.a = 0.75f;

        if ((team != null) && vp_MPTeamManager.Exists && vp_MPTeamManager.TeamCount > 1)
        {
            if (vp_MathUtility.IsOdd(team.Number))
            {
                TeamNameStyle.alignment  = TextAnchor.MiddleLeft;
                TeamScoreStyle.alignment = TextAnchor.MiddleRight;
            }
            else
            {
                TeamNameStyle.alignment  = TextAnchor.MiddleRight;
                TeamScoreStyle.alignment = TextAnchor.MiddleLeft;
            }
            DrawLabel(team.Name.ToUpper(), position, scale, TeamNameStyle, Color.white, col, true);
            if (team is vp_DMTeam)
            {
                DrawLabel((team as vp_DMTeam).Score.ToString(), position, scale, TeamScoreStyle, Color.white, Color.clear, true);
            }
            scale.y  = m_Size.y;
            m_Pos.y -= m_Padding;
        }

        m_Pos.x  = position.x;
        m_Size.y = (Screen.height / 2.0f) - m_Pos.y - 2 * m_Margin;

        DrawLabel("", m_Pos, m_Size, TextStyle, Color.clear, m_TranspBlack);
        m_Pos.y = position.y + scale.y;
        DrawTopRow(new Vector2(position.x, m_Pos.y), scale);
        m_CurrentRowColor = m_TranspBlack;

        foreach (vp_MPNetworkPlayer p in vp_MPNetworkPlayer.Players.Values)
        {
            if (p == null)
            {
                continue;
            }
            if ((team == null) || p.TeamNumber == team.Number)
            {
                DrawPlayerRow(p, m_Pos + (Vector2.up * m_Size.y), new Vector2(scale.x, m_Size.y));
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// returns the player count of 'team'
    /// </summary>
    protected virtual int GetTeamSize(vp_MPTeam team)
    {
        int amount = 0;

        foreach (vp_MPNetworkPlayer p in vp_MPNetworkPlayer.Players.Values)
        {
            if (p == null)
            {
                continue;
            }
            if (p.TeamNumber == Teams.IndexOf(team))
            {
                amount++;
            }
        }

        return(amount);
    }
Esempio n. 3
0
    /// <summary>
    /// returns the team with the lowest player count. used to even out
    /// the odds by assigning joining players to the smallest team
    /// </summary>
    public virtual int GetSmallestTeam()
    {
        vp_MPTeam smallestTeam = null;

        if (vp_MPNetworkPlayer.Players.Count > 0)
        {
            foreach (vp_MPTeam team in Teams)
            {
                if (Teams.IndexOf(team) > 0)
                {
                    if ((smallestTeam == null) || (GetTeamSize(team) <= GetTeamSize(smallestTeam)))
                    {
                        smallestTeam = team;
                    }
                }
            }
        }
        if (smallestTeam == null)
        {
            smallestTeam = Teams[Random.Range(1, Teams.Count)];
        }

        return(smallestTeam != null ? Teams.IndexOf(smallestTeam) : 0);
    }
	/// <summary>
	/// returns the player count of 'team'
	/// </summary>
	protected virtual int GetTeamSize(vp_MPTeam team)
	{

		int amount = 0;
		foreach (vp_MPNetworkPlayer p in vp_MPNetworkPlayer.Players.Values)
		{
			if (p == null)
				continue;
			if (p.TeamNumber == Teams.IndexOf(team))
				amount++;
		}

		return amount;
	}
	/// <summary>
	/// 
	/// </summary>
	void DrawTeam(Vector2 position, Vector2 scale, vp_MPTeam team)
	{

		Color col = (team != null ? team.Color * (Color.white * 0.35f) : Color.white);
		col.a = 0.75f;
		col.a = 0.75f;

		if ((team != null) && vp_MPTeamManager.Exists && vp_MPTeamManager.TeamCount > 1)
		{
			if (vp_MathUtility.IsOdd(team.Number))
			{
				TeamNameStyle.alignment = TextAnchor.MiddleLeft;
				TeamScoreStyle.alignment = TextAnchor.MiddleRight;
			}
			else
			{
				TeamNameStyle.alignment = TextAnchor.MiddleRight;
				TeamScoreStyle.alignment = TextAnchor.MiddleLeft;
			}
			DrawLabel(team.Name.ToUpper(), position, scale, TeamNameStyle, Color.white, col, true);
			if(team is vp_DMTeam)
				DrawLabel((team as vp_DMTeam).Score.ToString(), position, scale, TeamScoreStyle, Color.white, Color.clear, true);
			scale.y = m_Size.y;
			m_Pos.y -= m_Padding;
		}

		m_Pos.x = position.x;
		m_Size.y = Screen.height - m_Pos.y - m_Margin;
		DrawLabel("", m_Pos, m_Size, TextStyle, Color.clear, m_TranspBlack);
		m_Pos.y = position.y + scale.y;
		DrawTopRow(new Vector2(position.x, m_Pos.y), scale);
		m_CurrentRowColor = m_TranspBlack;

		foreach (vp_MPNetworkPlayer p in vp_MPNetworkPlayer.Players.Values)
		{
			if (p == null)
				continue;
			if ((team == null) || p.TeamNumber == team.Number)
			{
				DrawPlayerRow(p, m_Pos + (Vector2.up * m_Size.y), new Vector2(scale.x, m_Size.y));
			}
		}

	}