Skip to content

Commit

Permalink
0.6.1.2, restore mod icon hover.
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Mar 19, 2018
1 parent 00e6c50 commit 6be360e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions RecipeBrowserUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using RecipeBrowser.UIElements;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Terraria;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -244,15 +245,15 @@ 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();
}

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();
}
Expand All @@ -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();
}
Expand All @@ -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;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -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\*,
Expand Down

0 comments on commit 6be360e

Please sign in to comment.