Decompiled source of RoundsRoulette v0.1.2

RoundsRoulette.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Photon.Pun;
using TMPro;
using UnboundLib;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace RoundsRoulette;

internal static class Fx
{
	private struct Saved
	{
		public object Target;

		public FieldInfo Field;

		public object Value;
	}

	private static readonly List<Saved> saved = new List<Saved>();

	private static readonly HashSet<string> savedKeys = new HashSet<string>();

	private static readonly Dictionary<Player, float> dmgTimer = new Dictionary<Player, float>();

	internal static bool Mirror;

	internal static bool SwapJumpShoot;

	internal static bool AutoFire;

	internal static bool NoJump;

	internal static bool NoBlock;

	internal static bool Drunk;

	internal static bool AutoRun;

	internal static bool CamFlip;

	internal static bool CamTouched;

	internal static float CamSpin;

	internal static readonly List<Action> Overlays = new List<Action>();

	private static readonly FieldRef<PlayerVelocity, Vector2> velRef = AccessTools.FieldRefAccess<PlayerVelocity, Vector2>("velocity");

	internal static float T => Time.time - RoulettePlugin.RoundStartTime;

	internal static Gun Gun(Player p)
	{
		return p.data.weaponHandler.gun;
	}

	internal static GunAmmo Ammo(Player p)
	{
		return ((Component)p.data.weaponHandler.gun).GetComponentInChildren<GunAmmo>();
	}

	internal static CharacterStatModifiers St(Player p)
	{
		return p.data.stats;
	}

	internal static Block Blk(Player p)
	{
		return p.data.block;
	}

	internal static Gravity Grav(Player p)
	{
		return ((Component)p).GetComponent<Gravity>();
	}

	internal static PlayerMovement Move(Player p)
	{
		return ((Component)p).GetComponent<PlayerMovement>();
	}

	internal static PlayerJump Jump(Player p)
	{
		return ((Component)p).GetComponent<PlayerJump>();
	}

	internal static HealthHandler HH(Player p)
	{
		return p.data.healthHandler;
	}

	internal static bool Mine(Player p)
	{
		if (!((Object)(object)p.data.view == (Object)null))
		{
			return p.data.view.IsMine;
		}
		return true;
	}

	internal static void Resize(Player p)
	{
		try
		{
			AccessTools.Method(typeof(CharacterStatModifiers), "ConfigureMassAndSize", (Type[])null, (Type[])null).Invoke(p.data.stats, null);
		}
		catch (Exception)
		{
		}
	}

	internal static void Set(object target, string field, object value)
	{
		if (target == null)
		{
			return;
		}
		FieldInfo fieldInfo = AccessTools.Field(target.GetType(), field);
		if (fieldInfo == null)
		{
			Debug.LogWarning("[Roulette] no field " + field);
			return;
		}
		string item = target.GetHashCode() + "|" + target.GetType().Name + "|" + field;
		if (savedKeys.Add(item))
		{
			saved.Add(new Saved
			{
				Target = target,
				Field = fieldInfo,
				Value = fieldInfo.GetValue(target)
			});
		}
		fieldInfo.SetValue(target, Convert.ChangeType(value, fieldInfo.FieldType));
	}

	internal static void Mul(object target, string field, float factor)
	{
		if (target == null)
		{
			return;
		}
		FieldInfo fieldInfo = AccessTools.Field(target.GetType(), field);
		if (!(fieldInfo == null))
		{
			float num = Convert.ToSingle(fieldInfo.GetValue(target)) * factor;
			if (fieldInfo.FieldType == typeof(int))
			{
				Set(target, field, Mathf.Max(1, Mathf.RoundToInt(num)));
			}
			else
			{
				Set(target, field, num);
			}
		}
	}

	internal static void Add(object target, string field, float amount)
	{
		if (target == null)
		{
			return;
		}
		FieldInfo fieldInfo = AccessTools.Field(target.GetType(), field);
		if (!(fieldInfo == null))
		{
			float num = Convert.ToSingle(fieldInfo.GetValue(target)) + amount;
			if (fieldInfo.FieldType == typeof(int))
			{
				Set(target, field, Mathf.RoundToInt(num));
			}
			else
			{
				Set(target, field, num);
			}
		}
	}

	internal static float Orig(object target, string field)
	{
		foreach (Saved item in saved)
		{
			if (item.Target == target && item.Field.Name == field)
			{
				return Convert.ToSingle(item.Value);
			}
		}
		return Convert.ToSingle(AccessTools.Field(target.GetType(), field).GetValue(target));
	}

	internal static void MaxHealth(Player p, float factor)
	{
		Mul(p.data, "maxHealth", factor);
		p.data.health = p.data.maxHealth;
	}

	internal static void RestoreAll()
	{
		for (int num = saved.Count - 1; num >= 0; num--)
		{
			try
			{
				object target = saved[num].Target;
				if ((Object)((target is Object) ? target : null) != (Object)null || !(saved[num].Target is Object))
				{
					saved[num].Field.SetValue(saved[num].Target, saved[num].Value);
				}
			}
			catch (Exception)
			{
			}
		}
		saved.Clear();
		savedKeys.Clear();
		dmgTimer.Clear();
		Overlays.Clear();
		Mirror = (SwapJumpShoot = (AutoFire = (NoJump = (NoBlock = (Drunk = (AutoRun = (CamFlip = false)))))));
		CamSpin = 0f;
	}

	internal static void Refresh()
	{
		if ((Object)(object)PlayerManager.instance == (Object)null)
		{
			return;
		}
		foreach (Player player in PlayerManager.instance.players)
		{
			if (!((Object)(object)player == (Object)null))
			{
				Resize(player);
				if (player.data.health > player.data.maxHealth)
				{
					player.data.health = player.data.maxHealth;
				}
			}
		}
	}

	internal static void Push(Player p, Vector2 velocityChangePerSecond)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		if (Mine(p))
		{
			PlayerVelocity component = ((Component)p).GetComponent<PlayerVelocity>();
			if (!((Object)(object)component == (Object)null))
			{
				ref Vector2 reference = ref velRef.Invoke(component);
				reference += velocityChangePerSecond * Time.deltaTime;
			}
		}
	}

	internal static void SetVel(Player p, Vector2 v)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		if (Mine(p))
		{
			PlayerVelocity component = ((Component)p).GetComponent<PlayerVelocity>();
			if ((Object)(object)component != (Object)null)
			{
				velRef.Invoke(component) = v;
			}
		}
	}

	internal static Vector2 GetVel(Player p)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		PlayerVelocity component = ((Component)p).GetComponent<PlayerVelocity>();
		if (!((Object)(object)component != (Object)null))
		{
			return Vector2.zero;
		}
		return velRef.Invoke(component);
	}

	internal static void Teleport(Player p, Vector2 pos)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		if (Mine(p))
		{
			((Component)p).transform.position = new Vector3(pos.x, pos.y, ((Component)p).transform.position.z);
			SetVel(p, Vector2.zero);
		}
	}

	internal static void Hurt(Player p, float amount, float interval = 0.5f)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		if (Mine(p))
		{
			dmgTimer.TryGetValue(p, out var value);
			if (!(Time.time - value < interval))
			{
				dmgTimer[p] = Time.time;
				((Damagable)HH(p)).CallTakeDamage(Vector2.up * amount, Vector2.op_Implicit(((Component)p).transform.position), (GameObject)null, (Player)null, true);
			}
		}
	}

	internal static Vector2 World(float vx, float vy)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		Camera main = Camera.main;
		if ((Object)(object)main == (Object)null)
		{
			return Vector2.zero;
		}
		return Vector2.op_Implicit(main.ViewportToWorldPoint(new Vector3(vx, vy, 10f)));
	}

	internal static Vector2 Viewport(Vector3 world)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		Camera main = Camera.main;
		if (!((Object)(object)main == (Object)null))
		{
			return Vector2.op_Implicit(main.WorldToViewportPoint(world));
		}
		return Vector2.zero;
	}

	internal static Vector2 RandomSpot()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		return World(Random.Range(0.15f, 0.85f), Random.Range(0.3f, 0.85f));
	}

	internal static void Rect(float vx, float vy, float vw, float vh, Color c)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		GUI.color = c;
		GUI.DrawTexture(new Rect(vx * (float)Screen.width, (1f - vy - vh) * (float)Screen.height, vw * (float)Screen.width, vh * (float)Screen.height), (Texture)(object)Texture2D.whiteTexture);
		GUI.color = Color.white;
	}

	internal static float Noise(float a, float b)
	{
		return Mathf.PerlinNoise((float)(RoulettePlugin.Seed % 1000) + a, b);
	}
}
[HarmonyPatch(typeof(GeneralInput), "Update")]
internal static class InputPatch
{
	private static readonly Dictionary<GeneralInput, float> lastX = new Dictionary<GeneralInput, float>();

	private static void Postfix(GeneralInput __instance)
	{
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		if (Fx.Mirror)
		{
			__instance.direction.x = 0f - __instance.direction.x;
		}
		if (Fx.AutoRun)
		{
			float value;
			if (Mathf.Abs(__instance.direction.x) > 0.1f)
			{
				lastX[__instance] = Mathf.Sign(__instance.direction.x);
			}
			else if (lastX.TryGetValue(__instance, out value))
			{
				__instance.direction.x = value;
			}
		}
		if (Fx.SwapJumpShoot)
		{
			bool jumpWasPressed = __instance.jumpWasPressed;
			bool jumpIsPressed = __instance.jumpIsPressed;
			__instance.jumpWasPressed = __instance.shootWasPressed;
			__instance.jumpIsPressed = __instance.shootIsPressed;
			__instance.shootWasPressed = jumpWasPressed;
			__instance.shootIsPressed = jumpIsPressed;
		}
		if (Fx.AutoFire)
		{
			__instance.shootIsPressed = true;
			__instance.shootWasPressed = true;
		}
		if (Fx.NoJump)
		{
			__instance.jumpWasPressed = false;
			__instance.jumpIsPressed = false;
		}
		if (Fx.NoBlock)
		{
			__instance.shieldWasPressed = false;
		}
		if (Fx.Drunk)
		{
			float num = Mathf.Sin(Time.time * 2.3f) * 35f;
			__instance.aimDirection = Quaternion.Euler(0f, 0f, num) * __instance.aimDirection;
			__instance.direction.x += Mathf.Sin(Time.time * 1.7f) * 0.5f;
		}
	}
}
internal class Modifier
{
	public string Name;

	public string Desc;

	public Action<Player> Apply;

	public Action<Player> Tick;

	public Action OnStart;

	public Action OnEnd;
}
internal static class Modifiers
{
	public const string DoubleWheelName = "Double Wheel";

	public static readonly List<Modifier> All;

	private static void M(string name, string desc, Action<Player> apply = null, Action<Player> tick = null, Action start = null, Action end = null)
	{
		All.Add(new Modifier
		{
			Name = name,
			Desc = desc,
			Apply = apply,
			Tick = tick,
			OnStart = start,
			OnEnd = end
		});
	}

	private static int Rounds(Player p)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			return GameModeManager.CurrentHandler.GetTeamScore(p.teamID).rounds;
		}
		catch
		{
			return 0;
		}
	}

	static Modifiers()
	{
		All = new List<Modifier>();
		M("Water World", "The map is flooded: swim with jump, everything is slow and floaty", delegate(Player p)
		{
			Fx.Mul(Fx.Grav(p), "gravityForce", 0.25f);
			Fx.Mul(Fx.St(p), "movementSpeed", 0.65f);
			Fx.Mul(Fx.Gun(p), "projectielSimulatonSpeed", 0.45f);
			Fx.Mul(Fx.Gun(p), "gravity", 0.2f);
		}, delegate(Player p)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (Fx.Mine(p))
			{
				p.data.currentJumps = Mathf.Max(p.data.currentJumps, 1);
			}
			if (Fx.Mine(p))
			{
				Fx.SetVel(p, Fx.GetVel(p) * (1f - 1.5f * Time.deltaTime));
			}
		}, delegate
		{
			Fx.Overlays.Add(delegate
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				Fx.Rect(0f, 0f, 1f, 1f, new Color(0.1f, 0.4f, 1f, 0.22f));
			});
		});
		M("Reverse Gravity", "Everyone falls UP", delegate(Player p)
		{
			Fx.Set(Fx.Grav(p), "gravityForce", 0f - Fx.Orig(Fx.Grav(p), "gravityForce"));
			Fx.Set(Fx.Gun(p), "gravity", 0f - Fx.Orig(Fx.Gun(p), "gravity"));
		});
		M("Low Gravity", "Floaty jumps for everyone", delegate(Player p)
		{
			Fx.Mul(Fx.Grav(p), "gravityForce", 0.35f);
			Fx.Mul(Fx.Gun(p), "gravity", 0.35f);
		});
		M("Heavy Gravity", "Gravity is crushing", delegate(Player p)
		{
			Fx.Mul(Fx.Grav(p), "gravityForce", 2.2f);
			Fx.Mul(Fx.St(p), "jump", 1.3f);
			Fx.Mul(Fx.Gun(p), "gravity", 2.5f);
		});
		M("Gravity Flip-Flop", "Gravity reverses every 5 seconds", null, delegate(Player p)
		{
			Fx.Set(Fx.Grav(p), "gravityForce", Fx.Orig(Fx.Grav(p), "gravityForce") * (((int)(Fx.T / 5f) % 2 == 0) ? 1f : (-1f)));
		});
		M("Sideways Gravity", "Gravity pulls everyone to the right", delegate(Player p)
		{
			Fx.Mul(Fx.Grav(p), "gravityForce", 0.1f);
		}, delegate(Player p)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Fx.Push(p, new Vector2(45f, 0f));
		});
		M("Moon Jump", "Huge jumps, slow fall", delegate(Player p)
		{
			Fx.Mul(Fx.St(p), "jump", 1.8f);
			Fx.Mul(Fx.Grav(p), "gravityForce", 0.5f);
		});
		M("Zero-G Space", "No gravity at all. Drift.", delegate(Player p)
		{
			Fx.Set(Fx.Grav(p), "gravityForce", 0f);
			Fx.Set(Fx.Gun(p), "gravity", 0f);
		}, delegate(Player p)
		{
			if (Fx.Mine(p))
			{
				p.data.currentJumps = Mathf.Max(p.data.currentJumps, 1);
			}
		}, delegate
		{
			Fx.Overlays.Add(delegate
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				Fx.Rect(0f, 0f, 1f, 1f, new Color(0.05f, 0f, 0.15f, 0.25f));
			});
		});
		M("Trampoline Floor", "Touching the ground launches you", null, delegate(Player p)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (p.data.isGrounded && Fx.Mine(p))
			{
				Fx.SetVel(p, new Vector2(Fx.GetVel(p).x, 38f));
			}
		});
		M("Wind", "A strong wind that changes direction every 8s", null, delegate(Player p)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			Fx.Push(p, new Vector2((Fx.Noise(Mathf.Floor(Fx.T / 8f), 0.5f) - 0.5f) * 140f, 0f));
		});
		M("Black Hole", "The center of the map pulls everyone in", null, delegate(Player p)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = Fx.World(0.5f, 0.5f);
			Vector2 val2 = val - Vector2.op_Implicit(((Component)p).transform.position);
			Fx.Push(p, ((Vector2)(ref val2)).normalized * 35f);
		}, delegate
		{
			Fx.Overlays.Add(delegate
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				Fx.Rect(0.485f, 0.47f, 0.03f, 0.06f, new Color(0f, 0f, 0f, 0.9f));
			});
		});
		M("Tornado", "A tornado wanders the map and flings players", null, delegate(Player p)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = Fx.World(0.15f + 0.7f * Fx.Noise(Fx.T * 0.15f, 1f), 0.4f) - Vector2.op_Implicit(((Component)p).transform.position);
			if (((Vector2)(ref val)).magnitude < 8f)
			{
				Vector2 val2 = new Vector2(0f - val.y, 0f);
				Fx.Push(p, ((Vector2)(ref val2)).normalized * 0f + Vector2.up * 120f + ((Vector2)(ref val)).normalized * 40f);
			}
		}, delegate
		{
			Fx.Overlays.Add(delegate
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				Fx.Rect(0.15f + 0.7f * Fx.Noise(Fx.T * 0.15f, 1f) - 0.03f, 0.15f, 0.06f, 0.5f, new Color(0.7f, 0.7f, 0.7f, 0.35f));
			});
		});
		M("Lava Rising", "Lava slowly fills the map from the bottom", null, delegate(Player p)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Min(0.55f, Fx.T / 70f);
			if (Fx.Viewport(((Component)p).transform.position).y < num)
			{
				Fx.Hurt(p, 12f, 0.25f);
			}
		}, delegate
		{
			Fx.Overlays.Add(delegate
			{
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				Fx.Rect(0f, 0f, 1f, Mathf.Min(0.55f, Fx.T / 70f), new Color(1f, 0.35f, 0f, 0.45f));
			});
		});
		M("Shrinking Arena", "The edges of the map close in", null, delegate(Player p)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Min(0.4f, Fx.T / 60f);
			float x = Fx.Viewport(((Component)p).transform.position).x;
			if (x < num || x > 1f - num)
			{
				Fx.Hurt(p, 10f, 0.25f);
			}
		}, delegate
		{
			Fx.Overlays.Add(delegate
			{
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.Min(0.4f, Fx.T / 60f);
				Color c = default(Color);
				((Color)(ref c))..ctor(1f, 0f, 0.2f, 0.35f);
				Fx.Rect(0f, 0f, num, 1f, c);
				Fx.Rect(1f - num, 0f, num, 1f, c);
			});
		});
		M("Laser Sweep", "A laser sweeps back and forth across the map", null, delegate(Player p)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.PingPong(Fx.T * 0.15f, 1f);
			if (Mathf.Abs(Fx.Viewport(((Component)p).transform.position).x - num) < 0.015f)
			{
				Fx.Hurt(p, 25f, 0.4f);
			}
		}, delegate
		{
			Fx.Overlays.Add(delegate
			{
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				Fx.Rect(Mathf.PingPong(Fx.T * 0.15f, 1f) - 0.004f, 0f, 0.008f, 1f, new Color(1f, 0f, 0f, 0.8f));
			});
		});
		M("Rising Ceiling Spikes", "A spike ceiling slowly lowers", null, delegate(Player p)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			float num = 1f - Mathf.Min(0.45f, Fx.T / 70f);
			if (Fx.Viewport(((Component)p).transform.position).y > num)
			{
				Fx.Hurt(p, 15f, 0.25f);
			}
		}, delegate
		{
			Fx.Overlays.Add(delegate
			{
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.Min(0.45f, Fx.T / 70f);
				Fx.Rect(0f, 1f - num, 1f, num, new Color(0.4f, 0.4f, 0.4f, 0.5f));
			});
		});
		M("Safe Zone", "Only a moving circle is safe; outside it you burn", null, delegate(Player p)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0.2f + 0.6f * Fx.Noise(Fx.T * 0.08f, 3f), 0.3f + 0.4f * Fx.Noise(Fx.T * 0.08f, 7f));
			if (Fx.T > 5f && Vector2.Distance(Fx.Viewport(((Component)p).transform.position), val) > 0.25f)
			{
				Fx.Hurt(p, 6f, 0.3f);
			}
		}, delegate
		{
			Fx.Overlays.Add(delegate
			{
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(0.2f + 0.6f * Fx.Noise(Fx.T * 0.08f, 3f), 0.3f + 0.4f * Fx.Noise(Fx.T * 0.08f, 7f));
				Fx.Rect(val.x - 0.2f, val.y - 0.25f, 0.4f, 0.5f, new Color(0.2f, 1f, 0.3f, 0.15f));
			});
		});
		M("Earthquake", "The ground keeps shaking players around", null, delegate(Player p)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (Fx.Mine(p) && Random.value < 0.02f)
			{
				Fx.SetVel(p, Fx.GetVel(p) + Random.insideUnitCircle * 25f);
			}
		});
		M("Bouncy Players", "Players bounce off everything", delegate(Player p)
		{
			Fx.Mul(Fx.Jump(p), "upForce", 1.3f);
		}, delegate(Player p)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (p.data.isGrounded && Fx.Mine(p) && Mathf.Abs(Fx.GetVel(p).x) > 3f)
			{
				Fx.SetVel(p, Fx.GetVel(p) + Vector2.up * 20f * Time.deltaTime * 60f * 0.1f);
			}
		});
		M("Upside Down", "The camera is flipped", null, null, delegate
		{
			Fx.CamFlip = true;
		});
		M("Spinning Map", "The camera slowly rotates", null, null, delegate
		{
			Fx.CamSpin = 12f;
		});
		M("Blackout", "The lights flicker off", null, null, delegate
		{
			Fx.Overlays.Add(delegate
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				Fx.Rect(0f, 0f, 1f, 1f, new Color(0f, 0f, 0f, (Mathf.Sin(Fx.T * 1.3f) > 0.3f) ? 0.85f : 0f));
			});
		});
		M("Disco", "Party lights!", null, null, delegate
		{
			Fx.Overlays.Add(delegate
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				Fx.Rect(0f, 0f, 1f, 1f, Color.HSVToRGB(Fx.T * 0.5f % 1f, 1f, 1f) * new Color(1f, 1f, 1f, 0.18f));
			});
		});
		M("Giant Bullets", "Bullets are huge", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "projectileSize", 4f);
			Fx.Mul(Fx.Gun(p), "size", 3f);
		});
		M("Tiny Bullets", "Bullets are tiny", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "projectileSize", 0.3f);
			Fx.Mul(Fx.Gun(p), "size", 0.3f);
		});
		M("Super Bouncy Bullets", "Bullets bounce 10 times", delegate(Player p)
		{
			Fx.Add(Fx.Gun(p), "reflects", 10f);
		});
		M("Random Bounces", "Bullets bounce in random directions", delegate(Player p)
		{
			Fx.Add(Fx.Gun(p), "reflects", 4f);
			Fx.Add(Fx.Gun(p), "randomBounces", 4f);
		});
		M("Wavy Bullets", "Bullets wiggle through the air", delegate(Player p)
		{
			Fx.Set(Fx.Gun(p), "waveMovement", true);
		});
		M("Slow-Mo Bullets", "Bullets crawl", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "projectielSimulatonSpeed", 0.3f);
		});
		M("Hyper Bullets", "Bullets are lightning fast", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "projectielSimulatonSpeed", 2.5f);
			Fx.Mul(Fx.Gun(p), "projectileSpeed", 2f);
		});
		M("Artillery", "Bullets arc heavily", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "gravity", 4f);
			Fx.Mul(Fx.Gun(p), "projectileSpeed", 1.4f);
		});
		M("Anti-Gravity Bullets", "Bullets fall upward", delegate(Player p)
		{
			Fx.Set(Fx.Gun(p), "gravity", 0f - Mathf.Max(0.5f, Mathf.Abs(Fx.Orig(Fx.Gun(p), "gravity"))));
		});
		M("Ghost Bullets", "Bullets go through walls", delegate(Player p)
		{
			Fx.Set(Fx.Gun(p), "ignoreWalls", true);
		});
		M("Unblockable", "Bullets can't be blocked", delegate(Player p)
		{
			Fx.Set(Fx.Gun(p), "unblockable", true);
		});
		M("Shotgun Party", "Everyone fires 6 spread bullets", delegate(Player p)
		{
			Fx.Add(Fx.Gun(p), "numberOfProjectiles", 5f);
			Fx.Add(Fx.Gun(p), "spread", 0.25f);
			Fx.Mul(Fx.Gun(p), "damage", 0.4f);
		});
		M("Burst Fire", "Every shot is a 4-round burst", delegate(Player p)
		{
			Fx.Add(Fx.Gun(p), "bursts", 3f);
			Fx.Set(Fx.Gun(p), "timeBetweenBullets", 0.07f);
			Fx.Mul(Fx.Gun(p), "damage", 0.5f);
		});
		M("Knockback Only", "Bullets barely hurt but push really hard", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "damage", 0.15f);
			Fx.Mul(Fx.Gun(p), "knockback", 6f);
		});
		M("Freeze Rays", "Hits slow targets massively", delegate(Player p)
		{
			Fx.Add(Fx.Gun(p), "slow", 0.8f);
		});
		M("Recoil Rocket", "Shooting launches you backward", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "bodyRecoil", 8f);
		});
		M("Sniper Mode", "Fast, deadly bullets but slow fire rate", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "damage", 2.5f);
			Fx.Mul(Fx.Gun(p), "projectileSpeed", 2f);
			Fx.Mul(Fx.Gun(p), "attackSpeed", 3f);
		});
		M("Machine Guns", "Very fast fire rate, weak bullets", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "attackSpeed", 0.2f);
			Fx.Mul(Fx.Gun(p), "damage", 0.3f);
			Fx.Mul(Fx.Ammo(p), "maxAmmo", 4f);
		});
		M("Drag Bullets", "Bullets slow down and stop mid-air", delegate(Player p)
		{
			Fx.Add(Fx.Gun(p), "drag", 3f);
			Fx.Set(Fx.Gun(p), "dragMinSpeed", 0.1f);
		});
		M("Ricochet Damage", "Bullets get stronger each bounce", delegate(Player p)
		{
			Fx.Add(Fx.Gun(p), "reflects", 5f);
			Fx.Add(Fx.Gun(p), "dmgMOnBounce", 0.5f);
		});
		M("Speedy Bounce", "Bullets speed up each bounce", delegate(Player p)
		{
			Fx.Add(Fx.Gun(p), "reflects", 5f);
			Fx.Add(Fx.Gun(p), "speedMOnBounce", 0.5f);
		});
		M("Huge Spread", "Accuracy? Never heard of it", delegate(Player p)
		{
			Fx.Add(Fx.Gun(p), "spread", 0.6f);
			Fx.Add(Fx.Gun(p), "numberOfProjectiles", 2f);
		});
		M("Percent Damage", "Bullets deal % of max health", delegate(Player p)
		{
			Fx.Add(Fx.Gun(p), "percentageDamage", 0.25f);
		});
		M("Long Range Snipes", "Bullets get stronger the farther they travel", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "damageAfterDistanceMultiplier", 3f);
		});
		M("Short Range", "Bullets vanish quickly", delegate(Player p)
		{
			Fx.Set(Fx.Gun(p), "destroyBulletAfter", 0.25f);
		});
		M("One Shot", "Everyone has 1 HP", delegate(Player p)
		{
			Fx.Set(p.data, "maxHealth", 1f);
			p.data.health = 1f;
		});
		M("Juggernauts", "Everyone has 10x HP", delegate(Player p)
		{
			Fx.MaxHealth(p, 10f);
		});
		M("Double Speed", "Everyone moves twice as fast", delegate(Player p)
		{
			Fx.Mul(Fx.St(p), "movementSpeed", 2f);
		});
		M("Slow Motion", "Everyone moves at half speed", delegate(Player p)
		{
			Fx.Mul(Fx.St(p), "movementSpeed", 0.5f);
			Fx.Mul(Fx.St(p), "jump", 0.8f);
		});
		M("Shrink Ray", "Players are tiny", delegate(Player p)
		{
			Fx.Mul(Fx.St(p), "sizeMultiplier", 0.5f);
		});
		M("Giants", "Players are huge", delegate(Player p)
		{
			Fx.Mul(Fx.St(p), "sizeMultiplier", 2f);
		});
		M("Size Chaos", "Player size keeps changing", null, delegate(Player p)
		{
			Fx.Set(Fx.St(p), "sizeMultiplier", Fx.Orig(Fx.St(p), "sizeMultiplier") * (0.4f + 1.6f * Fx.Noise(Fx.T * 0.4f, (float)p.playerID * 10f)));
			Fx.Resize(p);
		});
		M("Infinite Ammo", "No reloading", null, delegate(Player p)
		{
			GunAmmo val = Fx.Ammo(p);
			if ((Object)(object)val != (Object)null)
			{
				Traverse.Create((object)val).Field("currentAmmo").SetValue((object)val.maxAmmo);
			}
		});
		M("One Bullet", "1 bullet per reload", delegate(Player p)
		{
			Fx.Set(Fx.Ammo(p), "maxAmmo", 1);
			Fx.Mul(Fx.Gun(p), "damage", 2f);
		});
		M("Infinite Jumps", "Jump as many times as you like", null, delegate(Player p)
		{
			if (Fx.Mine(p))
			{
				p.data.currentJumps = Mathf.Max(p.data.currentJumps, 1);
			}
		});
		M("Grounded", "Nobody can jump", null, null, delegate
		{
			Fx.NoJump = true;
		});
		M("Vampires", "Everyone heals from damage dealt", delegate(Player p)
		{
			Fx.Add(Fx.St(p), "lifeSteal", 0.75f);
		});
		M("Regeneration", "Everyone heals quickly", delegate(Player p)
		{
			Fx.Add(Fx.HH(p), "regeneration", 15f);
		});
		M("Poison Air", "Everyone slowly loses health", null, delegate(Player p)
		{
			Fx.Hurt(p, 4f, 1f);
		}, delegate
		{
			Fx.Overlays.Add(delegate
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				Fx.Rect(0f, 0f, 1f, 1f, new Color(0.3f, 0.8f, 0.1f, 0.12f));
			});
		});
		M("Glass Cannon", "3x damage, 1/3 HP", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "damage", 3f);
			Fx.MaxHealth(p, 0.34f);
		});
		M("Tank Mode", "1/3 damage, 3x HP", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "damage", 0.34f);
			Fx.MaxHealth(p, 3f);
		});
		M("Adrenaline", "You get faster the longer you survive", null, delegate(Player p)
		{
			Fx.Set(Fx.St(p), "movementSpeed", Fx.Orig(Fx.St(p), "movementSpeed") * (1f + Fx.T / 15f));
		});
		M("Fading", "Players flicker invisible", null, delegate(Player p)
		{
			SpriteRenderer[] componentsInChildren = ((Component)p).GetComponentsInChildren<SpriteRenderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((Renderer)componentsInChildren[i]).enabled = Mathf.Sin(Fx.T * 3f + (float)p.playerID) > -0.2f;
			}
		}, null, delegate
		{
			foreach (Player player in PlayerManager.instance.players)
			{
				SpriteRenderer[] componentsInChildren = ((Component)player).GetComponentsInChildren<SpriteRenderer>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Renderer)componentsInChildren[i]).enabled = true;
				}
			}
		});
		M("Damage Over Time", "All damage is dealt slowly over 3 seconds", delegate(Player p)
		{
			Fx.Add(Fx.St(p), "secondsToTakeDamageOver", 3f);
		});
		M("Super Jump", "Jumps go WAY higher", delegate(Player p)
		{
			Fx.Mul(Fx.St(p), "jump", 1.8f);
		});
		M("Triple Jump", "Everyone gets 2 extra jumps", delegate(Player p)
		{
			Fx.Add(Fx.St(p), "numberOfJumps", 2f);
		});
		M("Featherweight", "Players are light and easy to knock around", delegate(Player p)
		{
			Fx.Mul(Fx.Gun(p), "knockback", 3f);
		});
		M("Mirror Mode", "Left and right are swapped", null, null, delegate
		{
			Fx.Mirror = true;
		});
		M("Swapped Buttons", "Jump shoots and shoot jumps", null, null, delegate
		{
			Fx.SwapJumpShoot = true;
		});
		M("Trigger Happy", "Everyone shoots nonstop", null, null, delegate
		{
			Fx.AutoFire = true;
		});
		M("Drunk Mode", "Wobbly aim and movement", null, null, delegate
		{
			Fx.Drunk = true;
		});
		M("No Brakes", "You can't stop moving", null, null, delegate
		{
			Fx.AutoRun = true;
		});
		M("Random Teleport", "Everyone teleports every 8 seconds", null, delegate(Player p)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (Fx.Mine(p) && Mathf.Repeat(Fx.T, 8f) < Time.deltaTime)
			{
				Fx.Teleport(p, Fx.RandomSpot());
			}
		});
		M("Blink Dash", "Jumping teleports you a short distance forward", null, delegate(Player p)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//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)
			if (Fx.Mine(p) && p.data.input.jumpWasPressed && !p.data.isGrounded)
			{
				Fx.Teleport(p, Vector2.op_Implicit(((Component)p).transform.position) + Vector2.op_Implicit(((Vector3)(ref p.data.input.direction)).normalized) * 5f);
			}
		});
		M("Hyper Mode", "Everything is faster: movement, bullets, reloads", delegate(Player p)
		{
			Fx.Mul(Fx.St(p), "movementSpeed", 1.5f);
			Fx.Mul(Fx.Gun(p), "projectielSimulatonSpeed", 1.5f);
			Fx.Mul(Fx.Gun(p), "attackSpeed", 0.6f);
			Fx.Mul(Fx.Ammo(p), "reloadTimeMultiplier", 0.5f);
		});
		M("Sudden Death", "1 HP and no blocking. First hit wins.", delegate(Player p)
		{
			Fx.Set(p.data, "maxHealth", 1f);
			p.data.health = 1f;
		}, null, delegate
		{
			Fx.NoBlock = true;
		});
		M("No Blocking", "Blocking is disabled", null, null, delegate
		{
			Fx.NoBlock = true;
		});
		M("Block Spam", "Block cooldown is almost zero", delegate(Player p)
		{
			Fx.Mul(Fx.Blk(p), "cdMultiplier", 0.1f);
		});
		M("Slow Blocks", "Blocks take ages to recharge", delegate(Player p)
		{
			Fx.Mul(Fx.Blk(p), "cdMultiplier", 3f);
		});
		M("Healing Blocks", "Blocking heals you", delegate(Player p)
		{
			Fx.Add(Fx.Blk(p), "healing", 30f);
		});
		M("Rocket Block", "Blocking launches you upward", delegate(Player p)
		{
			Fx.Add(Fx.Blk(p), "forceToAddUp", 50f);
		});
		M("Double Block", "Every block counts twice", delegate(Player p)
		{
			Fx.Add(Fx.Blk(p), "additionalBlocks", 1f);
		});
		M("Underdog Buff", "Players with the fewest rounds get 2x damage and speed", delegate(Player p)
		{
			int num = ((IEnumerable<Player>)PlayerManager.instance.players).Min((Func<Player, int>)Rounds);
			if (Rounds(p) == num)
			{
				Fx.Mul(Fx.Gun(p), "damage", 2f);
				Fx.Mul(Fx.St(p), "movementSpeed", 1.4f);
			}
		});
		M("Leader Debuff", "Whoever is winning is slower and smaller", delegate(Player p)
		{
			int num = ((IEnumerable<Player>)PlayerManager.instance.players).Max((Func<Player, int>)Rounds);
			if (Rounds(p) == num && num > 0)
			{
				Fx.Mul(Fx.St(p), "movementSpeed", 0.7f);
				Fx.Mul(Fx.Gun(p), "damage", 0.7f);
				Fx.MaxHealth(p, 0.7f);
			}
		});
		M("Random Buffs", "Everyone gets a random stat boost", delegate(Player p)
		{
			switch (new Random(RoulettePlugin.Seed + p.playerID).Next(4))
			{
			case 0:
				Fx.Mul(Fx.Gun(p), "damage", 2f);
				break;
			case 1:
				Fx.MaxHealth(p, 2f);
				break;
			case 2:
				Fx.Mul(Fx.St(p), "movementSpeed", 1.7f);
				break;
			default:
				Fx.Mul(Fx.Gun(p), "attackSpeed", 0.4f);
				break;
			}
		});
		M("Random Nerfs", "Everyone gets a random stat penalty", delegate(Player p)
		{
			switch (new Random(RoulettePlugin.Seed * 3 + p.playerID).Next(4))
			{
			case 0:
				Fx.Mul(Fx.Gun(p), "damage", 0.5f);
				break;
			case 1:
				Fx.MaxHealth(p, 0.5f);
				break;
			case 2:
				Fx.Mul(Fx.St(p), "movementSpeed", 0.6f);
				break;
			default:
				Fx.Mul(Fx.Gun(p), "attackSpeed", 2f);
				break;
			}
		});
		M("Double Wheel", "Spin twice and stack two modifiers");
		M("Lucky!", "No modifier this round");
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.roundsroulette.rounds", "Rounds Roulette", "0.1.2")]
[BepInProcess("Rounds.exe")]
public class RoulettePlugin : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static UnityAction <>9__12_0;

		public static UnityAction<float> <>9__13_0;

		public static Func<int, bool> <>9__14_0;

		public static Func<int, bool> <>9__14_1;

		internal void <Start>b__12_0()
		{
		}

		internal void <BuildMenu>b__13_0(float v)
		{
			SpinChance.Value = v;
		}

		internal bool <OnRoundStart>b__14_0(int i)
		{
			return Enabled[i].Value;
		}

		internal bool <OnRoundStart>b__14_1(int i)
		{
			return Modifiers.All[i].Name != "Double Wheel";
		}
	}

	public const string ModId = "com.roundsroulette.rounds";

	public const string ModName = "Rounds Roulette";

	public const string Version = "0.1.2";

	internal static RoulettePlugin Instance;

	internal static ConfigEntry<float> SpinChance;

	internal static ConfigEntry<bool> RouletteOn;

	internal static readonly Dictionary<int, ConfigEntry<bool>> Enabled = new Dictionary<int, ConfigEntry<bool>>();

	internal static int[] Pending;

	internal static readonly List<Modifier> Active = new List<Modifier>();

	internal static float RoundStartTime;

	internal static int Seed;

	private void Awake()
	{
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		Instance = this;
		RouletteOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Rounds Roulette", "Enabled", true, "Roulette on or off (F7 in the lobby).");
		SpinChance = ((BaseUnityPlugin)this).Config.Bind<float>("Rounds Roulette", "SpinChance", 1f, "Chance (0-1) that the wheel spins at the start of a round.");
		for (int i = 0; i < Modifiers.All.Count; i++)
		{
			string text = new string(Modifiers.All[i].Name.Where(char.IsLetterOrDigit).ToArray());
			Enabled[i] = ((BaseUnityPlugin)this).Config.Bind<bool>("Modifiers", i.ToString("000") + "_" + text, true, Modifiers.All[i].Desc);
		}
		new Harmony("com.roundsroulette.rounds").PatchAll();
	}

	private void Start()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		Unbound.RegisterCredits("Rounds Roulette", new string[1] { "Rounds Roulette contributors" }, new string[0], new string[0]);
		object obj = <>c.<>9__12_0;
		if (obj == null)
		{
			UnityAction val = delegate
			{
			};
			<>c.<>9__12_0 = val;
			obj = (object)val;
		}
		Unbound.RegisterMenu("Rounds Roulette", (UnityAction)obj, (Action<GameObject>)BuildMenu, (GameObject)null, true);
		GameModeManager.AddHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)OnRoundStart);
		GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)OnRoundEnd);
		GameModeManager.AddHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)OnRoundEnd);
		GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)OnRoundEnd);
		((Component)this).gameObject.AddComponent<RouletteRunner>();
		((Component)this).gameObject.AddComponent<RouletteToggle>();
		Unbound.RegisterHandshake("com.roundsroulette.rounds", (Action)RouletteToggle.Push);
	}

	private static void BuildMenu(GameObject menu)
	{
		TextMeshProUGUI val = default(TextMeshProUGUI);
		MenuHandler.CreateText("ROUNDS ROULETTE", menu, ref val, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
		MenuHandler.CreateText("The host's settings decide which modifiers can be rolled.", menu, ref val, 24, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
		Slider val2 = default(Slider);
		MenuHandler.CreateSlider("Spin chance", menu, 30, 0f, 1f, SpinChance.Value, (UnityAction<float>)delegate(float v)
		{
			SpinChance.Value = v;
		}, ref val2, false, (Color?)null, (Direction)0, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
		for (int num = 0; num < Modifiers.All.Count; num++)
		{
			int idx = num;
			MenuHandler.CreateToggle(Enabled[idx].Value, Modifiers.All[idx].Name + " - " + Modifiers.All[idx].Desc, menu, (UnityAction<bool>)delegate(bool on)
			{
				Enabled[idx].Value = on;
			}, 20, false, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
		}
	}

	private static IEnumerator OnRoundStart(IGameModeHandler gm)
	{
		Clear();
		if (PhotonNetwork.OfflineMode || PhotonNetwork.IsMasterClient || !PhotonNetwork.InRoom)
		{
			Random random = new Random();
			List<int> list = new List<int>();
			if (RouletteToggle.On && random.NextDouble() < (double)SpinChance.Value)
			{
				List<int> list2 = (from i in Enumerable.Range(0, Modifiers.All.Count)
					where Enabled[i].Value
					select i).ToList();
				if (list2.Count > 0)
				{
					int num = list2[random.Next(list2.Count)];
					list.Add(num);
					if (Modifiers.All[num].Name == "Double Wheel")
					{
						List<int> list3 = list2.Where((int i) => Modifiers.All[i].Name != "Double Wheel").ToList();
						for (int num2 = 0; num2 < 2; num2++)
						{
							if (list3.Count <= 0)
							{
								break;
							}
							int item = list3[random.Next(list3.Count)];
							list3.Remove(item);
							list.Add(item);
						}
					}
				}
			}
			NetworkingManager.RPC(typeof(RoulettePlugin), "RPC_Spin", new object[2]
			{
				list.ToArray(),
				random.Next(1, 100000)
			});
		}
		float waited = 0f;
		while (Pending == null && waited < 4f)
		{
			waited += Time.unscaledDeltaTime;
			yield return null;
		}
		if (Pending == null || Pending.Length == 0)
		{
			Pending = null;
			yield break;
		}
		yield return RouletteRunner.Instance.SpinAnimation(Pending);
		RoundStartTime = Time.time;
		int[] pending = Pending;
		foreach (int index in pending)
		{
			Active.Add(Modifiers.All[index]);
		}
		foreach (Modifier item2 in Active)
		{
			item2.OnStart?.Invoke();
		}
		foreach (Player player in PlayerManager.instance.players)
		{
			foreach (Modifier item3 in Active)
			{
				item3.Apply?.Invoke(player);
			}
		}
		Fx.Refresh();
		Pending = null;
	}

	[UnboundRPC]
	public static void RPC_Spin(int[] ids, int seed)
	{
		Pending = ids;
		Seed = seed;
	}

	private static IEnumerator OnRoundEnd(IGameModeHandler gm)
	{
		Clear();
		yield break;
	}

	internal static void Clear()
	{
		foreach (Modifier item in Active)
		{
			item.OnEnd?.Invoke();
		}
		Active.Clear();
		Fx.RestoreAll();
		Fx.Refresh();
	}
}
internal class RouletteRunner : MonoBehaviour
{
	internal static RouletteRunner Instance;

	private string spinText;

	private string spinDesc;

	private GUIStyle big;

	private GUIStyle small;

	private GUIStyle corner;

	private const int Segments = 12;

	private const float SegAngle = 30f;

	private static readonly Color[] SegColors = (Color[])(object)new Color[12]
	{
		new Color(0.12f, 0.7f, 0.27f),
		new Color(0.1f, 0.1f, 0.12f),
		new Color(0.86f, 0.16f, 0.2f),
		new Color(0.1f, 0.1f, 0.12f),
		new Color(0.16f, 0.55f, 1f),
		new Color(0.1f, 0.1f, 0.12f),
		new Color(1f, 0.59f, 0.08f),
		new Color(0.1f, 0.1f, 0.12f),
		new Color(0.59f, 0.24f, 0.9f),
		new Color(0.1f, 0.1f, 0.12f),
		new Color(0.86f, 0.16f, 0.2f),
		new Color(0.1f, 0.1f, 0.12f)
	};

	private Texture2D wheelTex;

	private Texture2D hubTex;

	private string[] segLabels;

	private bool wheelVisible;

	private bool wheelLanded;

	private float wheelAngle;

	private GUIStyle segStyle;

	private GUIStyle hubStyle;

	private void Awake()
	{
		Instance = this;
	}

	internal IEnumerator SpinAnimation(int[] ids)
	{
		List<Modifier> all = Modifiers.All;
		Random rng = new Random(RoulettePlugin.Seed);
		EnsureTextures();
		segLabels = new string[12];
		segLabels[0] = all[ids[0]].Name;
		List<int> list = (from _ in Enumerable.Range(0, all.Count)
			where _ != ids[0]
			orderby rng.Next()
			select _).ToList();
		for (int num = 1; num < 12; num++)
		{
			segLabels[num] = all[list[(num - 1) % list.Count]].Name;
		}
		float num2 = (float)(rng.NextDouble() - 0.5) * 30f * 0.7f;
		float target = 2160f + num2;
		wheelVisible = true;
		wheelLanded = false;
		spinText = null;
		for (float t = 0f; t < 4f; t += Time.unscaledDeltaTime)
		{
			float num3 = t / 4f;
			wheelAngle = target * (1f - Mathf.Pow(1f - num3, 3f));
			yield return null;
		}
		wheelAngle = target;
		wheelLanded = true;
		spinText = string.Join(" + ", (from i in ids
			where ids.Length == 1 || all[i].Name != "Double Wheel"
			select all[i].Name).ToArray());
		spinDesc = string.Join("   |   ", (from i in ids
			where ids.Length == 1 || all[i].Name != "Double Wheel"
			select all[i].Desc).ToArray());
		yield return (object)new WaitForSecondsRealtime((ids.Length > 1) ? 3.5f : 2.5f);
		wheelVisible = false;
		spinText = null;
	}

	private void EnsureTextures()
	{
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Expected O, but got Unknown
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Expected O, but got Unknown
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0243: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)wheelTex != (Object)null)
		{
			return;
		}
		float num = 256f;
		float num2 = num - 2f;
		float num3 = num2 * 0.94f;
		Color val = default(Color);
		((Color)(ref val))..ctor(0.9f, 0.7f, 0.16f);
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(0.47f, 0.27f, 0.04f);
		wheelTex = new Texture2D(512, 512, (TextureFormat)4, false)
		{
			filterMode = (FilterMode)1
		};
		hubTex = new Texture2D(128, 128, (TextureFormat)4, false)
		{
			filterMode = (FilterMode)1
		};
		Color[] array = (Color[])(object)new Color[262144];
		for (int i = 0; i < 512; i++)
		{
			for (int j = 0; j < 512; j++)
			{
				float num4 = (float)j - num;
				float num5 = num - (float)i;
				float num6 = Mathf.Sqrt(num4 * num4 + num5 * num5);
				Color val3;
				if (num6 > num2)
				{
					val3 = Color.clear;
				}
				else if (num6 > num3)
				{
					val3 = ((num6 > num2 - 3f || num6 < num3 + 3f) ? val2 : val);
				}
				else
				{
					float num7 = Mathf.Repeat(Mathf.Atan2(num4, 0f - num5) * 57.29578f + 15f, 360f);
					val3 = ((num7 % 30f < 144f / Mathf.Max(num6, 1f)) ? val : SegColors[(int)(num7 / 30f) % 12]);
				}
				if (num6 > num2 - 1.5f && num6 <= num2)
				{
					val3.a = num2 - num6;
				}
				array[i * 512 + j] = val3;
			}
		}
		wheelTex.SetPixels(array);
		wheelTex.Apply();
		Color[] array2 = (Color[])(object)new Color[16384];
		for (int k = 0; k < 128; k++)
		{
			for (int l = 0; l < 128; l++)
			{
				float num8 = Mathf.Sqrt(((float)l - 64f) * ((float)l - 64f) + ((float)k - 64f) * ((float)k - 64f));
				array2[k * 128 + l] = (Color)((num8 > 63f) ? Color.clear : ((num8 > 46f) ? val : new Color(0.1f, 0.1f, 0.12f)));
			}
		}
		hubTex.SetPixels(array2);
		hubTex.Apply();
	}

	private void DrawWheel()
	{
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Expected O, but got Unknown
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Expected O, but got Unknown
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0310: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_034c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_036e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		float num = (float)Screen.height * 0.3f;
		Vector2 val = default(Vector2);
		((Vector2)(ref val))..ctor((float)Screen.width / 2f, (float)Screen.height * 0.45f);
		if (segStyle == null)
		{
			segStyle = new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1,
				wordWrap = false,
				clipping = (TextClipping)1
			};
			segStyle.normal.textColor = Color.white;
			hubStyle = new GUIStyle(segStyle);
			hubStyle.normal.textColor = new Color(1f, 0.86f, 0.3f);
		}
		segStyle.fontSize = Mathf.RoundToInt(num * 0.075f);
		hubStyle.fontSize = Mathf.RoundToInt(num * 0.2f);
		GUI.color = new Color(0f, 0f, 0f, 0.55f);
		GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)Texture2D.whiteTexture);
		GUI.color = Color.white;
		Matrix4x4 matrix = GUI.matrix;
		GUIUtility.RotateAroundPivot(wheelAngle, val);
		GUI.DrawTexture(new Rect(val.x - num, val.y - num, 2f * num, 2f * num), (Texture)(object)wheelTex);
		GUI.matrix = matrix;
		float num2 = num * 0.2f;
		float num3 = num * 0.9f;
		for (int i = 0; i < 12; i++)
		{
			GUIUtility.RotateAroundPivot((float)i * 30f + wheelAngle - 90f, val);
			bool flag = wheelLanded && i == 0;
			segStyle.normal.textColor = (Color)(flag ? new Color(1f, 0.9f, 0.3f) : Color.white);
			GUI.Label(new Rect(val.x + num2, val.y - num * 0.08f, num3 - num2, num * 0.16f), segLabels[i], segStyle);
			GUI.matrix = matrix;
		}
		float num4 = num * 0.22f;
		GUI.DrawTexture(new Rect(val.x - num4, val.y - num4, 2f * num4, 2f * num4), (Texture)(object)hubTex);
		GUI.Label(new Rect(val.x - num4, val.y - num4, 2f * num4, 2f * num4), "?", hubStyle);
		float num5 = num * 0.16f;
		float num6 = num * 0.18f;
		float num7 = val.y - num - num6 * 0.55f;
		for (int j = 0; j < 12; j++)
		{
			float num8 = (float)j / 12f;
			float num9 = num5 * (1f - num8);
			GUI.DrawTexture(new Rect(val.x - num9 / 2f, num7 + num6 * num8, num9, num6 / 12f + 1f), (Texture)(object)Texture2D.whiteTexture);
		}
		GUI.Label(new Rect(0f, val.y - num - num6 - 60f, (float)Screen.width, 50f), "~ ROULETTE ~", small);
		if (spinText != null)
		{
			GUI.Label(new Rect(0f, val.y + num + 10f, (float)Screen.width, 70f), spinText, big);
			GUI.Label(new Rect(0f, val.y + num + 75f, (float)Screen.width, 40f), spinDesc, small);
		}
	}

	private void Update()
	{
		if (RoulettePlugin.Active.Count == 0 || (Object)(object)PlayerManager.instance == (Object)null)
		{
			return;
		}
		foreach (Player player in PlayerManager.instance.players)
		{
			if ((Object)(object)player == (Object)null || player.data.dead)
			{
				continue;
			}
			foreach (Modifier item in RoulettePlugin.Active)
			{
				item.Tick?.Invoke(player);
			}
		}
	}

	private void LateUpdate()
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		Camera main = Camera.main;
		if (!((Object)(object)main == (Object)null))
		{
			float num = (Fx.CamFlip ? 180f : 0f);
			num += Fx.CamSpin * (Time.time - RoulettePlugin.RoundStartTime);
			if (num != 0f || Fx.CamTouched)
			{
				((Component)main).transform.rotation = Quaternion.Euler(0f, 0f, num);
				Fx.CamTouched = num != 0f;
			}
		}
	}

	private void OnGUI()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//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_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Expected O, but got Unknown
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Expected O, but got Unknown
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		if (big == null)
		{
			big = new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4,
				fontSize = 54,
				fontStyle = (FontStyle)1
			};
			big.normal.textColor = new Color(1f, 0.85f, 0.2f);
			small = new GUIStyle(big)
			{
				fontSize = 26,
				fontStyle = (FontStyle)0
			};
			small.normal.textColor = Color.white;
			corner = new GUIStyle(small)
			{
				alignment = (TextAnchor)0,
				fontSize = 20
			};
		}
		foreach (Action overlay in Fx.Overlays)
		{
			overlay();
		}
		if (wheelVisible)
		{
			DrawWheel();
		}
		else if (RoulettePlugin.Active.Count > 0)
		{
			GUI.Label(new Rect(15f, 10f, (float)Screen.width, 30f), "ROULETTE: " + string.Join(" + ", RoulettePlugin.Active.Select((Modifier m) => m.Name).ToArray()), corner);
		}
	}
}
internal class RouletteToggle : MonoBehaviour
{
	private const KeyCode Hotkey = (KeyCode)288;

	private static readonly Color Gold = new Color(1f, 0.82f, 0.25f);

	private static Type rwfRoomHandler;

	internal static bool On = true;

	private GameObject canvasObject;

	private TextMeshProUGUI title;

	private TextMeshProUGUI hint;

	private bool fontApplied;

	private bool visible;

	private float nextCheck;

	internal static bool CanChange
	{
		get
		{
			if (PhotonNetwork.InRoom)
			{
				return PhotonNetwork.IsMasterClient;
			}
			return true;
		}
	}

	private void Start()
	{
		rwfRoomHandler = AccessTools.TypeByName("RWF.PrivateRoomHandler");
		On = RoulettePlugin.RouletteOn.Value;
	}

	internal static void Push()
	{
		if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient)
		{
			NetworkingManager.RPC_Others(typeof(RouletteToggle), "RPC_SyncOn", new object[1] { On });
		}
	}

	[UnboundRPC]
	public static void RPC_SyncOn(bool on)
	{
		On = on;
	}

	private void Update()
	{
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		if (Time.unscaledTime >= nextCheck)
		{
			nextCheck = Time.unscaledTime + 0.2f;
			visible = InPreGameMenu();
		}
		if (visible && Input.GetKeyDown((KeyCode)288) && CanChange)
		{
			On = !On;
			RoulettePlugin.RouletteOn.Value = On;
			Push();
		}
		if (!visible)
		{
			if ((Object)(object)canvasObject != (Object)null && canvasObject.activeSelf)
			{
				canvasObject.SetActive(false);
			}
			return;
		}
		EnsureCanvas();
		if (!canvasObject.activeSelf)
		{
			canvasObject.SetActive(true);
		}
		((TMP_Text)title).text = "ROULETTE: " + (On ? "ON" : "OFF");
		((Graphic)title).color = (On ? Gold : Color.white);
		((TMP_Text)hint).text = (CanChange ? "PRESS F7 TO TOGGLE" : "THE HOST PRESSES F7 TO TOGGLE");
	}

	private static bool InPreGameMenu()
	{
		if ((Object)(object)GameManager.instance != (Object)null && GameManager.instance.isPlaying)
		{
			return false;
		}
		if (rwfRoomHandler != null)
		{
			object value = Traverse.Create(rwfRoomHandler).Field("instance").GetValue();
			if (value != null && Traverse.Create(value).Property("IsOpen", (object[])null).GetValue<bool>())
			{
				return true;
			}
		}
		if ((Object)(object)GameObject.Find("GamemodeMenu") != (Object)null)
		{
			return true;
		}
		bool num = (Object)(object)MainMenuHandler.instance != (Object)null && MainMenuHandler.instance.isOpen;
		CharacterSelectionMenu val = Object.FindObjectOfType<CharacterSelectionMenu>();
		if (num && (Object)(object)val != (Object)null)
		{
			return ((Behaviour)val).isActiveAndEnabled;
		}
		return false;
	}

	private void EnsureCanvas()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)canvasObject == (Object)null)
		{
			canvasObject = new GameObject("RouletteIndicator");
			Object.DontDestroyOnLoad((Object)(object)canvasObject);
			Canvas obj = canvasObject.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)0;
			obj.sortingOrder = 4000;
			CanvasScaler obj2 = canvasObject.AddComponent<CanvasScaler>();
			obj2.uiScaleMode = (ScaleMode)1;
			obj2.referenceResolution = new Vector2(1920f, 1080f);
			obj2.matchWidthOrHeight = 1f;
			title = Text("Title", 32f, -110f);
			hint = Text("Hint", 18f, -150f);
		}
		if (fontApplied)
		{
			return;
		}
		TextMeshProUGUI[] array = Object.FindObjectsOfType<TextMeshProUGUI>();
		foreach (TextMeshProUGUI val in array)
		{
			if (!((Object)(object)val == (Object)(object)title) && !((Object)(object)val == (Object)(object)hint) && !((Object)(object)((TMP_Text)val).font == (Object)null))
			{
				TextMeshProUGUI obj3 = title;
				TMP_FontAsset font = (((TMP_Text)hint).font = ((TMP_Text)val).font);
				((TMP_Text)obj3).font = font;
				TextMeshProUGUI obj4 = title;
				Material fontSharedMaterial = (((TMP_Text)hint).fontSharedMaterial = ((TMP_Text)val).fontSharedMaterial);
				((TMP_Text)obj4).fontSharedMaterial = fontSharedMaterial;
				fontApplied = true;
				break;
			}
		}
	}

	private TextMeshProUGUI Text(string name, float size, float y)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
		val.transform.SetParent(canvasObject.transform, false);
		RectTransform val2 = (RectTransform)val.transform;
		Vector2 val3 = default(Vector2);
		((Vector2)(ref val3))..ctor(1f, 1f);
		val2.anchorMax = val3;
		val2.anchorMin = val3;
		val2.pivot = new Vector2(1f, 1f);
		val2.anchoredPosition = new Vector2(-30f, y);
		val2.sizeDelta = new Vector2(700f, size * 1.4f);
		TextMeshProUGUI val4 = val.AddComponent<TextMeshProUGUI>();
		if ((Object)(object)TMP_Settings.defaultFontAsset != (Object)null)
		{
			((TMP_Text)val4).font = TMP_Settings.defaultFontAsset;
		}
		((TMP_Text)val4).fontSize = size;
		((TMP_Text)val4).alignment = (TextAlignmentOptions)260;
		((TMP_Text)val4).enableWordWrapping = false;
		((Graphic)val4).raycastTarget = false;
		return val4;
	}

	private void OnDestroy()
	{
		if ((Object)(object)canvasObject != (Object)null)
		{
			Object.Destroy((Object)(object)canvasObject);
		}
	}
}