private void NewGameStripMenuItemClick(object sender, EventArgs e) { var characters = Program.GManager.CharacterList; var rosterForm = new PlayerRosterForm(characters); rosterForm.ShowDialog(); if (rosterForm.DialogResult != DialogResult.OK) return; var optionalRulesForm = new OptionalRulesForm(); optionalRulesForm.ShowDialog(); if (optionalRulesForm.DialogResult != DialogResult.OK) return; var firstPlayerDrawIndex = 0; var currentPlayer = rosterForm.Players.First(); if (currentPlayer.Character.DefaultDrawColors.Count > 0) { var drawForm = new SelectDrawForm(currentPlayer.Character.DefaultDrawColors); drawForm.ShowDialog(); if (drawForm.DialogResult == DialogResult.OK && drawForm.SelectedSkillCardDrawIndex.HasValue) firstPlayerDrawIndex = drawForm.SelectedSkillCardDrawIndex.Value; } Program.GManager.NewGame(rosterForm.Players, optionalRulesForm.ExtraLoyaltyCards, optionalRulesForm.UsingSympathizer, firstPlayerDrawIndex); PlayerReadonlyListBox.BeginUpdate(); PlayerReadonlyListBox.DataSource = Program.GManager.CurrentGameState.Players; PlayerReadonlyListBox.SelectedIndex = 0; PlayerReadonlyListBox.EndUpdate(); FoodUpDown.Value = Program.GManager.CurrentGameState.Food; FuelUpDown.Value = Program.GManager.CurrentGameState.Fuel; MoraleUpDown.Value = Program.GManager.CurrentGameState.Morale; PopUpDown.Value = Program.GManager.CurrentGameState.Population; managePlayerToolStripMenuItem.DropDownItems.Clear(); ShowHandMenuItem.DropDownItems.Clear(); foreach (var player in Program.GManager.CurrentGameState.Players) { var newMenuItem = new ToolStripMenuItem(player.PlayerName, null, ManagePlayerMenuItemClick); var showHandItem = new ToolStripMenuItem(player.PlayerName, null, ShowHandMenuItemClick); managePlayerToolStripMenuItem.DropDownItems.Add(newMenuItem); ShowHandMenuItem.DropDownItems.Add(showHandItem); } RefreshGameDataBoxes(); JumpPrepChanged(sender, e); }
private void PassTurnButtonClick(object sender, EventArgs e) { var dialogResult = MessageBox.Show(Resources.GameWindow_PassTurnButtonClick_PassTurnInfo, Resources.GameWindow_PassTurnButtonClick_PassTurnTitle, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { if (PlayerReadonlyListBox.SelectedIndex == (PlayerReadonlyListBox.Items.Count - 1)) { PlayerReadonlyListBox.SelectedIndex = 0; } else { PlayerReadonlyListBox.SelectedIndex += 1; } Program.GManager.AddToTurnLog(String.Format("The turn passes to {0}!", PlayerReadonlyListBox.SelectedItem)); System.IO.Directory.CreateDirectory("save\\"); Program.GManager.SaveGame(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "save\\" + DateTime.Now.ToString(@"M-d-yyyy-hh_mm_ss-tt") + ".bsg")); var turnRecord = new HelpForm(Program.GManager.GetTurnLog(), "Turn log"); turnRecord.Show(); Program.GManager.EndTurn(); var currentPlayer = (Player)PlayerReadonlyListBox.SelectedItem; if (currentPlayer.Character.DefaultDrawColors.Count > 0) { var drawForm = new SelectDrawForm(currentPlayer.Character.DefaultDrawColors); drawForm.ShowDialog(); if (drawForm.DialogResult == DialogResult.OK && drawForm.SelectedSkillCardDrawIndex.HasValue) { Program.GManager.DoPlayerDraw(currentPlayer, drawForm.SelectedSkillCardDrawIndex.Value); } RefreshGameDataBoxes(); } } }
private void NewGameStripMenuItemClick(object sender, EventArgs e) { var characters = Program.GManager.CharacterList; var rosterForm = new PlayerRosterForm(characters); rosterForm.ShowDialog(); if (rosterForm.DialogResult != DialogResult.OK) { return; } var optionalRulesForm = new OptionalRulesForm(); optionalRulesForm.ShowDialog(); if (optionalRulesForm.DialogResult != DialogResult.OK) { return; } var firstPlayerDrawIndex = 0; var currentPlayer = rosterForm.Players.First(); if (currentPlayer.Character.DefaultDrawColors.Count > 0) { var drawForm = new SelectDrawForm(currentPlayer.Character.DefaultDrawColors); drawForm.ShowDialog(); if (drawForm.DialogResult == DialogResult.OK && drawForm.SelectedSkillCardDrawIndex.HasValue) { firstPlayerDrawIndex = drawForm.SelectedSkillCardDrawIndex.Value; } } Program.GManager.NewGame(rosterForm.Players, optionalRulesForm.ExtraLoyaltyCards, optionalRulesForm.UsingSympathizer, firstPlayerDrawIndex); PlayerReadonlyListBox.BeginUpdate(); PlayerReadonlyListBox.DataSource = Program.GManager.CurrentGameState.Players; PlayerReadonlyListBox.SelectedIndex = 0; PlayerReadonlyListBox.EndUpdate(); FoodUpDown.Value = Program.GManager.CurrentGameState.Food; FuelUpDown.Value = Program.GManager.CurrentGameState.Fuel; MoraleUpDown.Value = Program.GManager.CurrentGameState.Morale; PopUpDown.Value = Program.GManager.CurrentGameState.Population; managePlayerToolStripMenuItem.DropDownItems.Clear(); ShowHandMenuItem.DropDownItems.Clear(); foreach (var player in Program.GManager.CurrentGameState.Players) { var newMenuItem = new ToolStripMenuItem(player.PlayerName, null, ManagePlayerMenuItemClick); var showHandItem = new ToolStripMenuItem(player.PlayerName, null, ShowHandMenuItemClick); managePlayerToolStripMenuItem.DropDownItems.Add(newMenuItem); ShowHandMenuItem.DropDownItems.Add(showHandItem); } foreach (var boardSkillCheck in Program.GManager.CurrentGameState.BoardSkillChecks.Deck) { playBoardSkillCheckToolStripMenuItem.DropDownItems.Add(boardSkillCheck.Heading, null, PlayBoardSkillCheck); } RefreshGameDataBoxes(); JumpPrepChanged(sender, e); }
private void PassTurnButtonClick(object sender, EventArgs e) { var dialogResult = MessageBox.Show(Resources.GameWindow_PassTurnButtonClick_PassTurnInfo, Resources.GameWindow_PassTurnButtonClick_PassTurnTitle, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { if(PlayerReadonlyListBox.SelectedIndex == (PlayerReadonlyListBox.Items.Count - 1)) PlayerReadonlyListBox.SelectedIndex = 0; else PlayerReadonlyListBox.SelectedIndex += 1; Program.GManager.AddToTurnLog(String.Format("The turn passes to {0}!", PlayerReadonlyListBox.SelectedItem)); System.IO.Directory.CreateDirectory("save\\"); Program.GManager.SaveGame(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "save\\" + DateTime.Now.ToString(@"M-d-yyyy-hh_mm_ss-tt") + ".bsg")); var turnRecord = new HelpForm(Program.GManager.GetTurnLog(), "Turn log"); turnRecord.Show(); Program.GManager.EndTurn(); var currentPlayer = (Player)PlayerReadonlyListBox.SelectedItem; if (currentPlayer.Character.DefaultDrawColors.Count > 0) { var drawForm = new SelectDrawForm(currentPlayer.Character.DefaultDrawColors); drawForm.ShowDialog(); if(drawForm.DialogResult == DialogResult.OK && drawForm.SelectedSkillCardDrawIndex.HasValue) Program.GManager.DoPlayerDraw(currentPlayer, drawForm.SelectedSkillCardDrawIndex.Value); RefreshGameDataBoxes(); } } }