Decompiled source of RainbowCompany v0.0.69

rainbow-company_0.0.69.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Rainbow Company")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("R A I N B O W")]
[assembly: AssemblyFileVersion("0.0.69.0")]
[assembly: AssemblyInformationalVersion("0.0.69+5646578275a1e207f2d77b4095a09c45c10f2224")]
[assembly: AssemblyProduct("Rainbow Company")]
[assembly: AssemblyTitle("Rainbow Company")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.69.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RainbowCompany
{
	public class Company : MonoBehaviour
	{
		private float hue;

		private float colorTimer = 0.05f;

		private void Update()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			if (colorTimer >= 0f)
			{
				colorTimer -= Time.deltaTime;
				return;
			}
			hue += Time.deltaTime;
			if (hue > 1f)
			{
				hue -= 1f;
			}
			Color color = Color.HSVToRGB(hue, 0.5f, 0.5f);
			foreach (Material item in Rainbow.sceneMaterials.Where((Material m) => Object.op_Implicit((Object)(object)m)))
			{
				item.color = color;
			}
			colorTimer = 0.05f;
		}
	}
	[BepInPlugin("giosuel.rainbowcompany", "Rainbow Company", "6.9.0")]
	public class Rainbow : BaseUnityPlugin
	{
		private const string PLUGIN_GUID = "giosuel.rainbowcompany";

		private const string PLUGIN_NAME = "Rainbow Company";

		internal static List<Material> sceneMaterials = new List<Material>();

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("giosuel.rainbowcompany").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"R A I N B O W");
		}

		public static void RefreshMaterials()
		{
			sceneMaterials = (from material in Object.FindObjectsOfType<MeshRenderer>().SelectMany((MeshRenderer renderer) => ((Renderer)renderer).materials)
				where material.HasProperty("_Color") && material.color.a != 0f
				select material).ToList();
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	public abstract class PlayerControllerBPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("ConnectClientToPlayerObject")]
		private static void ConnectClientToPlayerObjectPatch(PlayerControllerB __instance)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Rainbow.RefreshMaterials();
			new GameObject().AddComponent<Company>();
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	public abstract class RoundManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("FinishGeneratingNewLevelClientRpc")]
		private static void FinishGeneratingNewLevelClientRpcPostfixPatch()
		{
			Rainbow.RefreshMaterials();
		}
	}
}