public void Setup(Logic l)
        {
            _data = (SetVariable)l;
            if (_data.display != null && _data.display != this)
            {
                _data.display.Close();
            }
            _data.display = this;

            comboBoxCalculables.DataSource = EnchantmentUtilities.getCalculableTypes();
            if (_data.setTo != null)
            {
                comboBoxCalculables.SelectedItem = ((Logic)_data.setTo).LogicType;
                label1.Text = ((Logic)_data.setTo).LogicType;
            }

            if (_data.parent != null)
            {
                comboBoxVariables.SelectedIndexChanged -= comboBoxVariables_SelectedIndexChanged;
                EnchantmentUtilities.FillComboboxWithVariableNames(comboBoxVariables, _data);
                comboBoxVariables.SelectedIndexChanged += comboBoxVariables_SelectedIndexChanged;
                if (_data.varName != null)
                {
                    comboBoxVariables.SelectedItem = _data.varName;
                }
            }
        }
        public void Setup(Logic l)
        {
            _data = (IfElseLogic)l;
            if (_data.display != null && _data.display != this)
            {
                _data.display.Close();
            }
            _data.display             = this;
            richTextBoxVariables.Text = "Variables:\n";
            foreach (object[] oarr in _data.variables)
            {
                richTextBoxVariables.Text += oarr[0] + "   " + oarr[1].ToString() + "\n";
            }

            richTextBoxVariables.Text += "\nVariables From Parent:\n";
            if (_data.parent != null)
            {
                Dictionary <String, Object[]> forDisplay = _data.parent.GetVariables();
                foreach (String s in forDisplay.Keys)
                {
                    richTextBoxVariables.Text += forDisplay[s][0] + "\t\t" + forDisplay[s][1].ToString() + "\n";
                }
            }

            EnchantmentUtilities.FillComboboxWithVariableNames(comboBoxVariables, _data);

            comboBoxConditions.DataSource = EnchantmentUtilities.getCalculableTypes();
            comboBoxResults.DataSource    = EnchantmentUtilities.getTriggerableTypes(checkBoxPremades.Checked);
            EnchantmentUtilities.FillComboboxWithNames(comboBoxCurrentConditions, _data.conditions);
            EnchantmentUtilities.FillComboboxWithNames(comboBoxIfResults, _data.ifResults);
            EnchantmentUtilities.FillComboboxWithNames(comboBoxElseResults, _data.elseResults);
            comboBoxCurrentConditions.Text          = "";
            comboBoxElseResults.Text                = "";
            comboBoxIfResults.Text                  = "";
            comboBoxCurrentConditions.SelectedIndex = comboBoxCurrentConditions.Items.Count - 1;
            comboBoxElseResults.SelectedIndex       = comboBoxElseResults.Items.Count - 1;
            comboBoxIfResults.SelectedIndex         = comboBoxIfResults.Items.Count - 1;
            textBoxLogicName.TextChanged           -= textBoxLogicName_TextChanged;
            textBoxLogicName.Text         = _data.name;
            textBoxLogicName.TextChanged += textBoxLogicName_TextChanged;
        }
Exemplo n.º 3
0
 public void Setup(Logic l)
 {
     _data = (GetVariable)l;
     if (_data.display != null && _data.display != this)
     {
         _data.display.Close();
     }
     _data.display = this;
     if (_data.parent != null)
     {
         comboBoxVariables.SelectedIndexChanged -= comboBoxVariables_SelectedIndexChanged;
         EnchantmentUtilities.FillComboboxWithVariableNames(comboBoxVariables, _data);
         comboBoxVariables.SelectedIndexChanged += comboBoxVariables_SelectedIndexChanged;
         if (_data.varName != null)
         {
             if (_data.GetVariables().ContainsKey(_data.varName))
             {
                 comboBoxVariables.SelectedItem = _data.varName;
             }
         }
     }
 }