using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using OpJosModREPO.RainbowPlayer.Patches;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("REPOMods")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("REPOMods")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ae067094-69b3-4aaf-9688-38ff78ee3b28")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace OpJosModREPO.RainbowPlayer
{
[BepInPlugin("OpJosModREPO.RainbowPlayer", "RainbowPlayer", "1.0.0")]
public class OpJosModBase : BaseUnityPlugin
{
private const string modGUID = "OpJosModREPO.RainbowPlayer";
private const string modName = "RainbowPlayer";
private const string modVersion = "1.0.0";
private readonly Harmony harmoy = new Harmony("OpJosModREPO.RainbowPlayer");
private static OpJosModBase Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("OpJosModREPO.RainbowPlayer");
mls.LogInfo((object)"RainbowPlayer has started!");
PlayerAvaterPatch.SetLogSource(mls);
harmoy.PatchAll();
}
}
}
namespace OpJosModREPO.RainbowPlayer.Patches
{
[HarmonyPatch(typeof(PlayerAvatar))]
internal class PlayerAvaterPatch
{
private static ManualLogSource mls;
private static bool swapColor = false;
private static int curColor = 0;
private static float delay = 0.5f;
private static float lastRan = 0f;
public static void SetLogSource(ManualLogSource logSource)
{
mls = logSource;
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void UpdatePatch(PlayerAvatar __instance)
{
if (((Object)__instance).GetInstanceID() != ((Object)PlayerAvatar.instance).GetInstanceID() || !(Time.time - lastRan > delay))
{
return;
}
lastRan = Time.time;
try
{
__instance.PlayerAvatarSetColor(curColor);
curColor++;
}
catch
{
__instance.PlayerAvatarSetColor(0);
curColor = 0;
}
}
}
}