Exemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            if (hasChanges || selected != parent.selectedRecipe || selected == null || !selected.Equals(parent.selectedRecipe))
            {
                selected = parent.selectedRecipe;

                internalGrid.Left.Set(0, 0);
                internalGrid.Top.Set(0, 0);
                internalGrid.Width.Set(this.Width.Pixels - 4, 0);
                internalGrid.Height.Set(this.Height.Pixels - 4, 0);
                internalGrid.Clear();

                float startX = 0;
                float startY = 0;
                if (selected != null)
                {
                    PartsPlayer prt = Main.player[Main.myPlayer].GetModPlayer <PartsPlayer>();
                    foreach (Item part in selected.parts)
                    {
                        PartItemSlot pt = new PartItemSlot(ARareItemSwapJPANs.ItemToTag(part), part.stack);
                        //pt.Left.Set(startX, 0);
                        // pt.Top.Set(startY, 0);

                        /*startX += pt.Width.Pixels + 2;
                         * if (startX + pt.Width.Pixels + 2 > this.Height.Pixels - 4)
                         * {
                         *  startX = 0;
                         *  startY += pt.Height.Pixels + 2;
                         * }*/
                        internalGrid.Add(pt);
                    }
                }
                //  internalGrid.Height.Set(Math.Max(this.Height.Pixels, startY + parent.destroySlot.Height.Pixels + 2), 0);
                internalGrid.Recalculate();
                Recalculate();
                hasChanges = false;
            }
            base.Update(gameTime);
        }