예제 #1
0
        public override void Render(SpriteBatch b, int x, int y)
        {
            Hovered = Render2DUtils.IsHovered(Game1.getMouseX(), Game1.getMouseY(), x, y, Width, Height);

            Render2DUtils.DrawButton(b, x, y, Width, Height, Hovered ? Color.Wheat : Color.White);
            FontUtils.DrawHvCentered(b, $"{Title}:({Min}-{Max}){Current}", x + Width / 2, y + Height / 2);
        }
예제 #2
0
        public override void Render(SpriteBatch b)
        {
            Hovered = Render2DUtils.IsHovered(Game1.getMouseX(), Game1.getMouseY(), X, Y, Width, Height);

            Render2DUtils.DrawButton(b, X, Y, Width, Height, Hovered ? Color.Wheat : Color.White);
            FontUtils.DrawHvCentered(b, Title, X + Width / 2, Y + Height / 2);
        }
예제 #3
0
        public override void Render(SpriteBatch b)
        {
            Hovered = Render2DUtils.IsHovered(Game1.getMouseX(), Game1.getMouseY(), X, Y, Width, Height);

            for (int i = _index, j = 0;
                 j < (Entries.Count >= _maxEntry ? _maxEntry : Entries.Count);
                 i++, j++)
            {
                IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 396, 15, 15), X,
                                              Y + j * SlotHeight, Width, SlotHeight, Color.Wheat, 4f, false);
                Entries[i].Width  = Width;
                Entries[i].Height = SlotHeight;
                var slotY = Y + j * SlotHeight;
                Entries[i].Render(b, X, slotY);
                if (Entries[i].Hovered)
                {
                    IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(375, 357, 3, 3), X, slotY, Width, SlotHeight,
                                                  Color.Red, 4f, false);
                }

                if (Entries[i].Equals(SelectedEntry))
                {
                    IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(375, 357, 3, 3), X, slotY, Width, SlotHeight,
                                                  Color.Red, 4f, false);
                }

                if (Entries[i].Hovered && _mouseClicked)
                {
                    SelectedEntry = Entries[i];
                }
            }
        }
        public override void draw(SpriteBatch b)
        {
            var background = new Rectangle(_slot.X - 13, _slot.Y - 10, _slot.Width + 15,
                                           _slot.Height + 20);

            Render2DUtils.DrawBound(b, background.X, background.Y, background.Width, background.Height, Color.White);

            _remove.Visibled = _slot.SelectedEntry != null && !_record;

            _add.Visibled    = !_record;
            _done.Visibled   = _record;
            _cancel.Visibled = _record;

            base.draw(b);

            if (_record)
            {
                b.DrawString(Game1.dialogueFont,
                             KeyList.Count == 0
                        ? Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsElement.cs.11225")
                        : string.Join(" + ", KeyList.ToArray()),
                             Utility.getTopLeftPositionForCenteringOnScreen(192, 64), Color.White, 0.0f, Vector2.Zero, 1f,
                             SpriteEffects.None, 0.9999f);
            }
        }
예제 #5
0
        public override void draw(SpriteBatch b)
        {
            Render2DUtils.DrawBound(b, xPositionOnScreen, yPositionOnScreen, width, height, Color.White);
            var y = yPositionOnScreen + 20;

            _searchElements = new List <Element>();
            _searchElements.AddRange(GetSearchElements());
            for (int i = _index, j = 0;
                 j < (_searchElements.Count >= _maxElement ? _maxElement : _searchElements.Count);
                 i++, j++)
            {
                var element = _searchElements[i];

                if (element.Visibled)
                {
                    element.Render(b, xPositionOnScreen + 15, y + j * 78);
                    if (element.Hovered && !element.Description.Equals(""))
                    {
                        var descriptionWidth  = FontUtils.GetWidth(element.Description) + 50;
                        var descriptionHeight = FontUtils.GetHeight(element.Description) + 50;

                        drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 396, 15, 15), 0, 0, descriptionWidth,
                                       descriptionHeight, Color.Wheat, 4f, false);
                        FontUtils.DrawHvCentered(b, element.Description, descriptionWidth / 2, descriptionHeight / 2);
                    }
                }
            }

            foreach (var component in _components)
            {
                if (component.Visibled)
                {
                    component.Render(b);
                    if (component.Hovered && !component.Description.Equals(""))
                    {
                        var descriptionWidth  = FontUtils.GetWidth(component.Description) + 50;
                        var descriptionHeight = FontUtils.GetHeight(component.Description) + 50;

                        drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 396, 15, 15), 0, 0, descriptionWidth,
                                       descriptionHeight, Color.Wheat, 4f, false);
                        FontUtils.DrawHvCentered(b, component.Description, descriptionWidth / 2, descriptionHeight / 2);
                    }
                }
            }

            if (Title != null)
            {
                SpriteText.drawStringWithScrollCenteredAt(b, Title, Game1.viewport.Width / 2,
                                                          Game1.viewport.Height - 100, Title);
            }

            const string text = "EnaiumToolKit By Enaium";

            FontUtils.Draw(b, text, 0, Game1.viewport.Height - FontUtils.GetHeight(text));

            drawMouse(b);
            base.draw(b);
        }
예제 #6
0
            public override void Render(SpriteBatch b, int x, int y)
            {
                Hovered = Render2DUtils.IsHovered(Game1.getMouseX(), Game1.getMouseY(), x, y, Width, Height);
                FontUtils.Draw(b, ModInfo.Manifest.Name, x + 15, y + 10);
                var desc = Game1.parseText(ModInfo.Manifest.Description, Game1.smallFont, Width - 15).Split('\n')[0];

                Utility.drawTextWithShadow(b, desc, Game1.smallFont,
                                           new Vector2(x + 15, y + 10 + 30), Game1.textColor, 1f,
                                           -1f,
                                           -1, -1, 0.0f);
            }
예제 #7
0
        public override void Render(SpriteBatch b, int x, int y)
        {
            Hovered = Render2DUtils.IsHovered(Game1.getMouseX(), Game1.getMouseY(), x, y, Width, Height);

            Render2DUtils.DrawButton(b, x, y, Width, Height, Hovered ? Color.Wheat : Color.White);
            FontUtils.DrawHvCentered(b, Title, x + Width / 2, y + Height / 2);
            if (!(Npc is Pet || Npc is Horse))
            {
                new ClickableTextureComponent("Mugshot", new Rectangle(x, y, Height, Height), "", "", Npc.Sprite.Texture,
                                              Npc.getMugShotSourceRect(), 0.7f * Game1.pixelZoom).draw(b);
            }
        }
예제 #8
0
        public override void Render(SpriteBatch b, int x, int y)
        {
            Hovered = Render2DUtils.IsHovered(Game1.getMouseX(), Game1.getMouseY(), x, y, Width, Height);
            Render2DUtils.DrawButton(b, x, y, Width, Height, Color.Wheat);
            if (Hovered)
            {
                IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(375, 357, 3, 3), x, y, Width, Height,
                                              Color.Black, 4f, false);
            }

            FontUtils.DrawHvCentered(b, Title, x + Width / 2, y + Height / 2);
        }
예제 #9
0
        public override void Render(SpriteBatch b)
        {
            Hovered = Render2DUtils.IsHovered(Game1.getMouseX(), Game1.getMouseY(), X, Y, Width, Height);

            Render2DUtils.DrawBound(b, X - 5, Y - 5, Width + 20, Height + 25, Color.White);

            if (!Hovered)
            {
                _textBox.Selected = false;
            }

            _textBox.Draw(b);
        }
예제 #10
0
        public override void Render(SpriteBatch b)
        {
            Hovered = Render2DUtils.IsHovered(Game1.getMouseX(), Game1.getMouseY(), X, Y, Width, Height);

            Render2DUtils.DrawButton(b, X, Y, Width, Height, Hovered ? Color.Wheat : Color.White);
            FontUtils.DrawHvCentered(b, Title, X + Width / 2, Y + Height / 2);

            if (Hovered)
            {
                IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(375, 357, 3, 3), X, Y, Width, Height,
                                              Color.Red, 4f, false);
            }
        }
예제 #11
0
        public override void Render(SpriteBatch b, int x, int y)
        {
            Hovered = Render2DUtils.IsHovered(Game1.getMouseX(), Game1.getMouseY(), x, y, Width, Height);

            Color color;

            if (Toggled)
            {
                color = Color.Green;
            }
            else
            {
                color = Color.Red;
            }

            if (Hovered)
            {
                color = Color.Wheat;
            }

            Render2DUtils.DrawButton(b, x, y, Width, Height, color);
            FontUtils.DrawHvCentered(b, Title, x + Width / 2, y + Height / 2);
        }
예제 #12
0
        public override void draw(SpriteBatch b)
        {
            var background = new Rectangle(_slot.X - 10, _slot.Y - 10, Game1.viewport.Width - _slot.X + 10,
                                           _slot.Height + 20);

            Render2DUtils.DrawBound(b, background.X, background.Y, background.Width, background.Height, Color.White);
            if (_slot.SelectedEntry != null)
            {
                var texts = new List <string>
                {
                    $"{GetTranslation("name")}:{_slot.SelectedEntry.ModInfo.Manifest.Name}",
                    $"{GetTranslation("author")}:{_slot.SelectedEntry.ModInfo.Manifest.Author}",
                    $"{GetTranslation("version")}:{_slot.SelectedEntry.ModInfo.Manifest.Version}",
                    $"{GetTranslation("description")}:"
                };
                texts.AddRange(Game1.parseText(_slot.SelectedEntry.ModInfo.Manifest.Description, Game1.dialogueFont,
                                               background.Width - _slot.Width).Split('\n'));
                if (_slot.SelectedEntry.ModInfo.Manifest.Dependencies != null)
                {
                    texts.Add(
                        $"{GetTranslation("dependencies")}:{string.Join(",", _slot.SelectedEntry.ModInfo.Manifest.Dependencies.Select(element => element.UniqueID.Split('.').Last()))}"
                        );
                }

                var y = _slot.Y;
                foreach (var variable in texts)
                {
                    FontUtils.Draw(b, variable, _slot.X + _slot.Width, y);
                    y += FontUtils.GetHeight(variable);
                }
            }

            if (_slot.SelectedEntry != null)
            {
                var updateUrls = _slot.SelectedEntry.ModInfo.Manifest.UpdateKeys;
                if (updateUrls != null)
                {
                    var updateUrl = GetPageUrl(updateUrls);
                    if (updateUrl != null)
                    {
                        _updateButton.OnLeftClicked = () => { Process.Start(updateUrl); };
                        _updateButton.Visibled      = true;
                    }
                    else
                    {
                        _updateButton.Visibled = false;
                    }
                }
                else
                {
                    _updateButton.Visibled = false;
                }

                var selectedEntryModMenu = _slot.SelectedEntry.ModMenu;

                if (selectedEntryModMenu != null)
                {
                    if (selectedEntryModMenu.Setting != null)
                    {
                        _settingButton.OnLeftClicked = () =>
                        {
                            var type = AppDomain.CurrentDomain.GetAssemblies()
                                       .SelectMany(t => t.GetTypes()).Where(t =>
                                                                            t.IsClass && selectedEntryModMenu.Setting.Equals(t.FullName)).ToArray();

                            if (type.Length == 1)
                            {
                                OpenScreenGui(Activator.CreateInstance(type[0]) as IClickableMenu);
                            }
                            else
                            {
                                ModEntry.GetInstance().Monitor.Log("Not Found Setting:" + selectedEntryModMenu.Setting,
                                                                   LogLevel.Error);
                            }
                        };
                        _settingButton.Visibled = true;
                    }
                    else
                    {
                        _settingButton.Visibled = false;
                    }

                    if (selectedEntryModMenu.Contact != null)
                    {
                        if (selectedEntryModMenu.Contact.HomePage != null)
                        {
                            _homePageButton.OnLeftClicked = () =>
                            {
                                Process.Start(selectedEntryModMenu.Contact.HomePage);
                            };
                            _homePageButton.Visibled = true;
                        }
                        else
                        {
                            _homePageButton.Visibled = false;
                        }


                        if (selectedEntryModMenu.Contact.Issues != null)
                        {
                            _issuesButton.OnLeftClicked = () => { Process.Start(selectedEntryModMenu.Contact.Issues); };
                            _issuesButton.Visibled      = true;
                        }
                        else
                        {
                            _issuesButton.Visibled = false;
                        }
                    }
                    else
                    {
                        _homePageButton.Visibled = false;
                        _issuesButton.Visibled   = false;
                    }
                }
                else
                {
                    _settingButton.Visibled  = false;
                    _homePageButton.Visibled = false;
                    _issuesButton.Visibled   = false;
                }
            }

            base.draw(b);
        }
예제 #13
0
 public override void Render(SpriteBatch b, int x, int y)
 {
     Hovered = Render2DUtils.IsHovered(Game1.getMouseX(), Game1.getMouseY(), x, y, Width, Height);
     FontUtils.DrawHvCentered(b, Title, x + Width / 2, y + Height / 2);
 }
예제 #14
0
 public override void Render(SpriteBatch b, int x, int y)
 {
     Hovered = Render2DUtils.IsHovered(Game1.getMouseX(), Game1.getMouseY(), x, y, Width, Height);
     b.Draw(Game1.staminaRect, new Rectangle(x, y, Width, Height), Color);
     FontUtils.DrawHvCentered(b, Title, x + Width / 2, y + Height / 2);
 }