コード例 #1
0
        private void RefreshGameDataBoxes()
        {
            RaptorReserveLabel.Text = Program.GManager.CurrentRaptors().ToString(CultureInfo.InvariantCulture);

            var selectedIndex = PlayerReadonlyListBox.SelectedIndex;

            PlayerReadonlyListBox.BeginUpdate();
            PlayerReadonlyListBox.DataSource    = null;
            PlayerReadonlyListBox.DataSource    = Program.GManager.CurrentGameState.Players;
            PlayerReadonlyListBox.SelectedIndex = selectedIndex;
            PlayerReadonlyListBox.EndUpdate();

            AlphaDradisListBox.DataSource   = null;
            BravoDradisListBox.DataSource   = null;
            CharlieDradisListBox.DataSource = null;
            DeltaDradisListBox.DataSource   = null;
            EchoDradisListBox.DataSource    = null;
            FoxtrotDradisListBox.DataSource = null;

            AlphaDradisListBox.DataSource   = Program.GManager.CurrentGameState.Dradis.GetComponents(DradisNodeName.Alpha);
            BravoDradisListBox.DataSource   = Program.GManager.CurrentGameState.Dradis.GetComponents(DradisNodeName.Bravo);
            CharlieDradisListBox.DataSource = Program.GManager.CurrentGameState.Dradis.GetComponents(DradisNodeName.Charlie);
            DeltaDradisListBox.DataSource   = Program.GManager.CurrentGameState.Dradis.GetComponents(DradisNodeName.Delta);
            EchoDradisListBox.DataSource    = Program.GManager.CurrentGameState.Dradis.GetComponents(DradisNodeName.Echo);
            FoxtrotDradisListBox.DataSource = Program.GManager.CurrentGameState.Dradis.GetComponents(DradisNodeName.Foxtrot);

            AlphaDradisListBox.SelectedIndex   = -1;
            BravoDradisListBox.SelectedIndex   = -1;
            CharlieDradisListBox.SelectedIndex = -1;
            DeltaDradisListBox.SelectedIndex   = -1;
            EchoDradisListBox.SelectedIndex    = -1;
            FoxtrotDradisListBox.SelectedIndex = -1;

            GalacticaBoardListBox.DataSource = null;
            ColonialOneListBox.DataSource    = null;
            CylonBoardListBox.DataSource     = null;

            GalacticaBoardListBox.DataSource = Program.GManager.CurrentGameState.Boards.First(x => x.Name == BoardName.Galactica).Locations;
            ColonialOneListBox.DataSource    = Program.GManager.CurrentGameState.Boards.First(x => x.Name == BoardName.ColonialOne).Locations;
            CylonBoardListBox.DataSource     = Program.GManager.CurrentGameState.Boards.First(x => x.Name == BoardName.Cylon).Locations;

            GalacticaBoardListBox.SelectedIndex = -1;
            ColonialOneListBox.SelectedIndex    = -1;
            CylonBoardListBox.SelectedIndex     = -1;
        }
コード例 #2
0
        private void PlayCrisisButtonClick(object sender, EventArgs e)
        {
            if (CurrentCrisis == null || CurrentCrisis.PassLevels.Any() == false)
            {
                return;
            }

            var destinyDraw = Program.GManager.DrawDestiny(2).ToList();

            var form = new PlayCrisisForm(Program.GManager.CurrentGameState.Players, CurrentCrisis, destinyDraw, Program.GManager.SkillCheckRules);

            form.ShowDialog();
            if (form.DialogResult == DialogResult.Cancel)
            {
                Program.GManager.TopCards(destinyDraw, true);
                return;
            }

            if (form.PlayerTakingCards == null)
            {
                foreach (var contribution in form.CrisisContributions)
                {
                    Program.GManager.DiscardCard(contribution.Item1, Program.GManager.FindPlayerByName(contribution.Item2));
                }
            }
            else
            {
                foreach (var contribution in form.CrisisContributions)
                {
                    Program.GManager.GiveCardToPlayer(form.PlayerTakingCards, contribution.Item1, Program.GManager.FindPlayerByName(contribution.Item2));
                }
            }

            Program.GManager.DiscardCard(CurrentCrisis);

            var helpForm = new HelpForm(form.Result, "Crisis Result");

            helpForm.Show();
            PlayerReadonlyListBox.BeginUpdate();
            PlayerReadonlyListBox.DataSource    = null;
            PlayerReadonlyListBox.DataSource    = Program.GManager.CurrentGameState.Players;
            PlayerReadonlyListBox.SelectedIndex = 0;
            PlayerReadonlyListBox.EndUpdate();
        }
コード例 #3
0
        private void LoadGameStripMenuItemClick(object sender, EventArgs e)
        {
            var openDialog = new OpenFileDialog {
                Filter = Resources.GameWindow_SavedGamesFilter
            };

            if (openDialog.ShowDialog() == DialogResult.OK)
            {
                Program.GManager.LoadGame(openDialog.FileName);

                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;
                DistanceUpDown.Value = Program.GManager.CurrentGameState.Distance;

                RefreshGameDataBoxes();

                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);
                    if (player.SuperCrisisCards.Count > 0)
                    {
                        playSuperCrisisToolStripMenuItem.DropDownItems.Add(player.PlayerName, null, PlaySuperCrisis);
                    }
                }
                foreach (var boardSkillCheck in Program.GManager.CurrentGameState.BoardSkillChecks.Deck)
                {
                    playBoardSkillCheckToolStripMenuItem.DropDownItems.Add(boardSkillCheck.Heading, null, PlayBoardSkillCheck);
                }

                JumpPrepChanged(sender, e);
            }
        }
コード例 #4
0
        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);
        }