public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (letterviewerSubMenu != null)
     {
         letterviewerSubMenu.receiveLeftClick(x, y);
         return;
     }
     foreach (KeyValuePair <int, ClickableTextureComponent> v in sideTabs)
     {
         if (v.Value.containsPoint(x, y) && currentTab != v.Key)
         {
             Game1.playSound("smallSelect");
             sideTabs[currentTab].bounds.X -= widthToMoveActiveTab;
             currentTab        = Convert.ToInt32(v.Value.name);
             currentPage       = 0;
             v.Value.bounds.X += widthToMoveActiveTab;
         }
     }
     if (currentPage > 0 && backButton.containsPoint(x, y))
     {
         currentPage--;
         Game1.playSound("shwip");
         backButton.scale = backButton.baseScale;
         if (Game1.options.snappyMenus && Game1.options.gamepadControls && currentPage == 0)
         {
             currentlySnappedComponent = forwardButton;
             Game1.setMousePosition(currentlySnappedComponent.bounds.Center);
         }
     }
     if (currentPage < collections[currentTab].Count - 1 && forwardButton.containsPoint(x, y))
     {
         currentPage++;
         Game1.playSound("shwip");
         forwardButton.scale = forwardButton.baseScale;
         if (Game1.options.snappyMenus && Game1.options.gamepadControls && currentPage == collections[currentTab].Count - 1)
         {
             currentlySnappedComponent = backButton;
             Game1.setMousePosition(currentlySnappedComponent.bounds.Center);
         }
     }
     if (currentTab == 7)
     {
         Dictionary <string, string> mail = Game1.content.Load <Dictionary <string, string> >("Data\\mail");
         foreach (ClickableTextureComponent c in collections[currentTab][currentPage])
         {
             if (c.containsPoint(x, y))
             {
                 letterviewerSubMenu = new LetterViewerMenu(mail[c.name.Split(' ')[0]], c.name.Split(' ')[0], fromCollection: true);
             }
         }
     }
 }
示例#2
0
 public override void update(GameTime time)
 {
     base.update(time);
     if (letterviewerSubMenu == null)
     {
         return;
     }
     letterviewerSubMenu.update(time);
     if (letterviewerSubMenu.destroy)
     {
         letterviewerSubMenu = null;
         if (Game1.options.SnappyMenus)
         {
             snapCursorToCurrentSnappedComponent();
         }
     }
 }