Esempio n. 1
0
 public override void performHoverAction(int x, int y)
 {
     hoverText = "";
     base.performHoverAction(x, y);
     if (questPage == -1)
     {
         for (int i = 0; i < questLogButtons.Count; i++)
         {
             if (pages.Count > 0 && pages[0].Count > i && questLogButtons[i].containsPoint(x, y) && !questLogButtons[i].containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()))
             {
                 Game1.playSound("Cowboy_gunshot");
             }
         }
     }
     else if (_shownQuest.CanBeCancelled() && cancelQuestButton.containsPoint(x, y))
     {
         hoverText = Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11364");
     }
     forwardButton.tryHover(x, y, 0.2f);
     backButton.tryHover(x, y, 0.2f);
     cancelQuestButton.tryHover(x, y, 0.2f);
     if (NeedsScroll())
     {
         upArrow.tryHover(x, y);
         downArrow.tryHover(x, y);
         scrollBar.tryHover(x, y);
         _ = scrolling;
     }
 }
Esempio n. 2
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            base.receiveLeftClick(x, y, playSound);
            if (Game1.activeClickableMenu == null)
            {
                return;
            }
            if (questPage == -1)
            {
                for (int i = 0; i < questLogButtons.Count; i++)
                {
                    if (pages.Count > 0 && pages[currentPage].Count > i && questLogButtons[i].containsPoint(x, y))
                    {
                        Game1.playSound("smallSelect");
                        questPage      = i;
                        _shownQuest    = pages[currentPage][i];
                        _objectiveText = _shownQuest.GetObjectiveDescriptions();
                        _shownQuest.MarkAsViewed();
                        scrollAmount = 0f;
                        SetScrollBarFromAmount();
                        if (Game1.options.SnappyMenus)
                        {
                            currentlySnappedComponent = getComponentWithID(102);
                            currentlySnappedComponent.rightNeighborID = -7777;
                            currentlySnappedComponent.downNeighborID  = (HasMoneyReward() ? 103 : (_shownQuest.CanBeCancelled() ? 104 : (-1)));
                            snapCursorToCurrentSnappedComponent();
                        }
                        return;
                    }
                }
                if (currentPage < pages.Count - 1 && forwardButton.containsPoint(x, y))
                {
                    nonQuestPageForwardButton();
                    return;
                }
                if (currentPage > 0 && backButton.containsPoint(x, y))
                {
                    nonQuestPageBackButton();
                    return;
                }
                Game1.playSound("bigDeSelect");
                exitThisMenu();
                return;
            }
            Quest quest = _shownQuest as Quest;

            if (questPage != -1 && _shownQuest.ShouldDisplayAsComplete() && _shownQuest.HasMoneyReward() && rewardBox.containsPoint(x, y))
            {
                Game1.player.Money += _shownQuest.GetMoneyReward();
                Game1.playSound("purchaseRepeat");
                _shownQuest.OnMoneyRewardClaimed();
            }
            else if (questPage != -1 && quest != null && !quest.completed && (bool)quest.canBeCancelled && cancelQuestButton.containsPoint(x, y))
            {
                quest.accepted.Value = false;
                if (quest.dailyQuest.Value && quest.dayQuestAccepted.Value == Game1.Date.TotalDays)
                {
                    Game1.player.acceptedDailyQuest.Set(newValue: false);
                }
                Game1.player.questLog.Remove(quest);
                pages[currentPage].RemoveAt(questPage);
                questPage = -1;
                Game1.playSound("trashcan");
                if (Game1.options.SnappyMenus && currentPage == 0)
                {
                    currentlySnappedComponent = getComponentWithID(0);
                    snapCursorToCurrentSnappedComponent();
                }
            }
            else if (!NeedsScroll() || backButton.containsPoint(x, y))
            {
                exitQuestPage();
            }
            if (NeedsScroll())
            {
                if (downArrow.containsPoint(x, y) && scrollAmount < _contentHeight - _scissorRectHeight)
                {
                    DownArrowPressed();
                    Game1.playSound("shwip");
                }
                else if (upArrow.containsPoint(x, y) && scrollAmount > 0f)
                {
                    UpArrowPressed();
                    Game1.playSound("shwip");
                }
                else if (scrollBar.containsPoint(x, y))
                {
                    scrolling = true;
                }
                else if (scrollBarBounds.Contains(x, y))
                {
                    scrolling = true;
                }
                else if (!downArrow.containsPoint(x, y) && x > xPositionOnScreen + width && x < xPositionOnScreen + width + 128 && y > yPositionOnScreen && y < yPositionOnScreen + height)
                {
                    scrolling = true;
                    leftClickHeld(x, y);
                    releaseLeftClick(x, y);
                }
            }
        }