示例#1
0
 public CalicoJack(int toBet = -1, bool highStakes = false)
 {
     coinBuffer      = ((LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru) ? "     " : ((LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.zh) ? "\u3000\u3000" : "  "));
     this.highStakes = highStakes;
     startTimer      = 1000;
     playerCards     = new List <int[]>();
     dealerCards     = new List <int[]>();
     if (toBet == -1)
     {
         currentBet = (highStakes ? 1000 : 100);
     }
     else
     {
         currentBet = toBet;
     }
     Club.timesPlayedCalicoJack++;
     r               = new Random(Club.timesPlayedCalicoJack + (int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame);
     hit             = new ClickableComponent(new Rectangle((int)((float)Game1.graphics.GraphicsDevice.Viewport.Width / Game1.options.zoomLevel - 128f - (float)SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11924"))), Game1.graphics.GraphicsDevice.Viewport.Height / 2 - 64, SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11924") + "  "), 64), "", " " + Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11924") + " ");
     stand           = new ClickableComponent(new Rectangle((int)((float)Game1.graphics.GraphicsDevice.Viewport.Width / Game1.options.zoomLevel - 128f - (float)SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11927"))), Game1.graphics.GraphicsDevice.Viewport.Height / 2 + 32, SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11927") + "  "), 64), "", " " + Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11927") + " ");
     doubleOrNothing = new ClickableComponent(new Rectangle((int)((float)(Game1.graphics.GraphicsDevice.Viewport.Width / 2) / Game1.options.zoomLevel) - SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11930")) / 2, (int)((float)(Game1.graphics.GraphicsDevice.Viewport.Height / 2) / Game1.options.zoomLevel), SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11930")) + 64, 64), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11930"));
     playAgain       = new ClickableComponent(new Rectangle((int)((float)(Game1.graphics.GraphicsDevice.Viewport.Width / 2) / Game1.options.zoomLevel) - SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11933")) / 2, (int)((float)(Game1.graphics.GraphicsDevice.Viewport.Height / 2) / Game1.options.zoomLevel) + 64 + 16, SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11933")) + 64, 64), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11933"));
     quit            = new ClickableComponent(new Rectangle((int)((float)(Game1.graphics.GraphicsDevice.Viewport.Width / 2) / Game1.options.zoomLevel) - SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11936")) / 2, (int)((float)(Game1.graphics.GraphicsDevice.Viewport.Height / 2) / Game1.options.zoomLevel) + 64 + 96, SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11936")) + 64, 64), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11936"));
     RepositionButtons();
     if (Game1.options.SnappyMenus)
     {
         currentlySnappedComponent = hit;
         currentlySnappedComponent.snapMouseCursorToCenter();
     }
 }
示例#2
0
 public void receiveKeyPress(Keys k)
 {
     if (!Game1.options.SnappyMenus)
     {
         return;
     }
     if (Game1.options.doesInputListContain(Game1.options.moveUpButton, k))
     {
         if (currentlySnappedComponent.Equals(stand))
         {
             currentlySnappedComponent = hit;
         }
         else if (currentlySnappedComponent.Equals(playAgain) && playerWon)
         {
             currentlySnappedComponent = doubleOrNothing;
         }
         else if (currentlySnappedComponent.Equals(quit) && Game1.player.clubCoins >= currentBet)
         {
             currentlySnappedComponent = playAgain;
         }
     }
     else if (Game1.options.doesInputListContain(Game1.options.moveDownButton, k))
     {
         if (currentlySnappedComponent.Equals(hit))
         {
             currentlySnappedComponent = stand;
         }
         else if (currentlySnappedComponent.Equals(doubleOrNothing))
         {
             currentlySnappedComponent = playAgain;
         }
         else if (currentlySnappedComponent.Equals(playAgain))
         {
             currentlySnappedComponent = quit;
         }
     }
     if (currentlySnappedComponent != null)
     {
         currentlySnappedComponent.snapMouseCursorToCenter();
     }
 }
示例#3
0
        public void endGame()
        {
            if (Game1.options.SnappyMenus)
            {
                currentlySnappedComponent = quit;
                currentlySnappedComponent.snapMouseCursorToCenter();
            }
            showingResultsScreen = true;
            int playertotal = 0;

            foreach (int[] j in playerCards)
            {
                playertotal += j[0];
            }
            if (playertotal == 21)
            {
                Game1.playSound("reward");
                playerWon               = true;
                endTitle                = Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11943");
                endMessage              = Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11944");
                Game1.player.clubCoins += currentBet;
                return;
            }
            if (playertotal > 21)
            {
                Game1.playSound("fishEscape");
                endTitle                = Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11946");
                endMessage              = Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11947");
                Game1.player.clubCoins -= currentBet;
                return;
            }
            int dealerTotal = 0;

            foreach (int[] i in dealerCards)
            {
                dealerTotal += i[0];
            }
            if (dealerTotal > 21)
            {
                Game1.playSound("reward");
                playerWon               = true;
                endTitle                = Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11943");
                endMessage              = Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11950");
                Game1.player.clubCoins += currentBet;
            }
            else if (playertotal == dealerTotal)
            {
                endTitle   = Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11951");
                endMessage = Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11952");
            }
            else if (playertotal > dealerTotal)
            {
                Game1.playSound("reward");
                endTitle                = Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11943");
                endMessage              = Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11955", 21);
                Game1.player.clubCoins += currentBet;
                playerWon               = true;
            }
            else
            {
                Game1.playSound("fishEscape");
                endTitle                = Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11946");
                endMessage              = Game1.content.LoadString("Strings\\StringsFromCSFiles:CalicoJack.cs.11958", 21);
                Game1.player.clubCoins -= currentBet;
            }
        }
示例#4
0
        private static void JunimoNoteCustomButtons(JunimoNoteMenu __instance, Bundle ___currentPageBundle, int signal, bool isLeftShiftPressed = false)
        {
            try
            {
                switch (signal)
                {
                case 0:     // For ingredient list
                {
                    if (___currentPageBundle.ingredients.Count >= 0)
                    {
                        currentIngredientListItem = currentIngredientListItem + (isLeftShiftPressed ? -1 : 1);
                        if (currentIngredientListItem >= ___currentPageBundle.ingredients.Count)
                        {
                            if (isLeftShiftPressed)
                            {
                                currentIngredientListItem = ___currentPageBundle.ingredients.Count - 1;
                            }
                            else
                            {
                                currentIngredientListItem = 0;
                            }
                        }

                        if (currentIngredientListItem < 0)
                        {
                            if (isLeftShiftPressed)
                            {
                                currentIngredientListItem = ___currentPageBundle.ingredients.Count - 1;
                            }
                            else
                            {
                                currentIngredientListItem = 0;
                            }
                        }

                        ClickableTextureComponent   c          = __instance.ingredientList[currentIngredientListItem];
                        BundleIngredientDescription ingredient = ___currentPageBundle.ingredients[currentIngredientListItem];

                        Item item      = new StardewValley.Object(ingredient.index, ingredient.stack, isRecipe: false, -1, ingredient.quality);
                        bool completed = false;
                        if (___currentPageBundle != null && ___currentPageBundle.ingredients != null && currentIngredientListItem < ___currentPageBundle.ingredients.Count && ___currentPageBundle.ingredients[currentIngredientListItem].completed)
                        {
                            completed = true;
                        }

                        string toSpeak = item.DisplayName;

                        if (!completed)
                        {
                            int quality = ingredient.quality;
                            if (quality == 1)
                            {
                                toSpeak = $"Silver quality {toSpeak}";
                            }
                            else if (quality == 2 || quality == 3)
                            {
                                toSpeak = $"Gold quality {toSpeak}";
                            }
                            else if (quality >= 4)
                            {
                                toSpeak = $"Iridium quality {toSpeak}";
                            }

                            toSpeak = $"{ingredient.stack} {toSpeak}";
                        }

                        if (completed)
                        {
                            toSpeak = $"Completed {toSpeak}";
                        }

                        c.snapMouseCursorToCenter();
                        MainClass.ScreenReader.Say(toSpeak, true);
                    }
                }
                break;

                case 1:     // For input slot list
                {
                    if (__instance.ingredientSlots.Count >= 0)
                    {
                        currentIngredientInputSlot = currentIngredientInputSlot + (isLeftShiftPressed ? -1 : 1);
                        if (currentIngredientInputSlot >= __instance.ingredientSlots.Count)
                        {
                            if (isLeftShiftPressed)
                            {
                                currentIngredientInputSlot = __instance.ingredientSlots.Count - 1;
                            }
                            else
                            {
                                currentIngredientInputSlot = 0;
                            }
                        }

                        if (currentIngredientInputSlot < 0)
                        {
                            if (isLeftShiftPressed)
                            {
                                currentIngredientInputSlot = __instance.ingredientSlots.Count - 1;
                            }
                            else
                            {
                                currentIngredientInputSlot = 0;
                            }
                        }

                        ClickableTextureComponent c = __instance.ingredientSlots[currentIngredientInputSlot];
                        Item   item = c.item;
                        string toSpeak;

                        if (item == null)
                        {
                            toSpeak = $"Input Slot {currentIngredientInputSlot + 1}";
                        }
                        else
                        {
                            toSpeak = item.DisplayName;
                        }

                        c.snapMouseCursorToCenter();
                        MainClass.ScreenReader.Say(toSpeak, true);
                    }
                }
                break;

                case 2:     // For inventory slots
                {
                    if (__instance.inventory != null && __instance.inventory.actualInventory.Count >= 0)
                    {
                        int prevSlotIndex = currentInventorySlot;
                        currentInventorySlot = currentInventorySlot + (isLeftShiftPressed ? -1 : 1);
                        if (currentInventorySlot >= __instance.inventory.actualInventory.Count)
                        {
                            if (isLeftShiftPressed)
                            {
                                currentInventorySlot = __instance.inventory.actualInventory.Count - 1;
                            }
                            else
                            {
                                currentInventorySlot = 0;
                            }
                        }

                        if (currentInventorySlot < 0)
                        {
                            if (isLeftShiftPressed)
                            {
                                currentInventorySlot = __instance.inventory.actualInventory.Count - 1;
                            }
                            else
                            {
                                currentInventorySlot = 0;
                            }
                        }

                        Item item            = __instance.inventory.actualInventory[currentInventorySlot];
                        ClickableComponent c = __instance.inventory.inventory[currentInventorySlot];
                        string             toSpeak;
                        if (item != null)
                        {
                            toSpeak = item.DisplayName;

                            if ((item as StardewValley.Object) != null)
                            {
                                int quality = ((StardewValley.Object)item).Quality;
                                if (quality == 1)
                                {
                                    toSpeak = $"Silver quality {toSpeak}";
                                }
                                else if (quality == 2 || quality == 3)
                                {
                                    toSpeak = $"Gold quality {toSpeak}";
                                }
                                else if (quality >= 4)
                                {
                                    toSpeak = $"Iridium quality {toSpeak}";
                                }
                            }
                            toSpeak = $"{item.Stack} {toSpeak}";
                        }
                        else
                        {
                            toSpeak = "Empty Slot";
                        }
                        c.snapMouseCursorToCenter();
                        MainClass.ScreenReader.Say(toSpeak, true);
                    }
                }
                break;
                }
            }
            catch (Exception e)
            {
                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
            }
        }