Beispiel #1
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (!(Parent.Parent.Parent.Parent is CodexBack))
            {
                return;                                              //way too many parents >.<
            }
            CodexBack parent = Parent.Parent.Parent.Parent as CodexBack;

            Vector2   pos       = GetDimensions().ToRectangle().TopLeft();
            Color     backColor = Entry.New ? new Color(255, 255, 127 + (int)((float)Math.Sin(StarlightWorld.rottime * 2) * 127f)) : Color.White; //yellow flashing background for new entries
            Texture2D backTex   = Entry.RequiresUpgradedBook ? GetTexture("StarlightRiver/GUI/Assets/EntryButton2") : GetTexture("StarlightRiver/GUI/Assets/EntryButton");

            spriteBatch.Draw(backTex, pos, backColor * 0.8f);

            Vector2 iconPos = pos + new Vector2(10, 14);

            if (!Entry.Locked) //draws the icon and name if the entry is unlocked
            {
                spriteBatch.Draw(Entry.Icon, iconPos, Entry.Icon.Frame(), Color.White, 0, Entry.Icon.Size() / 2, 0.5f, 0, 0);
                Utils.DrawBorderString(spriteBatch, Entry.Title, iconPos + new Vector2(10, -6), (parent.ActiveEntry != null && parent.ActiveEntry == Entry) ? Color.Yellow : Color.White, 0.6f);
            }
            else //draws the locked icon if locked
            {
                Texture2D blankTex = GetTexture("StarlightRiver/GUI/Assets/blank");
                spriteBatch.Draw(blankTex, iconPos, blankTex.Frame(), Color.White, 0, blankTex.Size() / 2, 0.5f, 0, 0);
                Utils.DrawBorderString(spriteBatch, "???", iconPos + new Vector2(10, -6), Color.White, 0.6f);
            }
        }
Beispiel #2
0
        public override void MouseDown(UIMouseEvent evt)
        {
            Main.PlaySound(SoundID.MenuTick);

            if (!(Parent is CodexBack))
            {
                return;
            }
            CodexBack parent = Parent as CodexBack;

            parent.ChangeCategory(Category);
        }
Beispiel #3
0
        public override void MouseDown(UIMouseEvent evt)
        {
            Main.PlaySound(SoundID.MenuTick);

            if (!(Parent.Parent.Parent.Parent is CodexBack) || Entry.Locked)
            {
                return;                                                              //way too many parents >.<
            }
            CodexBack parent = Parent.Parent.Parent.Parent as CodexBack;

            parent.ActiveEntry = Entry;
            Entry.New          = false;
        }
Beispiel #4
0
        private void ScrollEntry(UIScrollWheelEvent evt, UIElement listeningElement)
        {
            Vector2   pos         = listeningElement.GetDimensions().ToRectangle().TopLeft();
            Rectangle entryWindow = new Rectangle((int)pos.X + 20, (int)pos.Y + 50, 310, 342);

            if (!entryWindow.Contains(Main.MouseScreen.ToPoint()))
            {
                return;                                                    //makes sure were in the entry window to scroll. I shouldnt have hardcoded the entries to draw to the back element but oh well.
            }
            CodexBack element = listeningElement as CodexBack;

            if (element.ActiveEntry != null)
            {
                element.ActiveEntry.LinePos += evt.ScrollWheelValue > 0 ? -1 : 1;
            }
        }
Beispiel #5
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (!(Parent is CodexBack))
            {
                return;
            }
            CodexBack    parent = Parent as CodexBack;
            CodexHandler player = Main.LocalPlayer.GetModPlayer <CodexHandler>();

            Vector2   pos       = GetDimensions().ToRectangle().TopLeft();
            Color     backColor = player.Entries.Any(n => n.New && n.Category == Category) ? new Color(255, 255, 127 + (int)((float)Math.Sin(StarlightWorld.rottime * 2) * 127f)) : Color.White; //yellow flashing background for new entries
            Texture2D backTex   = GetTexture("StarlightRiver/GUI/Assets/CategoryButton");

            spriteBatch.Draw(backTex, pos, backColor * 0.8f);
            Vector2 textSize = Main.fontDeathText.MeasureString(Text) * 0.6f;

            Utils.DrawBorderString(spriteBatch, Text, GetDimensions().ToRectangle().Center(), (parent.ActiveCategory == Category) ? Color.Yellow : Color.White, 0.6f, 0.5f, 0.5f);
        }