//Display the parameter's value according to its type. public void DisplayInType(MoveDefEventParameterNode value) { if (value is MoveDefEventOffsetNode) { requirementPanel.Visible = false; valueGrid.Visible = false; offsetPanel.Visible = true; MoveDefEventOffsetNode offset = value as MoveDefEventOffsetNode; int list, type, index; offset.Root.GetLocation(offset.RawOffset, out list, out type, out index); _updating = true; comboBox1.SelectedIndex = offset.list = list; if (offset.type != -1) { comboBox3.SelectedIndex = offset.type = type; } if (offset.index != -1) { comboBox2.SelectedIndex = offset.index = index; } _updating = false; } else { requirementPanel.Visible = false; valueGrid.Visible = true; offsetPanel.Visible = false; valueGrid.SelectedObject = value; } }
private void offsetOkay_Click(object sender, EventArgs e) { MoveDefEventOffsetNode _targetNode = param as MoveDefEventOffsetNode; if (_targetNode.action != null) { _targetNode._value = -1; _targetNode.action._actionRefs.Remove(param); } if (comboBox1.SelectedIndex >= 3) { if (comboBox1.SelectedIndex == 3 && comboBox2.SelectedIndex >= 0 && comboBox2.SelectedIndex < param.Root._externalRefs.Count) { if (_targetNode._extNode != null) { _targetNode._extNode._refs.Remove(_targetNode); _targetNode._extNode = null; } (param._extNode = param.Root._externalRefs[comboBox2.SelectedIndex] as MoveDefExternalNode)._refs .Add( param); } } else { if (param._extNode != null) { param._extNode._refs.Remove(param); param._extNode = null; } } _targetNode.list = comboBox1.SelectedIndex; _targetNode.type = comboBox1.SelectedIndex >= 2 ? -1 : comboBox3.SelectedIndex; _targetNode.index = comboBox1.SelectedIndex == 4 ? -1 : comboBox2.SelectedIndex; _targetNode.action = param.Root.GetAction(_targetNode.list, _targetNode.type, _targetNode.index); if (_targetNode.action != null) { param._value = _targetNode.action._offset; _targetNode.action._actionRefs.Add(param); } else { param._value = -1; } param.SignalPropertyChange(); }