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); } }
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); }
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); }
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); }