// INTERNALS

    private void InternalSetResults(tnStandardMatchController i_MathController)
    {
        if (i_MathController == null)
        {
            return;
        }

        // Team 0

        tnStandardMatchTeamResults teamResults0 = (tnStandardMatchTeamResults)i_MathController.GetTeamResultsByIndex(0);

        if (teamResults0 != null)
        {
            int        teamId0   = teamResults0.id;
            tnTeamData teamData0 = tnGameData.GetTeamDataMain(teamId0);

            if (m_Team0Flag != null)
            {
                m_Team0Flag.sprite = teamData0.flag;
            }

            if (m_Team0Name != null)
            {
                m_Team0Name.text = teamData0.name;
            }

            if (m_Team0Score != null)
            {
                m_Team0Score.text = teamResults0.score.ToString();
            }
        }

        // Team 1

        tnStandardMatchTeamResults teamResults1 = (tnStandardMatchTeamResults)i_MathController.GetTeamResultsByIndex(1);

        if (teamResults1 != null)
        {
            int        teamId1   = teamResults1.id;
            tnTeamData teamData1 = tnGameData.GetTeamDataMain(teamId1);

            if (m_Team1Flag != null)
            {
                m_Team1Flag.sprite = teamData1.flag;
            }

            if (m_Team1Name != null)
            {
                m_Team1Name.text = teamData1.name;
            }

            if (m_Team1Score != null)
            {
                m_Team1Score.text = teamResults1.score.ToString();
            }
        }
    }
Exemplo n.º 2
0
    // LOGIC

    public void Config(tnStandardMatchController i_Controller)
    {
        if (viewInstance != null)
        {
            if (i_Controller == null)
            {
                return;
            }

            // Team 0

            tnStandardMatchTeamResults teamResults0 = (tnStandardMatchTeamResults)i_Controller.GetTeamResultsByIndex(0);
            if (teamResults0 != null)
            {
                int        teamId0   = teamResults0.id;
                tnTeamData teamData0 = tnGameData.GetTeamDataMain(teamId0);

                string name  = teamData0.name;
                int    score = teamResults0.score;
                Sprite flag  = teamData0.flag;

                viewInstance.SetTeam0(name, score, flag);
            }

            // Team 1

            tnStandardMatchTeamResults teamResults1 = (tnStandardMatchTeamResults)i_Controller.GetTeamResultsByIndex(1);
            if (teamResults1 != null)
            {
                int        teamId1   = teamResults1.id;
                tnTeamData teamData1 = tnGameData.GetTeamDataMain(teamId1);

                string name  = teamData1.name;
                int    score = teamResults1.score;
                Sprite flag  = teamData1.flag;

                viewInstance.SetTeam1(name, score, flag);
            }
        }
    }
Exemplo n.º 3
0
    void Update()
    {
        if (m_MatchController == null)
        {
            return;
        }

        // Update animator parameters.

        if (m_Animator != null)
        {
            m_Animator.SetBool("GoldenGoal", m_MatchController.goldenGoal);
        }

        // Timer.

        float time = (float)m_MatchController.remainingTime;

        SetRemainingTime(time);

        // Team 0.

        tnStandardMatchTeamResults teamResults0 = (tnStandardMatchTeamResults)m_MatchController.GetTeamResultsByIndex(0);

        if (teamResults0 != null)
        {
            SetScoreTeam0(teamResults0.score);
        }

        // Team 1.

        tnStandardMatchTeamResults teamResults1 = (tnStandardMatchTeamResults)m_MatchController.GetTeamResultsByIndex(1);

        if (teamResults1 != null)
        {
            SetScoreTeam1(teamResults1.score);
        }
    }