mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
squash final bugs
This commit is contained in:
3 files changed
+6
-11
No files matched your search
@@ -11,8 +11,8 @@ namespace MiraAPI.Colors;
|
||||
/// <param name="name">The name of the option.</param>
|
||||
/// <param name="mainColor">The main color.</param>
|
||||
/// <param name="shadowColor">The shadow color.</param>
|
||||
[SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "Looks weird.")]
|
||||
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "Internal code.")]
|
||||
[SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "Looks weird.")]
|
||||
public class CustomColor(StringNames name, Color32 mainColor, Color32 shadowColor)
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -17,7 +17,6 @@ namespace MiraAPI;
|
||||
public sealed class VariableColorBehaviour : MonoBehaviour
|
||||
{
|
||||
private SpriteRenderer rend;
|
||||
private Material material;
|
||||
private VariableColor? color;
|
||||
|
||||
private static readonly Color VisorColor = Palette.VisorColor;
|
||||
@@ -35,8 +34,7 @@ public sealed class VariableColorBehaviour : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
rend = GetComponent<SpriteRenderer>();
|
||||
material = rend.material;
|
||||
material.SetColor(ShaderID.VisorColor, VisorColor);
|
||||
rend.material.SetColor(ShaderID.VisorColor, VisorColor);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -45,6 +43,7 @@ public sealed class VariableColorBehaviour : MonoBehaviour
|
||||
return;
|
||||
|
||||
var time = Time.time;
|
||||
var material = rend.material;
|
||||
material.SetColor(ShaderID.BodyColor, color.EvaluateMainColor(time));
|
||||
material.SetColor(ShaderID.BackColor, color.EvaluateShadowColor(time));
|
||||
}
|
||||
|
||||
@@ -44,19 +44,15 @@ internal static class PlayerTabPatch
|
||||
[HarmonyPatch(typeof(ChatNotification), nameof(ChatNotification.Update))]
|
||||
internal static class ChatNotifRainbowPatch
|
||||
{
|
||||
private static readonly Regex RichTags = new(@"<[^>]*>", default, Regex.InfiniteMatchTimeout);
|
||||
|
||||
public static void Postfix(ChatNotification __instance)
|
||||
{
|
||||
if (!__instance.gameObject.active || !PaletteManager.IsVariable(__instance.player.cosmetics.ColorId))
|
||||
return;
|
||||
|
||||
var str = PaletteManager.GetMainColor(__instance.player.cosmetics.ColorId).ToHtmlStringRGBA();
|
||||
__instance.playerNameText.text = "<color=#" + str + ">" + __instance.playerNameText.text.WithoutRichText();
|
||||
}
|
||||
|
||||
private static string WithoutRichText(this string text)
|
||||
{
|
||||
var richTagRegex = new Regex(@"<[^>]*>", default, Regex.InfiniteMatchTimeout);
|
||||
return richTagRegex.Replace(text, string.Empty);
|
||||
__instance.playerNameText.text = "<color=#" + str + ">" + RichTags.Replace(__instance.playerNameText.text, string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user