Decompiled source of SideDeckNode v2.0.0

SideDeckNode.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
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 BepInEx;
using CustomSideDeck;
using CustomSideDeck.Info;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Nodes;
using InscryptionAPI.Saves;
using Pixelplacement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("SideDeckNode")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SideDeckNode")]
[assembly: AssemblyTitle("SideDeckNode")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SideDeckNode;

internal class MycologistSideDeckNode : CardChoicesSequencer, ICustomNodeSequencer
{
	private MycologistSideDeckNode sequencer = null;

	private static FullNode fullNode;

	private DuplicateMergeSequencer dupie;

	private List<GameObject> mushrooms;

	public SideDeckInfo sideDeckInfo;

	private static Traverse _parentContainer;

	private string selectedCardName = null;

	private Vector3 basePosition;

	private readonly Vector3 BASE_ANCHOR = new Vector3(-2.2f, 5.01f, -0.12f);

	private readonly Vector3 ROW_OFFSET = new Vector3(0f, 0f, -1.6f);

	private readonly Vector3 COL_OFFSET = new Vector3(1.6f, 0f, 0f);

	private void Initialize()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)base.selectableCardPrefab == (Object)null)
		{
			base.selectableCardPrefab = GetCopiedField<GameObject>("selectableCardPrefab");
		}
		basePosition = ((Component)this).transform.position;
	}

	private static T GetCopiedField<T>(string fieldName) where T : class
	{
		if (_parentContainer == null)
		{
			object value = Traverse.Create((object)Singleton<SpecialNodeHandler>.Instance).Field("cardChoiceSequencer").GetValue();
			_parentContainer = Traverse.Create((value is CardSingleChoicesSequencer) ? value : null);
		}
		return _parentContainer.Field(fieldName).GetValue() as T;
	}

	public static void AddNode()
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Expected O, but got Unknown
		string text = "roundqueen.inscryption.sidedecknode";
		string text2 = "Side Deck Node Sequencer";
		FullNode val = NewNodeManager.New<MycologistSideDeckNode>(text, text2, (GenerationType)8, new List<Texture2D>
		{
			Tools.LoadTex("SideDeckNode/Resources/Sequencers/choosedeck_1.png"),
			Tools.LoadTex("SideDeckNode/Resources/Sequencers/choosedeck_2.png"),
			Tools.LoadTex("SideDeckNode/Resources/Sequencers/choosedeck_3.png"),
			Tools.LoadTex("SideDeckNode/Resources/Sequencers/choosedeck_4.png")
		}, new List<SelectionCondition>
		{
			(SelectionCondition)new CustomPreviousNodesContent(text, text2, false),
			(SelectionCondition)new WithinRegionIndexRange(0, 2)
		}, new List<SelectionCondition>(), (Action<CustomSpecialNodeData>)null, (Action<CustomSpecialNodeData, MapNode2D>)null, (GameObject)null, (GameObject)null);
	}

	public IEnumerator DoCustomSequence(CustomSpecialNodeData nodeData)
	{
		Initialize();
		Singleton<ViewManager>.Instance.Controller.SwitchToControlMode((ControlMode)5, false);
		Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
		DuplicateMergeSequencer handler = Tools.GetPrivateType<SpecialNodeHandler, DuplicateMergeSequencer>(Singleton<SpecialNodeHandler>.Instance, "duplicateMerger");
		mushrooms = Tools.GetPrivateType<DuplicateMergeSequencer, List<GameObject>>(handler, "mushrooms");
		AudioController.Instance.PlaySound3D("mushrooms_small_appear", (MixerGroup)4, ((Component)LeshyAnimationController.Instance).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
		foreach (GameObject mushroom in mushrooms)
		{
			mushroom.SetActive(true);
			yield return (object)new WaitForSeconds(0.05f);
			mushroom.GetComponent<Collider>().enabled = true;
		}
		yield return (object)new WaitForSeconds(0.5f);
		if (!HasLearnedSequence())
		{
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("A pair of familiar faces shuffles out from the cover of darkness and fungi.", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)1, (Speaker)0, (string[])null, true);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("You squint to make them out through the dense sporeclouds surrounding you.", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)1, (Speaker)0, (string[])null, true);
			new WaitForSeconds(0.3f);
		}
		LeshyAnimationController.Instance.PutOnMask((Mask)5, true);
		yield return (object)new WaitForSeconds(1f);
		Singleton<ViewManager>.Instance.SwitchToView((View)29, false, true);
		Singleton<OpponentAnimationController>.Instance.SetHeadTrigger("doctor_idle");
		if (!HasLearnedSequence())
		{
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("P-pleasure to see you agai- again.", -2.5f, 0.5f, (Emotion)4, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: true);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("[size:3]Yes.[size:]", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)5, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: false);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("We have gleaned knowledge f-from the un-unknowable [c:R]OLD_DATA[c:].", -2.5f, 0.5f, (Emotion)4, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: true);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("[size:3]Our work has improved.[size:]", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)5, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: false);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("With it, we can oper- operate to b-birth your creatures anew!", -2.5f, 0.5f, (Emotion)4, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: true);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("[size:3]Choose a sidedeck.[size:]", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)5, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: false);
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
		}
		else
		{
			Singleton<ViewManager>.Instance.SwitchToView((View)29, false, true);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("A-allow us to o-operate on your c-creatures.", -2.5f, 0.5f, (Emotion)4, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: true);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("[size:3]Choose.[size:]", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)5, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: false);
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
		}
		Singleton<ViewManager>.Instance.SwitchToView((View)3, false, false);
		Singleton<ViewManager>.Instance.Controller.SwitchToControlMode((ControlMode)11, false);
		Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
		List<SideDeckInfo> SideDecks = SideDeckManager.sideDecksList;
		int i = 0;
		List<string> stringsName = new List<string>();
		foreach (SideDeckInfo sideDecks in SideDeckManager.sideDecksList)
		{
			stringsName.Add(sideDecks.defaultCard);
		}
		using (List<string>.Enumerator enumerator3 = stringsName.GetEnumerator())
		{
			while (enumerator3.MoveNext())
			{
				CreateSideDeckCard(carder: enumerator3.Current, index: i, totalCards: stringsName.Count);
				i++;
			}
		}
		((CardChoicesSequencer)this).SetCollidersEnabled(true);
		((CardChoicesSequencer)this).EnableViewDeck((ControlMode)11, basePosition);
		yield return (object)new WaitUntil((Func<bool>)(() => !string.IsNullOrEmpty(selectedCardName)));
		foreach (string stringer in stringsName)
		{
			if (stringer == selectedCardName)
			{
				int index = stringsName.IndexOf(stringer);
				SideDeckInfo objectiveDeck = SideDecks.ElementAt(index);
				if (objectiveDeck.displayName != null)
				{
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("T-the [c:R]" + objectiveDeck.displayName + " Deck[c:] it is- is.", -2.5f, 0.5f, (Emotion)4, (LetterAnimation)0, (Speaker)0, (string[])null, true);
				}
				else
				{
					yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("T-the [c:R]" + objectiveDeck.defaultCard + " Deck[c:] it is- is.", -2.5f, 0.5f, (Emotion)4, (LetterAnimation)0, (Speaker)0, (string[])null, true);
				}
				SetSideHeadTalking(sideHeadTalking: true);
				yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("[size:3]It will suffice.[size:]", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)5, (string[])null, true);
				Plugin.CurrentSideDeck = objectiveDeck;
				SetSideHeadTalking(sideHeadTalking: false);
			}
		}
		((CardChoicesSequencer)this).DisableViewDeck();
		CleanUpCards();
		Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
		((MonoBehaviour)this).StartCoroutine(LeshyAnimationController.Instance.TakeOffMask());
		yield return (object)new WaitForSeconds(1.5f);
		SetSequenceLearned();
		yield return CleanUp();
		selectedCardName = null;
	}

	private void OnCardChosen2(SelectableCard obj)
	{
		CleanUpCards();
	}

	public static CardModificationInfo FungalStarterMod()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Expected O, but got Unknown
		return new CardModificationInfo
		{
			DecalIds = { AlternatingBloodDecal.GetBloodDecalId() },
			DecalIds = { "decal_fungus" }
		};
	}

	private void CreateSideDeckCard(int index, int totalCards, string carder, float tweenDelay = 0f)
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: 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_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: 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_0098: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(base.selectableCardPrefab, ((Component)this).transform);
		SelectableCard component = val.GetComponent<SelectableCard>();
		((Component)component).gameObject.SetActive(true);
		CardInfo cardByName = CardLoader.GetCardByName(carder);
		component.Initialize(cardByName, (Action<SelectableCard>)OnCardChosen, (Action<SelectableCard>)null, false, (Action<SelectableCard>)null);
		((Card)component).SetFaceDown(false, false);
		Vector3 locationForCard = GetLocationForCard(index, totalCards);
		val.transform.localPosition = locationForCard + Vector3.forward * 6f;
		val.transform.localScale = Vector3.Scale(val.transform.localScale, new Vector3(0.8f, 0.8f, 1f));
		Tween.LocalPosition(val.transform, locationForCard, 0.2f, tweenDelay, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
		Tween.Rotate(val.transform, new Vector3(0f, 0f, -2f + Random.value * 4f), (Space)1, 0.25f, tweenDelay, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
		CustomCoroutine.WaitThenExecute(tweenDelay, (Action)((Card)component).Anim.PlayRiffleSound, false);
		base.selectableCards.Add(component);
	}

	private Vector3 GetLocationForCard(int index, int totalCards)
	{
		//IL_0038: 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_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		int num = (int)Math.Ceiling((float)totalCards / 4f);
		int num2 = 4;
		if (totalCards < 4)
		{
			num2 = totalCards;
		}
		if (totalCards == 5 || totalCards == 6 || totalCards == 9)
		{
			num2 = 3;
		}
		Vector3 bASE_ANCHOR = BASE_ANCHOR;
		float num3 = num switch
		{
			2 => 0.5f, 
			1 => 1f, 
			_ => 0f, 
		};
		float num4 = num2 switch
		{
			2 => 1f, 
			3 => 0.5f, 
			4 => 0f, 
			_ => 1.5f, 
		};
		num3 += (float)(index / num2);
		num4 += (float)(index % num2);
		return BASE_ANCHOR + Vector3.Scale(ROW_OFFSET, new Vector3(0f, 0f, num3)) + Vector3.Scale(COL_OFFSET, new Vector3(num4, 0f, 0f));
	}

	private void OnCardChosen(SelectableCard card)
	{
		if (selectedCardName == null)
		{
			((CardChoicesSequencer)this).SetCollidersEnabled(false);
			selectedCardName = ((Object)((Card)card).Info).name;
		}
	}

	private void OnCardFlipped(SelectableCard card)
	{
		if ((Object)(object)((Card)card).Info != (Object)null)
		{
			((MonoBehaviour)this).StartCoroutine(TutorialTextSequence(card));
		}
	}

	private IEnumerator TutorialTextSequence(SelectableCard card)
	{
		if (!ProgressionData.IntroducedCard(((Card)card).Info))
		{
			if (!string.IsNullOrEmpty(((Card)card).Info.description))
			{
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
				Singleton<RuleBookController>.Instance.SetShown(false, true);
				yield return Singleton<TextDisplayer>.Instance.ShowUntilInput(((Card)card).Info.description, -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}
			ProgressionData.SetCardIntroduced(((Card)card).Info);
		}
	}

	protected void CleanUpCards()
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: 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)
		((CardChoicesSequencer)this).ResetLocalRotations();
		foreach (SelectableCard selectableCard in base.selectableCards)
		{
			((Card)selectableCard).SetInteractionEnabled(false);
			Tween.Position(((Component)selectableCard).transform, ((Component)selectableCard).transform.position + Vector3.forward * 20f, 0.5f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
			Object.Destroy((Object)(object)((Component)selectableCard).gameObject, 0.5f);
		}
		base.selectableCards.Clear();
	}

	public static List<string> GetConfCards(SideDeckInfo decker)
	{
		List<string> list = new List<string>();
		if (decker.csdType != "Advanced")
		{
			if (decker.options.Count > 0)
			{
				for (int i = 0; i < decker.numCards; i++)
				{
					list.Add(ModdedSaveManager.SaveData.GetValue("tvflabs.inscryption.CustomSideDeck", $"ConfCard{i}"));
				}
			}
		}
		else
		{
			int num = 0;
			foreach (string card in decker.cards)
			{
				if (card == "conf")
				{
					list.Add(ModdedSaveManager.SaveData.GetValue("tvflabs.inscryption.CustomSideDeck", $"ConfCard{num}"));
					num++;
				}
			}
		}
		return list;
	}

	public static List<CardInfo> SideDeckCards(SideDeckInfo decker)
	{
		List<CardInfo> list = new List<CardInfo>();
		if (decker.csdType != "Advanced")
		{
			for (int i = 0; i < decker.numCards; i++)
			{
				if (decker.options.Count > 0)
				{
					list.Add(CardLoader.GetCardByName(GetConfCards(decker)[i]));
				}
				else
				{
					list.Add(CardLoader.GetCardByName(decker.defaultCard));
				}
			}
		}
		else
		{
			int num = 0;
			foreach (string card in decker.cards)
			{
				if (card == "conf")
				{
					list.Add(CardLoader.GetCardByName(GetConfCards(decker)[num]));
					num++;
				}
				else if (card == "def" || card == "self")
				{
					CardLoader.GetCardByName(decker.defaultCard);
				}
				else
				{
					list.Add(CardLoader.GetCardByName(card));
				}
			}
		}
		return list;
	}

	private IEnumerator CleanUp()
	{
		Singleton<ViewManager>.Instance.SwitchToView((View)1, false, true);
		AudioController.Instance.PlaySound3D("mushrooms_small_disappear", (MixerGroup)4, ((Component)Singleton<BoardManager>.Instance).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
		if (mushrooms == null)
		{
			yield break;
		}
		foreach (GameObject gameObject2 in mushrooms)
		{
			gameObject2.GetComponent<Collider>().enabled = false;
			gameObject2.GetComponentInChildren<Animator>().Play("mushroom_shrink", 0, 0f);
			yield return (object)new WaitForSeconds(0.05f);
		}
		mushrooms.ForEach(delegate(GameObject x)
		{
			x.SetActive(false);
		});
	}

	private bool HasLearnedSequence()
	{
		return ModdedSaveManager.SaveData.GetValueAsBoolean("roundqueen.inscryption.sidedecknode", "LearnedSideDeckNodeSequence");
	}

	private void SetSequenceLearned()
	{
		ModdedSaveManager.SaveData.SetValue("roundqueen.inscryption.sidedecknode", "LearnedSideDeckNodeSequence", (object)true);
	}

	private void SetSideHeadTalking(bool sideHeadTalking)
	{
		Singleton<OpponentAnimationController>.Instance.SetHeadBool("doctor_sidehead", sideHeadTalking);
		LeshyAnimationController.Instance.CurrentMask.GetComponent<DoctorMask>().SetEyesActive(sideHeadTalking);
		LeshyAnimationController.Instance.EyeAnimationsDisabled = sideHeadTalking;
	}
}
[BepInPlugin("roundqueen.inscryption.sidedecknode", "SideDeckNode", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class PluginManager : BaseUnityPlugin
{
	public const string PluginGuid = "roundqueen.inscryption.sidedecknode";

	public const string PluginName = "SideDeckNode";

	public const string PluginVersion = "1.0.0";

	public const string PluginPrefix = "SideDeckNode";

	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("SideDeckNode.harmonypatcher");
		val.PatchAll(Assembly.GetExecutingAssembly());
		MycologistSideDeckNode.AddNode();
	}
}
internal static class Tools
{
	public static Texture2D LoadTex(string path)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		byte[] array = ExtractEmbeddedResource(path);
		Texture2D val = new Texture2D(2, 2);
		ImageConversion.LoadImage(val, array);
		((Texture)val).filterMode = (FilterMode)0;
		return val;
	}

	public static byte[] ExtractEmbeddedResource(string filePath)
	{
		filePath = filePath.Replace("/", ".");
		filePath = filePath.Replace("\\", ".");
		Assembly callingAssembly = Assembly.GetCallingAssembly();
		using Stream stream = callingAssembly.GetManifestResourceStream(filePath);
		if (stream == null)
		{
			return null;
		}
		byte[] array = new byte[stream.Length];
		stream.Read(array, 0, array.Length);
		return array;
	}

	public static Sprite ConvertTexToSprite(Texture2D tex, Vector2? pivot = null)
	{
		//IL_005f: 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_0022: 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)
		Vector2 val = default(Vector2);
		((Vector2)(ref val))..ctor(0.5f, 0.5f);
		if (pivot.HasValue)
		{
			((Vector2)(ref val))..ctor(pivot.Value.x, pivot.Value.y);
		}
		((Texture)tex).filterMode = (FilterMode)0;
		return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), val, 100f);
	}

	public static T2 GetPrivateType<T, T2>(T obj, string field)
	{
		FieldInfo field2 = typeof(T).GetField(field, BindingFlags.Instance | BindingFlags.NonPublic);
		return (T2)field2.GetValue(obj);
	}

	public static void ShowLeshyMessage(string message, Emotion emotion, float duration)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)Singleton<TextDisplayer>.Instance).StartCoroutine(Singleton<TextDisplayer>.Instance.ShowThenClear(message, duration, 0f, emotion, (LetterAnimation)0, (Speaker)1, (string[])null));
	}

	public static Texture2D ChangeSize(this Texture2D texture2D, int targetX, int targetY)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		RenderTexture val2 = (RenderTexture.active = new RenderTexture(targetX, targetY, 24));
		Graphics.Blit((Texture)(object)texture2D, val2);
		Texture2D val3 = new Texture2D(targetX, targetY);
		val3.ReadPixels(new Rect(0f, 0f, (float)targetX, (float)targetY), 0, 0);
		val3.Apply();
		return val3;
	}
}