public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (GameMenu.forcePreventClose)
     {
         return;
     }
     if (this.downArrow.containsPoint(x, y) && this.currentItemIndex < Math.Max(0, this.options.Count <OptionsElement>() - 7))
     {
         this.downArrowPressed();
         Game1.playSound("shwip");
     }
     else if (this.upArrow.containsPoint(x, y) && this.currentItemIndex > 0)
     {
         this.upArrowPressed();
         Game1.playSound("shwip");
     }
     else if (this.scrollBar.containsPoint(x, y))
     {
         this.scrolling = true;
     }
     else if (!this.downArrow.containsPoint(x, y) && x > this.xPositionOnScreen + this.width && x < this.xPositionOnScreen + this.width + Game1.tileSize * 2 && y > this.yPositionOnScreen && y < this.yPositionOnScreen + this.height)
     {
         this.scrolling = true;
         this.leftClickHeld(x, y);
     }
     if (tooltipButton1.rect.Contains(x, y))
     {
         tooltipButton1.receiveLeftClick(x, y);
         tooltipButton2.greyOut();
         tooltipButton3.greyOut();
     }
     else if (tooltipButton2.rect.Contains(x, y))
     {
         tooltipButton2.receiveLeftClick(x, y);
         tooltipButton1.greyOut();
         tooltipButton3.greyOut();
     }
     else if (tooltipButton3.rect.Contains(x, y))
     {
         tooltipButton3.receiveLeftClick(x, y);
         tooltipButton1.greyOut();
         tooltipButton2.greyOut();
     }
     else if (immersionButton1.rect.Contains(x, y))
     {
         immersionButton1.receiveLeftClick(x, y);
         immersionButton2.greyOut();
         immersionButton3.greyOut();
     }
     else if (immersionButton2.rect.Contains(x, y))
     {
         immersionButton2.receiveLeftClick(x, y);
         immersionButton1.greyOut();
         immersionButton3.greyOut();
     }
     else if (immersionButton3.rect.Contains(x, y))
     {
         immersionButton3.receiveLeftClick(x, y);
         immersionButton1.greyOut();
         immersionButton2.greyOut();
     }
     if (this.okButton.containsPoint(x, y))
     {
         this.okButton.scale -= 0.25f;
         this.okButton.scale  = Math.Max(0.75f, this.okButton.scale);
         (Game1.activeClickableMenu as MapModMenu).exitThisMenu(true);
         Game1.activeClickableMenu = new GameMenu();
         (Game1.activeClickableMenu as GameMenu).changeTab(3);
         MapModMain.menuOpen = 0;
     }
     y -= 15;
     this.currentItemIndex = Math.Max(0, Math.Min(this.options.Count <OptionsElement>() - 7, this.currentItemIndex));
     for (int i = 0; i < this.optionSlots.Count <ClickableComponent>(); i++)
     {
         if (this.optionSlots[i].bounds.Contains(x, y) && this.currentItemIndex + i < this.options.Count <OptionsElement>() && this.options[this.currentItemIndex + i].bounds.Contains(x - this.optionSlots[i].bounds.X, y - this.optionSlots[i].bounds.Y))
         {
             this.options[this.currentItemIndex + i].receiveLeftClick(x - this.optionSlots[i].bounds.X, y - this.optionSlots[i].bounds.Y);
             this.optionsSlotHeld = i;
             break;
         }
     }
 }
Beispiel #2
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            if (GameMenu.forcePreventClose)
            {
                return;
            }

            if (downArrow.containsPoint(x, y) &&
                currentItemIndex < Math.Max(0, options.Count() - 7))
            {
                DownArrowPressed();
                Game1.playSound("shwip");
            }
            else if (upArrow.containsPoint(x, y) && currentItemIndex > 0)
            {
                UpArrowPressed();
                Game1.playSound("shwip");
            }
            else if (scrollBar.containsPoint(x, y))
            {
                scrolling = true;
            }
            else if (!downArrow.containsPoint(x, y) && x > xPositionOnScreen + width &&
                     x < xPositionOnScreen + width + Game1.tileSize * 2 && y > yPositionOnScreen &&
                     y < yPositionOnScreen + height)
            {
                scrolling = true;
                leftClickHeld(x, y);
            }
            else if (immersionButton1.rect.Contains(x, y))
            {
                immersionButton1.receiveLeftClick(x, y);
                immersionButton2.GreyOut();
                immersionButton3.GreyOut();
            }
            else if (immersionButton2.rect.Contains(x, y))
            {
                immersionButton2.receiveLeftClick(x, y);
                immersionButton1.GreyOut();
                immersionButton3.GreyOut();
            }
            else if (immersionButton3.rect.Contains(x, y))
            {
                immersionButton3.receiveLeftClick(x, y);
                immersionButton1.GreyOut();
                immersionButton2.GreyOut();
            }

            if (okButton.containsPoint(x, y))
            {
                okButton.scale -= 0.25f;
                okButton.scale  = Math.Max(0.75f, okButton.scale);
                (Game1.activeClickableMenu as ModMenu).exitThisMenu(false);
                Game1.activeClickableMenu = new GameMenu();
                (Game1.activeClickableMenu as GameMenu).changeTab(3);
            }

            y -= 15;
            currentItemIndex = Math.Max(0, Math.Min(options.Count() - 7, currentItemIndex));
            for (var i = 0; i < optionSlots.Count(); i++)
            {
                if (optionSlots[i].bounds.Contains(x, y) &&
                    currentItemIndex + i < options.Count() && options[currentItemIndex + i]
                    .bounds.Contains(x - optionSlots[i].bounds.X, y - optionSlots[i].bounds.Y))
                {
                    options[currentItemIndex + i]
                    .receiveLeftClick(x - optionSlots[i].bounds.X, y - optionSlots[i].bounds.Y);
                    optionsSlotHeld = i;
                    break;
                }
            }
        }