예제 #1
0
        public void PopulateList()
        {
            var imprint = new InfusionRecipieEntry(ItemType <AstralImprint>());

            imprint.Width.Set(100, 0);
            imprint.Height.Set(32, 0);
            imprint.Left.Set(12, 0);
            options.Add(imprint);
        }
예제 #2
0
        public void PopulateList() //TODO: Decide if available listing should be ability-specific? with ability specific slates?
        {
            foreach (int n in infusionOptions)
            {
                var imprint = new InfusionRecipieEntry(n);
                imprint.Width.Set(100, 0);
                imprint.Height.Set(28, 0);
                imprint.Left.Set(12, 0);
                options.Add(imprint);
            }

            options._items.Sort((a, b) => (a as InfusionRecipieEntry).output.Visible ? 0 : 1);
        }
예제 #3
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            previewPlayer.Update();
            previewPlayer.framerate = 2;
            spriteBatch.Draw(previewPlayer.CurrentFrame, new Rectangle((int)basePos.X + 2, (int)basePos.Y + 190, 194, 194), Color.White);


            var tex = GetTexture(AssetDirectory.GUI + "InfusionBack");

            spriteBatch.Draw(tex, basePos, Color.White);

            Constrain();
            basePos = new Vector2(800, 200);
            Recalculate();

            if (selected != null)
            {
                Vector2 pos = basePos + new Vector2(10, 60);
                foreach (var objective in selected.output.objectives)
                {
                    pos.Y += objective.DrawTextAndBar(spriteBatch, pos);
                }

                spriteBatch.DrawString(Main.fontItemStack, Helpers.Helper.WrapString(selected.output.item.ToolTip.GetLine(0), 140, Main.fontItemStack, 0.8f), basePos + new Vector2(10, 410), Color.White, 0, Vector2.Zero, 0.8f, 0, 0);
            }

            if (inSlot.item != null && inSlot.item.IsAir)
            {
                options.Clear();
                selected = null;
            }

            if (crafting)
            {
                craftTime++;

                SpawnParticles();

                if (craftTime >= 60)
                {
                    inSlot.item.TurnToAir();
                    outSlot.item = selected.output.item.Clone();
                    craftTime    = 0;
                    crafting     = false;
                }
            }

            particles.DrawParticles(spriteBatch);

            base.Draw(spriteBatch);
        }
예제 #4
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (new Rectangle((int)(basePos.X), (int)(basePos.Y), 384, 478).Contains(Main.MouseScreen.ToPoint()))
            {
                if (!dragging && Main.mouseLeft)
                {
                    offset   = Main.MouseScreen - basePos;
                    dragging = true;
                }

                Main.LocalPlayer.mouseInterface = true;
            }

            if (dragging)
            {
                basePos = Main.MouseScreen - offset;

                Constrain();
                Recalculate();

                if (!Main.mouseLeft)
                {
                    dragging = false;
                }
            }

            var tex = GetTexture(AssetDirectory.GUI + "InfusionBack");

            spriteBatch.Draw(tex, basePos, Color.White);

            if (selected != null)
            {
                Vector2 pos = basePos + new Vector2(10, 356);

                foreach (var objective in selected.output.objectives)
                {
                    pos.Y += objective.DrawText(spriteBatch, pos);
                }

                spriteBatch.DrawString(Main.fontItemStack, Helpers.Helper.WrapString(selected.output.item.ToolTip.GetLine(0), 130, Main.fontItemStack, 0.8f), basePos + new Vector2(10, 10), Color.White, 0, Vector2.Zero, 0.8f, 0, 0);

                if (previewFade < 1 && !crafting)
                {
                    previewFade += 0.05f;
                }
            }

            if (crafting || selected is null)
            {
                if (previewFade > 0)
                {
                    previewFade -= 0.1f;
                }
            }

            if (inSlot.item != null && inSlot.item.IsAir)
            {
                options.Clear();
                selected = null;
            }

            if (crafting)
            {
                craftTime++;

                SpawnParticles();

                if (craftTime >= 60)
                {
                    inSlot.item.TurnToAir();
                    inSlot.item = selected.output.item.Clone();
                    inSlot.item.SetDefaults(inSlot.item.type);
                    craftTime = 0;
                    crafting  = false;

                    selected = null;
                }
            }

            particles.DrawParticles(spriteBatch);

            base.Draw(spriteBatch);

            previewGif?.Draw(spriteBatch, new Rectangle((int)basePos.X + 2, (int)basePos.Y + 142, 192, 192), Color.White * previewFade);
            previewGif?.UpdateGIF();

            if (previewGif is null && selected != null)
            {
                spriteBatch.Draw(Main.magicPixel, new Rectangle((int)basePos.X + 2, (int)basePos.Y + 142, 192, 192), Color.Black * previewFade);

                for (int k = 0; k < 5; k++)
                {
                    var pos   = basePos + new Vector2(94, 232) + Vector2.UnitX.RotatedBy(Main.GameUpdateCount / 8f + k) * 16;
                    var color = Color.White * ((k + 1) / 5f) * previewFade;
                    spriteBatch.Draw(GetTexture(AssetDirectory.GUI + "charm"), pos, null, color, 0, Vector2.Zero, 0.5f, 0, 0);
                }
            }

            spriteBatch.Draw(GetTexture(AssetDirectory.GUI + "InfusionVideoFrame"), basePos + new Vector2(0, 140), Color.White);
        }