Beispiel #1
0
 private void Form2_Load(object sender, EventArgs e)
 {
     for (int i = 0; i < FotbalovyKlubInfo.Pocet; i++)
     {
         KlubComboBox.Items.Add(FotbalovyKlubInfo.DejNazev(i));
     }
 }
Beispiel #2
0
 private void Form2_Load(object sender, EventArgs e)
 {
     for (int i = 0; i < FotbalovyKlubInfo.Pocet; i++)
     {
         KlubComboBox.Items.Add(FotbalovyKlubInfo.DejNazev(i));
     }
     if (upravit)
     {
         Hrac hracik = (Hrac)list[index];
         JmenoTextBox.Text         = hracik.Jmeno;
         GolTextBox.Text           = Convert.ToString(hracik.GolPocet);
         KlubComboBox.SelectedText = FotbalovyKlubInfo.GetName((FotbalovyKlubInfo.FotbalovyKlub)hracik.Klub);
     }
 }
Beispiel #3
0
        // string pole
        public void NjadiNejlepsiKluby(out string[] kluby, out int golPocet)
        {
            kluby = new string[0];
            List <string> list = new List <string>();
            int           max  = 0;

            int[] temp = new int[FotbalovyKlubInfo.Pocet];
            for (int i = 0; i < hraciPole.Length(); i++)
            {
                for (int j = 0; j < FotbalovyKlubInfo.Pocet; j++)
                {
                    if (hraciPole[i].Klub == (Hrac.FotbalovyKlub)j)
                    {
                        temp[j] += hraciPole[i].GolPocet;
                    }
                }
            }
            for (int i = 0; i < temp.Length; i++)
            {
                if (temp[i] > max)
                {
                    max = temp[i];
                    list.Clear();
                    list.Add(FotbalovyKlubInfo.DejNazev(i));
                }
                else if (temp[i] == max)
                {
                    list.Add(FotbalovyKlubInfo.DejNazev(i));
                }
            }
            Array.Resize <string>(ref kluby, list.Count);
            int y = 0;

            foreach (var item in list)
            {
                kluby[y] = item;
                y++;
            }
            golPocet = max;
        }
Beispiel #4
0
        // string pole
        public void NjadiNejlepsiKluby(out string[] kluby, out int golPocet)
        {
            //kluby = new string[0];
            //List<string> stringList = new List<string>();
            //int max = 0;
            //int[] temp = new int[FotbalovyKlubInfo.Pocet];
            //for (int i = 0; i < hraciPole.Length(); i++)
            //{
            //    for (int j = 0; j < FotbalovyKlubInfo.Pocet; j++)
            //    {
            //        if (hraciPole[i].Klub == (Hrac.FotbalovyKlub)j)
            //            temp[j] += hraciPole[i].GolPocet;
            //    }
            //}
            //for (int i = 0; i < temp.Length; i++)
            //{
            //    if (temp[i] > max)
            //    {
            //        max = temp[i];
            //        stringList.Clear();
            //        stringList.Add(FotbalovyKlubInfo.DejNazev(i));
            //    }
            //    else if (temp[i] == max)
            //    {
            //        stringList.Add(FotbalovyKlubInfo.DejNazev(i));
            //    }

            //}
            //Array.Resize<string>(ref kluby, stringList.Count);
            //int y = 0;
            //foreach (var item in stringList)
            //{
            //    kluby[y] = item;
            //    y++;
            //}
            //golPocet = max;

            kluby = new string[0];
            List <string> stringList = new List <string>();
            int           max        = 0;

            int[] temp = new int[FotbalovyKlubInfo.Pocet];
            for (int i = 0; i < list.Count; i++)
            {
                for (int j = 0; j < FotbalovyKlubInfo.Pocet; j++)
                {
                    Hrac hracik = (Hrac)list[i];
                    if (hracik.Klub == (Hrac.FotbalovyKlub)j)
                    {
                        temp[j] += hracik.GolPocet;
                    }
                }
            }
            for (int i = 0; i < temp.Length; i++)
            {
                if (temp[i] > max)
                {
                    max = temp[i];
                    stringList.Clear();
                    stringList.Add(FotbalovyKlubInfo.DejNazev(i));
                }
                else if (temp[i] == max)
                {
                    stringList.Add(FotbalovyKlubInfo.DejNazev(i));
                }
            }
            Array.Resize <string>(ref kluby, stringList.Count);
            int y = 0;

            foreach (var item in stringList)
            {
                kluby[y] = item;
                y++;
            }
            golPocet = max;
        }
Beispiel #5
0
 public override string ToString()
 {
     return($"{Jmeno} {FotbalovyKlubInfo.DejNazev((int)Klub)} {GolPocet}");
 }