Пример #1
0
        private void buttonAssignment_Click(object sender, EventArgs e)
        {
            IfElseLogic ench = Utilities.GetEnchantmentByName(comboBoxEnchantments.Text);

            saveEnchantmentCollection.Add(ench, readParamRTB());
            saveListInCorrectPlace();
            updateAlreadyAssignedChoices();
        }
Пример #2
0
        private void updateAlreadyAssignedChoices()
        {
            if (!doneWithInit)
            {
                return;
            }
            IfElseLogic ench = Utilities.GetEnchantmentByName(comboBoxEnchantments.Text);

            if (Utilities.EffectableTypes.Character == (Utilities.EffectableTypes)comboBoxType.SelectedItem)
            {
                Character c = Utilities.GetCharByName(comboBoxTargets.Text);
                saveEnchantmentCollection = c.Enchantments;
            }
            else
            {
                Item currentItem = new Item();
                if (comboBoxType.Text == "Item")
                {
                    currentItem = Utilities.GetItemByName(comboBoxTargets.Text);
                }
                if (comboBoxType.Text == "Shield")
                {
                    currentItem = Utilities.GetShieldByName(comboBoxTargets.Text);
                }
                if (comboBoxType.Text == "Weapon")
                {
                    currentItem = Utilities.GetWeaponByName(comboBoxTargets.Text);
                }
                if (comboBoxType.Text == "Armor")
                {
                    currentItem = Utilities.GetArmorByName(comboBoxTargets.Text);
                }

                saveEnchantmentCollection = currentItem.Enchantments;
            }
            List <IfElseLogic> selectable = new List <IfElseLogic>();

            foreach (IfElseLogic iel in saveEnchantmentCollection.Keys)
            {
                if (iel.name == ench.name)
                {
                    selectable.Add(iel);
                }
            }
            comboBoxAlreadyAssigned.DataSource    = selectable;
            comboBoxAlreadyAssigned.Text          = "";
            comboBoxAlreadyAssigned.SelectedIndex = -1;
            if (selectable.Count > 0)
            {
                comboBoxAlreadyAssigned.SelectedIndex = 0;
            }
            populateRTBWithParams(saveEnchantmentCollection, (IfElseLogic)comboBoxAlreadyAssigned.SelectedItem ?? Utilities.GetEnchantmentByName(comboBoxEnchantments.Text));
        }
Пример #3
0
 private void populateRTBWithParams(Dictionary <IfElseLogic, Dictionary <String, Object> > readFrom, IfElseLogic ench)
 {
     richTextBoxParams.Text = "";
     foreach (object[] vari in ench.variables)
     {
         richTextBoxParams.Text += (string)vari[0] + "\t\t";
         if (readFrom.ContainsKey(ench) && readFrom[ench].ContainsKey((string)vari[0]))
         {
             richTextBoxParams.Text += readFrom[ench][(string)vari[0]].ToString().Replace(' ', '_');
         }
         else
         {
             richTextBoxParams.Text += "0";
         }
         richTextBoxParams.Text += "\n";
     }
 }