示例#1
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();
        }
示例#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);
            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();
        }