Пример #1
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (ContainsPoint(Main.MouseScreen))
            {
                Main.LocalPlayer.mouseInterface = true;
            }

            spriteBatch.Draw(Main.magicPixel, GetDimensions().ToRectangle(), Main.magicPixel.Frame(), Color.White * 0.1f);
            Vector2   pos     = GetDimensions().ToRectangle().TopLeft() + new Vector2(20, 50);
            Texture2D backTex = GetTexture("StarlightRiver/Assets/GUI/CodexBack");

            if (ActiveEntry?.RequiresUpgradedBook == true)
            {
                backTex = GetTexture("StarlightRiver/Assets/GUI/CodexBack2");                                            //use a purple back for rift entries
            }
            spriteBatch.Draw(backTex, pos, Color.White * 0.8f);
            ActiveEntry?.Draw(pos + new Vector2(50, 16), spriteBatch); //draws the text of the active entry
            base.Draw(spriteBatch);

            foreach (EntryButton button in (Parent as Codex).ClickableEntries._items)
            {
                if (button.IsMouseHovering && button.Entry.Locked && button.Entry.Hint != null)
                {
                    Utils.DrawBorderString(spriteBatch, Helper.WrapString(button.Entry.Hint, 300, Main.fontDeathText, 0.8f), Main.MouseScreen + Vector2.One * 16, Main.mouseTextColorReal, 0.8f);
                }
            }
        }
Пример #2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            //regular codex open
            if (Open)
            {
                spriteBatch.Draw(ModContent.GetTexture("StarlightRiver/GUI/CodexBack"), new Vector2(Main.screenWidth / 2, Main.screenHeight / 2) - new Vector2(170, 168), Color.White * 0.8f);
                if (ActiveEntry != null)
                {
                    ActiveEntry.Draw(new Vector2(Main.screenWidth / 2, Main.screenHeight / 2) - new Vector2(120, 150), spriteBatch);
                }

                BackButton.Left.Set(0, 2);
                CraftButton.Left.Set(-160, 0.5f);
                QuerySlot.Left.Set(0, 2);
            }
            //RC open
            else if (Crafting)
            {
                Texture2D tex = (ActiveRecipe == null) ? ModContent.GetTexture("StarlightRiver/GUI/RecipeBack") : ModContent.GetTexture("StarlightRiver/GUI/RecipeBackDark");
                spriteBatch.Draw(tex, new Vector2(Main.screenWidth / 2, Main.screenHeight / 2) - new Vector2(170, 168), Color.White * 0.8f);

                CraftButton.Left.Set(0, 2);
                BackButton.Left.Set(-210, 0.5f);
                QuerySlot.Left.Set(160, 0.5f);
            }
            //Nothing open
            else
            {
                CraftButton.Left.Set(0, 2);
                BackButton.Left.Set(0, 2);
                QuerySlot.Left.Set(0, 2);
            }

            //Draw Bootlegdusts
            foreach (BootlegDust dust in Dust)
            {
                dust.Update();
                dust.Draw(spriteBatch);
            }
            Dust.RemoveAll(dust => dust.time <= 0);

            //Draw actual UI elements
            base.Draw(spriteBatch);

            //Swap the button textures
            if (BookButton.IsMouseHovering || Open || Crafting)
            {
                BookButton.SetImage(ModContent.GetTexture("StarlightRiver/GUI/Book1Open"));
            }
            else
            {
                BookButton.SetImage(ModContent.GetTexture("StarlightRiver/GUI/Book1Closed"));
            }

            //Glow for new entry
            if (NewEntry)
            {
                spriteBatch.Draw((BookButton.IsMouseHovering || Open || Crafting) ? ModContent.GetTexture("StarlightRiver/GUI/BookGlowOpen") : ModContent.GetTexture("StarlightRiver/GUI/BookGlowClosed"),
                                 BookButton.GetDimensions().ToRectangle().TopLeft() + new Vector2(-1, 0), Color.White * (0.5f + (float)Math.Sin(LegendWorld.rottime * 2) * 0.25f));
            }

            //if locked
            if (Main.LocalPlayer.GetModPlayer <CodexHandler>().CodexState == 0)
            {
                BookButton.SetImage(ModContent.GetTexture("StarlightRiver/GUI/BookLocked"));
            }
            ;

            //bootlegdust for crafing
            if (Crafting && ShownRecipes.Count > 0 && ActiveRecipe == null)
            {
                Vector2   pos = new Vector2(Main.screenWidth / 2, Main.screenHeight / 2) + new Vector2(-10, -10);
                Texture2D tex = ModContent.GetTexture("StarlightRiver/GUI/Light");
                Dust.Add(new HolyDust(tex, pos + Vector2.One.RotatedByRandom(6.28f) * 80, Vector2.Zero));
            }

            if (Crafting && ActiveRecipe != null)
            {
                Texture2D tex = ModContent.GetTexture("StarlightRiver/GUI/Holy");
                Vector2   pos = new Vector2(Main.screenWidth / 2, Main.screenHeight / 2) + new Vector2(-15, -15);
                DrawItem(spriteBatch, pos, ActiveRecipe.Result);

                List <int> DrawnItems = new List <int>();
                DrawnItems.Add(ModContent.ItemType <Items.RiftCore1>() + (ActiveRecipe.Tier - 1));
                for (int k = 0; k < ActiveRecipe.Ingredients.Count; k++)
                {
                    for (int l = 0; l < ActiveRecipe.Ingredients[k].count; l++)
                    {
                        DrawnItems.Add(ActiveRecipe.Ingredients[k].type);
                    }
                }

                for (int k = 0; k < DrawnItems.Count; k++)
                {
                    float   rot  = k / (float)DrawnItems.Count * 6.28f;
                    Vector2 pos2 = pos + new Vector2(0, 110).RotatedBy(rot);
                    DrawItem(spriteBatch, pos2, DrawnItems[k]);

                    float offset = (6.28f - LegendWorld.rottime) / 6.28f * 100;
                    Dust.Add(new ExpertDust(tex, pos + new Vector2((float)Math.Sin(LegendWorld.rottime * 5) * 3, offset).RotatedBy(rot), Vector2.Zero, Color.White, 1, 30));
                    Dust.Add(new ExpertDust(tex, pos + new Vector2(0, Main.rand.NextFloat(100)).RotatedBy(rot), Vector2.Zero, Color.White * 0.6f, 0.6f, 30));
                }
                Dust.Add(new ExpertDust(tex, pos, Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(1), Color.White * 0.7f, 1.5f, 30));
            }

            Recalculate();
        }