Exemple #1
0
        private void cmbPassives_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            PassiveSkill passiveSkill = (PassiveSkill)cmbPassives.SelectedItem;

            if (passiveSkill != null)
            {
                txtFloat.Text     = passiveSkill._float.ToString();
                txtInt.Text       = passiveSkill._int.ToString();
                txtString.Text    = passiveSkill._string;
                cmbPriority.Text  = passiveSkill.priority;
                cmbType.Text      = passiveSkill.type;
                cmbSpecifier.Text = passiveSkill.specifier;
                txtName.Text      = passiveSkill.name;
                txtId.Text        = passiveSkill.id.ToString();
            }
            else
            {
                txtFloat.Text     = "";
                txtInt.Text       = "";
                txtString.Text    = "";
                cmbPriority.Text  = "";
                cmbType.Text      = "";
                cmbSpecifier.Text = "";
                txtName.Text      = "";
                txtId.Text        = "";
            }
        }
Exemple #2
0
        private void cmbPassives_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count < 1)
            {
                return;
            }
            PassiveSkill passive = (PassiveSkill)e.AddedItems[0];

            lstPassives.Items.Add(passive);
        }
 public PassiveSkill(PassiveSkill x)
 {
     id        = x.id;
     name      = x.name;
     priority  = x.priority;
     type      = x.type;
     specifier = x.specifier;
     _string   = x._string;
     _int      = x._int;
     _float    = x._float;
 }
Exemple #4
0
        private void SaveCurrentPassive()
        {
            try
            {
                PassiveSkill passiveSkill = new PassiveSkill();
                passiveSkill.name      = txtName.Text;
                passiveSkill.priority  = cmbPriority.Text;
                passiveSkill.specifier = cmbSpecifier.Text;
                passiveSkill.type      = cmbType.Text;

                if (txtFloat.Text == "")
                {
                    passiveSkill._float = 0;
                }
                else
                {
                    passiveSkill._float = float.Parse(txtFloat.Text);
                }

                if (txtInt.Text == "")
                {
                    passiveSkill._int = 0;
                }
                else
                {
                    passiveSkill._int = int.Parse(txtInt.Text);
                }
                passiveSkill._string = txtString.Text;

                passiveSkill.id = int.Parse(txtId.Text);

                PassiveSkill ps = passives.Where(x => x.id == int.Parse(txtId.Text)).FirstOrDefault();
                if (ps != null && ps.id == int.Parse(txtId.Text))
                {
                    passives.Remove(ps);
                    passives.Add(passiveSkill);
                }
                else
                {
                    passives.Add(passiveSkill);
                }

                cmbPassives.Items.Refresh();
                cmbPassives.SelectedItem = passiveSkill;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }