Skip to content

Commit

Permalink
UIModItem different version link to beta branches wiki page. Adjust t…
Browse files Browse the repository at this point in the history
…ooltip

"Click to Update" -> "Switch to a different tModLoader version"
  • Loading branch information
JavidPack committed Aug 1, 2023
1 parent 66c9cf4 commit 673ff63
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions patches/tModLoader/Terraria/ModLoader/UI/UIModItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public override void OnInitialize()

// Don't show the Enable/Disable button if there is no loadable version
string updateVersion = null;
string updateURL = "https://github.com/tModLoader/tModLoader/releases/latest";
string updateURL = "https://github.com/tModLoader/tModLoader/wiki/tModLoader-guide-for-players#beta-branches";
Color updateColor = Color.Orange;

// Detect if it's for a preview version ahead of our time
if (BuildInfo.tMLVersion.MajorMinorBuild() < _mod.tModLoaderVersion.MajorMinorBuild()) {
Expand All @@ -115,13 +116,15 @@ public override void OnInitialize()
}

// Detect if it's for a different browser version entirely
if (!ModOrganizer.CheckIfPublishedForThisBrowserVersion(_mod, out var modBrowserVersion))
if (!ModOrganizer.CheckIfPublishedForThisBrowserVersion(_mod, out var modBrowserVersion)) {
updateVersion = $"{modBrowserVersion} v{_mod.tModLoaderVersion}";
updateColor = Color.Yellow;
}

// Hide the Enabled button if it's not for this built version
if (updateVersion != null) {
tMLUpdateRequired = new UIAutoScaleTextTextPanel<string>(Language.GetTextValue("tModLoader.MBRequiresTMLUpdate", updateVersion)).WithFadedMouseOver(Color.Orange, Color.Orange * 0.7f);
tMLUpdateRequired.BackgroundColor = Color.Orange * 0.7f;
tMLUpdateRequired = new UIAutoScaleTextTextPanel<string>(Language.GetTextValue("tModLoader.MBRequiresTMLUpdate", updateVersion)).WithFadedMouseOver(updateColor, updateColor * 0.7f);
tMLUpdateRequired.BackgroundColor = updateColor * 0.7f;
tMLUpdateRequired.Top.Pixels = 40;
tMLUpdateRequired.Width.Pixels = 280;
tMLUpdateRequired.Height.Pixels = 36;
Expand Down Expand Up @@ -347,7 +350,7 @@ protected override void DrawSelf(SpriteBatch spriteBatch)
_tooltip = Language.GetTextValue("tModLoader.ModUpdatedSinceLastLaunchMessage", previousVersionHint);
}
else if (tMLUpdateRequired?.IsMouseHovering == true) {
_tooltip = Language.GetTextValue("tModLoader.MBClickToUpdate");
_tooltip = Language.GetTextValue("tModLoader.SwitchVersionInfoButton");
}
}

Expand Down

0 comments on commit 673ff63

Please sign in to comment.