Decompiled source of Rainbow Skin v1.0.0

rainbow_skin.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("rainbow_skin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d0f878bdfbda9f5f2d753f932ab8b10a145f492d")]
[assembly: AssemblyProduct("Rainbow Skin")]
[assembly: AssemblyTitle("rainbow_skin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 rainbow_skin
{
	[BepInPlugin("dev.cmax.rainbow_skin", "Rainbow Skin", "1.0.0")]
	[BepInProcess("Super Battle Golf.exe")]
	public class Plugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <RainbowCycle>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Plugin <>4__this;

			private PlayerInfo <localPlayer>5__1;

			private PlayerCosmeticsSwitcher <switcher>5__2;

			private int <colorCount>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <RainbowCycle>d__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<localPlayer>5__1 = null;
				<switcher>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_011e: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					break;
				case 2:
					<>1__state = -1;
					<localPlayer>5__1 = null;
					break;
				}
				<localPlayer>5__1 = GameManager.LocalPlayerInfo;
				if ((Object)(object)<localPlayer>5__1 != (Object)null)
				{
					PlayerCosmetics cosmetics = <localPlayer>5__1.Cosmetics;
					<switcher>5__2 = ((cosmetics != null) ? cosmetics.Switcher : null);
					if ((Object)(object)<switcher>5__2 != (Object)null)
					{
						SkinColor[] skinColors = <switcher>5__2.cosmeticsSettings.skinColors;
						<colorCount>5__3 = ((skinColors != null) ? skinColors.Length : 0);
						if (<colorCount>5__3 > 0)
						{
							<>4__this._currentColorIndex = (<>4__this._currentColorIndex + 1) % <colorCount>5__3;
							<switcher>5__2.SetSkinColor(<>4__this._currentColorIndex);
						}
					}
					<switcher>5__2 = null;
				}
				<>2__current = (object)new WaitForSeconds(0.5f);
				<>1__state = 2;
				return true;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		internal static ManualLogSource logger;

		private int _currentColorIndex;

		private Coroutine _rainbowCoroutine;

		private const float COLOR_CYCLE_INTERVAL = 0.5f;

		private void Awake()
		{
			logger = ((BaseUnityPlugin)this).Logger;
			SceneManager.sceneLoaded += OnSceneLoaded;
			((BaseUnityPlugin)this).Logger.LogMessage((object)$"guid: {((BaseUnityPlugin)this).Info.Metadata.GUID}, name: {((BaseUnityPlugin)this).Info.Metadata.Name}, version: {((BaseUnityPlugin)this).Info.Metadata.Version}");
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			if (_rainbowCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(_rainbowCoroutine);
			}
			if (!(((Scene)(ref scene)).name == "Main menu"))
			{
				_rainbowCoroutine = ((MonoBehaviour)this).StartCoroutine(RainbowCycle());
			}
		}

		[IteratorStateMachine(typeof(<RainbowCycle>d__6))]
		private IEnumerator RainbowCycle()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <RainbowCycle>d__6(0)
			{
				<>4__this = this
			};
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "rainbow_skin";

		public const string PLUGIN_NAME = "Rainbow Skin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}