Esempio n. 1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            PlayerSkillComboBox psc_First = new PlayerSkillComboBox();

            psc_First.DropDownStyle = ComboBoxStyle.DropDownList;
            psc_First.Size          = new Size(100, 20);
            psc_First.Left          = 10;
            psc_First.Top           = 20;
            this.gb_PlayerSkills.Controls.Add(psc_First);
        }
Esempio n. 2
0
 protected override void OnSelectedValueChanged(EventArgs e)
 {
     if (this.Index == (this.Parent.Controls.Count - 1))
     {
         PlayerSkillComboBox psc_Next = new PlayerSkillComboBox(this.Index + 1);
         psc_Next.DropDownStyle = ComboBoxStyle.DropDownList;
         psc_Next.Size          = new Size(100, 20);
         psc_Next.Left          = 10;
         psc_Next.Top           = this.Top + 25;
         this.Parent.Controls.Add(psc_Next);
     }
     base.OnSelectedValueChanged(e);
 }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            int[] ar_ChosenSkills = { };

            foreach (Control actControl in this.gb_PlayerSkills.Controls)
            {
                PlayerSkillComboBox actPSC = (PlayerSkillComboBox)actControl;
                if (actPSC.SelectedIndex != -1)
                {
                    Array.Resize(ref ar_ChosenSkills, ar_ChosenSkills.Length + 1);
                    ar_ChosenSkills.SetValue(actPSC.SelectedIndex + 1, ar_ChosenSkills.Length - 1);
                }
            }

            Drills allDrills = new Drills();



            foreach (Drills.DrillPrototype actDrill in allDrills.DrillsList)
            {
                foreach (int actChosenSkill in ar_ChosenSkills)
                {
                    for (int i = 0; i < actDrill.Attributes.Length; i++)
                    {
                        if (actDrill.Attributes[i] == actChosenSkill)
                        {
                            actDrill.NumberOfSelectedSkills++;
                        }
                    }
                }
            }

            Result[] results = { };

            int counter = 6;

            while (counter > 0)
            {
                foreach (Drills.DrillPrototype actDrill in allDrills.DrillsList)
                {
                    if (actDrill.NumberOfSelectedSkills == counter)
                    {
                        Result actResult = new Result();
                        actResult.Name        = actDrill.TextName;
                        actResult.Counter     = counter;
                        actResult.TotalSkills = actDrill.Attributes.Length;
                        actResult.Position    = actDrill.Position;
                        Array.Resize(ref results, results.Length + 1);
                        results.SetValue(actResult, results.Length - 1);
                    }
                }
                counter--;
            }

            this.dgv_Results.Rows.Clear();

            DataGridViewRow actRow = new DataGridViewRow();

            foreach (Result actRes in results)
            {
                this.dgv_Results.Rows.Add(actRes.Name, actRes.Counter.ToString(), actRes.TotalSkills.ToString(), actRes.Position);
            }
        }