From 6be360e11a537d760966dd7671079a87e4dbf62b Mon Sep 17 00:00:00 2001 From: JavidPack Date: Mon, 19 Mar 2018 11:19:53 -0600 Subject: [PATCH] 0.6.1.2, restore mod icon hover. --- RecipeBrowserUI.cs | 17 +++++++++++------ build.txt | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/RecipeBrowserUI.cs b/RecipeBrowserUI.cs index 4754a5a..c7eba5f 100644 --- a/RecipeBrowserUI.cs +++ b/RecipeBrowserUI.cs @@ -3,6 +3,7 @@ using RecipeBrowser.UIElements; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Reflection; using Terraria; @@ -197,7 +198,7 @@ public override void OnInitialize() button.Height.Set(22, 0); button.BackgroundColor = Color.DarkRed; - var modFilterButton = new UIHoverImageButtonMod(RecipeBrowser.instance.GetTexture("Images/filterMod"), RBText("ModFilter")+": "+RBText("All")); + var modFilterButton = new UIHoverImageButtonMod(RecipeBrowser.instance.GetTexture("Images/filterMod"), RBText("ModFilter") + ": " + RBText("All")); modFilterButton.Left.Set(-60, 1f); modFilterButton.Top.Set(-0, 0f); modFilterButton.OnClick += ModFilterButton_OnClick; @@ -244,7 +245,7 @@ public override void OnInitialize() private void ModFilterButton_OnClick(UIMouseEvent evt, UIElement listeningElement) { UIHoverImageButtonMod button = (evt.Target as UIHoverImageButtonMod); - button.hoverText = RBText("ModFilter")+": " + GetModFilterTooltip(true); + button.hoverText = RBText("ModFilter") + ": " + GetModFilterTooltip(true); UpdateModHoverImage(button); AllUpdateNeeded(); } @@ -252,7 +253,7 @@ private void ModFilterButton_OnClick(UIMouseEvent evt, UIElement listeningElemen private void ModFilterButton_OnRightClick(UIMouseEvent evt, UIElement listeningElement) { UIHoverImageButtonMod button = (evt.Target as UIHoverImageButtonMod); - button.hoverText = RBText("ModFilter")+": " + GetModFilterTooltip(false); + button.hoverText = RBText("ModFilter") + ": " + GetModFilterTooltip(false); UpdateModHoverImage(button); AllUpdateNeeded(); } @@ -261,7 +262,7 @@ private void ModFilterButton_OnMiddleClick(UIMouseEvent evt, UIElement listening { UIHoverImageButtonMod button = (evt.Target as UIHoverImageButtonMod); modIndex = mods.Length - 1; - button.hoverText = RBText("ModFilter")+": "+RBText("All"); + button.hoverText = RBText("ModFilter") + ": " + RBText("All"); UpdateModHoverImage(button); AllUpdateNeeded(); } @@ -270,9 +271,13 @@ private void UpdateModHoverImage(UIHoverImageButtonMod button) { button.texture = null; Mod otherMod = ModLoader.GetMod(mods[modIndex]); - if (otherMod != null && otherMod.TextureExists("icon")) + if (otherMod != null && otherMod.FileExists("icon.png")) { - button.texture = otherMod.GetTexture("icon"); + var modIconTexture = Texture2D.FromStream(Main.instance.GraphicsDevice, new MemoryStream(otherMod.GetFileBytes("icon.png"))); + if (modIconTexture.Width == 80 && modIconTexture.Height == 80) + { + button.texture = modIconTexture; + } } } diff --git a/build.txt b/build.txt index 165ab2f..911e651 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = jopojelly -version = 0.6.1.1 +version = 0.6.1.2 displayName = Recipe Browser homepage = https://forums.terraria.org/index.php?threads/recipe-browser.62462/ buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, unused\*, .git\*,