Decompiled source of StartingPicks v1.0.0

StartingPicks.dll

Decompiled 10 months 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 BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using TMPro;
using UnboundLib;
using UnboundLib.GameModes;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[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("StartingPicks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StartingPicks")]
[assembly: AssemblyTitle("StartingPicks")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace StartingPicks
{
	[BepInPlugin("dev.scyye.rounds.startingpicks", "Starting Picks", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__4_0;

			public static UnityAction<float> <>9__4_2;

			public static Action<GameObject> <>9__4_1;

			internal void <Start>b__4_0()
			{
			}

			internal void <Start>b__4_1(GameObject menu)
			{
				Slider val2 = default(Slider);
				MenuHandler.CreateSlider("Extra Picks", menu, 30, 0f, 5f, (float)extraPicks.Value, (UnityAction<float>)delegate(float val)
				{
					extraPicks.Value = (int)val;
				}, ref val2, true, (Color?)null, (Direction)0, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			}

			internal void <Start>b__4_2(float val)
			{
				extraPicks.Value = (int)val;
			}
		}

		private const string ModName = "Starting Picks";

		private static ConfigEntry<int> extraPicks;

		public const int maxExtraPicks = 5;

		public static bool pickHasRun;

		private void Start()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			Unbound.RegisterCredits("Starting Picks", new string[2] { "Scyye", "willuwontu (old ver)" }, new string[1] { "github" }, new string[1] { "https://github.com/willuwontu/WillsWackyGameModes" });
			object obj = <>c.<>9__4_0;
			if (obj == null)
			{
				UnityAction val2 = delegate
				{
				};
				<>c.<>9__4_0 = val2;
				obj = (object)val2;
			}
			Unbound.RegisterMenu("Starting Picks", (UnityAction)obj, (Action<GameObject>)delegate(GameObject menu)
			{
				Slider val3 = default(Slider);
				MenuHandler.CreateSlider("Extra Picks", menu, 30, 0f, 5f, (float)extraPicks.Value, (UnityAction<float>)delegate(float val)
				{
					extraPicks.Value = (int)val;
				}, ref val3, true, (Color?)null, (Direction)0, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			}, (GameObject)null, false);
			GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)GameStart);
			GameModeManager.AddHook("PickStart", (Func<IGameModeHandler, IEnumerator>)StartingPicks);
			extraPicks = ((BaseUnityPlugin)this).Config.Bind<int>("Starting Picks", "ExtraPicks", 0, "The number of extra pick phases at the start of a game.");
		}

		internal static IEnumerator GameStart(IGameModeHandler gm)
		{
			pickHasRun = false;
			yield break;
		}

		internal static IEnumerator StartingPicks(IGameModeHandler gm)
		{
			if (pickHasRun)
			{
				yield break;
			}
			for (int i = 0; i < extraPicks.Value; i++)
			{
				List<Player> pickOrder = PlayerManager.instance.players;
				foreach (Player player in pickOrder)
				{
					yield return GameModeManager.TriggerHook("PlayerPickStart");
					CardChoiceVisuals.instance.Show(player.playerID, true);
					yield return CardChoice.instance.DoPick(1, player.playerID, (PickerType)1);
					yield return GameModeManager.TriggerHook("PlayerPickEnd");
					yield return (object)new WaitForSecondsRealtime(0.1f);
				}
			}
			pickHasRun = true;
		}
	}
}