示例#1
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     foreach (ClickableTextureComponent component in recipeComponents)
     {
         if (!component.bounds.Contains(x, y) || !scrollView.Contains(x, y))
         {
             continue;
         }
         try
         {
             int index = Convert.ToInt32(_recipeMetadata[component.name].Split(' ')[2]);
             if (index >= 2000)
             {
                 Game1.player.addItemToInventoryBool(new Hat(index - 2000));
                 continue;
             }
             Clothing o = new Clothing(index);
             if (_recipeColors.ContainsKey(component.name))
             {
                 o.Dye(_recipeColors[component.name], 1f);
             }
             Game1.player.addItemToInventoryBool(o);
         }
         catch (Exception)
         {
         }
     }
     if (okButton.containsPoint(x, y))
     {
         exitThisMenu();
     }
 }