private void EnableCorrectInput(ToolCommand.TriggerType type) { TogglePlayerCountInput(type == ToolCommand.TriggerType.PlayerCount); TogglePlayerCountInRangeInput(type == ToolCommand.TriggerType.PlayerCountInRange); ToggleCustomServerCommandInput(type == ToolCommand.TriggerType.CustomServerCommand); ToggleDailyCommandInput(type == ToolCommand.TriggerType.Daily); ToggleEveryXMinutesInput(type == ToolCommand.TriggerType.EveryXMinutes); }
public ToolCommandEditor(ListBox listBox = null, ToolCommand command = null) { InitializeComponent(); //autoCompleteTextBoxCommands.Values = autoCompleteTextBoxCommandsList; autoCompleteTextBoxCommands.HandleCreated += (o, e) => { autoCompleteTextBoxCommands.Values = autoCompleteTextBoxCommandsList; //List<string> vals = new List<string>(ConsoleAutoCompleteStrings); //vals.AddRange((IEnumerable<string>)RuntimeCommand.RuntimeCommands); //autoCompleteTextBoxCommands.Values = vals.ToArray(); }; commandEditor = this; if (listBox != null) { this.listBox = listBox; } comboBoxConditionType.DataSource = Enum.GetValues(typeof(ToolCommand.TriggerType)); if (command != null) { isEditing = true; commandEditTarget = command; // set controls to display existing properties textBoxName.Text = command.Name; conditionType = command.ConditionType; comboBoxConditionType.SelectedItem = (conditionType); conditionOperator = command.ConditionOperator; buttonOperatorSelection_SetText(); numericUpDownThreshold.Value = command.ConditionThreshold; selectionRangeSliderPlayerCountRange.SelectedMin = command.PlayerCountRangeMin; selectionRangeSliderPlayerCountRange.SelectedMax = command.PlayerCountRangeMax; comboBoxDailyCommandTime.SelectedIndex = command.RunTime; textBoxCustomServerCommand.Text = command.CustomServerCommand; textBoxCommandTag.Text = command.Tag; switch (conditionType) { case ToolCommand.TriggerType.EveryXMinutes: numericUpDownRunIntervalMinutes.Value = command.RunTime; checkBoxGlobalCommand.Enabled = true; break; case ToolCommand.TriggerType.Daily: comboBoxDailyCommandTime.SelectedIndex = command.RunTime; checkBoxGlobalCommand.Enabled = true; break; default: break; } if (command.IsGlobalToolCommand) { checkBoxGlobalCommand.Checked = true; checkBoxGlobalCommand.CheckState = CheckState.Checked; } foreach (string commandString in command.CommandStrings) { autoCompleteTextBoxCommands.AppendText(commandString + System.Environment.NewLine); } } textBoxName.Select(); textBoxName.Focus(); }
private void SetHelpText(ToolCommand.TriggerType conditionType) { string help = ""; switch (conditionType) { case ToolCommand.TriggerType.PlayerJoined: labelConditionInformation.Text = "Condition Information: Player Joined"; help = "The command will activate each time a player joins the server."; break; case ToolCommand.TriggerType.PlayerLeft: labelConditionInformation.Text = "Condition Information: Player Left"; help = "The command will activate each time a player leaves the server."; break; case ToolCommand.TriggerType.PlayerCount: labelConditionInformation.Text = "Condition Information: Player Count"; help = "The command will activate once each time the player count changes and the condition becomes true."; help += Environment.NewLine + Environment.NewLine; help += "For instance, you can use Player Count conditions to load different server voting configuration files."; help += Environment.NewLine; help += "You could have one condition for \"Player Count > 8\" that loads a \"Big Team Battle\" voting file."; help += Environment.NewLine; help += "You could have another condition for \"Player Count < 9\" that loads a \"Small Lobby\" voting file."; help += Environment.NewLine + Environment.NewLine; help += "Setting up the conditions like this ensures that each time the Player Count becomes 9, the \"Big Team Battle\" "; help += "voting file will be loaded, and each time the Player Count becomes 8, the \"Small Lobby\" voting file will be loaded."; break; case ToolCommand.TriggerType.PlayerCountInRange: labelConditionInformation.Text = "Condition Information: Player Count In Range"; help = "The command will activate once each time the player count enters the specified range. "; help += Environment.NewLine; help += "The range is inclusive of the numbers the sliders rest on."; break; case ToolCommand.TriggerType.CustomServerCommand: labelConditionInformation.Text = "Condition Information: Custom Server Command"; help = "The command will activate once each time the custom command text is entered in chat by any player."; help += Environment.NewLine; help += "Custom commands prefixed with \"!\" will not show up in chat, but will be accepted "; help += "by the server and will be capable of triggering this conditional command." + Environment.NewLine; help += "However, the \"!\" prefix is not required, and any text can be used to trigger a custom server command."; //help += Environment.NewLine + Environment.NewLine; //help += "Combining custom server commands with " break; case ToolCommand.TriggerType.Daily: labelConditionInformation.Text = "Condition Information: Daily"; help = "The command will activate at the specified time once per day."; break; case ToolCommand.TriggerType.EveryXMinutes: labelConditionInformation.Text = "Condition Information: Every X Minutes"; help = "The command will activate once every X minutes." + Environment.NewLine; help += "X represents the number of minutes between activations."; break; case ToolCommand.TriggerType.MatchBegan: labelConditionInformation.Text = "Condition Information: Match Began"; help = "The command will activate each time a match begins."; break; case ToolCommand.TriggerType.MatchEnded: labelConditionInformation.Text = "Condition Information: Match Ended"; help = "The command will activate each time a match ends."; break; } textBoxConditionInformation.Text = help; }