public override async Task <bool> Validate() { if (this.ButtonTriggerComboBox.SelectedIndex < 0) { await MessageBoxHelper.ShowMessageDialog("An trigger type must be selected"); return(false); } InteractiveButtonCommandTriggerType trigger = EnumHelper.GetEnumValueFromString <InteractiveButtonCommandTriggerType>((string)this.ButtonTriggerComboBox.SelectedItem); if (trigger == InteractiveButtonCommandTriggerType.MouseKeyHeld) { if (string.IsNullOrEmpty(this.HeldRateTextBox.Text) || !int.TryParse(this.HeldRateTextBox.Text, out int heldRate) || heldRate < 1) { await MessageBoxHelper.ShowMessageDialog("A valid held rate of 1 or greater must be entered"); return(false); } } if (!int.TryParse(this.SparkCostTextBox.Text, out int sparkCost) || sparkCost < 0) { await MessageBoxHelper.ShowMessageDialog("A valid spark cost must be entered"); return(false); } if (!await this.Requirements.Validate()) { return(false); } return(true); }
public override async Task <CommandBase> GetNewCommand() { if (await this.Validate()) { InteractiveButtonCommandTriggerType trigger = EnumHelper.GetEnumValueFromString <InteractiveButtonCommandTriggerType>((string)this.ButtonTriggerComboBox.SelectedItem); RequirementViewModel requirements = this.Requirements.GetRequirements(); if (this.command == null) { this.command = new InteractiveButtonCommand(this.Game, this.Scene, this.Control, trigger, requirements); ChannelSession.Settings.InteractiveCommands.Add(this.command); } this.command.Trigger = trigger; this.command.Button.cost = int.Parse(this.SparkCostTextBox.Text); this.command.Unlocked = this.UnlockedControl.Unlocked; this.command.Requirements = requirements; await ChannelSession.Connection.UpdateInteractiveGameVersion(this.Version); return(this.command); } return(null); }
public InteractiveCommand(InteractiveGameListingModel game, InteractiveSceneModel scene, InteractiveButtonControlModel control, InteractiveButtonCommandTriggerType eventType) : base(control.controlID, CommandTypeEnum.Interactive, EnumHelper.GetEnumName(eventType)) { this.GameID = game.id; this.SceneID = scene.sceneID; this.Control = control; this.Trigger = eventType; }
private void ButtonTriggerComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { if (this.ButtonTriggerComboBox.SelectedIndex >= 0) { InteractiveButtonCommandTriggerType trigger = EnumHelper.GetEnumValueFromString <InteractiveButtonCommandTriggerType>((string)this.ButtonTriggerComboBox.SelectedItem); if (trigger == InteractiveButtonCommandTriggerType.MouseKeyHeld) { this.HeldRateTextBox.Visibility = System.Windows.Visibility.Visible; } else { this.HeldRateTextBox.Visibility = System.Windows.Visibility.Collapsed; } } }
public override async Task <CommandBase> GetNewCommand() { if (await this.Validate()) { InteractiveButtonCommandTriggerType trigger = EnumHelper.GetEnumValueFromString <InteractiveButtonCommandTriggerType>((string)this.ButtonTriggerComboBox.SelectedItem); if (this.command == null) { if (this.Control is InteractiveButtonControlModel) { this.command = new InteractiveCommand(this.Game, this.Scene, (InteractiveButtonControlModel)this.Control, trigger); } else { this.command = new InteractiveCommand(this.Game, this.Scene, (InteractiveJoystickControlModel)this.Control); } ChannelSession.Settings.InteractiveCommands.Add(this.command); } if (this.Control is InteractiveButtonControlModel) { this.command.Trigger = trigger; this.command.Button.cost = int.Parse(this.SparkCostTextBox.Text); if (this.CooldownTypeComboBox.SelectedItem.Equals("Group")) { string cooldownGroup = this.CooldownGroupsComboBox.Text; this.command.CooldownGroup = cooldownGroup; ChannelSession.Settings.InteractiveCooldownGroups[cooldownGroup] = int.Parse(this.CooldownTextBox.Text); this.command.IndividualCooldown = 0; } else { int cooldown = 0; if (!string.IsNullOrEmpty(this.CooldownTextBox.Text)) { cooldown = int.Parse(this.CooldownTextBox.Text); } this.command.IndividualCooldown = cooldown; this.command.CooldownGroup = null; } await ChannelSession.Connection.UpdateInteractiveGameVersion(this.Version); } return(this.command); } return(null); }
public InteractiveButtonCommand(InteractiveGameModel game, InteractiveSceneModel scene, InteractiveButtonControlModel control, InteractiveButtonCommandTriggerType eventType, RequirementViewModel requirements) : base(game, scene, control, EnumHelper.GetEnumName(eventType), requirements) { this.Trigger = eventType; }
public InteractiveButtonCommand(InteractiveGameModel game, InteractiveSceneModel scene, InteractiveButtonControlModel control, InteractiveButtonCommandTriggerType eventType, RequirementViewModel requirements) : this(game, scene, control, eventType, 0, requirements) { }