Ejemplo n.º 1
0
        public UIRecipeProgress(int index, Recipe recipe, int order)
        {
            this.order = order;
            UIMockRecipeSlot create = new UIMockRecipeSlot(RecipeCatalogueUI.instance.recipeSlots[index]);

            create.Recalculate();
            create.Left.Set(-create.Width.Pixels, 1f);
            var b = create.GetOuterDimensions();

            Append(create);
            int x = 0;

            x += (int)b.Width + 2;
            for (int j = 0; j < Recipe.maxRequirements; j++)
            {
                if (recipe.requiredItem[j].type > 0)
                {
                    Item item = new Item();
                    item.SetDefaults(recipe.requiredItem[j].type);
                    UITrackIngredientSlot ingredient = new UITrackIngredientSlot(item, recipe.requiredItem[j].stack);
                    x += (int)b.Width + 2;
                    ingredient.Left.Set(-x, 1f);
                    Append(ingredient);
                }
            }
            Height.Pixels = b.Height;
            Width.Pixels  = x + 12;
        }
Ejemplo n.º 2
0
        public UIRecipeProgress(int index, Recipe recipe, int order, int owner)
        {
            if (drawPlayerHeadMethodInfo == null)
            {
                drawPlayerHeadMethodInfo = typeof(Main).GetMethod("DrawPlayerHead", BindingFlags.Instance | BindingFlags.NonPublic);
            }

            playerBackGroundTexture = TextureManager.Load("Images/UI/PlayerBackground");
            this.order = order;
            this.owner = owner;
            // TODO: Implement Craft Path for teammates.
            UIMockRecipeSlot create = new UIMockRecipeSlot(RecipeCatalogueUI.instance.recipeSlots[index], owner != Main.myPlayer ? .5f : 0.75f);

            create.Recalculate();
            create.Left.Set(-create.Width.Pixels - (owner != Main.myPlayer ? 23 : 0), 1f);
            var b = create.GetOuterDimensions();

            Append(create);
            int x = (owner != Main.myPlayer ? 23 : 0);

            x += (int)b.Width + 2;
            for (int j = 0; j < Recipe.maxRequirements; j++)
            {
                if (recipe.requiredItem[j].type > 0)
                {
                    Item item = new Item();
                    item.SetDefaults(recipe.requiredItem[j].type);
                    UITrackIngredientSlot ingredient = new UITrackIngredientSlot(item, recipe.requiredItem[j].stack, recipe, j, owner, owner != Main.myPlayer ? .5f : 0.75f);
                    x += (int)b.Width + 2;
                    ingredient.Left.Set(-x, 1f);

                    RecipeCatalogueUI.OverrideForGroups(recipe, ingredient.item);

                    Append(ingredient);
                }
            }
            Height.Pixels = b.Height;
            Width.Pixels  = x + 12;
        }