Exemplo n.º 1
0
        private void DrawMultipleToolStripMenuItemClick(object sender, EventArgs e)
        {
            var inputForm = new InputForm("Input the number of Crises to draw", "Draw Crises");

            inputForm.ShowDialog();
            if (inputForm.DialogResult == DialogResult.OK)
            {
                var numCrises = inputForm.UserInput.ParseAs <int>();
                if (numCrises == 0)
                {
                    MessageBox.Show(Resources.GameWindow_drawMultipleToolStripMenuItem_InputMoreThanZero);
                    return;
                }
                var crisisCards          = Program.GManager.CurrentGameState.CrisisDeck.DrawMany(numCrises).ToList();
                var crisisManagementForm = new CrisisManagementForm(crisisCards);
                crisisManagementForm.ShowDialog();
                if (crisisManagementForm.DialogResult == DialogResult.OK)
                {
                    foreach (var decision in crisisManagementForm.Decisions.OrderByDescending(x => x.Order))
                    {
                        switch (decision.Action)
                        {
                        case CrisisAction.Replace:
                            Program.GManager.CurrentGameState.CrisisDeck.Top(decision.Crisis);
                            break;

                        case CrisisAction.Draw:
                            CurrentCrisis   = decision.Crisis;
                            crisisText.Text = CurrentCrisis.Heading + Environment.NewLine + CurrentCrisis.AdditionalText;
                            break;

                        case CrisisAction.Bury:
                            Program.GManager.CurrentGameState.CrisisDeck.Bury(CurrentCrisis);
                            CurrentCrisis   = null;
                            crisisText.Text = string.Empty;
                            break;
                        }
                    }
                }
                else
                {
                    crisisCards.Reverse();
                    foreach (var crisisCard in crisisCards)
                    {
                        Program.GManager.CurrentGameState.CrisisDeck.Top(crisisCard);
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void DrawMultipleToolStripMenuItemClick(object sender, EventArgs e)
 {
     var inputForm = new InputForm("Input the number of Crises to draw", "Draw Crises");
     inputForm.ShowDialog();
     if(inputForm.DialogResult == DialogResult.OK)
     {
         var numCrises = inputForm.UserInput.ParseAs<int>();
         if (numCrises == 0)
         {
             MessageBox.Show(Resources.GameWindow_drawMultipleToolStripMenuItem_InputMoreThanZero);
             return;
         }
         var crisisCards = Program.GManager.CurrentGameState.CrisisDeck.DrawMany(numCrises).ToList();
         var crisisManagementForm = new CrisisManagementForm(crisisCards);
         crisisManagementForm.ShowDialog();
         if (crisisManagementForm.DialogResult == DialogResult.OK)
         {
             foreach (var decision in crisisManagementForm.Decisions.OrderByDescending(x => x.Order))
             {
                 switch(decision.Action)
                 {
                     case CrisisAction.Replace:
                         Program.GManager.CurrentGameState.CrisisDeck.Top(decision.Crisis);
                         break;
                     case CrisisAction.Draw:
                         CurrentCrisis = decision.Crisis;
                         crisisText.Text = CurrentCrisis.Heading + Environment.NewLine + CurrentCrisis.AdditionalText;
                         break;
                     case CrisisAction.Bury:
                         Program.GManager.CurrentGameState.CrisisDeck.Bury(CurrentCrisis);
                         CurrentCrisis = null;
                         crisisText.Text = string.Empty;
                         break;
                 }
             }
         }
         else
         {
             crisisCards.Reverse();
             foreach (var crisisCard in crisisCards)
             {
                 Program.GManager.CurrentGameState.CrisisDeck.Top(crisisCard);
             }
         }
     }
 }