예제 #1
0
 public override void Click(UIMouseEvent evt)
 {
     slot.Click(evt);
     if (!Main.keyState.IsKeyDown(Main.FavoriteKey))
     {
         if ((slot.craftPathCalculated || slot.craftPathsCalculated) && slot.craftPaths.Count > 0)
         {
             RecipeBrowserUI.instance.tabController.SetPanel(RecipeBrowserUI.Craft);
             CraftUI.instance.SetRecipe(slot.index);
             if (!RecipeBrowserUI.instance.ShowRecipeBrowser)
             {
                 RecipeBrowserUI.instance.ShowRecipeBrowser = true;
             }
         }
         else
         {
             // inherited. RecipeCatalogueUI.instance.SetRecipe(slot.index);
             RecipeBrowserUI.instance.tabController.SetPanel(RecipeBrowserUI.RecipeCatalogue);
             RecipeCatalogueUI.instance.recipeGrid.Goto(delegate(UIElement element)
             {
                 UIRecipeSlot itemSlot = element as UIRecipeSlot;
                 return(itemSlot == slot);
             }, true);
             if (!RecipeBrowserUI.instance.ShowRecipeBrowser)
             {
                 RecipeBrowserUI.instance.ShowRecipeBrowser = true;
             }
         }
     }
 }
예제 #2
0
        public override int CompareTo(object obj)
        {
            UIRecipeSlot other = obj as UIRecipeSlot;

            if (favorited && !other.favorited)
            {
                return(-1);
            }
            if (!favorited && other.favorited)
            {
                return(1);
            }
            if (recentlyDiscovered && !other.recentlyDiscovered)
            {
                return(-1);
            }
            if (!recentlyDiscovered && other.recentlyDiscovered)
            {
                return(1);
            }
            if (favorited && other.favorited)
            {
                return(RecipeBrowserUI.instance.favoritedRecipes.IndexOf(this).CompareTo(RecipeBrowserUI.instance.favoritedRecipes.IndexOf(other)));
            }
            return(index.CompareTo(other.index));
        }
예제 #3
0
 public override void Click(UIMouseEvent evt)
 {
     slot.Click(evt);
     if (!(Main.keyState.IsKeyDown(Main.FavoriteKey) && Main.drawingPlayerChat))
     {
         // inherited. RecipeCatalogueUI.instance.SetRecipe(slot.index);
         RecipeCatalogueUI.instance.recipeGrid.Goto(delegate(UIElement element)
         {
             UIRecipeSlot itemSlot = element as UIRecipeSlot;
             return(itemSlot == slot);
         }, true);
         RecipeBrowserUI.instance.ShowRecipeBrowser = true;
     }
 }
예제 #4
0
 public int CompareToIgnoreIndex(UIRecipeSlot other)
 {
     if (favorited && !other.favorited)
     {
         return(-1);
     }
     if (!favorited && other.favorited)
     {
         return(1);
     }
     if (recentlyDiscovered && !other.recentlyDiscovered)
     {
         return(-1);
     }
     if (!recentlyDiscovered && other.recentlyDiscovered)
     {
         return(1);
     }
     if (favorited && other.favorited)
     {
         return(RecipeBrowserUI.instance.localPlayerFavoritedRecipes.IndexOf(this.index).CompareTo(RecipeBrowserUI.instance.localPlayerFavoritedRecipes.IndexOf(other.index)));
     }
     return(0);
 }
예제 #5
0
 public UIMockRecipeSlot(UIRecipeSlot slot, float scale = 0.75f) : base(slot.item, scale)
 {
     this.slot = slot;
 }