Exemple #1
0
    public void MiseAJourScore(TPS tps)
    {
        List <TPS> superieur = new List <TPS>();
        List <TPS> inferieur = new List <TPS>();

        for (byte i = 0; i < twitchPlayerScore.Length; i++)
        {
            if (twitchPlayerScore[i].GetScore() > tps.GetScore())
            {
                superieur.Add(twitchPlayerScore[i]);
            }
            else if (twitchPlayerScore[i].GetScore() < tps.GetScore())
            {
                inferieur.Add(twitchPlayerScore[i]);
            }
        }

        for (byte i = 0; i < twitchPlayerScore.Length; i++)
        {
            if (i < superieur.Count)
            {
                twitchPlayerScore[i] = superieur[i];
            }
            if (i == superieur.Count)
            {
                twitchPlayerScore[i] = tps;
            }
            if (i > superieur.Count)
            {
                twitchPlayerScore[i] = inferieur[i - (superieur.Count + 1)];
            }
        }

        MiseAJourScoreText();
    }
Exemple #2
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            TPS hm = new TPS();

            this.Hide();
            hm.Show();
        }
Exemple #3
0
 void Start()
 {
     Connect();                                                    //connection a twitch
     spawnPoint = GameObject.FindGameObjectsWithTag("SpawnPoint"); // on recup tout les point de spawn dans un tableaux.
     temps      = tADP;                                            // on mais a jour le temps qui va etre decrementer au debut de la partie.
     tempsD     = tADP2;
     StartCoroutine(StartPartieC());                               // on demare la coroutine de debut de partie on att les joueurs.
     for (byte i = 0; i < twitchPlayerScore.Length; i++)
     {
         twitchPlayerScore[i] = new TPS(PlayerPrefs.GetString(i.ToString(), ""), PlayerPrefs.GetInt(PlayerPrefs.GetString(i.ToString(), ""), 0));
     }
     MiseAJourScoreText();
     //PlayerPrefs.DeleteAll();
 }
Exemple #4
0
        private Task <List <TPS> > GenerateTpsList()
        {
            // Generate TPS List
            return(Task <List <TPS> > .Factory.StartNew(() =>
            {
                List <TPS> tpsList = new List <TPS>();
                int currentIndex = 0;
                int currentAtsdelimiter = atslist[currentIndex].ID;

                while (true)
                {
                    try
                    {
                        // find the index of next delimiter
                        int nextIndex = atslist.FindIndex(currentIndex + 1, item => item.ID == currentAtsdelimiter);
                        if (nextIndex > 0)
                        {
                            tpsList.Add(TPS.Create("TPS", atslist.GetRange(currentIndex, nextIndex - currentIndex)));
                            currentIndex = nextIndex;
                            currentAtsdelimiter = atslist[currentIndex].ID;
                        }
                        else
                        {
                            //End of List
                            tpsList.Add(TPS.Create("TPS", atslist.GetRange(currentIndex, atslist.Count - currentIndex)));
                            break;
                        }
                    }
                    catch (ArgumentOutOfRangeException)
                    {
                        // Error
                        break;
                    }
                }

                return tpsList;
            }));
        }
Exemple #5
0
        private void ListTPSView_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            var datagrid = sender as DataGrid;

            selectedTps = datagrid.SelectedItem as TPS;
        }
 public void SetPlayerName(string name)//on mais a jour le non du joueur et l'affiche sur le texte
 {
     textName.text = name;
     playerScore   = new TPS(name, 0);
     StartCoroutine(AddScore());
 }