コード例 #1
0
 /// <summary>
 /// When Play is selected by the user
 /// </summary>
 private void PlayOptionTriggered()
 {
     if (confirmationPending)
     {
         userNotification    = "Invalid key";
         confirmationPending = false;
         helpString          = gamehelp;
     }
     else
     {
         Logger.Logger.Log("Drawing a card.");
         userNotification = "Drawing new card...";
         Card newCard = engine.Draw();
         if (newCard == null)
         {
             userNotification    = "Cards in the deck are over. Do you want to reset? (Y/N): ";
             confirmationPending = true;
             helpString          = confirmationHelp;
             lastUserAction      = EUserAction.Reset;
         }
         else
         {
             userNotification    = "A card was drawn";
             cardString          = GetCard(GetCardCode(newCard.number), GetSuitCode(newCard.suit));
             confirmationPending = false;
             helpString          = gamehelp;
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// When Save is selected by the user
 /// </summary>
 private void SaveOptionTriggered()
 {
     if (confirmationPending)
     {
         userNotification    = "Invalid key";
         confirmationPending = false;
         helpString          = gamehelp;
     }
     else
     {
         confirmationPending = true;
         helpString          = confirmationHelp;
         lastUserAction      = EUserAction.Save;
         userNotification    = "Are you sure you want to Save?";
     }
 }