Decompiled source of PlaneImagePlugin v1.7.1

PlaneImagePlugin.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using Bounce.Singletons;
using Newtonsoft.Json;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("PlaneImagePlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlaneImagePlugin")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("PlaneImagePlugin")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("1.7.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.7.1.0")]
namespace LordAshes;

[BepInPlugin("org.lordashes.plugins.planeimage", "Plane Image Plugin", "1.7.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class PlaneImagePlugin : BaseUnityPlugin
{
	public static class Utility
	{
		public static bool isBoardLoaded()
		{
			return SimpleSingletonBehaviour<CameraController>.HasInstance && SingletonStateMBehaviour<BoardSessionManager, State<BoardSessionManager>>.HasInstance && !BoardSessionManager.IsLoading;
		}

		public static Guid GuidFromString(string input)
		{
			using MD5 mD = MD5.Create();
			byte[] b = mD.ComputeHash(Encoding.Default.GetBytes(input));
			return new Guid(b);
		}

		public static GameObject GetBaseLoader(CreatureGuid cid)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				CreatureBoardAsset val = null;
				CreaturePresenter.TryGetAsset(cid, ref val);
				if ((Object)(object)val != (Object)null)
				{
					Transform match = null;
					Traverse(((Component)val).transform, "BaseLoader", 0, 10, ref match);
					if ((Object)(object)match != (Object)null)
					{
						Debug.Log((object)("Plane Image Plugin: Base Loader '" + ((Object)match.GetChild(0)).name + "' Found"));
						return ((Component)match.GetChild(0)).gameObject;
					}
					Debug.LogWarning((object)"Plane Image Plugin: Could Not Find Base Loader");
					return null;
				}
				return null;
			}
			catch
			{
				return null;
			}
		}

		public static GameObject GetAssetLoader(CreatureGuid cid)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				CreatureBoardAsset val = null;
				CreaturePresenter.TryGetAsset(cid, ref val);
				if ((Object)(object)val != (Object)null)
				{
					Transform match = null;
					Traverse(((Component)val).transform, "AssetLoader", 0, 10, ref match);
					if ((Object)(object)match != (Object)null)
					{
						Debug.Log((object)("Plane Image Plugin: Asset Loader '" + ((Object)match.GetChild(0)).name + "' Found"));
						return ((Component)match.GetChild(0)).gameObject;
					}
					Debug.LogWarning((object)"Plane Image Plugin: Could Not Find Asset Loader");
					return null;
				}
				return null;
			}
			catch
			{
				return null;
			}
		}

		public static void Traverse(Transform root, string seek, int depth, int depthMax, ref Transform match)
		{
			try
			{
				if ((Object)(object)match != (Object)null)
				{
					return;
				}
				if (((Object)root).name == seek)
				{
					match = root;
					return;
				}
				foreach (Transform item in ExtensionMethods.Children(root))
				{
					if (depth < depthMax)
					{
						Traverse(item, seek, depth + 1, depthMax, ref match);
					}
				}
			}
			catch
			{
			}
		}

		public static float ParseFloat(string value)
		{
			return float.Parse(value, CultureInfo.InvariantCulture);
		}

		public static string GetCreatureName(string nameBlock)
		{
			if (nameBlock == null)
			{
				return "(Unknown)";
			}
			if (!nameBlock.Contains("<size=0>"))
			{
				return nameBlock;
			}
			return nameBlock.Substring(0, nameBlock.IndexOf("<size=0>")).Trim();
		}

		public static void PostOnMainPage(MemberInfo plugin)
		{
			SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode)
			{
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Expected O, but got Unknown
				try
				{
					if (((Scene)(ref scene)).name == "UI")
					{
						TextMeshProUGUI uITextByName = GetUITextByName("BETA");
						if (Object.op_Implicit((Object)(object)uITextByName))
						{
							((TMP_Text)uITextByName).text = "INJECTED BUILD - unstable mods";
						}
					}
					else
					{
						TextMeshProUGUI uITextByName2 = GetUITextByName("TextMeshPro Text");
						if (Object.op_Implicit((Object)(object)uITextByName2))
						{
							BepInPlugin val = (BepInPlugin)Attribute.GetCustomAttribute(plugin, typeof(BepInPlugin));
							if (((TMP_Text)uITextByName2).text.EndsWith("</size>"))
							{
								((TMP_Text)uITextByName2).text = ((TMP_Text)uITextByName2).text + "\n\nMods Currently Installed:\n";
							}
							TextMeshProUGUI val2 = uITextByName2;
							((TMP_Text)val2).text = ((TMP_Text)val2).text + "\nPlugin Masters' " + val.Name + " - " + val.Version;
						}
					}
				}
				catch (Exception ex)
				{
					Debug.Log((object)ex);
				}
			};
		}

		private static TextMeshProUGUI GetUITextByName(string name)
		{
			TextMeshProUGUI[] array = Object.FindObjectsOfType<TextMeshProUGUI>();
			for (int i = 0; i < array.Length; i++)
			{
				if (((Object)array[i]).name == name)
				{
					return array[i];
				}
			}
			return null;
		}
	}

	private enum PlaneImageMode
	{
		game,
		move,
		size,
		rotate
	}

	public const string Name = "Plane Image Plugin";

	public const string Guid = "org.lordashes.plugins.planeimage";

	public const string Version = "1.7.1.0";

	private int currentPlaneIndex = -1;

	private bool displayCurrentPlaneInfo = false;

	private PlaneImageMode activeMode = PlaneImageMode.game;

	private List<GameObject> planes = new List<GameObject>();

	private int updater = -1;

	private GameInput gameInputInstance = null;

	private MethodInfo gameInputDisable = null;

	private MethodInfo gameInputEnable = null;

	private GameObject prefab = null;

	private KeyboardShortcut[] applyKeys = (KeyboardShortcut[])(object)new KeyboardShortcut[12]
	{
		new KeyboardShortcut((KeyCode)273, Array.Empty<KeyCode>()),
		new KeyboardShortcut((KeyCode)274, Array.Empty<KeyCode>()),
		new KeyboardShortcut((KeyCode)276, Array.Empty<KeyCode>()),
		new KeyboardShortcut((KeyCode)275, Array.Empty<KeyCode>()),
		new KeyboardShortcut((KeyCode)280, Array.Empty<KeyCode>()),
		new KeyboardShortcut((KeyCode)281, Array.Empty<KeyCode>()),
		new KeyboardShortcut((KeyCode)306, (KeyCode[])(object)new KeyCode[1] { (KeyCode)273 }),
		new KeyboardShortcut((KeyCode)306, (KeyCode[])(object)new KeyCode[1] { (KeyCode)274 }),
		new KeyboardShortcut((KeyCode)306, (KeyCode[])(object)new KeyCode[1] { (KeyCode)276 }),
		new KeyboardShortcut((KeyCode)306, (KeyCode[])(object)new KeyCode[1] { (KeyCode)275 }),
		new KeyboardShortcut((KeyCode)306, (KeyCode[])(object)new KeyCode[1] { (KeyCode)280 }),
		new KeyboardShortcut((KeyCode)306, (KeyCode[])(object)new KeyCode[1] { (KeyCode)281 })
	};

	private ConfigEntry<KeyboardShortcut>[] triggerKeys { get; set; }

	private void Awake()
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)("Plane Image Plugin: " + ((object)this).GetType().AssemblyQualifiedName + " Active."));
		triggerKeys = new ConfigEntry<KeyboardShortcut>[7]
		{
			((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Add Plane Image", new KeyboardShortcut((KeyCode)291, Array.Empty<KeyCode>()), (ConfigDescription)null),
			((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Remove Plane Image", new KeyboardShortcut((KeyCode)303, (KeyCode[])(object)new KeyCode[1] { (KeyCode)291 }), (ConfigDescription)null),
			((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Replace Image", new KeyboardShortcut((KeyCode)292, Array.Empty<KeyCode>()), (ConfigDescription)null),
			((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Cycle Planes", new KeyboardShortcut((KeyCode)282, Array.Empty<KeyCode>()), (ConfigDescription)null),
			((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Toggle Move Mode", new KeyboardShortcut((KeyCode)283, Array.Empty<KeyCode>()), (ConfigDescription)null),
			((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Toggle Size Mode", new KeyboardShortcut((KeyCode)284, Array.Empty<KeyCode>()), (ConfigDescription)null),
			((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Toggle Rotate Mode", new KeyboardShortcut((KeyCode)285, Array.Empty<KeyCode>()), (ConfigDescription)null)
		};
		AssetDataPlugin.Subscribe("org.lordashes.plugins.planeimage.Create", (Action<DatumChange>)RequestHandler);
		AssetDataPlugin.Subscribe("org.lordashes.plugins.planeimage.Update", (Action<DatumChange>)RequestHandler, (Func<DatumChange, bool>)CheckPlaneExistance);
		string[] array = File.Find("laplane01", (CacheType)0);
		if (array.Length != 0)
		{
			try
			{
				Debug.Log((object)("Plane Image Plugin: Loading asset bundle '" + array[0] + "'"));
				AssetBundle val = AssetBundle.LoadFromFile(array[0]);
				Debug.Log((object)"Plane Image Plugin: Loading asset prefab 'laplane01.prefab'");
				prefab = val.LoadAsset<GameObject>("laplane01.prefab");
				val.Unload(false);
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("Plane Image Plugin: Exception: " + ex));
			}
		}
		else
		{
			Debug.LogWarning((object)"Plane Image Plugin: Missing 'laplane01' file");
		}
		BoardSessionManager.OnCurrentBoardChanged += delegate
		{
			Debug.LogWarning((object)"Plane Image Plugin: Board Change Event: Removing All Planes");
			planes = (from go in Object.FindObjectsOfType<GameObject>()
				where ((Object)go).name.StartsWith("Plane:")
				select go).ToList();
			for (int i = 0; i < planes.Count; i++)
			{
				Object.Destroy((Object)(object)planes[i]);
			}
			planes.Clear();
		};
		Utility.PostOnMainPage(((object)this).GetType());
	}

	private void Update()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: 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_1c30: Unknown result type (might be due to invalid IL or missing references)
		//IL_1c35: Unknown result type (might be due to invalid IL or missing references)
		//IL_1c71: Unknown result type (might be due to invalid IL or missing references)
		//IL_1c76: Unknown result type (might be due to invalid IL or missing references)
		//IL_1cb2: Unknown result type (might be due to invalid IL or missing references)
		//IL_1cb7: Unknown result type (might be due to invalid IL or missing references)
		//IL_1cf3: Unknown result type (might be due to invalid IL or missing references)
		//IL_1cf8: Unknown result type (might be due to invalid IL or missing references)
		//IL_1d34: Unknown result type (might be due to invalid IL or missing references)
		//IL_1d39: Unknown result type (might be due to invalid IL or missing references)
		//IL_1d75: Unknown result type (might be due to invalid IL or missing references)
		//IL_1d7a: Unknown result type (might be due to invalid IL or missing references)
		//IL_1db6: Unknown result type (might be due to invalid IL or missing references)
		//IL_1dbb: Unknown result type (might be due to invalid IL or missing references)
		//IL_1df7: Unknown result type (might be due to invalid IL or missing references)
		//IL_1dfc: Unknown result type (might be due to invalid IL or missing references)
		//IL_1e38: Unknown result type (might be due to invalid IL or missing references)
		//IL_1e3d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: 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_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Unknown result type (might be due to invalid IL or missing references)
		//IL_0259: Unknown result type (might be due to invalid IL or missing references)
		//IL_0391: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bc1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0be1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c01: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c11: Unknown result type (might be due to invalid IL or missing references)
		//IL_043c: Unknown result type (might be due to invalid IL or missing references)
		//IL_045c: Unknown result type (might be due to invalid IL or missing references)
		//IL_047c: Unknown result type (might be due to invalid IL or missing references)
		//IL_048c: Unknown result type (might be due to invalid IL or missing references)
		//IL_1409: Unknown result type (might be due to invalid IL or missing references)
		//IL_142f: Unknown result type (might be due to invalid IL or missing references)
		//IL_144f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1459: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c6c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c8c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cac: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cbc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_050d: Unknown result type (might be due to invalid IL or missing references)
		//IL_052d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0537: Unknown result type (might be due to invalid IL or missing references)
		//IL_14b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_14da: Unknown result type (might be due to invalid IL or missing references)
		//IL_14fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_1504: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d17: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d3d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d5d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d67: Unknown result type (might be due to invalid IL or missing references)
		//IL_0592: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_155f: Unknown result type (might be due to invalid IL or missing references)
		//IL_157f: Unknown result type (might be due to invalid IL or missing references)
		//IL_159f: Unknown result type (might be due to invalid IL or missing references)
		//IL_15af: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dc2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0de8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e08: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e12: Unknown result type (might be due to invalid IL or missing references)
		//IL_063d: Unknown result type (might be due to invalid IL or missing references)
		//IL_065d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0683: Unknown result type (might be due to invalid IL or missing references)
		//IL_068d: Unknown result type (might be due to invalid IL or missing references)
		//IL_160a: Unknown result type (might be due to invalid IL or missing references)
		//IL_162a: Unknown result type (might be due to invalid IL or missing references)
		//IL_164a: Unknown result type (might be due to invalid IL or missing references)
		//IL_165a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e6d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e93: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eb3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ec3: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0708: Unknown result type (might be due to invalid IL or missing references)
		//IL_072e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0738: Unknown result type (might be due to invalid IL or missing references)
		//IL_16b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_16d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_16fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_1705: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f1e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f44: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f64: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f74: Unknown result type (might be due to invalid IL or missing references)
		//IL_0793: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_1760: Unknown result type (might be due to invalid IL or missing references)
		//IL_1780: Unknown result type (might be due to invalid IL or missing references)
		//IL_17a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_17b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fcf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fef: Unknown result type (might be due to invalid IL or missing references)
		//IL_100f: Unknown result type (might be due to invalid IL or missing references)
		//IL_101f: Unknown result type (might be due to invalid IL or missing references)
		//IL_083e: Unknown result type (might be due to invalid IL or missing references)
		//IL_085e: Unknown result type (might be due to invalid IL or missing references)
		//IL_087e: Unknown result type (might be due to invalid IL or missing references)
		//IL_088e: Unknown result type (might be due to invalid IL or missing references)
		//IL_180b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1831: Unknown result type (might be due to invalid IL or missing references)
		//IL_1851: Unknown result type (might be due to invalid IL or missing references)
		//IL_185b: Unknown result type (might be due to invalid IL or missing references)
		//IL_107a: Unknown result type (might be due to invalid IL or missing references)
		//IL_109a: Unknown result type (might be due to invalid IL or missing references)
		//IL_10ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_10ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_08e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_090f: Unknown result type (might be due to invalid IL or missing references)
		//IL_092f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0939: Unknown result type (might be due to invalid IL or missing references)
		//IL_18b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_18dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_18fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_1906: Unknown result type (might be due to invalid IL or missing references)
		//IL_1125: Unknown result type (might be due to invalid IL or missing references)
		//IL_114b: Unknown result type (might be due to invalid IL or missing references)
		//IL_116b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1175: Unknown result type (might be due to invalid IL or missing references)
		//IL_0995: Unknown result type (might be due to invalid IL or missing references)
		//IL_09bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_09db: Unknown result type (might be due to invalid IL or missing references)
		//IL_09e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_1961: Unknown result type (might be due to invalid IL or missing references)
		//IL_1981: Unknown result type (might be due to invalid IL or missing references)
		//IL_19a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_19b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_11d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_11f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_1217: Unknown result type (might be due to invalid IL or missing references)
		//IL_1221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a41: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a61: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a87: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a91: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a0d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a2d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a4d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a5d: Unknown result type (might be due to invalid IL or missing references)
		//IL_127d: Unknown result type (might be due to invalid IL or missing references)
		//IL_12a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_12c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_12d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b0d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b33: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b3d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1ab9: Unknown result type (might be due to invalid IL or missing references)
		//IL_1ad9: Unknown result type (might be due to invalid IL or missing references)
		//IL_1aff: Unknown result type (might be due to invalid IL or missing references)
		//IL_1b09: Unknown result type (might be due to invalid IL or missing references)
		//IL_132f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1355: Unknown result type (might be due to invalid IL or missing references)
		//IL_1375: Unknown result type (might be due to invalid IL or missing references)
		//IL_1385: Unknown result type (might be due to invalid IL or missing references)
		//IL_1b65: Unknown result type (might be due to invalid IL or missing references)
		//IL_1b85: Unknown result type (might be due to invalid IL or missing references)
		//IL_1bab: Unknown result type (might be due to invalid IL or missing references)
		//IL_1bb5: Unknown result type (might be due to invalid IL or missing references)
		if (!Utility.isBoardLoaded())
		{
			return;
		}
		if (LocalClient.IsInGmMode)
		{
			KeyboardShortcut value = triggerKeys[0].Value;
			if (((KeyboardShortcut)(ref value)).IsUp())
			{
				Debug.Log((object)"Plane Image Plugin: Add Plane Request");
				SystemMessage.AskForTextInput("Plane Image", "Name Of Image", "Set", (Action<string>)delegate(string image)
				{
					AssetDataPlugin.SetInfo("Plane:" + System.Guid.NewGuid(), "org.lordashes.plugins.planeimage.Create", image, false);
				}, (Action)null, "Canel", (Action)null, "Plane Image");
			}
			else
			{
				value = triggerKeys[1].Value;
				if (((KeyboardShortcut)(ref value)).IsUp())
				{
					Debug.Log((object)"Plane Image Plugin: Remove Plane Request");
					AssetDataPlugin.ClearInfo(((Object)planes[currentPlaneIndex]).name, "org.lordashes.plugins.planeimage.Update", false);
					AssetDataPlugin.ClearInfo(((Object)planes[currentPlaneIndex]).name, "org.lordashes.plugins.planeimage.Create", false);
				}
				else
				{
					value = triggerKeys[2].Value;
					if (((KeyboardShortcut)(ref value)).IsUp())
					{
						Debug.Log((object)"Plane Image Plugin: Replace Image Request");
						SystemMessage.AskForTextInput("Replace Image", "Name Of Image", "Set", (Action<string>)delegate(string image)
						{
							AssetDataPlugin.SetInfo(((Object)planes[currentPlaneIndex]).name, "org.lordashes.plugins.planeimage.Create", image, false);
						}, (Action)null, "Canel", (Action)null, "Plane Image");
					}
					else
					{
						value = triggerKeys[3].Value;
						if (((KeyboardShortcut)(ref value)).IsUp())
						{
							Debug.Log((object)"Plane Image Plugin: Cycle Planes Request");
							if (planes.Count > 0)
							{
								currentPlaneIndex++;
								if (currentPlaneIndex >= planes.Count)
								{
									currentPlaneIndex = 0;
								}
							}
							((MonoBehaviour)this).StartCoroutine(TemporarilyDisplayPlaneInformation());
						}
						else
						{
							value = triggerKeys[4].Value;
							if (((KeyboardShortcut)(ref value)).IsUp())
							{
								Debug.Log((object)"Plane Image Plugin: Toggle Move Mode");
								if (activeMode != PlaneImageMode.move)
								{
									activeMode = PlaneImageMode.move;
								}
								else
								{
									activeMode = PlaneImageMode.game;
								}
								if (activeMode != 0)
								{
									GameInputEnabled(setting: false);
								}
								else
								{
									GameInputEnabled(setting: true);
								}
							}
							else
							{
								value = triggerKeys[5].Value;
								if (((KeyboardShortcut)(ref value)).IsUp())
								{
									Debug.Log((object)"Plane Image Plugin: Toggle Size Mode");
									if (activeMode != PlaneImageMode.size)
									{
										activeMode = PlaneImageMode.size;
									}
									else
									{
										activeMode = PlaneImageMode.game;
									}
									if (activeMode != 0)
									{
										GameInputEnabled(setting: false);
									}
									else
									{
										GameInputEnabled(setting: true);
									}
								}
								else
								{
									value = triggerKeys[6].Value;
									if (((KeyboardShortcut)(ref value)).IsUp())
									{
										Debug.Log((object)"Plane Image Plugin: Toggle Rotate Mode");
										if (activeMode != PlaneImageMode.rotate)
										{
											activeMode = PlaneImageMode.rotate;
										}
										else
										{
											activeMode = PlaneImageMode.game;
										}
										if (activeMode != 0)
										{
											GameInputEnabled(setting: false);
										}
										else
										{
											GameInputEnabled(setting: true);
										}
									}
								}
							}
						}
					}
				}
			}
			if (activeMode == PlaneImageMode.move)
			{
				bool flag = false;
				if (((KeyboardShortcut)(ref applyKeys[0])).IsUp())
				{
					planes[currentPlaneIndex].transform.position = new Vector3(planes[currentPlaneIndex].transform.position.x, planes[currentPlaneIndex].transform.position.y, planes[currentPlaneIndex].transform.position.z + 0.01f);
					flag = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[1])).IsUp())
				{
					planes[currentPlaneIndex].transform.position = new Vector3(planes[currentPlaneIndex].transform.position.x, planes[currentPlaneIndex].transform.position.y, planes[currentPlaneIndex].transform.position.z - 0.01f);
					flag = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[2])).IsUp())
				{
					planes[currentPlaneIndex].transform.position = new Vector3(planes[currentPlaneIndex].transform.position.x - 0.01f, planes[currentPlaneIndex].transform.position.y, planes[currentPlaneIndex].transform.position.z);
					flag = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[3])).IsUp())
				{
					planes[currentPlaneIndex].transform.position = new Vector3(planes[currentPlaneIndex].transform.position.x + 0.01f, planes[currentPlaneIndex].transform.position.y, planes[currentPlaneIndex].transform.position.z);
					flag = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[4])).IsUp())
				{
					planes[currentPlaneIndex].transform.position = new Vector3(planes[currentPlaneIndex].transform.position.x, planes[currentPlaneIndex].transform.position.y + 0.01f, planes[currentPlaneIndex].transform.position.z);
					flag = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[5])).IsUp())
				{
					planes[currentPlaneIndex].transform.position = new Vector3(planes[currentPlaneIndex].transform.position.x, planes[currentPlaneIndex].transform.position.y - 0.01f, planes[currentPlaneIndex].transform.position.z);
					flag = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[6])).IsPressed())
				{
					planes[currentPlaneIndex].transform.position = new Vector3(planes[currentPlaneIndex].transform.position.x, planes[currentPlaneIndex].transform.position.y, planes[currentPlaneIndex].transform.position.z + 0.1f);
					flag = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[7])).IsPressed())
				{
					planes[currentPlaneIndex].transform.position = new Vector3(planes[currentPlaneIndex].transform.position.x, planes[currentPlaneIndex].transform.position.y, planes[currentPlaneIndex].transform.position.z - 0.1f);
					flag = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[8])).IsPressed())
				{
					planes[currentPlaneIndex].transform.position = new Vector3(planes[currentPlaneIndex].transform.position.x - 0.1f, planes[currentPlaneIndex].transform.position.y, planes[currentPlaneIndex].transform.position.z);
					flag = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[9])).IsPressed())
				{
					planes[currentPlaneIndex].transform.position = new Vector3(planes[currentPlaneIndex].transform.position.x + 0.1f, planes[currentPlaneIndex].transform.position.y, planes[currentPlaneIndex].transform.position.z);
					flag = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[10])).IsPressed())
				{
					planes[currentPlaneIndex].transform.position = new Vector3(planes[currentPlaneIndex].transform.position.x, planes[currentPlaneIndex].transform.position.y + 0.1f, planes[currentPlaneIndex].transform.position.z);
					flag = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[11])).IsPressed())
				{
					planes[currentPlaneIndex].transform.position = new Vector3(planes[currentPlaneIndex].transform.position.x, planes[currentPlaneIndex].transform.position.y - 0.1f, planes[currentPlaneIndex].transform.position.z);
					flag = true;
				}
				if (flag)
				{
					updater = 30;
				}
			}
			else if (activeMode == PlaneImageMode.size)
			{
				bool flag2 = false;
				if (((KeyboardShortcut)(ref applyKeys[0])).IsUp())
				{
					planes[currentPlaneIndex].transform.localScale = new Vector3(planes[currentPlaneIndex].transform.localScale.x, planes[currentPlaneIndex].transform.localScale.y, planes[currentPlaneIndex].transform.localScale.z + 0.01f);
					flag2 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[1])).IsUp())
				{
					planes[currentPlaneIndex].transform.localScale = new Vector3(planes[currentPlaneIndex].transform.localScale.x, planes[currentPlaneIndex].transform.localScale.y, planes[currentPlaneIndex].transform.localScale.z - 0.01f);
					flag2 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[2])).IsUp())
				{
					planes[currentPlaneIndex].transform.localScale = new Vector3(planes[currentPlaneIndex].transform.localScale.x - 0.01f, planes[currentPlaneIndex].transform.localScale.y, planes[currentPlaneIndex].transform.localScale.z);
					flag2 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[3])).IsUp())
				{
					planes[currentPlaneIndex].transform.localScale = new Vector3(planes[currentPlaneIndex].transform.localScale.x + 0.01f, planes[currentPlaneIndex].transform.localScale.y, planes[currentPlaneIndex].transform.localScale.z);
					flag2 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[4])).IsUp())
				{
					planes[currentPlaneIndex].transform.localScale = new Vector3(planes[currentPlaneIndex].transform.localScale.x + 0.01f, planes[currentPlaneIndex].transform.localScale.y, planes[currentPlaneIndex].transform.localScale.z + 0.01f);
					flag2 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[5])).IsUp())
				{
					planes[currentPlaneIndex].transform.localScale = new Vector3(planes[currentPlaneIndex].transform.localScale.x - 0.01f, planes[currentPlaneIndex].transform.localScale.y, planes[currentPlaneIndex].transform.localScale.z - 0.01f);
					flag2 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[6])).IsPressed())
				{
					planes[currentPlaneIndex].transform.localScale = new Vector3(planes[currentPlaneIndex].transform.localScale.x, planes[currentPlaneIndex].transform.localScale.y, planes[currentPlaneIndex].transform.localScale.z + 0.1f);
					flag2 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[7])).IsPressed())
				{
					planes[currentPlaneIndex].transform.localScale = new Vector3(planes[currentPlaneIndex].transform.localScale.x, planes[currentPlaneIndex].transform.localScale.y, planes[currentPlaneIndex].transform.localScale.z - 0.1f);
					flag2 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[8])).IsPressed())
				{
					planes[currentPlaneIndex].transform.localScale = new Vector3(planes[currentPlaneIndex].transform.localScale.x - 0.1f, planes[currentPlaneIndex].transform.localScale.y, planes[currentPlaneIndex].transform.localScale.z);
					flag2 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[9])).IsPressed())
				{
					planes[currentPlaneIndex].transform.localScale = new Vector3(planes[currentPlaneIndex].transform.localScale.x + 0.1f, planes[currentPlaneIndex].transform.localScale.y, planes[currentPlaneIndex].transform.localScale.z);
					flag2 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[10])).IsPressed())
				{
					planes[currentPlaneIndex].transform.localScale = new Vector3(planes[currentPlaneIndex].transform.localScale.x + 0.1f, planes[currentPlaneIndex].transform.localScale.y, planes[currentPlaneIndex].transform.localScale.z + 0.1f);
					flag2 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[11])).IsPressed())
				{
					planes[currentPlaneIndex].transform.localScale = new Vector3(planes[currentPlaneIndex].transform.localScale.x - 0.1f, planes[currentPlaneIndex].transform.localScale.y, planes[currentPlaneIndex].transform.localScale.z - 0.1f);
					flag2 = true;
				}
				if (flag2)
				{
					updater = 30;
				}
			}
			else if (activeMode == PlaneImageMode.rotate)
			{
				bool flag3 = false;
				if (((KeyboardShortcut)(ref applyKeys[0])).IsUp())
				{
					planes[currentPlaneIndex].transform.eulerAngles = new Vector3(planes[currentPlaneIndex].transform.eulerAngles.x + 1f, planes[currentPlaneIndex].transform.eulerAngles.y, planes[currentPlaneIndex].transform.eulerAngles.z);
					flag3 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[1])).IsUp())
				{
					planes[currentPlaneIndex].transform.eulerAngles = new Vector3(planes[currentPlaneIndex].transform.eulerAngles.x - 1f, planes[currentPlaneIndex].transform.eulerAngles.y, planes[currentPlaneIndex].transform.eulerAngles.z);
					flag3 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[2])).IsUp())
				{
					planes[currentPlaneIndex].transform.eulerAngles = new Vector3(planes[currentPlaneIndex].transform.eulerAngles.x, planes[currentPlaneIndex].transform.eulerAngles.y, planes[currentPlaneIndex].transform.eulerAngles.z + 1f);
					flag3 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[3])).IsUp())
				{
					planes[currentPlaneIndex].transform.eulerAngles = new Vector3(planes[currentPlaneIndex].transform.eulerAngles.x, planes[currentPlaneIndex].transform.eulerAngles.y, planes[currentPlaneIndex].transform.eulerAngles.z - 1f);
					flag3 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[4])).IsUp())
				{
					planes[currentPlaneIndex].transform.eulerAngles = new Vector3(planes[currentPlaneIndex].transform.eulerAngles.x, planes[currentPlaneIndex].transform.eulerAngles.y + 1f, planes[currentPlaneIndex].transform.eulerAngles.z);
					flag3 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[5])).IsUp())
				{
					planes[currentPlaneIndex].transform.eulerAngles = new Vector3(planes[currentPlaneIndex].transform.eulerAngles.x, planes[currentPlaneIndex].transform.eulerAngles.y - 1f, planes[currentPlaneIndex].transform.eulerAngles.z);
					flag3 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[6])).IsPressed())
				{
					planes[currentPlaneIndex].transform.eulerAngles = new Vector3(planes[currentPlaneIndex].transform.eulerAngles.x + 1f, planes[currentPlaneIndex].transform.eulerAngles.y, planes[currentPlaneIndex].transform.eulerAngles.z);
					flag3 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[7])).IsPressed())
				{
					planes[currentPlaneIndex].transform.eulerAngles = new Vector3(planes[currentPlaneIndex].transform.eulerAngles.x - 1f, planes[currentPlaneIndex].transform.eulerAngles.y, planes[currentPlaneIndex].transform.eulerAngles.z);
					flag3 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[8])).IsPressed())
				{
					planes[currentPlaneIndex].transform.eulerAngles = new Vector3(planes[currentPlaneIndex].transform.eulerAngles.x, planes[currentPlaneIndex].transform.eulerAngles.y, planes[currentPlaneIndex].transform.eulerAngles.z + 1f);
					flag3 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[9])).IsPressed())
				{
					planes[currentPlaneIndex].transform.eulerAngles = new Vector3(planes[currentPlaneIndex].transform.eulerAngles.x, planes[currentPlaneIndex].transform.eulerAngles.y, planes[currentPlaneIndex].transform.eulerAngles.z - 1f);
					flag3 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[10])).IsPressed())
				{
					planes[currentPlaneIndex].transform.eulerAngles = new Vector3(planes[currentPlaneIndex].transform.eulerAngles.x, planes[currentPlaneIndex].transform.eulerAngles.y + 1f, planes[currentPlaneIndex].transform.eulerAngles.z);
					flag3 = true;
				}
				else if (((KeyboardShortcut)(ref applyKeys[11])).IsPressed())
				{
					planes[currentPlaneIndex].transform.eulerAngles = new Vector3(planes[currentPlaneIndex].transform.eulerAngles.x, planes[currentPlaneIndex].transform.eulerAngles.y - 1f, planes[currentPlaneIndex].transform.eulerAngles.z);
					flag3 = true;
				}
				if (flag3)
				{
					updater = 30;
				}
			}
		}
		if (updater > 0)
		{
			updater--;
		}
		else if (updater == 0)
		{
			Debug.Log((object)"Plane Image Plugin: Sending Update");
			string text = planes[currentPlaneIndex].transform.position.x.ToString("f", CultureInfo.InvariantCulture) + ",";
			text = text + planes[currentPlaneIndex].transform.position.y.ToString("f", CultureInfo.InvariantCulture) + ",";
			text = text + planes[currentPlaneIndex].transform.position.z.ToString("f", CultureInfo.InvariantCulture) + ",";
			text = text + planes[currentPlaneIndex].transform.localScale.x.ToString("f", CultureInfo.InvariantCulture) + ",";
			text = text + planes[currentPlaneIndex].transform.localScale.y.ToString("f", CultureInfo.InvariantCulture) + ",";
			text = text + planes[currentPlaneIndex].transform.localScale.z.ToString("f", CultureInfo.InvariantCulture) + ",";
			text = text + planes[currentPlaneIndex].transform.eulerAngles.x.ToString("f", CultureInfo.InvariantCulture) + ",";
			text = text + planes[currentPlaneIndex].transform.eulerAngles.y.ToString("f", CultureInfo.InvariantCulture) + ",";
			text += planes[currentPlaneIndex].transform.eulerAngles.z.ToString("f", CultureInfo.InvariantCulture);
			AssetDataPlugin.SetInfo(((Object)planes[currentPlaneIndex]).name, "org.lordashes.plugins.planeimage.Update", text, false);
			updater--;
		}
	}

	private void OnGUI()
	{
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02df: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_031a: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0355: Unknown result type (might be due to invalid IL or missing references)
		//IL_035a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0390: Unknown result type (might be due to invalid IL or missing references)
		//IL_0395: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		if (!displayCurrentPlaneInfo && activeMode == PlaneImageMode.game)
		{
			return;
		}
		if (planes.Count == 0)
		{
			UpdatePlanesCache(0, "Zero Planes When In Non-Game Mode");
		}
		if (planes.Count == 0)
		{
			displayCurrentPlaneInfo = false;
			activeMode = PlaneImageMode.game;
			currentPlaneIndex = -1;
			return;
		}
		if (currentPlaneIndex >= planes.Count || currentPlaneIndex < 0)
		{
			currentPlaneIndex = 0;
		}
		try
		{
			if (planes[currentPlaneIndex].transform.localScale.x.ToString("0.00").ToString().ToUpper() == "NAN" || planes[currentPlaneIndex].transform.localScale.z.ToString("0.00").ToString().ToUpper() == "NAN")
			{
				planes[currentPlaneIndex].transform.localScale = new Vector3(1f, 1f, 1f);
			}
			GUI.Label(new Rect(20f, (float)(Screen.height - 60), (float)(Screen.width - 40), 30f), "Planes: " + planes.Count + ", Plane: " + ((Object)((Renderer)planes[currentPlaneIndex].GetComponentInChildren<MeshRenderer>()).material).name + ", Mode: " + activeMode.ToString().Substring(0, 1).ToUpper() + activeMode.ToString().Substring(1) + ", Position: (" + planes[currentPlaneIndex].transform.position.x.ToString("0.00") + "," + planes[currentPlaneIndex].transform.position.y.ToString("0.00") + "," + planes[currentPlaneIndex].transform.position.z.ToString("0.00") + ") , Size: (" + planes[currentPlaneIndex].transform.localScale.x.ToString("0.00") + "x" + planes[currentPlaneIndex].transform.localScale.z.ToString("0.00") + "), Rotation: (" + planes[currentPlaneIndex].transform.eulerAngles.x.ToString("0.00") + "," + planes[currentPlaneIndex].transform.eulerAngles.y.ToString("0.00") + "," + planes[currentPlaneIndex].transform.eulerAngles.z.ToString("0.00") + ")");
		}
		catch
		{
			displayCurrentPlaneInfo = false;
			activeMode = PlaneImageMode.game;
		}
	}

	private void RequestHandler(DatumChange datum)
	{
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Invalid comparison between Unknown and I4
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Invalid comparison between Unknown and I4
		Debug.Log((object)("Plane Image Plugin: Datum = " + JsonConvert.SerializeObject((object)datum)));
		if (datum.key.EndsWith(".Create"))
		{
			if ((int)datum.action != 1)
			{
				PlaneBuild(datum.source, datum.value.ToString());
			}
			else
			{
				PlaneRemove(datum.source);
			}
		}
		else if ((int)datum.action != 1 && datum.key.EndsWith(".Update"))
		{
			PlaneUpdate(datum.source, datum.value.ToString());
		}
	}

	private bool CheckPlaneExistance(DatumChange datum)
	{
		Debug.Log((object)("Plane Image Plugin: Pending Datum " + datum.key + " on " + datum.source + " to " + datum.value));
		GameObject val = GameObject.Find(datum.source);
		if ((Object)(object)val == (Object)null)
		{
			Debug.Log((object)"Plane Image Plugin: No Go");
			return false;
		}
		MeshRenderer component = val.GetComponent<MeshRenderer>();
		if ((Object)(object)component == (Object)null)
		{
			Debug.Log((object)"Plane Image Plugin: No Mesh Renderer");
			return false;
		}
		if ((Object)(object)((Renderer)component).material == (Object)null)
		{
			Debug.Log((object)"Plane Image Plugin: No Material");
			return false;
		}
		if ((Object)(object)((Renderer)component).material.mainTexture == (Object)null)
		{
			Debug.Log((object)"Plane Image Plugin: No Main Texture");
			return false;
		}
		if (val.activeInHierarchy && ((Renderer)component).enabled)
		{
			Debug.Log((object)"Plane Image Plugin: Check True. Applying Pending Datum");
			return true;
		}
		Debug.Log((object)"Plane Image Plugin: Not Active");
		return false;
	}

	private void PlaneBuild(string id, string image)
	{
		//IL_0044: 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_00bf: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			GameObject val = GameObject.Find(id);
			if ((Object)(object)val != (Object)null)
			{
				Debug.Log((object)"Plane Image Plugin: Using Existing Plane Game Object");
			}
			else
			{
				Debug.Log((object)"Plane Image Plugin: Adding Plane Game Object");
				val = Object.Instantiate<GameObject>(prefab, new Vector3(0f, 0.1f, 0f), Quaternion.identity);
				planes.Add(val);
			}
			Debug.Log((object)"Plane Image Plugin: Adding SkinnedMeshRenderer");
			MeshRenderer val2 = default(MeshRenderer);
			val.TryGetComponent<MeshRenderer>(ref val2);
			if ((Object)(object)val2 != (Object)null)
			{
				Debug.Log((object)"Plane Image Plugin: Using Existing SkinnedMeshRenderer Object");
			}
			else
			{
				Debug.Log((object)"Plane Image Plugin: Adding A SkinnedMeshRenderer Object");
				val2 = val.AddComponent<MeshRenderer>();
			}
			Debug.Log((object)"Plane Image Plugin: Setting Bounds");
			((Renderer)val2).bounds = new Bounds(new Vector3(0f, 0f, 0f), new Vector3(2f, 2f, 2f));
			Debug.Log((object)"Plane Image Plugin: Creating Material");
			ApplyPlaneTexture(val, val2, image);
			Debug.Log((object)"Plane Image Plugin: Setting Mesh Name");
			((Object)val2).name = Path.GetFileNameWithoutExtension(image);
			Debug.Log((object)"Plane Image Plugin: Setting Shadow Settings");
			((Renderer)val2).receiveShadows = false;
			((Renderer)val2).staticShadowCaster = false;
			Debug.Log((object)"Plane Image Plugin: Enabling SkinnedMeshRenderer");
			((Renderer)val2).enabled = true;
			Debug.Log((object)("Plane Image Plugin: Enabling Plane " + id));
			((Object)val).name = id;
			val.SetActive(true);
			UpdatePlanesCache(0, "Post Build");
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("Plane Image Plugin: PlaneBuild Caught Exception: " + ex));
		}
		((MonoBehaviour)this).StartCoroutine(TemporarilyDisplayPlaneInformation());
	}

	private void PlaneUpdate(string id, string data)
	{
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: 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_01fc: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			GameObject val = planes.Where((GameObject p) => ((Object)p).name == id).ElementAt(0);
			if ((Object)(object)val == (Object)null)
			{
				UpdatePlanesCache(currentPlaneIndex - 1, "Plane Not Found During Update");
				val = planes.Where((GameObject p) => ((Object)p).name == id).ElementAt(0);
				if ((Object)(object)val != (Object)null)
				{
					Debug.Log((object)"Plane Image Plugin: Updating Plane Not Found");
					{
						foreach (GameObject plane in planes)
						{
							Debug.Log((object)("Plane Image Plugin: Found Plane " + ((Object)plane).name + " While Looking For " + id));
						}
						return;
					}
				}
			}
			string[] array = data.Split(new char[1] { ',' });
			if (array.Length == 9)
			{
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(Utility.ParseFloat(array[0]), Utility.ParseFloat(array[1]), Utility.ParseFloat(array[2]));
				Vector3 val3 = default(Vector3);
				((Vector3)(ref val3))..ctor(Utility.ParseFloat(array[3]), Utility.ParseFloat(array[4]), Utility.ParseFloat(array[5]));
				Vector3 val4 = default(Vector3);
				((Vector3)(ref val4))..ctor(Utility.ParseFloat(array[6]), Utility.ParseFloat(array[7]), Utility.ParseFloat(array[8]));
				string[] obj = new string[8]
				{
					"Plane Image Plugin: Updating Plane ",
					((Object)val).name,
					" To Pos ",
					null,
					null,
					null,
					null,
					null
				};
				Vector3 val5 = val2;
				obj[3] = ((object)(Vector3)(ref val5)).ToString();
				obj[4] = " Size ";
				val5 = val3;
				obj[5] = ((object)(Vector3)(ref val5)).ToString();
				obj[6] = " Rot ";
				val5 = val4;
				obj[7] = ((object)(Vector3)(ref val5)).ToString();
				Debug.Log((object)string.Concat(obj));
				val.transform.position = val2;
				val.transform.localScale = val3;
				val.transform.eulerAngles = val4;
			}
			else
			{
				Debug.Log((object)"Plane Image Plugin: Unexpected Parameter Count");
			}
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("Plane Image Plugin: PlaneUpdate Caught Exception: " + ex));
		}
	}

	private void PlaneRemove(string source)
	{
		try
		{
			Debug.Log((object)("Plane Image Plugin: Destroying Plane " + source));
			UpdatePlanesCache(currentPlaneIndex - 1, "Plane Not Found During Remove");
			Debug.Log((object)("Plane Image Plugin: " + planes.Count + " Planes Exist"));
			for (int i = 0; i < planes.Count; i++)
			{
				if (((Object)planes[i]).name == source)
				{
					Debug.Log((object)("Plane Image Plugin: Found Plane '" + ((Object)planes[i]).name + "' Matching " + source + ". Destroying..."));
					Object.Destroy((Object)(object)planes[i]);
					planes[i] = null;
					planes.RemoveAt(i);
				}
				else
				{
					Debug.Log((object)("Plane Image Plugin: Found Plane '" + ((Object)planes[i]).name + "' Not Match '" + source + "' . Ignoring..."));
				}
			}
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("Plane Image Plugin: PlaneRemove Exception: " + ex));
		}
		((MonoBehaviour)this).StartCoroutine(TemporarilyDisplayPlaneInformation());
	}

	private void UpdatePlanesCache(int suggestedPlaneIndex, string reason)
	{
		try
		{
			Debug.Log((object)("Plane Image Plugin: Updating Planes Cache (Reason: " + reason + ")"));
			planes = (from go in Object.FindObjectsOfType<GameObject>()
				where ((Object)go).name.StartsWith("Plane:")
				select go).ToList();
			if (suggestedPlaneIndex < planes.Count)
			{
				currentPlaneIndex = suggestedPlaneIndex;
			}
			else
			{
				currentPlaneIndex = planes.Count - 1;
			}
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("Plane Image Plugin: UpdatePlaneCache Exception: " + ex));
		}
	}

	private void ApplyPlaneTexture(GameObject plane, MeshRenderer mr, string image)
	{
		//IL_0282: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: 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_0141: 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_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			string text = File.Find(image, (CacheType)999)[0];
			string text2 = text.Substring(text.LastIndexOf(".") + 1).ToUpper();
			if (text2.Trim() != "" && "|AVI|MKV|MP4|MPG|".Contains(text2))
			{
				Debug.Log((object)"Plane Image Plugin: Creating Video Texture");
				VideoPlayer val = default(VideoPlayer);
				if (!plane.TryGetComponent<VideoPlayer>(ref val))
				{
					val = plane.AddComponent<VideoPlayer>();
				}
				val.playOnAwake = true;
				val.source = (VideoSource)1;
				val.url = ((!image.ToUpper().StartsWith("HTTP")) ? ("file://" + text) : text);
				val.isLooping = true;
				float num = (float)val.height / (float)val.width;
				Debug.Log((object)("Plane Image Plugin: Scaling Plane Based On Video Size " + (float)val.width + "x" + (float)val.height + " With Anchor Size = " + plane.transform.localScale.x));
				plane.transform.localScale = new Vector3(plane.transform.localScale.x, plane.transform.localScale.y, plane.transform.localScale.x * num);
				val.Play();
				Debug.Log((object)"Plane Image Plugin: Setting White Image Texture");
				((Object)((Renderer)mr).material).name = "Video:" + val.url;
				((Renderer)mr).material.mainTexture = (Texture)(object)Texture2D.whiteTexture;
			}
			else
			{
				Debug.Log((object)"Plane Image Plugin: Creating Image Texture");
				((Renderer)mr).material.mainTexture = (Texture)(object)Image.LoadTexture(text, (CacheType)999);
				float num2 = (float)((Renderer)mr).material.mainTexture.height / (float)((Renderer)mr).material.mainTexture.width;
				((Object)((Renderer)mr).material).name = "Texture:" + Path.GetFileNameWithoutExtension(image);
				Debug.Log((object)("Plane Image Plugin: Scaling Plane Based On Texture Size " + (float)((Renderer)mr).material.mainTexture.width + "x" + (float)((Renderer)mr).material.mainTexture.height + " With Anchor Size = " + plane.transform.localScale.x));
				plane.transform.localScale = new Vector3(plane.transform.localScale.x, plane.transform.localScale.y, plane.transform.localScale.x * num2);
				Debug.Log((object)"Plane Image Plugin: Destorying Video Texture");
				VideoPlayer val2 = default(VideoPlayer);
				if (plane.TryGetComponent<VideoPlayer>(ref val2))
				{
					Object.Destroy((Object)(object)val2);
				}
			}
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("Plane Image Plugin: ApplyPlaneTexture Exception: " + ex));
		}
	}

	private void GameInputEnabled(bool setting)
	{
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Expected O, but got Unknown
		if (gameInputInstance == null || gameInputDisable == null || gameInputEnable == null)
		{
			try
			{
				Debug.Log((object)"Plane Image Plugin: Getting Game Input Reference");
				gameInputInstance = null;
				gameInputDisable = null;
				gameInputEnable = null;
				gameInputInstance = (GameInput)(from f in typeof(ControllerManager).GetRuntimeFields()
					where f.Name == "_gameInput"
					select f).ToArray()[0].GetValue(null);
				gameInputDisable = (from m in typeof(GameInput).GetMethods()
					where m.Name == "Disable"
					select m).ElementAt(0);
				gameInputEnable = (from m in typeof(GameInput).GetMethods()
					where m.Name == "Enable"
					select m).ElementAt(0);
			}
			catch
			{
				Debug.LogWarning((object)"Plane Image Plugin: Unable To Get Game Input Reference Or Reference To One Of Its Methods");
			}
		}
		if (setting)
		{
			Debug.Log((object)"Plane Image Plugin: Enabling Game Input");
			gameInputEnable.Invoke(gameInputInstance, new object[0]);
		}
		else
		{
			Debug.Log((object)"Plane Image Plugin: Disabling Game Input");
			gameInputDisable.Invoke(gameInputInstance, new object[0]);
		}
	}

	private IEnumerator TemporarilyDisplayPlaneInformation()
	{
		displayCurrentPlaneInfo = true;
		yield return (object)new WaitForSeconds(3f);
		displayCurrentPlaneInfo = false;
	}
}