コード例 #1
0
 private void Leftclick(object sender, Coordinate coord)
 {
     if (payButton.containsPoint(coord.X, coord.Y) && taxation.State.PendingTaxAmount != 0)
     {
         taxation.PayTaxes();
     }
 }
コード例 #2
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            TasksPage?tasksPage = GetParentMenu() as TasksPage;

            if (checkbox.containsPoint(x, y))
            {
                if (_task.Active)
                {
                    _task.Complete = !_task.Complete;
                    _task.MarkAsViewed();
                    Game1.playSoundPitched("tinyWhip", _task.Complete ? 2000 : 1000);
                }
                else
                {
                    _task.Active = true;
                    Game1.playSound("newRecipe");
                }
            }
            else
            {
                if (editbox.containsPoint(x, y) && tasksPage != null)
                {
                    tasksPage.OpenTaskOptionsMenu(_task);
                    return;
                }
                else if (removeButton.containsPoint(x, y))
                {
                    tasksPage?.RemoveTask(_task);
                    Game1.playSound("trashcan");
                }

                exitThisMenuNoSound();
            }
        }
コード例 #3
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            base.receiveLeftClick(x, y, playSound);

            if (_button_GlobalMessage.containsPoint(x, y) && _button_GlobalMessage.visible)
            {
                Game1.showGlobalMessage("Hello World");
            }
            else if (_button_HudMessage.containsPoint(x, y) && _button_HudMessage.visible)
            {
                Game1.addHUDMessage(new HUDMessage("Hello World", 2));
            }
            else if (_button_ChatMessage.containsPoint(x, y) && _button_ChatMessage.visible)
            {
                _helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer")?.GetValue().sendChatMessage(LocalizedContentManager.CurrentLanguageCode, "Hello World");
                Game1.chatBox.receiveChatMessage(Game1.player.UniqueMultiplayerID, 0, LocalizedContentManager.CurrentLanguageCode, "Hello World");
            }

            //if (this.linkToSVSite.containsPoint(x, y) && this.linkToSVSite.visible)
            //    HelloWorldMenu.LaunchBrowser("http://www.stardewvalley.net");
            //else if (this.linkToTwitter.containsPoint(x, y) && this.linkToTwitter.visible)
            //    HelloWorldMenu.LaunchBrowser("http://www.twitter.com/ConcernedApe");
            //else if (this.linkToChucklefish.containsPoint(x, y) && this.linkToChucklefish.visible)
            //    HelloWorldMenu.LaunchBrowser("http://blog.chucklefish.org/");
            //else
            //    this.isWithinBounds(x, y);
        }
コード例 #4
0
        internal static bool Prefix(InventoryPage __instance, int x, int y, bool playSound = true)
        {
            ClickableComponent hatComponent = __instance.equipmentIcons.First(s => s.name == "Hat");

            if (hatComponent.containsPoint(x, y))
            {
                Hat wornHat = Game1.player.hat;
                if (wornHat is null)
                {
                    return(true);
                }

                if (wornHat.Name == "Headphones" || wornHat.Name == "Earbuds")
                {
                    ModEntry.ShowMusicMenu();
                    return(false);
                }
                if (wornHat.Name == "Studio Headphones")
                {
                    ModEntry.ShowSoundMenu();
                    return(false);
                }
            }

            return(true);
        }
コード例 #5
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            if (button.containsPoint(x, y))
            {
                if (!iscooking && ScavengerRecipe.doesFarmerHaveIngredientsInInventory(null))
                {
                    Item obj = ScavengerRecipe.createItem();
                    ScavengerRecipe.consumeIngredients(null);
                    Game1.playSound("crafting");

                    if (!this.iscooking && Game1.player.craftingRecipes.ContainsKey(ScavengerRecipe.name))
                    {
                        Game1.player.craftingRecipes[ScavengerRecipe.name] += ScavengerRecipe.numberProducedPerCraft;
                    }
                    if (this.iscooking)
                    {
                        Game1.player.cookedRecipe(obj.ParentSheetIndex);
                    }
                    if (!this.iscooking)
                    {
                        Game1.stats.checkForCraftingAchievements();
                    }
                    else
                    {
                        Game1.stats.checkForCookingAchievements();
                    }

                    Game1.player.addItemByMenuIfNecessary(obj);
                }
            }
        }
コード例 #6
0
ファイル: Utils.cs プロジェクト: Pathoschild/smapi-mod-dump
        public static object SerializeClickableCmp(ClickableComponent cmp, Point mousePosition, bool adjustUiMode = true)
        {
            if (cmp == null)
            {
                return(null);
            }
            Rectangle bounds        = cmp.bounds;
            bool      containsMouse = cmp.containsPoint(mousePosition.X, mousePosition.Y);
            var       serializedCmp = new
            {
                type   = "clickableComponent",
                bounds = new { x = bounds.X, y = bounds.Y, width = bounds.Width, height = bounds.Height },
                center = new List <dynamic> {
                    bounds.Center.X, bounds.Center.Y
                },
                cmp.name,
                containsMouse,
                cmp.visible,
                hoverText = cmp is ClickableTextureComponent ? (cmp as ClickableTextureComponent).hoverText : "",
            };

            if (adjustUiMode)
            {
                float x = (float)Convert.ToInt32(serializedCmp.center[0]);
                float y = (float)Convert.ToInt32(serializedCmp.center[1]);
                serializedCmp.center[0] = x * Game1.options.uiScale / Game1.options.zoomLevel;
                serializedCmp.center[1] = y * Game1.options.uiScale / Game1.options.zoomLevel;
            }
            return(serializedCmp);
        }
コード例 #7
0
        public override void performHoverAction(int x, int y)
        {
            _hoverText = "";

            if (optionsButton.containsPoint(x, y))
            {
                _hoverText = _translation.Get("ui.tasks.new.optionsbutton.hover");
            }
            else if (cancelButton.containsPoint(x, y))
            {
                _hoverText = _translation.Get("ui.tasks.new.cancelbutton.hover");
            }
            else if (_taskParser.MatchFound())
            {
                if (smartOkButton.containsPoint(x, y))
                {
                    _hoverText = _translation.Get("ui.tasks.new.smartokbutton.hover");
                }
                else if (smartTypeIconCC.containsPoint(x, y))
                {
                    _hoverText = _translation.Get("task." + _taskParser.ID);
                }
                else if (smartItemIcon.containsPoint(x, y) && _taskParser.SmartIconItem is Item item)
                {
                    _hoverText = item.DisplayName;
                }
                else if (smartNPCIcon.containsPoint(x, y) && _taskParser.SmartIconNPC is NPC npc)
                {
                    _hoverText = npc.getName();
                }
                else if (smartNameIcon.containsPoint(x, y) && _taskParser.SmartIconName is string name)
                {
                    _hoverText = name;
                }
            }

            optionsButton.tryHover(x, y);
            cancelButton.tryHover(x, y, 0.2f);
            closeTipButton.tryHover(x, y, 0.2f);

            if (_textBox.Text.Length > 0)
            {
                okButton.tryHover(x, y);

                if (_taskParser.MatchFound())
                {
                    smartOkButton.tryHover(x, y);
                }
                else
                {
                    smartOkButton.scale = smartOkButton.baseScale;
                }
            }
            else
            {
                okButton.scale = okButton.baseScale;
            }
        }
コード例 #8
0
        private void OnButtonReleased(object sender, ButtonReleasedEventArgs e)
        {
            if (Game1.activeClickableMenu != null && e.Button.Equals(SButton.MouseLeft) &&
                electionTab.containsPoint((int)e.Cursor.ScreenPixels.X, (int)e.Cursor.ScreenPixels.Y))
            {
                Game1.activeClickableMenu = new ElectionMenu();
            }

            assetInitialization.AssetReactions(e, data);
        }
コード例 #9
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (showingResultScreen.GetValue() && playAgain.containsPoint(x, y) && (
             toBet == 0 || Game1.player.clubCoins >= toBet || !M.Config.checkQiCoin
             ))
     {
         Game1.currentMinigame = new CalicoJackExitable(toBet, highStakes);
         Game1.playSound("smallSelect");
         return;
     }
     base.receiveLeftClick(x, y, playSound);
 }
コード例 #10
0
        private void LeftClick(CoopMenu menu, int x, int y)
        {
            if (addServerButton != null && addServerButton.containsPoint(x, y))
            {
                Game1.playSound("bigDeSelect");

                Game1.activeClickableMenu = new TextMenu("Server name?", (serverName) =>
                {
                    Game1.activeClickableMenu = new TextMenu("IP address?", (ipAddress) =>
                    {
                        bookmarks.Bookmarks.Remove(serverName);
                        bookmarks.Bookmarks.Add(serverName, ipAddress);
                        writeData(bookmarks, "Bookmarks.json");

                        var title = new TitleMenu();
                        title.skipToTitleButtons();
                        TitleMenu.subMenu         = new CoopMenu();
                        Game1.activeClickableMenu = title;
                    });
                });
            }
        }
コード例 #11
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            int oldColor = ColorPicker.colorSelection;
            ColorPicker.receiveLeftClick(x, y, playSound);
            if (oldColor != ColorPicker.colorSelection)
            {
                settings.SetColorFor(name, ColorPicker.colorSelection);
                return;
            }

            if (toggleVisibility != null && toggleVisibility.containsPoint(x, y))
                ColorPicker.visible = !ColorPicker.visible;
            else
                ColorPicker.visible = false;
        }
コード例 #12
0
        internal static void Postfix(InventoryPage __instance, bool __state, int x, int y, bool playSound = true)
        {
            ClickableComponent hatComponent = __instance.equipmentIcons.First(s => s.name == "Hat");

            if (hatComponent.containsPoint(x, y))
            {
                if (__state)
                {
                    Game1.changeMusicTrack("none");

                    if (!Game1.isStartingToGetDarkOut() && !Game1.isRaining)
                    {
                        Game1.playMorningSong();
                    }
                }
            }
        }
コード例 #13
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            if (_waitingForServerResponse)
            {
                return;
            }

            base.receiveLeftClick(x, y);
            if (!GeodeSpot.containsPoint(x, y))
            {
                return;
            }

            if (heldItem == null || !Utility.IsGeode(heldItem) || GeodeAnimationTimer > 0)
            {
                return;
            }
            if (Game1.player.freeSpotsInInventory() > 1 ||
                Game1.player.freeSpotsInInventory() == 1 && heldItem.Stack == 1)
            {
                if (heldItem.ParentSheetIndex == 791 && !Game1.netWorldState.Value.GoldenCoconutCracked.Value)
                {
                    _waitingForServerResponse = true;
                    Game1.player.team.goldenCoconutMutex.RequestLock(delegate
                    {
                        _waitingForServerResponse = false;
                        _geodeTreasureOverride    = new Object(73, 1);
                        StartGeodeCrack();
                    }, delegate
                    {
                        _waitingForServerResponse = false;
                        StartGeodeCrack();
                    });
                }
                else
                {
                    StartGeodeCrack();
                }
            }
            else
            {
                descriptionText  = Game1.content.LoadString("Strings\\UI:GeodeMenu_InventoryFull");
                wiggleWordsTimer = 500;
                _alertTimer      = 1500;
            }
        }
コード例 #14
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            if (cancelButton.containsPoint(x, y))
            {
                exitThisMenu(playSound);
            }
            else if (okButton.containsPoint(x, y))
            {
                if (_textBox.Text.Length > 0)
                {
                    AddTaskAndExit(false);
                }
            }
            else if (smartOkButton.containsPoint(x, y))
            {
                if (_textBox.Text.Length > 0 && _taskParser.MatchFound())
                {
                    AddTaskAndExit(true);
                }
            }
            else if (optionsButton.containsPoint(x, y))
            {
                IClickableMenu optionsMenu = new TaskOptionsMenu(_previousText, _taskParser, _translation);

                _parentMenu.SetChildMenu(optionsMenu);
                optionsMenu.SetChildMenu(this);
                OnExit();
            }
            else if (closeTipButton.containsPoint(x, y) && DeluxeJournalMod.Instance?.Config is Config config)
            {
                config.ShowSmartAddTip = false;
            }
            else if (textBoxCC.containsPoint(x, y))
            {
                _textBox.SelectMe();

                // HACK: TextBox.Update() will not show the gamepad keyboard immediately after opening
                //  this menu due to Game1.lastCursorMotionWasMouse being true, regardless of the fact
                //  that snapToDefaultClickableComponent() should invalidate this flag. As a workaround,
                //  manually show the keyboard without checking mouse state.
                if (Game1.options.SnappyMenus)
                {
                    Game1.showTextEntry(_textBox);
                }
            }
        }
コード例 #15
0
        public override void applyMovementKey(int direction)
        {
            base.applyMovementKey(direction);

            if (Game1.options.SnappyMenus && gamepadCursorArea.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()))
            {
                switch (direction)
                {
                case Game1.up:
                    _textBox.ReceiveScrollWheelAction(1);
                    break;

                case Game1.down:
                    _textBox.ReceiveScrollWheelAction(-1);
                    break;
                }
            }
        }
コード例 #16
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            base.receiveLeftClick(x, y, playSound);
            foreach (Request r in Requests.RequestList)
            {
                if (r.itemIndex == Util.CompletedRequestIndex)
                {
                    string name = Game1.objectInformation[r.itemIndex].Split('/')[0];
                    foreach (ClickableTextureComponent component in textures)
                    {
                        if (component.name == name && Game1.player.Money >= r.totalPrice && component.containsPoint(x, y))
                        {
                            SObject tempObject = new SObject(r.itemIndex, 1);
                            for (int i = 0; i < r.itemCount; i++)
                            {
                                Item oneTempObject = tempObject.getOne();
                                Game1.player.addItemToInventory(oneTempObject);
                            }
                            Game1.player.Money -= r.totalPrice;
                            Game1.activeClickableMenu = null;
                            break;
                        }
                        else if (Game1.player.Money < r.totalPrice)
                        {
                            Game1.activeClickableMenu = (IClickableMenu)new DialogueBox("You do not have enough money to claim this item");
                            break;
                        }
                        else
                            break;
                    }
                }
            }
            Util.TryToRemoveRequests();


            if (!RequestItemButton.visible || !RequestItemButton.containsPoint(x, y))
                return;
            else
                Game1.activeClickableMenu = (IClickableMenu)new ItemSelectionMenu("Select It4m", Monitor);
        }
コード例 #17
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            if (upperRightCloseButton.containsPoint(x, y))
            {
                if (playSound)
                {
                    Game1.playSound("bigDeSelect");
                }
                Game1.exitActiveMenu();
                return;
            }

            for (int i = 0; i < NUM_TABS; ++i)
            {
                ClickableComponent tab = tabs[i];
                if (tab.containsPoint(x, y) && CurrentTab != i)
                {
                    ChangeTab(i);
                }
            }
            pages[CurrentTab].receiveLeftClick(x, y, playSound);
        }
コード例 #18
0
        internal static void JojaCDMenuPatch(JojaCDMenu __instance)
        {
            try
            {
                int    x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
                string toSpeak = "";

                for (int i = 0; i < __instance.checkboxes.Count; i++)
                {
                    ClickableComponent c = __instance.checkboxes[i];
                    if (!c.containsPoint(x, y))
                    {
                        continue;
                    }

                    if (c.name.Equals("complete"))
                    {
                        toSpeak = $"Completed {getNameFromIndex(i)}";
                    }
                    else
                    {
                        toSpeak = $"{getNameFromIndex(i)} Cost: {__instance.getPriceFromButtonNumber(i)}g Description: {__instance.getDescriptionFromButtonNumber(i)}";
                    }

                    break;
                }

                if (jojaCDMenuQuery != toSpeak)
                {
                    jojaCDMenuQuery = toSpeak;
                    MainClass.ScreenReader.Say(toSpeak, true);
                }
            }
            catch (System.Exception e)
            {
                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
            }
        }
コード例 #19
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            base.receiveLeftClick(x, y, playSound);

            if (!AcceptQuestButton.containsPoint(x, y))
            {
                return;
            }

            if (playSound)
            {
                Game1.playSound("newArtifact");
            }

            // set required properties and add to questlog
            ModEntry.CurrentBillBoardQuests[QuestPosition].dailyQuest.Value     = true;
            ModEntry.CurrentBillBoardQuests[QuestPosition].accepted.Value       = true;
            ModEntry.CurrentBillBoardQuests[QuestPosition].canBeCancelled.Value = true;
            Game1.player.questLog.Add(ModEntry.CurrentBillBoardQuests[QuestPosition]);

            ModEntry.CurrentBillBoardQuests.RemoveAt(QuestPosition);
            this.exitThisMenu(true);
        }
コード例 #20
0
ファイル: PlayerBar.cs プロジェクト: xxjbcxx/smapi-mod-dump
        public void draw(SpriteBatch b)
        {
            checkOnline();

            IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 396, 15, 15),
                                          section.bounds.X, section.bounds.Y, section.bounds.Width, section.bounds.Height, Color.White, 4f, false);

            farmer.FarmerRenderer.drawMiniPortrat(b, new Vector2(icon.bounds.X, icon.bounds.Y), 0.5f, 5, 1, farmer);

            string nameT = $"Player:\n{farmer.name}";
            string locaT = "Location:\n" + ((online) ? farmer.currentLocation.name : "Offline");

            Utility.drawTextWithShadow(b, nameT, Game1.smallFont, new Vector2(section.bounds.X + 120, section.bounds.Y + 22), Game1.textColor);
            Utility.drawTextWithShadow(b, locaT, Game1.smallFont, new Vector2(section.bounds.X + 300, section.bounds.Y + 22), Game1.textColor);

            if (Game1.player == farmer)
            {
                return;
            }
            Color color = (warpButton.containsPoint(Game1.getMouseX(), Game1.getMouseY())) ? Color.Wheat : Color.White;

            UtilityPlus.drawButtonWithText(b, warpButton.bounds, (online)? color : Color.Gray, "Warp", Game1.smallFont, Game1.textColor);
        }
コード例 #21
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (okButton.containsPoint(x, y))
     {
         doReskinning();
     }
     else if (baseItemClickable.containsPoint(x, y))
     {
         if (Game1.player.addItemToInventoryBool(baseItemClickable.item))
         {
             baseItemClickable.item = null;
         }
     }
     else if (skinItemClickable.containsPoint(x, y))
     {
         if (Game1.player.addItemToInventoryBool(skinItemClickable.item))
         {
             skinItemClickable.item = null;
         }
     }
     else if (baseItemClickable.item == null || skinItemClickable.item == null)
     {
         Item clicked = inventory.leftClick(x, y, null);
         if (clicked != null)
         {
             if (baseItemClickable.item == null)
             {
                 baseItemClickable.item = clicked;
             }
             else
             {
                 skinItemClickable.item = clicked;
             }
         }
     }
 }
コード例 #22
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            if ((double)MailFrameworkModEntry.ModHelper.Reflection.GetField <float>(this, "scale").GetValue() < 1.0)
            {
                return;
            }

            if (this.upperRightCloseButton == null || !this.readyToClose() ||
                !this.upperRightCloseButton.containsPoint(x, y))
            {
                if (Game1.activeClickableMenu != null || Game1.currentMinigame != null)
                {
                    if (this.itemsToGrab.Count > 0)
                    {
                        ClickableComponent clickableComponent = this.itemsToGrab.Last();
                        if (clickableComponent.containsPoint(x, y) && clickableComponent.item != null)
                        {
                            Game1.playSound("coin");
                            Game1.player.addItemByMenuIfNecessary(clickableComponent.item, null);
                            if (Game1.activeClickableMenu != null && Game1.activeClickableMenu != this)
                            {
                                Game1.activeClickableMenu.exitFunction = (IClickableMenu.onExit)Delegate.Combine(Game1.activeClickableMenu.exitFunction, new IClickableMenu.onExit(() => Game1.activeClickableMenu = this));
                            }
                            clickableComponent.item = (Item)null;
                            if (this.itemsToGrab.Count > 1)
                            {
                                this.itemsToGrab.Remove(clickableComponent);
                            }
                            return;
                        }
                    }
                }
            }

            base.receiveLeftClick(x, y, playSound);
        }
コード例 #23
0
        internal static bool Prefix(InventoryPage __instance, out bool __state, int x, int y, bool playSound = true)
        {
            __state = false;

            ClickableComponent hatComponent = __instance.equipmentIcons.First(s => s.name == "Hat");

            if (hatComponent.containsPoint(x, y))
            {
                bool heldItemWasNull = Game1.player.CursorSlotItem is null;
                if (!IsHeadphoneHeld())
                {
                    if (IsWearingMusicPlayer())
                    {
                        if (heldItemWasNull || Game1.player.CursorSlotItem is Hat)
                        {
                            __state = true;
                        }
                    }
                    return(true);
                }

                if (IsValidMusicPlayer(Game1.player.CursorSlotItem.Name))
                {
                    Hat  tmp      = (Hat)helper.Reflection.GetMethod(__instance, "takeHeldItem").Invoke <Item>();
                    Item heldItem = Game1.player.hat;
                    heldItem = Utility.PerformSpecialItemGrabReplacement(heldItem);
                    Game1.player.hat.Value = tmp;

                    if (Game1.player.hat.Value != null)
                    {
                        Game1.playSound("grassyStep");
                    }
                    else if (Game1.player.CursorSlotItem is null)
                    {
                        Game1.playSound("dwop");
                    }

                    if (heldItem != null && !Game1.player.addItemToInventoryBool(heldItem, false))
                    {
                        helper.Reflection.GetMethod(__instance, "setHeldItem").Invoke(heldItem);
                    }

                    ShowCorrectPrompt();
                }

                if (!heldItemWasNull || Game1.player.CursorSlotItem is null || !Game1.oldKBState.IsKeyDown(Keys.LeftShift))
                {
                    return(false);
                }

                for (int l = 0; l < Game1.player.items.Count; l++)
                {
                    if (Game1.player.items[l] == null || Game1.player.CursorSlotItem != null && Game1.player.items[l].canStackWith(Game1.player.CursorSlotItem))
                    {
                        if (Game1.player.CurrentToolIndex == l && Game1.player.CursorSlotItem != null)
                        {
                            Game1.player.CursorSlotItem.actionWhenBeingHeld(Game1.player);
                        }
                        helper.Reflection.GetMethod(__instance, "setHeldItem").Invoke(Utility.addItemToInventory(helper.Reflection.GetMethod(__instance, "takeHeldItem").Invoke <Item>(), l, __instance.inventory.actualInventory));
                        if (Game1.player.CurrentToolIndex == l && Game1.player.CursorSlotItem != null)
                        {
                            Game1.player.CursorSlotItem.actionWhenStopBeingHeld(Game1.player);
                        }
                        Game1.playSound("stoneStep");
                        return(false);
                    }
                }
            }

            if (IsSelectingHeadPhonesInInventory(__instance, x, y) && Game1.oldKBState.IsKeyDown(Keys.LeftShift))
            {
                helper.Reflection.GetMethod(__instance, "setHeldItem").Invoke(__instance.inventory.leftClick(x, y, helper.Reflection.GetMethod(__instance, "takeHeldItem").Invoke <Item>(), !Game1.oldKBState.IsKeyDown(Keys.LeftShift)));
                if (Game1.player.CursorSlotItem != null && Game1.oldKBState.IsKeyDown(Keys.LeftShift))
                {
                    if (Game1.player.hat.Value == null)
                    {
                        Game1.player.hat.Value = helper.Reflection.GetMethod(__instance, "takeHeldItem").Invoke <Item>() as Hat;

                        ShowCorrectPrompt();
                        return(false);
                    }
                }
            }

            return(true);
        }
コード例 #24
0
        /******************
        * Override methods
        ******************/

        /// <summary>The method invoked when the player left-clicks on the menu.</summary>
        /// <param name="x">The X-position of the cursor.</param>
        /// <param name="y">The Y-position of the cursor.</param>
        /// <param name="playSound">Whether to enable sound.</param>
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            // Implementation derived mostly from ShopMenu
            base.receiveLeftClick(x, y, playSound);
            if (Game1.activeClickableMenu == null)
            {
                return;
            }

            // scrolling related widgets
            if (DownArrow.containsPoint(x, y) && LowestVisibleIndex < MaxScrollIndex()) // not bottom of list
            {
                DownArrowPressed();
                Game1.playSound("shwip");
            }
            else if (UpArrow.containsPoint(x, y) && LowestVisibleIndex > 0) // not top of list
            {
                UpArrowPressed();
                Game1.playSound("shwip");
            }
            else if (ScrollBar.containsPoint(x, y))
            {
                IsScrolling = true;
            }
            else if (!DownArrow.containsPoint(x, y) &&
                     x > xPositionOnScreen + width &&
                     (x < xPositionOnScreen + width + 128 &&
                      y > yPositionOnScreen) &&
                     y < yPositionOnScreen + height)
            {
                IsScrolling = true;
                leftClickHeld(x, y);
                releaseLeftClick(x, y);
            }

            // play or stop buttons
            else if (PlayButton.containsPoint(x, y) && SelectedIndex >= 0)
            {
                PlayButtonPressed();
                Game1.playSound("select");
            }
            else if (StopButton != null && StopButton.containsPoint(x, y))
            {
                StopButtonPressed();
                Game1.playSound("select");
            }
            // and now random button
            else if (RandomButton != null && RandomButton.containsPoint(x, y))
            {
                RandomButtonPressed();
                Game1.playSound("select");
            }

            // option select (give 'em the mixup)
            else
            {
                // first tabs
                for (int i = 0; i < SortTabs.Count; ++i)
                {
                    ClickableComponent sort_tab = SortTabs[i];
                    if (sort_tab.containsPoint(x, y))
                    {
                        SelectedTab = i;
                        SortOptions();
                        RepositionTabs();
                        UpdateVisibleOptions();
                        SetScrollBarToLowestVisibleIndex();
                        Game1.playSound("shwip");
                    }
                }
                // then actual options
                for (int i = 0; i < VisibleOptions.Count; ++i)
                {
                    ClickableComponent visible_option = VisibleOptions[i];
                    if (visible_option.containsPoint(x, y))
                    {
                        // repeat selection
                        if (LowestVisibleIndex + i == SelectedIndex)
                        {
                            //Monitor.Log("Playing a song: " + Options[SelectedIndex]);
                            if (visible_option.name != Options[SelectedIndex])
                            {
                                Monitor.Log("The song on the button does not match the one being played!", LogLevel.Error);
                            }
                            PlayButtonPressed();
                            Game1.playSound("select");
                        }

                        // new selection
                        else
                        {
                            SelectedIndex = LowestVisibleIndex + i;
                            Game1.playSound("shiny4");
                        }
                    }
                }
            }
        }
コード例 #25
0
        /// <summary>Draw the menu to the screen.</summary>
        /// <param name="b">The sprite batch.</param>
        public override void draw(SpriteBatch b)
        {
            // Implementation derived from ChooseFromListMenu

            // from ShopMenu: draw menuBackground if enabled
            if (Game1.options.showMenuBackground)
            {
                base.drawBackground(b);
            }
            else
            {
                b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.4f); // 0.4 is default(?); used in GameMenu
            }

            // draw menu box
            drawTextureBox(
                b,
                xPositionOnScreen,
                yPositionOnScreen,
                width,
                height,
                Color.White);

            // draw options' submenu box
            drawTextureBox(
                b,
                Game1.mouseCursors,
                new Rectangle(384, 373, 18, 18),    // shopMenu's nail corners
                VisibleOptionsXPositionOnScreen,
                VisibleOptionsYPositionOnScreen,
                _longestNameWidth + _textureBoxBorderWidth * 2,
                _visibleOptionsHeight + _textureBoxBorderWidth * 2,
                Color.White,
                4f,
                false);

            // draw menu title
            StardewValley.BellsAndWhistles.SpriteText.drawStringWithScrollCenteredAt(
                b,
                Game1.content.LoadString(
                    "Strings\\UI:JukeboxMenu_Title"),
                xPositionOnScreen + width / 2,
                yPositionOnScreen - _spacingPixels);

            // draw "Currently Playing:"
            String cur_play = GetTranslation("BetterJukeboxMenu:Currently_Playing");

            Utility.drawTextWithShadow(
                b,
                cur_play,
                Game1.dialogueFont,
                new Vector2(
                    xPositionOnScreen + width / 2 - Game1.dialogueFont.MeasureString(cur_play).X / 2f,
                    yPositionOnScreen + _spacingPixels),
                Game1.textColor);

            // draw the name of the active song
            String song_name;

            if (PlayingIndex > -1)
            {
                song_name = Utility.getSongTitleFromCueName(Options[PlayingIndex]);
            }
            else
            {
                if (IsRandom)
                {
                    song_name = Utility.getSongTitleFromCueName(Game1.player.currentLocation.randomMiniJukeboxTrack.Value);
                }
                else
                {
                    song_name = Utility.getSongTitleFromCueName("turn_off");
                }
            }

            Utility.drawTextWithShadow(
                b,
                song_name,
                Game1.dialogueFont,
                new Vector2(
                    xPositionOnScreen + width / 2 - Game1.dialogueFont.MeasureString(song_name).X / 2f,
                    yPositionOnScreen + _spacingPixels + Game1.dialogueFont.MeasureString(cur_play).Y * 1.25f),
                Game1.textColor);

            //StardewValley.BellsAndWhistles.SpriteText.drawStringHorizontallyCenteredAt(
            //    b,
            //    song_name,
            //    xPositionOnScreen + width / 2,
            //    yPositionOnScreen + _spacingPixels * 3 / 2 + (int) Game1.dialogueFont.MeasureString(cur_play).Y);

            // draw the list of VisibleOptions
            // derived from forSale section of ShopMenu.draw()
            for (int i = 0; i < VisibleOptions.Count; ++i)
            {
                // don't draw if LowestVisibleIndex is incorrect
                if (LowestVisibleIndex + i >= Options.Count)
                {
                    Monitor.LogOnce("Ceased drawing options because LowestVisibleIndex is incorrectly high!", LogLevel.Error);
                    break;  // not continue because will continue to be incorrect
                }

                ClickableComponent button = VisibleOptions[i];

                // determining button colour; priority: selected - hovered (and not dragging scrollbar) - not hovered
                Color button_colour;
                if (LowestVisibleIndex + i == SelectedIndex)
                {
                    button_colour = Color.Peru; // probably looks fine
                }
                else if (button.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()) && !IsScrolling)
                {
                    button_colour = Color.Wheat;
                }
                else
                {
                    button_colour = Color.White;
                }

                // drawing the box around each option
                drawTextureBox(
                    b,
                    Game1.mouseCursors,
                    new Rectangle(384, 396, 15, 15),            // box shape w/ elaborate corners
                    button.bounds.X,
                    button.bounds.Y,
                    button.bounds.Width,
                    button.bounds.Height,
                    button_colour,
                    4f,
                    false);

                // drawing option name
                string cue_name = Options[LowestVisibleIndex + i];

                song_name = Utility.getSongTitleFromCueName(cue_name);

                if (_showInternalId)    // left align song_name, right align cue_name
                {
                    if (cue_name.Equals(song_name))
                    {
                    }
                    else
                    {
                        Utility.drawTextWithShadow(
                            b,
                            song_name,
                            Game1.dialogueFont,
                            new Vector2(
                                button.bounds.X + _textureBoxBorderWidth,
                                button.bounds.Y + button.bounds.Height / 2 - Game1.dialogueFont.MeasureString(song_name).Y / 2f),
                            Game1.textColor);
                    }

                    Utility.drawTextWithShadow(
                        b,
                        cue_name,
                        Game1.dialogueFont,
                        new Vector2(
                            button.bounds.X + button.bounds.Width - Game1.dialogueFont.MeasureString(cue_name).X - _textureBoxBorderWidth,
                            button.bounds.Y + button.bounds.Height / 2 - Game1.dialogueFont.MeasureString(cue_name).Y / 2f),
                        Game1.textColor);
                }
                else // center text
                {
                    Utility.drawTextWithShadow(
                        b,
                        song_name,
                        Game1.dialogueFont,
                        new Vector2(
                            button.bounds.X + button.bounds.Width / 2 - Game1.dialogueFont.MeasureString(song_name).X / 2f,
                            button.bounds.Y + button.bounds.Height / 2 - Game1.dialogueFont.MeasureString(song_name).Y / 2f),
                        Game1.textColor);
                }
            }

            // draw the play and stop buttons
            PlayButton.draw(b);
            StopButton?.draw(b);
            // and the random button
            if (RandomButton != null)
            {
                RandomButton.draw(b);
                // draw check/cross
                if (IsRandom)
                {
                    b.Draw(ChatBox.emojiTexture,
                           new Vector2(RandomButton.bounds.X + 6 * 4,
                                       RandomButton.bounds.Y + 6 * 4),
                           new Rectangle(117, 81, 9, 9),
                           Color.White,
                           0f,
                           Vector2.Zero,
                           4f,
                           SpriteEffects.None,
                           0.99f);
                }
                else
                {
                    b.Draw(ChatBox.emojiTexture,
                           new Vector2(RandomButton.bounds.X + 6 * 4,
                                       RandomButton.bounds.Y + 6 * 4),
                           new Rectangle(45, 81, 9, 9),
                           Color.White,
                           0f,
                           Vector2.Zero,
                           4f,
                           SpriteEffects.None,
                           0.99f);
                }
            }

            // draw the SortTabs
            for (int i = 0; i < SortTabs.Count; ++i)
            {
                SortTabs[i].draw(b);
            }

            // draw the scrolling elements
            if (VisibleOptions.Count >= Options.Count)
            {
            }
            else
            {
                UpArrow.draw(b);
                DownArrow.draw(b);

                // copied from ShopMenu.draw()
                drawTextureBox(
                    b,
                    Game1.mouseCursors,
                    new Rectangle(403, 383, 6, 6),
                    ScrollBarRunner.X,
                    ScrollBarRunner.Y,
                    ScrollBarRunner.Width,
                    ScrollBarRunner.Height,
                    Color.White,
                    4f);
                ScrollBar.draw(b);
            }

            // from ShopMenu: draw tooltip (hover)
            if (!HoverText.Equals(""))
            {
                IClickableMenu.drawHoverText(b, HoverText, Game1.smallFont);
            }

            // draw the upper right close button
            base.draw(b);

            // draw cursor
            drawMouse(b);
        }
コード例 #26
0
ファイル: Menus.cs プロジェクト: somnomania/smapi-mod-dump
 public override void receiveLeftClick(int x,
                                       int y,
                                       bool playSound = false)
 {
     base.receiveLeftClick(x,
                           y,
                           false);
     if (!GeodeSpot.containsPoint(x,
                                  y))
     {
         return;
     }
     if (heldItem != null &&
         (heldItem.Name.Contains("Geode") || heldItem.ParentSheetIndex == 275) &&
         GeodeAnimationTimer <= 0)
     {
         if (Game1.player.freeSpotsInInventory() > 1 ||
             Game1.player.freeSpotsInInventory() == 1 && heldItem.Stack == 1)
         {
             GeodeSpot.item = heldItem.getOne();
             --heldItem.Stack;
             if (heldItem.Stack <= 0)
             {
                 heldItem = null;
             }
             GeodeAnimationTimer = 300;
             Game1.playSound("stoneStep");
             _clint.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>
             {
                 new FarmerSprite.AnimationFrame(8,
                                                 24),
                 new FarmerSprite.AnimationFrame(9,
                                                 24),
                 new FarmerSprite.AnimationFrame(10,
                                                 24),
                 new FarmerSprite.AnimationFrame(11,
                                                 24),
                 new FarmerSprite.AnimationFrame(12,
                                                 24),
                 new FarmerSprite.AnimationFrame(8,
                                                 24)
             });
             _clint.loop = false;
         }
         else
         {
             descriptionText  = Game1.content.LoadString("Strings\\UI:GeodeMenu_InventoryFull");
             wiggleWordsTimer = 500;
             _alertTimer      = 800;
         }
     }
     else
     {
         if (Game1.player.Money >= 0)
         {
             return;
         }
         wiggleWordsTimer = 500;
         Game1.dayTimeMoneyBox.moneyShakeTimer = 1000;
     }
 }
コード例 #27
0
ファイル: CalicoJack.cs プロジェクト: osheroff/stardew-valley
 public void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (playButtonsActive() && bustTimer <= 0)
     {
         if (hit.bounds.Contains(x, y))
         {
             int playertotal = 0;
             foreach (int[] j in playerCards)
             {
                 playertotal += j[0];
             }
             int nextCard = r.Next(1, 10);
             int distance = 21 - playertotal;
             if (distance > 1 && distance < 6 && r.NextDouble() < (double)(1f / (float)distance))
             {
                 nextCard = ((r.NextDouble() < 0.5) ? distance : (distance - 1));
             }
             playerCards.Add(new int[2]
             {
                 nextCard,
                 400
             });
             Game1.playSound("shwip");
             int total = 0;
             foreach (int[] i in playerCards)
             {
                 total += i[0];
             }
             if (total == 21)
             {
                 bustTimer = 1000;
             }
             else if (total > 21)
             {
                 bustTimer = 1000;
             }
         }
         if (stand.bounds.Contains(x, y))
         {
             dealerTurnTimer = 1000;
             Game1.playSound("coin");
         }
     }
     else if (showingResultsScreen)
     {
         if (playerWon && doubleOrNothing.containsPoint(x, y))
         {
             Game1.currentMinigame = new CalicoJack(currentBet * 2, highStakes);
             Game1.playSound("bigSelect");
         }
         if (Game1.player.clubCoins >= currentBet && playAgain.containsPoint(x, y))
         {
             Game1.currentMinigame = new CalicoJack(-1, highStakes);
             Game1.playSound("smallSelect");
         }
         if (quit.containsPoint(x, y))
         {
             Game1.currentMinigame = null;
             Game1.playSound("bigDeSelect");
         }
     }
 }
コード例 #28
0
        public override void performHoverAction(int x, int y)
        {
            base.performHoverAction(x, y);

            if (ChildHasFocus())
            {
                _childMenu.performHoverAction(x, y);
                return;
            }

            _moneyButtonVisible = moneyButton.containsPoint(x, y);

            if (_moneyButtonVisible)
            {
                HoverText = Translation.Get("ui.tasks.moneybutton.hover");
            }
            else if (moneyBox.containsPoint(x, y))
            {
                HoverText = Translation.Get("ui.tasks.moneybox." + (_config.MoneyViewNetWealth ? "hover1" : "hover0"));
            }
            else if (addTaskButton.containsPoint(x, y))
            {
                HoverText = Translation.Get("ui.tasks.addbutton.hover");
            }

            IReadOnlyList <ITask> tasks = _taskManager.Tasks;
            int scrollOffset            = scrollComponent.ScrollAmount / scrollComponent.ScrollDistance;

            for (int i = 0; i < taskEntries.Count; i++)
            {
                TaskEntryComponent entry = taskEntries[i];

                if (entry.TryHover(x, y) && i + scrollOffset < tasks.Count && !_dragging)
                {
                    tasks[i + scrollOffset].MarkAsViewed();

                    if (!entry.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()))
                    {
                        Game1.playSound("Cowboy_gunshot");
                    }

                    if (HoverText.Length == 0)
                    {
                        if (entry.checkbox.containsPoint(x, y) && !tasks[i + scrollOffset].Active)
                        {
                            HoverText = Translation.Get("ui.tasks.renewbutton.hover");
                        }
                        else if (entry.removeButton.containsPoint(x, y))
                        {
                            HoverText = Translation.Get("ui.tasks.removebutton.hover");
                        }
                        else if (entry.IsNameTruncated() && entry.TimeHovering() > 1.0)
                        {
                            HoverText = tasks[i + scrollOffset].Name;
                        }
                    }
                }
            }

            moneyButton.tryHover(x, y);
            addTaskButton.tryHover(x, y);
        }
コード例 #29
0
        // private IReflectedField<int> something;
        //public static IReflectedField<int> curBet;
        public static void receiveLeftClick(int x, int y, bool playSount = true)
        {
            if (Game1.currentMinigame != null && "CalicoJack".Equals(Game1.currentMinigame.GetType().Name))
            {
                //Game1.currentMinigame = (IMinigame)new CalicoJack(curBet, highStakes);
                Type minigameType = Game1.currentMinigame.GetType();
                //Grab current bet;
                List <int[]> playerCards     = new List <int[]>();//helper.Reflection.GetField<List<int[]>>(Game1.currentMinigame, "playerCards").GetValue();
                int          dealerTurnTimer = -1;
                //List<int[]> dealerCards = //helper.Reflection.GetField<List<int[]>>(Game1.currentMinigame, "dealerCards").GetValue();
                int                curBet                    = CasinoHelper.Modhelper.Reflection.GetField <int>(Game1.currentMinigame, "currentBet").GetValue();
                Random             r                         = CasinoHelper.Modhelper.Reflection.GetField <Random>(Game1.currentMinigame, "r").GetValue();
                int                startTimer                = CasinoHelper.Modhelper.Reflection.GetField <int>(Game1.currentMinigame, "startTimer").GetValue();
                int                bustTimer                 = CasinoHelper.Modhelper.Reflection.GetField <int>(Game1.currentMinigame, "bustTimer").GetValue();
                ClickableComponent hit                       = CasinoHelper.Modhelper.Reflection.GetField <ClickableComponent>(Game1.currentMinigame, "hit").GetValue();
                ClickableComponent stand                     = CasinoHelper.Modhelper.Reflection.GetField <ClickableComponent>(Game1.currentMinigame, "stand").GetValue();
                ClickableComponent doubleOrNothing           = CasinoHelper.Modhelper.Reflection.GetField <ClickableComponent>(Game1.currentMinigame, "doubleOrNothing").GetValue();
                ClickableComponent playAgain                 = CasinoHelper.Modhelper.Reflection.GetField <ClickableComponent>(Game1.currentMinigame, "playAgain").GetValue();
                ClickableComponent quit                      = CasinoHelper.Modhelper.Reflection.GetField <ClickableComponent>(Game1.currentMinigame, "quit").GetValue();
                ClickableComponent currentlySnappedComponent = CasinoHelper.Modhelper.Reflection.GetField <ClickableComponent>(Game1.currentMinigame, "currentlySnappedComponent").GetValue();
                bool               showingResultsScreen      = CasinoHelper.Modhelper.Reflection.GetField <bool>(Game1.currentMinigame, "showingResultsScreen").GetValue();
                bool               playerWon                 = CasinoHelper.Modhelper.Reflection.GetField <bool>(Game1.currentMinigame, "playerWon").GetValue();
                bool               highStakes                = CasinoHelper.Modhelper.Reflection.GetField <bool>(Game1.currentMinigame, "highStakes").GetValue();
                string             coinBuffer                = CasinoHelper.Modhelper.Reflection.GetField <string>(Game1.currentMinigame, "coinBuffer").GetValue();

                //if (startTimer <= 0 && bustTimer <= 0)
                // showingResultsScreen = !showingResultsScreen;

                if (!showingResultsScreen && bustTimer <= 0)
                {
                    if (hit.bounds.Contains(x, y))
                    {
                        playerCards.Add(new int[2] {
                            r.Next(1, 10), 400
                        });
                        Game1.playSound("shwip");

                        int num = 0;
                        foreach (int[] playerCard in playerCards)
                        {
                            num += playerCard[0];
                        }
                        if (num == 21)
                        {
                            bustTimer = 1000;
                        }
                        else if (bustTimer > 21)
                        {
                            bustTimer = 1000;
                        }
                        Game1.playSound("coin");
                        CasinoHelper.Modhelper.Reflection.GetField <int>(Game1.currentMinigame, "bustTimer").SetValue(bustTimer);
                    }
                    if (stand.bounds.Contains(x, y))
                    {
                        return;
                    }
                    dealerTurnTimer = 1000;
                    CasinoHelper.Modhelper.Reflection.GetField <int>(Game1.currentMinigame, "dealerTurnTimer").SetValue(dealerTurnTimer);
                }
                else
                {
                    if (!showingResultsScreen)
                    {
                        return;
                    }
                    if (playerWon && doubleOrNothing.containsPoint(x, y))
                    {
                        Game1.currentMinigame = (IMinigame) new CalicoJack(curBet * 2, highStakes);
                        Game1.playSound("bigSelect");
                    }
                    if (Game1.player.clubCoins >= curBet && playAgain.containsPoint(x, y))
                    {
                        Game1.currentMinigame = (IMinigame) new CalicoJack(-1, highStakes);
                        Game1.playSound("smallSelect");
                    }
                    if (!quit.containsPoint(x, y))
                    {
                        return;
                    }
                    Game1.currentMinigame = (IMinigame)null;
                    Game1.playSound("bigDeSelect");
                }
            }
        }
コード例 #30
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            base.receiveLeftClick(x, y, playSound);
            lastTick = Game1.ticks;

            if (Game1.activeClickableMenu == null)
            {
                return;
            }

            if (isCheckingOut)
            {
                if (cancelButton.containsPoint(x, y))
                {
                    isCheckingOut = false;
                    Game1.playSound("cancel");
                }
                else if (nextDayShippingButton.containsPoint(x, y))
                {
                    isNextDayShipping = true;
                    Game1.playSound("select");
                }
                else if (twoDayShippingButton.containsPoint(x, y))
                {
                    isNextDayShipping = false;
                    Game1.playSound("select");
                }
                else if (purchaseButton.containsPoint(x, y))
                {
                    if (canAffordOrder)
                    {
                        // Close this menu
                        base.exitThisMenu();

                        // Create mail order
                        if (JojaMail.CreateMailOrder(Game1.player, isNextDayShipping ? 1 : 2, itemsInCart.Keys.Select(i => i as Item).ToList()))
                        {
                            this.monitor.Log("Order placed via JojaMail!", LogLevel.Debug);

                            // Display order success dialog
                            if (isNextDayShipping)
                            {
                                Game1.player.Money        = Game1.player.Money - (itemsInCart.Keys.Sum(i => i.Stack * itemsInCart[i][0]) + (itemsInCart.Keys.Sum(i => i.Stack * itemsInCart[i][0]) / nextDayShippingFee));
                                Game1.activeClickableMenu = new DialogueBox("Your order has been placed! ^It will arrive tomorrow.");
                            }
                            else
                            {
                                Game1.player.Money        = Game1.player.Money - itemsInCart.Keys.Sum(i => i.Stack * itemsInCart[i][0]);
                                Game1.activeClickableMenu = new DialogueBox("Your order has been placed! ^It will arrive in 2 days.");
                            }

                            Game1.playSound("moneyDial");
                            Game1.dayTimeMoneyBox.moneyShakeTimer = 1000;
                        }
                        else
                        {
                            this.monitor.Log("Issue ordering items, failed to dispatch JojaMail!", LogLevel.Error);

                            // Display order error dialog
                            Game1.activeClickableMenu = new DialogueBox($"Order failed to place! Please try again later.");
                        }
                    }
                    else
                    {
                        // Shake money bag
                        Game1.dayTimeMoneyBox.moneyShakeTimer = 2000;
                        Game1.playSound("cancel");
                    }
                }

                return;
            }

            if (this.scrollBar.containsPoint(x, y))
            {
                this.scrolling = true;
            }
            else if (randomSaleButton.containsPoint(x, y))
            {
                // Move the forSaleButtons until the randomSaleItem is displayed
                for (this.currentItemIndex = 0; this.currentItemIndex < Math.Max(0, this.forSale.Count - buttonScrollingOffset); currentItemIndex++)
                {
                    bool matchedItem = false;

                    for (int i = 0; i < this.forSaleButtons.Count; i++)
                    {
                        int index = (this.currentItemIndex * 2) + i;

                        if (this.forSale[index] == randomSaleItem)
                        {
                            matchedItem = true;
                            break;
                        }
                    }

                    if (matchedItem)
                    {
                        break;
                    }
                }

                this.setScrollBarToCurrentIndex();
                this.updateSaleButtonNeighbors();
            }
            else if ((checkoutButton.containsPoint(x, y) || cartQuantity.containsPoint(x, y)) && itemsInCart.Count > 0)
            {
                this.monitor.Log("Starting checkout...");
                isCheckingOut = true;
            }
            else
            {
                for (int i = 0; i < this.forSaleButtons.Count; i++)
                {
                    if ((this.currentItemIndex * 2) + i >= this.forSale.Count || !this.forSaleButtons[i].containsPoint(x, y))
                    {
                        continue;
                    }

                    int index = (this.currentItemIndex * 2) + i;
                    if (this.forSale[index] != null)
                    {
                        // Skip if we're at max for the cart size
                        if (itemsInCart.Count >= maxUniqueCartItems && !itemsInCart.ContainsKey(this.forSale[index]))
                        {
                            continue;
                        }

                        // DEBUG: monitor.Log($"{index} | {this.forSale[index].Name}");
                        int toBuy = (!Game1.oldKBState.IsKeyDown(Keys.LeftShift)) ? 1 : 5;
                        toBuy = Math.Min(toBuy, this.forSale[index].maximumStackSize());

                        // Skip if we're trying to buy more then what we can in a stack via mail
                        if (itemsInCart.ContainsKey(this.forSale[index]) && (itemsInCart[this.forSale[index]][1] >= this.forSale[index].maximumStackSize() || itemsInCart[this.forSale[index]][1] + toBuy > this.forSale[index].maximumStackSize()))
                        {
                            continue;
                        }

                        if (this.tryToPurchaseItem(this.forSale[index], toBuy, x, y, index))
                        {
                            DelayedAction.playSoundAfterDelay("coin", 100);
                        }
                        else
                        {
                            Game1.dayTimeMoneyBox.moneyShakeTimer = 1000;
                            Game1.playSound("cancel");
                        }
                    }

                    this.updateSaleButtonNeighbors();
                    this.setScrollBarToCurrentIndex();
                    return;
                }
            }
        }