Add option to hide the silver time when showing diamond time

This commit is contained in:
Terry Hearst 2023-10-06 22:38:09 -04:00
parent 492c125b8c
commit 2a3c7a888d
3 changed files with 32 additions and 12 deletions

View file

@ -20,6 +20,7 @@ namespace DiamondTimeViewer
public static bool Enabled = true;
public static DisplayMode Mode = DisplayMode.Diamond;
public static bool HideSilver = false;
public static void Init()
{
@ -68,6 +69,9 @@ namespace DiamondTimeViewer
break;
}
}
if (data["hideSilver"] != null)
HideSilver = data["hideSilver"].AsBool;
}
public static void SaveConfig()
@ -89,6 +93,7 @@ namespace DiamondTimeViewer
node.Add("mode", "always");
break;
}
node.Add("hideSilver", HideSilver ? "true" : "false");
File.WriteAllText(GetConfigPath(), node.ToString());
}

View file

@ -13,8 +13,11 @@ namespace DiamondTimeViewer
MIU.Console.Instance.Write(" gold Show once you've achieved gold time");
MIU.Console.Instance.Write(" always Always show diamond time");
MIU.Console.Instance.Write("");
MIU.Console.Instance.Write(" hideSilver Hide silver when showing diamond");
MIU.Console.Instance.Write(" showSilver Show silver always");
MIU.Console.Instance.Write("");
MIU.Console.Instance.Write(" enable Enable the mod");
MIU.Console.Instance.Write(" disable Disable the mod entirely");
MIU.Console.Instance.Write(" disable Disable the mod (should be the same as \"never\" unless I messed up)");
MIU.Console.Instance.Write("");
MIU.Console.Instance.Write(" save Saves the current config");
MIU.Console.Instance.Write(" load Loads the config file");
@ -45,6 +48,12 @@ namespace DiamondTimeViewer
case "always":
Config.Mode = DisplayMode.Always;
return "mode set to: always";
case "hideSilver":
Config.HideSilver = true;
return "Hiding silver time";
case "showSilver":
Config.HideSilver = false;
return "Showing silver time";
case "enable":
Config.Enabled = true;
return "Mod enabled";

View file

@ -35,14 +35,22 @@ namespace DiamondTimeViewer.Patches
}
}
string silverText = "<sprite=1> " + SegmentedTime.SPTimeText(silver);
string spacingText = "<space=0.5em> ";
string diamondText = "";
if (showDiamondTime)
{
if (Config.HideSilver)
silverText = "";
else
spacingText = "<space=0.25em> ";
diamondText = spacingText + "<sprite=3> " + SegmentedTime.SPTimeText(diamond, true);
}
if (silverText != "")
silverText += spacingText;
bool hasEgg = eggUnlock != null && eggUnlock.Count > 0;
bool gotEgg = hasEgg && UnlockManager.Get().IsUnlocked(eggUnlock[0]) && !CosmeticValues.WasPurchased(eggUnlock[0]);
@ -52,9 +60,7 @@ namespace DiamondTimeViewer.Patches
__instance.MedalTimes.text = string.Concat(new string[]
{
"<sprite=1> ",
SegmentedTime.SPTimeText(silver),
spacingText,
silverText,
"<sprite=2> ",
SegmentedTime.SPTimeText(gold),
diamondText,