public RussianRouletteGameEditorControl(RussianRouletteGameCommand command) { InitializeComponent(); this.existingCommand = command; this.viewModel = new RussianRouletteGameEditorControlViewModel(command); }
public override void SaveGameCommand(string name, IEnumerable <string> triggers, RequirementViewModel requirements) { Dictionary <UserRoleEnum, int> roleProbabilities = new Dictionary <UserRoleEnum, int>() { { UserRoleEnum.User, 0 }, { UserRoleEnum.Subscriber, 0 }, { UserRoleEnum.Mod, 0 } }; GameCommandBase newCommand = new RussianRouletteGameCommand(name, triggers, requirements, this.MinimumParticipants, this.TimeLimit, this.StartedCommand, this.UserJoinCommand, new GameOutcome("Success", 0, roleProbabilities, this.UserSuccessCommand), new GameOutcome("Failure", 0, roleProbabilities, this.UserFailCommand), this.MaxWinners, this.GameCompleteCommand, this.NotEnoughPlayersCommand); this.SaveGameCommand(newCommand, this.existingCommand); }
public RussianRouletteGameEditorControlViewModel(RussianRouletteGameCommand command) { this.existingCommand = command; this.MinimumParticipants = this.existingCommand.MinimumParticipants; this.TimeLimit = this.existingCommand.TimeLimit; this.MaxWinners = this.existingCommand.MaxWinners; this.StartedCommand = this.existingCommand.StartedCommand; this.UserJoinCommand = this.existingCommand.UserJoinCommand; this.NotEnoughPlayersCommand = this.existingCommand.NotEnoughPlayersCommand; this.UserSuccessCommand = this.existingCommand.UserSuccessOutcome.Command; this.UserFailCommand = this.existingCommand.UserFailOutcome.Command; this.GameCompleteCommand = this.existingCommand.GameCompleteCommand; }
public override void SaveGameCommand() { int.TryParse(this.MinimumParticipantsTextBox.Text, out int minimumParticipants); int.TryParse(this.TimeLimitTextBox.Text, out int timeLimit); int.TryParse(this.MaxWinnersTextBox.Text, out int maxWinners); Dictionary <MixerRoleEnum, int> roleProbabilities = new Dictionary <MixerRoleEnum, int>() { { MixerRoleEnum.User, 0 }, { MixerRoleEnum.Subscriber, 0 }, { MixerRoleEnum.Mod, 0 } }; GameCommandBase newCommand = new RussianRouletteGameCommand(this.CommandDetailsControl.GameName, this.CommandDetailsControl.ChatTriggers, this.CommandDetailsControl.GetRequirements(), minimumParticipants, timeLimit, this.startedCommand, this.userJoinCommand, new GameOutcome("Success", 0, roleProbabilities, this.userSuccessCommand), new GameOutcome("Failure", 0, roleProbabilities, this.userFailCommand), maxWinners, this.gameCompleteCommand); if (this.existingCommand != null) { ChannelSession.Settings.GameCommands.Remove(this.existingCommand); newCommand.ID = this.existingCommand.ID; } ChannelSession.Settings.GameCommands.Add(newCommand); }
private async void AddPreMadeGameButton_Click(object sender, RoutedEventArgs e) { if (this.PreMadeGamesComboBox.SelectedIndex >= 0) { await this.Window.RunAsyncOperation(async() => { string gameName = (string)this.PreMadeGamesComboBox.SelectedItem; if (ChannelSession.Settings.GameCommands.Any(c => c.Name.Equals(gameName))) { await MessageBoxHelper.ShowMessageDialog("This game already exist in your game list"); return; } UserCurrencyViewModel currency = ChannelSession.Settings.Currencies.Values.First(); GameCommandBase game = null; switch (gameName) { case "Spin Wheel": game = new SpinWheelGameCommand(currency); break; case "Heist": game = new HeistGameCommand(currency); break; case "Russian Roulette": game = new RussianRouletteGameCommand(currency); break; case "Charity": game = new CharityGameCommand(currency); break; case "Give": game = new GiveGameCommand(currency); break; } ChannelSession.Settings.GameCommands.Add(game); await ChannelSession.SaveSettings(); this.PreMadeGamesComboBox.SelectedIndex = -1; this.RefreshList(); }); } }
public RussianRouletteGameEditorControl(RussianRouletteGameCommand command) : this() { this.existingCommand = command; }