Decompiled source of CruncherSolitaire v1.0.0

CruncherSolitaire.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AssetBundleLoader;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CruncherSolitaire;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using UniverseLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("CruncherSolitaire")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyDescription("Solitaire on your Cruncher")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ed4ce69a58d430953604554204c40d6463720ce1")]
[assembly: AssemblyProduct("CruncherSolitaire")]
[assembly: AssemblyTitle("CruncherSolitaire")]
[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;
		}
	}
}
public class SolitaireCruncherAppPrefab : CruncherAppContent
{
	public override void Setup(ComputerController cc)
	{
		((CruncherAppContent)this).controller = cc;
		DoSetup();
	}

	public override void OnSetup()
	{
		DoSetup();
	}

	private void DoSetup()
	{
		Il2CppExtensions.AddListener((UnityEvent)(object)((IEnumerable<Button>)((Component)this).GetComponentsInChildren<Button>()).Where((Button button) => ((Object)button).name == "Exit").FirstOrDefault().onClick, (Action)delegate
		{
			((CruncherAppContent)this).controller.OnAppExit();
		});
	}

	public override void PrintButton()
	{
	}
}
public class PieSolitaire_Loader : MonoBehaviour
{
	public static GameObject CardPrefab;

	public static Dictionary<string, Sprite> CardSprites;

	public static Sprite CardSpriteBack;

	private void Awake()
	{
		AssetBundle val = BundleLoader.LoadBundle(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "crunchersolitaire"), true, true);
		CardPrefab = val.LoadAsset<GameObject>("Card");
		CardSprites = new Dictionary<string, Sprite>();
		Dictionary<int, string> dictionary = new Dictionary<int, string>
		{
			{ 0, "ace" },
			{ 10, "jack" },
			{ 11, "queen" },
			{ 12, "king" }
		};
		Dictionary<int, string> dictionary2 = new Dictionary<int, string>
		{
			{ 0, "clubs" },
			{ 1, "diamonds" },
			{ 2, "hearts" },
			{ 3, "spades" }
		};
		for (int i = 0; i < 52; i++)
		{
			string value;
			string text = (dictionary.TryGetValue(i % 13, out value) ? value : (i % 13 + 1).ToString());
			string text2 = dictionary2[i / 13];
			CardSprites[text + "_of_" + text2] = val.LoadAsset<Sprite>(text + "_of_" + text2);
		}
		CardSpriteBack = val.LoadAsset<Sprite>("card_back");
	}
}
public class PieSolitaire_Card : MonoBehaviour
{
	public static PieSolitaire_Card[] deck = new PieSolitaire_Card[52];

	public static int selectedIndex = -1;

	public static PieSolitaire_Card selectedCard;

	public int index;

	public int number;

	public int suit;

	public Button clickable;

	private Sprite visibleSprite;

	private Sprite backSprite;

	public bool faceUp = false;

	public bool locked = true;

	private void Awake()
	{
		clickable = ((Component)this).GetComponentInChildren<Button>();
		backSprite = PieSolitaire_Loader.CardSpriteBack;
		((Component)clickable).GetComponent<Image>().sprite = backSprite;
		Il2CppExtensions.AddListener((UnityEvent)(object)clickable.onClick, (Action)Click);
	}

	private void Start()
	{
		SetCardFromInt(index);
		clickable = ((Component)this).GetComponentInChildren<Button>();
		visibleSprite = PieSolitaire_Loader.CardSprites[((Object)this).name];
		backSprite = PieSolitaire_Loader.CardSpriteBack;
		((Component)clickable).GetComponent<Image>().sprite = (faceUp ? visibleSprite : backSprite);
	}

	private void SetCardFromInt(int i)
	{
		Dictionary<int, string> dictionary = new Dictionary<int, string>
		{
			{ 0, "ace" },
			{ 10, "jack" },
			{ 11, "queen" },
			{ 12, "king" }
		};
		Dictionary<int, string> dictionary2 = new Dictionary<int, string>
		{
			{ 0, "clubs" },
			{ 1, "diamonds" },
			{ 2, "spades" },
			{ 3, "hearts" }
		};
		number = i % 13;
		string value;
		string text = (dictionary.TryGetValue(number, out value) ? value : (i % 13 + 1).ToString());
		suit = i / 13;
		string text2 = dictionary2[suit];
		((Object)((Component)this).gameObject).name = text + "_of_" + text2;
	}

	public void Reset()
	{
		selectedIndex = -1;
		Flip(show: false);
		locked = true;
	}

	public void Click()
	{
		if ((Object)(object)clickable == (Object)null)
		{
			return;
		}
		if (faceUp)
		{
			if (selectedIndex < 0)
			{
				if (!locked)
				{
					SelectCard(index);
				}
				return;
			}
			PieSolitaire_CardHolder pieSolitaire_CardHolder;
			if (selectedIndex == index)
			{
				GameObject obj = ((Component)this).GetComponentInParent<PieSolitaire_Game>().CanAutoPlace(((Component)deck[selectedIndex]).gameObject);
				pieSolitaire_CardHolder = ((obj != null) ? obj.GetComponent<PieSolitaire_CardHolder>() : null);
				if ((Object)(object)pieSolitaire_CardHolder == (Object)null)
				{
					SelectCard(-1);
				}
			}
			else
			{
				pieSolitaire_CardHolder = ((Component)deck[index]).gameObject.GetComponentInParent<PieSolitaire_CardHolder>();
			}
			if (Object.op_Implicit((Object)(object)pieSolitaire_CardHolder) && pieSolitaire_CardHolder.WillAcceptCard(((Component)deck[selectedIndex]).gameObject))
			{
				MoveToNewStack(((Component)pieSolitaire_CardHolder).gameObject);
			}
			else if (!locked)
			{
				SelectCard(index);
			}
		}
		else if (!locked)
		{
			Flip(show: true);
		}
	}

	public void MoveToNewStack(GameObject newStackGO)
	{
		PieSolitaire_CardHolder component = newStackGO.GetComponent<PieSolitaire_CardHolder>();
		PieSolitaire_CardHolder componentInParent = ((Component)deck[selectedIndex]).gameObject.GetComponentInParent<PieSolitaire_CardHolder>();
		if (Object.op_Implicit((Object)(object)componentInParent))
		{
			bool flag = false;
			for (int i = 1; i < ((Component)componentInParent).transform.childCount; i++)
			{
				PieSolitaire_Card component2 = ((Component)((Component)componentInParent).transform.GetChild(i)).GetComponent<PieSolitaire_Card>();
				if (component2.index == selectedIndex)
				{
					flag = true;
				}
				if (flag)
				{
					component.AddCard(((Component)component2).gameObject);
					i--;
				}
			}
			componentInParent.UnlockLast();
		}
		else
		{
			component.AddCard(((Component)deck[selectedIndex]).gameObject);
		}
		if (component.acceptChildTypes == PieSolitaire_CardHolder.AcceptChildTypes.NextUpSameSuit)
		{
			deck[selectedIndex].locked = true;
		}
		SelectCard(-1);
	}

	public void Flip(bool show)
	{
		((Component)clickable).GetComponent<Image>().sprite = (show ? visibleSprite : backSprite);
		faceUp = show;
	}

	public static void SelectCard(int index)
	{
		//IL_0021: 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)
		//IL_0029: 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_0051: 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)
		//IL_0084: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		if (selectedIndex != -1)
		{
			ColorBlock colors = ((Selectable)deck[selectedIndex].clickable).colors;
			((ColorBlock)(ref colors)).normalColor = Color.white;
			((ColorBlock)(ref colors)).selectedColor = Color.white;
			((Selectable)deck[selectedIndex].clickable).colors = colors;
		}
		selectedIndex = index;
		if (selectedIndex != -1)
		{
			ColorBlock colors2 = ((Selectable)deck[selectedIndex].clickable).colors;
			((ColorBlock)(ref colors2)).normalColor = new Color(0.78f, 0.78f, 0.78f);
			((ColorBlock)(ref colors2)).selectedColor = new Color(0.78f, 0.78f, 0.78f);
			((Selectable)deck[selectedIndex].clickable).colors = colors2;
		}
	}
}
public class PieSolitaire_CardDeck : MonoBehaviour
{
	private Transform deckContainer;

	private Transform[] displayContainers = (Transform[])(object)new Transform[3];

	private void Awake()
	{
		Il2CppExtensions.AddListener((UnityEvent)(object)((Component)this).GetComponentInChildren<Button>().onClick, (Action)Click);
		deckContainer = ((Component)this).transform.parent.GetChild(0);
		displayContainers[0] = ((Component)this).transform.parent.GetChild(1).GetChild(2);
		displayContainers[1] = ((Component)this).transform.parent.GetChild(1).GetChild(1);
		displayContainers[2] = ((Component)this).transform.parent.GetChild(1).GetChild(0);
	}

	public void Click()
	{
		int num = deckContainer.childCount - 1;
		if (displayContainers[1].childCount > 0)
		{
			displayContainers[1].GetChild(0).SetParent(displayContainers[2], false);
		}
		if (displayContainers[0].childCount > 0)
		{
			displayContainers[0].GetChild(0).SetParent(displayContainers[2], false);
		}
		if (num > 0)
		{
			for (int num2 = Mathf.Min(num, CruncherSolitairePlugin.OneCardDraw.Value ? 1 : 3); num2 > 0; num2--)
			{
				Transform child = deckContainer.GetChild(deckContainer.childCount - 1);
				child.SetParent(displayContainers[num2 - 1], false);
				((Component)child).GetComponent<PieSolitaire_Card>().Flip(show: true);
				((Component)child).GetComponent<PieSolitaire_Card>().locked = false;
			}
		}
		else
		{
			for (int num3 = displayContainers[2].childCount - 1; num3 >= 0; num3--)
			{
				Transform child2 = displayContainers[2].GetChild(num3);
				child2.SetParent(deckContainer, false);
				((Component)child2).GetComponent<PieSolitaire_Card>().Flip(show: false);
				((Component)child2).GetComponent<PieSolitaire_Card>().locked = false;
			}
		}
	}
}
public class PieSolitaire_CardHolder : MonoBehaviour
{
	public enum AcceptChildTypes
	{
		None,
		NextUpSameSuit,
		NextDownOtherSuit
	}

	public bool holdFlat;

	public AcceptChildTypes acceptChildTypes;

	private void Awake()
	{
		Il2CppExtensions.AddListener((UnityEvent)(object)((Component)this).GetComponentInChildren<Button>().onClick, (Action)Click);
	}

	public bool WillAcceptCard(GameObject card)
	{
		PieSolitaire_Card component = card.GetComponent<PieSolitaire_Card>();
		PieSolitaire_Card component2 = ((Component)((Component)this).transform.GetChild(((Component)this).transform.childCount - 1)).GetComponent<PieSolitaire_Card>();
		if ((Object)(object)component2 == (Object)null)
		{
			switch (acceptChildTypes)
			{
			case AcceptChildTypes.NextUpSameSuit:
				return component.number == 0;
			case AcceptChildTypes.NextDownOtherSuit:
				return component.number == 12;
			}
		}
		return acceptChildTypes switch
		{
			AcceptChildTypes.NextUpSameSuit => component.suit == component2.suit && component.number == component2.number + 1 && (Object)(object)card.transform.parent.GetChild(card.transform.parent.childCount - 1) == (Object)(object)card.transform, 
			AcceptChildTypes.NextDownOtherSuit => (float)component.suit % 2f != (float)component2.suit % 2f && component.number == component2.number - 1, 
			_ => false, 
		};
	}

	public void AddCard(GameObject card)
	{
		//IL_0013: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: 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_0059: Unknown result type (might be due to invalid IL or missing references)
		//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_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		card.transform.SetParent(((Component)this).transform);
		Vector3 val = Vector3.zero;
		if (!holdFlat && ((Component)this).transform.childCount > 2)
		{
			val += ((Component)this).transform.GetChild(((Component)this).transform.childCount - 2).localPosition;
			val = ((((Component)this).transform.childCount <= 1 || !((Component)((Component)this).transform.GetChild(((Component)this).transform.childCount - 1)).GetComponent<PieSolitaire_Card>().faceUp) ? (val + Vector3.down * 0.02f) : (val + Vector3.down * 0.04f));
		}
		card.transform.localPosition = val;
		card.transform.localEulerAngles = new Vector3(0f, 180f, 0f);
		if (acceptChildTypes == AcceptChildTypes.NextUpSameSuit && ((Component)this).transform.childCount == 14)
		{
			PieSolitaire_Game.CompleteSet();
		}
	}

	public void UnlockLast()
	{
		if (((Component)this).transform.childCount >= 2)
		{
			((Component)((Component)this).transform.GetChild(((Component)this).transform.childCount - 1)).GetComponent<PieSolitaire_Card>().locked = false;
		}
	}

	public void Click()
	{
		if (((Component)this).transform.childCount == 1 && PieSolitaire_Card.selectedIndex >= 0 && WillAcceptCard(((Component)PieSolitaire_Card.deck[PieSolitaire_Card.selectedIndex]).gameObject))
		{
			PieSolitaire_Card.deck[PieSolitaire_Card.selectedIndex].MoveToNewStack(((Component)this).gameObject);
		}
	}
}
public class PieSolitaire_Game : MonoBehaviour
{
	private static Transform youWinPanel;

	public static int completedSets;

	private void Start()
	{
		Il2CppExtensions.AddListener((UnityEvent)(object)((Component)((Component)this).transform.parent.Find("Reset")).GetComponentInChildren<Button>().onClick, (Action)StartGame);
		foreach (PieSolitaire_CardHolder componentsInChild in ((Component)((Component)this).transform.Find("DrawPile")).GetComponentsInChildren<PieSolitaire_CardHolder>())
		{
			componentsInChild.holdFlat = true;
		}
		foreach (PieSolitaire_CardHolder componentsInChild2 in ((Component)((Component)this).transform.Find("Shelf")).GetComponentsInChildren<PieSolitaire_CardHolder>())
		{
			componentsInChild2.holdFlat = true;
			componentsInChild2.acceptChildTypes = PieSolitaire_CardHolder.AcceptChildTypes.NextUpSameSuit;
		}
		foreach (PieSolitaire_CardHolder componentsInChild3 in ((Component)((Component)this).transform.Find("PlayArea")).GetComponentsInChildren<PieSolitaire_CardHolder>())
		{
			componentsInChild3.acceptChildTypes = PieSolitaire_CardHolder.AcceptChildTypes.NextDownOtherSuit;
		}
		youWinPanel = ((Component)this).transform.Find("YouWinPanel");
		for (int i = 0; i < PieSolitaire_Card.deck.Length; i++)
		{
			if (!Object.op_Implicit((Object)(object)PieSolitaire_Card.deck[i]))
			{
				GameObject val = Object.Instantiate<GameObject>(PieSolitaire_Loader.CardPrefab);
				val.transform.SetParent(((Component)((Component)this).transform.Find("Deck")).transform, false);
				PieSolitaire_Card component = val.GetComponent<PieSolitaire_Card>();
				component.index = i;
				PieSolitaire_Card.deck[i] = component;
			}
		}
		StartGame();
	}

	private void StartGame()
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		completedSets = 0;
		((Component)youWinPanel).gameObject.SetActive(false);
		PieSolitaire_Card[] deck = PieSolitaire_Card.deck;
		foreach (PieSolitaire_Card pieSolitaire_Card in deck)
		{
			((Component)pieSolitaire_Card).transform.SetParent(((Component)this).transform.Find("Deck"), false);
			((Component)pieSolitaire_Card).transform.localPosition = Vector3.zero;
			((Component)pieSolitaire_Card).transform.localEulerAngles = new Vector3(0f, 180f, 0f);
			((Component)pieSolitaire_Card).transform.localScale = Vector3.one;
			pieSolitaire_Card.Reset();
		}
		Transform val = ((Component)this).transform.Find("PlayArea");
		Transform val2 = ((Component)this).transform.Find("DrawPile/CardPosition");
		Random rnd = new Random();
		PieSolitaire_Card[] array = PieSolitaire_Card.deck.OrderBy((PieSolitaire_Card x) => rnd.Next()).ToArray();
		int j = 0;
		for (int k = 0; k < val.childCount; k++)
		{
			for (int l = 0; l <= k; l++)
			{
				((Component)val.GetChild(k)).GetComponent<PieSolitaire_CardHolder>().AddCard(((Component)array[j]).gameObject);
				if (l == k)
				{
					array[j].Flip(show: true);
					array[j].locked = false;
				}
				j++;
			}
		}
		for (; j < 52; j++)
		{
			((Component)val2).GetComponent<PieSolitaire_CardHolder>().AddCard(((Component)array[j]).gameObject);
		}
	}

	public static void CompleteSet()
	{
		completedSets++;
		if (completedSets >= 4)
		{
			((Component)youWinPanel).gameObject.SetActive(true);
		}
	}

	public GameObject CanAutoPlace(GameObject card)
	{
		foreach (PieSolitaire_CardHolder componentsInChild in ((Component)((Component)this).transform.Find("Shelf")).GetComponentsInChildren<PieSolitaire_CardHolder>())
		{
			if (componentsInChild.WillAcceptCard(card))
			{
				return ((Component)componentsInChild).gameObject;
			}
		}
		return null;
	}
}
namespace CruncherSolitaire
{
	[BepInPlugin("CruncherSolitaire", "CruncherSolitaire", "1.0.0")]
	public class CruncherSolitairePlugin : BasePlugin
	{
		public static ManualLogSource PluginLogger;

		public static ConfigEntry<TimeSpeed> TimeScaleWhilePlaying;

		public static ConfigEntry<bool> OneCardDraw;

		public override void Load()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Expected O, but got Unknown
			PluginLogger = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val;
			if (!((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, (ConfigDescription)null).Value)
			{
				ManualLogSource pluginLogger = PluginLogger;
				val = new BepInExInfoLogInterpolatedStringHandler(20, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CruncherSolitaire");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is disabled.");
				}
				pluginLogger.LogInfo(val);
				return;
			}
			TimeScaleWhilePlaying = ((BasePlugin)this).Config.Bind<TimeSpeed>("General", "Time speed in app", (TimeSpeed)1, (ConfigDescription)null);
			OneCardDraw = ((BasePlugin)this).Config.Bind<bool>("General", "Draw one card at a time?", false, (ConfigDescription)null);
			ManualLogSource pluginLogger2 = PluginLogger;
			val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CruncherSolitaire");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			pluginLogger2.LogInfo(val);
			Harmony val2 = new Harmony("CruncherSolitaire");
			val2.PatchAll();
			ManualLogSource pluginLogger3 = PluginLogger;
			val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CruncherSolitaire");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is patched!");
			}
			pluginLogger3.LogInfo(val);
			ClassInjector.RegisterTypeInIl2Cpp<PieSolitaire_Card>();
			ClassInjector.RegisterTypeInIl2Cpp<PieSolitaire_CardHolder>();
			ClassInjector.RegisterTypeInIl2Cpp<PieSolitaire_Game>();
			ClassInjector.RegisterTypeInIl2Cpp<PieSolitaire_CardDeck>();
			ClassInjector.RegisterTypeInIl2Cpp<PieSolitaire_Loader>();
			ClassInjector.RegisterTypeInIl2Cpp<SolitaireCruncherAppPrefab>();
			ManualLogSource pluginLogger4 = PluginLogger;
			val = new BepInExInfoLogInterpolatedStringHandler(31, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CruncherSolitaire");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has added custom types!");
			}
			pluginLogger4.LogInfo(val);
		}

		public static void SetInAppTimeScale(bool inApp)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_0024: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0095: 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)
			bool flag = default(bool);
			if (inApp && (int)TimeScaleWhilePlaying.Value != 1)
			{
				if (SessionData.Instance.currentTimeSpeed != TimeScaleWhilePlaying.Value)
				{
					ManualLogSource pluginLogger = PluginLogger;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(42, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Cruncher Solitare: Changing time speed to ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Enum.GetName(typeof(TimeSpeed), TimeScaleWhilePlaying.Value));
					}
					pluginLogger.LogInfo(val);
					SessionData.Instance.SetTimeSpeed(TimeScaleWhilePlaying.Value);
				}
			}
			else if ((int)SessionData.Instance.currentTimeSpeed != 1)
			{
				ManualLogSource pluginLogger2 = PluginLogger;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(48, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Cruncher Solitare: Changing time speed to normal");
				}
				pluginLogger2.LogInfo(val);
				SessionData.Instance.SetTimeSpeed((TimeSpeed)1);
			}
		}
	}
	internal class CruncherSolitaireHooks
	{
		[HarmonyPatch(typeof(MainMenuController), "Start")]
		public class MainMenuController_Start
		{
			private static bool hasInit;

			public static void Prefix()
			{
				if (hasInit)
				{
					return;
				}
				hasInit = true;
				AssetBundle val = BundleLoader.LoadBundle(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "crunchersolitaire"), true, true);
				CruncherAppPreset val2 = val.LoadAsset<CruncherAppPreset>("Solitaire");
				val2.appContent[0].AddComponent<SolitaireCruncherAppPrefab>();
				val2.appContent[0].AddComponent<PieSolitaire_Loader>();
				foreach (InteractablePreset item in ((IEnumerable<InteractablePreset>)Resources.FindObjectsOfTypeAll<InteractablePreset>()).Where((InteractablePreset preset) => ((Object)preset).name.Contains("Cruncher")))
				{
					item.additionalApps.Insert(item.additionalApps.Count - 2, val2);
				}
				CruncherSolitairePlugin.PluginLogger.LogInfo((object)"Loading custom asset bundle complete");
			}
		}
	}
	[HarmonyPatch(typeof(ComputerController), "OnAppLoaded")]
	public class ComputerController_OnAppLoaded
	{
		public static void Postfix(ComputerController __instance)
		{
			if (__instance.playerControlled)
			{
				CruncherSolitairePlugin.SetInAppTimeScale(((Object)__instance.currentApp).name == "Solitaire");
			}
		}
	}
	[HarmonyPatch(typeof(ComputerController), "OnAppExit")]
	public class ComputerController_OnAppExit
	{
		public static void Prefix(ComputerController __instance)
		{
			if (__instance.playerControlled)
			{
				CruncherSolitairePlugin.SetInAppTimeScale(inApp: false);
			}
		}
	}
	[HarmonyPatch(typeof(ComputerController), "OnPlayerControlChange")]
	public class ComputerController_OnPlayerControlChange
	{
		private static bool wasPlayerControlled;

		public static void Prefix(ComputerController __instance)
		{
			wasPlayerControlled = __instance.playerControlled;
		}

		public static void Postfix(ComputerController __instance)
		{
			if (wasPlayerControlled)
			{
				CruncherSolitairePlugin.SetInAppTimeScale(inApp: false);
				wasPlayerControlled = false;
			}
			else if (__instance.playerControlled)
			{
				CruncherSolitairePlugin.SetInAppTimeScale(((Object)__instance.currentApp).name == "Solitaire");
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CruncherSolitaire";

		public const string PLUGIN_NAME = "CruncherSolitaire";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}