Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (!TeamName1.GetComponent <Text>().text.Equals(oldName1))
        {
            oldName1 = TeamName1.GetComponent <Text>().text;
            TeamElo1.GetComponent <Text>().text  = "" + TeamsPerformance.GetTeamElo(oldName1);
            TeamElo1.GetComponent <Text>().color = ColorElo(TeamsPerformance.GetTeamElo(oldName1));
        }

        if (!TeamName2.GetComponent <Text>().text.Equals(oldName2))
        {
            oldName2 = TeamName2.GetComponent <Text>().text;
            TeamElo2.GetComponent <Text>().text  = "" + TeamsPerformance.GetTeamElo(oldName2);
            TeamElo2.GetComponent <Text>().color = ColorElo(TeamsPerformance.GetTeamElo(oldName2));
        }

        if (!TeamName3.GetComponent <Text>().text.Equals(oldName3))
        {
            oldName3 = TeamName3.GetComponent <Text>().text;
            TeamElo3.GetComponent <Text>().text  = "" + TeamsPerformance.GetTeamElo(oldName3);
            TeamElo3.GetComponent <Text>().color = ColorElo(TeamsPerformance.GetTeamElo(oldName3));
        }

        if (!TeamName4.GetComponent <Text>().text.Equals(oldName4))
        {
            oldName4 = TeamName4.GetComponent <Text>().text;
            TeamElo4.GetComponent <Text>().text  = "" + TeamsPerformance.GetTeamElo(oldName4);
            TeamElo4.GetComponent <Text>().color = ColorElo(TeamsPerformance.GetTeamElo(oldName4));
        }
    }
Example #2
0
 // Use this for initialization
 void Start()
 {
     oldName1 = TeamName1.GetComponent <Text>().text;
     oldName2 = TeamName2.GetComponent <Text>().text;
     oldName3 = TeamName3.GetComponent <Text>().text;
     oldName4 = TeamName4.GetComponent <Text>().text;
     t        = new TeamsPerformance();
     TeamElo1.GetComponent <Text>().text = "" + TeamsPerformance.GetTeamElo(oldName1);
     TeamElo2.GetComponent <Text>().text = "" + TeamsPerformance.GetTeamElo(oldName2);
     TeamElo3.GetComponent <Text>().text = "" + TeamsPerformance.GetTeamElo(oldName3);
     TeamElo4.GetComponent <Text>().text = "" + TeamsPerformance.GetTeamElo(oldName4);
 }
Example #3
0
    public void ReadStats()
    {
        GameObject.Find("StatText").GetComponent <Text>().text = "";
        string team = change.captionText.text;

        team = team.Replace("_", " ");
        TeamsPerformance t = new TeamsPerformance();
        KeyValuePair <string, List <Matchup> > stats = TeamsPerformance.getStats(team);

        foreach (Matchup m in stats.Value)
        {
            string back = GameObject.Find("StatText").GetComponent <Text>().text;
            GameObject.Find("StatText").GetComponent <Text>().text = back + '\n' + m.opponent + '\n' + "Wins " + m.victoryCount + " / Loses " + (m.totalMatchCount - m.victoryCount) + '\n';
        }
    }
    public void InitEnds()
    {
        _ends["TestBot"] = delegate()
        {
            Traducteur t    = new Traducteur();
            string     trad = "Winner";
            t.langue = gm.GetComponent <LangageLoader>().language;
            t.setTextOriginal("Winner");
            trad = t.traduction;
            textWinnerTeam.GetComponent <Text>().text = trad + " : " + winnername;
            print("after Winnerteam");

            /* GameObject[] units = GameObject.FindGameObjectsWithTag("Unit");
             * foreach (GameObject u in units)
             * {
             *   Destroy(u);
             * }*/
            anim.SetTrigger("GameOver");
            print("after TextGO");
            if (!written)
            {
                TeamsPerformance p = new TeamsPerformance();
                int      size      = gm.GetComponent <TeamManager>()._teams.Count;
                string[] teams     = new string[size];
                int      cpt       = 0;
                foreach (Team t2 in gm.GetComponent <TeamManager>()._teams)
                {
                    teams[cpt] = t2._name;
                    cpt++;
                }
                p.WriteStats(teams, teams[winner], size);
                if (teams.Length == 2)
                {
                    p.ComputeELO(teams, teams[winner]);
                }

                written = true;
            }
            Time.timeScale = 0;
        };

        _ends["RessourceRace"] = delegate()
        {
            string     trad = "Winner";
            Traducteur t    = new Traducteur();

            if (equals || scorewinner == -1)
            {
                trad = "Egalite";
            }

            t.langue = gm.GetComponent <LangageLoader>().language;
            t.setTextOriginal(trad);
            trad = t.traduction;
            if (equals || scorewinner == -1)
            {
                textWinnerTeam.GetComponent <Text>().text = trad + " ! ";
            }
            else
            {
                textWinnerTeam.GetComponent <Text>().text = trad + " : " + winnername;
            }

            Score.GetComponent <Text>().text = "Score : " + scorewinner;
            print("after Winnerteam");

            /*    GameObject[] units = GameObject.FindGameObjectsWithTag("Unit");
             *  foreach (GameObject u in units)
             *  {
             *      Destroy(u);
             *  }
             *  print("DEBUG END RESSOURCERACE apres destrcution unités");*/
            anim.SetTrigger("GameOver");
            print("after TextGO");
            if (!written && !equals && scorewinner != -1)
            {
                TeamsPerformance p = new TeamsPerformance();
                int      size      = gm.GetComponent <TeamManager>()._teams.Count;
                string[] teams     = new string[size];
                int      cpt       = 0;
                foreach (Team t2 in gm.GetComponent <TeamManager>()._teams)
                {
                    teams[cpt] = t2._name;
                    cpt++;
                }
                p.WriteStats(teams, teams[winner], size);
                print("apres write stats ");
                if (teams.Length == 2 && !equals && scorewinner != -1)
                {
                    print("ComputeElo ");
                    p.ComputeELO(teams, teams[winner]);
                }
                written = true;
            }
            Time.timeScale = 0;
        };
    }
Example #5
0
 public void Change()
 {
     _teamName             = _teamDropDown.captionText.text;
     _powerScoreText.text  = TeamsPerformance.GetTeamElo(_teamName).ToString();
     _powerScoreText.color = ColorElo(TeamsPerformance.GetTeamElo(_teamName));
 }
Example #6
0
    // Use this for initialization
    void Start()
    {
        TeamsPerformance p = new TeamsPerformance();

        p.WriteStats(new string[] { "DefaultTeam", "EquipeTest A", "testTeamOpponent", "equipetriche" }, "DefaultTeam", 4);
    }