internal MudData.FormulaActionTriggerEvent GenerateMudDataAction() { var ret = new MudData.FormulaActionTriggerEvent(); ret.action = "TriggerEvent"; ret.@event = EventComboBox.Text; ret.target = TargetComboBox.Text; ret.delay = DelayTextBox.Text; foreach (DataGridViewRow row in ParamDataGridView.Rows) { if (row.Cells.Count != 2) { continue; } if (row.Cells[0].Value == null) { continue; } if (row.Cells[1].Value == null) { continue; } string key = row.Cells[0].Value.ToString(); string value = row.Cells[1].Value.ToString(); ret.@params[key] = value; } return(ret); }
internal ScriptActionControlTriggerEvent(MudData.FormulaActionTriggerEvent action) { InitializeComponent(); TargetComboBox.Text = action.target; EventComboBox.Text = action.@event; DelayTextBox.Text = action.delay; if (action.@params != null) { foreach (var kvp in action.@params) { ParamDataGridView.Rows.Add(new object[] { kvp.Key, kvp.Value }); } } }
private MudData.FormulaAction GetRawActionFromDropdownSelection() { MudData.FormulaAction action = null; if (ActionComboBox.Text == "AddToList") { action = new MudData.FormulaActionAddToList(); } else if (ActionComboBox.Text == "CreateListMember") { action = new MudData.FormulaActionCreateListMember(); } else if (ActionComboBox.Text == "foreach") { action = new MudData.FormulaActionForEach(); } else if (ActionComboBox.Text == "if") { action = new MudData.FormulaActionIf(); } else if (ActionComboBox.Text == "ListTransfer") { action = new MudData.FormulaActionListTransfer(); } else if (ActionComboBox.Text == "ListRemove") { action = new MudData.FormulaActionListRemove(); } else if (ActionComboBox.Text == "RepeatEvent") { action = new MudData.FormulaActionRepeatEvent(); } else if (ActionComboBox.Text == "SetGoalState") { action = new MudData.FormulaActionSetGoalState(); } else if (ActionComboBox.Text == "SetProperty") { action = new MudData.FormulaActionSetProperty(); } else if (ActionComboBox.Text == "TriggerEvent") { action = new MudData.FormulaActionTriggerEvent(); } else { action = new MudData.FormulaAction(); } return action; }