Decompiled source of PlanetTracker v0.8.1

PlanetTracker.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("PlanetTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlanetTracker")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a5bdcbc0-326d-4c93-9719-9e547f04a954")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PlanetTracker;

[BepInPlugin("jordy.dsp.planettracker", "Planet Tracker", "0.8.6")]
public class Plugin : BaseUnityPlugin
{
	private class PlanetEntry
	{
		public string Name;

		public PlanetData Planet;
	}

	public const string ModName = "Planet Tracker";

	public const string ModVersion = "0.8.6";

	private Rect windowRect = new Rect((float)(Screen.width - 430), 80f, 390f, 420f);

	private bool showWindow = true;

	private bool minimized = false;

	private bool draggingWindow = false;

	private Vector2 dragOffset;

	private bool resizingWindow = false;

	private Vector2 resizeStartMouse;

	private Vector2 resizeStartSize;

	private const float MinWindowWidth = 390f;

	private const float MinWindowHeight = 320f;

	private const float MaxWindowWidth = 900f;

	private const float MaxWindowHeight = 900f;

	private int selectedScope = 1;

	private int lastLoadedScope = -1;

	private float nextAutoLoadTime = 0f;

	private int activeIndicatorPlanetId = -1;

	private readonly string[] scopes = new string[3] { "Favorites", "Local System", "Entire Galaxy" };

	private readonly List<PlanetEntry> favorites = new List<PlanetEntry>();

	private readonly List<PlanetEntry> visiblePlanets = new List<PlanetEntry>();

	private readonly Dictionary<int, string> aliases = new Dictionary<int, string>();

	private Vector2 scrollPos;

	private string aliasInput = "";

	private PlanetEntry editingAlias;

	private GUIStyle titleStyle;

	private GUIStyle rowStyle;

	private GUIStyle smallTextStyle;

	private GUIStyle buttonStyle;

	private GUIStyle selectedScopeButtonStyle;

	private GUIStyle panelStyle;

	private GUIStyle miniButtonStyle;

	private GUIStyle activeIndicatorButtonStyle;

	private bool stylesReady = false;

	private readonly Color panelBg = new Color(0.015f, 0.045f, 0.06f, 0.86f);

	private readonly Color headerBg = new Color(0.03f, 0.11f, 0.14f, 0.95f);

	private readonly Color textColor = new Color(0.78f, 1f, 1f, 1f);

	private readonly Color subTextColor = new Color(0.52f, 0.78f, 0.82f, 0.95f);

	private readonly Color borderColor = new Color(0.38f, 0.95f, 1f, 0.65f);

	private void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Planet Tracker 0.8.6 loaded!");
	}

	private void Update()
	{
		if (Input.GetKeyDown((KeyCode)289))
		{
			showWindow = !showWindow;
			((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} window toggled. Visible: {1}", "Planet Tracker", showWindow));
		}
		if (showWindow && !minimized && Time.time >= nextAutoLoadTime)
		{
			nextAutoLoadTime = Time.time + 1f;
			if (visiblePlanets.Count == 0 || lastLoadedScope != selectedScope)
			{
				LoadScopePlanets();
				lastLoadedScope = selectedScope;
			}
		}
	}

	private void OnGUI()
	{
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: 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_0090: Unknown result type (might be due to invalid IL or missing references)
		if (showWindow)
		{
			SetupStyles();
			float num = (minimized ? 34f : ((Rect)(ref windowRect)).height);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref windowRect)).x, ((Rect)(ref windowRect)).y, ((Rect)(ref windowRect)).width, num);
			GUI.color = panelBg;
			GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = Color.white;
			DrawBorder(val, borderColor, 1);
			GUILayout.BeginArea(val);
			DrawTitleBar();
			if (!minimized)
			{
				DrawContent();
				DrawResizeHandle();
			}
			GUILayout.EndArea();
			HandleDrag();
			HandleResize();
		}
	}

	private void DrawTitleBar()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		GUI.color = headerBg;
		GUI.DrawTexture(new Rect(0f, 0f, ((Rect)(ref windowRect)).width, 34f), (Texture)(object)Texture2D.whiteTexture);
		GUI.color = Color.white;
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) });
		GUILayout.Space(10f);
		GUILayout.Label("Planet Tracker v0.8.6", titleStyle, Array.Empty<GUILayoutOption>());
		GUILayout.FlexibleSpace();
		if (GUILayout.Button(minimized ? "+" : "-", miniButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
		{
			GUILayout.Width(28f),
			GUILayout.Height(24f)
		}))
		{
			minimized = !minimized;
			((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} minimized: {1}", "Planet Tracker", minimized));
		}
		GUILayout.Space(6f);
		GUILayout.EndHorizontal();
	}

	private void DrawContent()
	{
		//IL_007f: 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_009e: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.Space(10f);
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Space(10f);
		DrawScopeButtons();
		GUILayout.FlexibleSpace();
		GUILayout.Space(10f);
		GUILayout.EndHorizontal();
		GUILayout.Space(8f);
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Space(10f);
		float num = Mathf.Max(120f, ((Rect)(ref windowRect)).height - 250f);
		scrollPos = GUILayout.BeginScrollView(scrollPos, panelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) });
		DrawListHeader();
		if (visiblePlanets.Count == 0)
		{
			GUILayout.Label("No planets loaded", rowStyle, Array.Empty<GUILayoutOption>());
		}
		else
		{
			foreach (PlanetEntry item in visiblePlanets.ToList())
			{
				DrawPlanetRow(item);
				GUILayout.Space(3f);
			}
		}
		GUILayout.EndScrollView();
		GUILayout.Space(10f);
		GUILayout.EndHorizontal();
		DrawAliasEditor();
	}

	private void DrawScopeButtons()
	{
		GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
		for (int i = 0; i < scopes.Length; i++)
		{
			GUIStyle val = ((selectedScope == i) ? selectedScopeButtonStyle : buttonStyle);
			if (GUILayout.Button(scopes[i], val, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(160f),
				GUILayout.Height(26f)
			}) && selectedScope != i)
			{
				selectedScope = i;
				visiblePlanets.Clear();
				LoadScopePlanets();
				lastLoadedScope = selectedScope;
			}
		}
		GUILayout.EndVertical();
	}

	private void DrawListHeader()
	{
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label("Name", smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
		GUILayout.Label("Alias", smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(95f) });
		GUILayout.Label("ID", smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
		GUILayout.FlexibleSpace();
		GUILayout.Label("Fav", smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) });
		GUILayout.Label("A", smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) });
		GUILayout.Label("↗", smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) });
		GUILayout.EndHorizontal();
		GUILayout.Space(4f);
	}

	private void DrawPlanetRow(PlanetEntry entry)
	{
		if (entry != null && entry.Planet != null)
		{
			string alias = GetAlias(entry);
			string text = (string.IsNullOrEmpty(alias) ? "-" : alias);
			string text2 = entry.Planet.id.ToString();
			bool flag = IsFavorite(entry);
			bool flag2 = activeIndicatorPlanetId == entry.Planet.id;
			GUILayout.BeginHorizontal(panelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(42f) });
			GUILayout.Label(entry.Name, rowStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			GUILayout.Label(text, smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(95f) });
			GUILayout.Label(text2, smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
			GUILayout.FlexibleSpace();
			if (GUILayout.Button(flag ? "X" : "+", miniButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(28f),
				GUILayout.Height(26f)
			}))
			{
				ToggleFavorite(entry);
			}
			if (GUILayout.Button("A", miniButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(28f),
				GUILayout.Height(26f)
			}))
			{
				editingAlias = entry;
				aliasInput = alias;
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Editing alias for: " + entry.Name));
			}
			GUIStyle val = (flag2 ? activeIndicatorButtonStyle : miniButtonStyle);
			if (GUILayout.Button(flag2 ? "*" : "↗", val, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(28f),
				GUILayout.Height(26f)
			}))
			{
				TogglePlanetIndicator(entry);
			}
			GUILayout.EndHorizontal();
		}
	}

	private void DrawAliasEditor()
	{
		GUILayout.Space(8f);
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Space(10f);
		GUILayout.BeginVertical(panelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(82f) });
		if (editingAlias == null)
		{
			GUILayout.Label("Select A to set an alias.", smallTextStyle, Array.Empty<GUILayoutOption>());
		}
		else
		{
			GUILayout.Label("Alias for: " + editingAlias.Name, smallTextStyle, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			aliasInput = GUILayout.TextField(aliasInput, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(210f),
				GUILayout.Height(28f)
			});
			if (GUILayout.Button("Save", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(70f),
				GUILayout.Height(28f)
			}))
			{
				SaveAlias(editingAlias, aliasInput);
				editingAlias = null;
				aliasInput = "";
			}
			if (GUILayout.Button("Clear", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(70f),
				GUILayout.Height(28f)
			}))
			{
				ClearAlias(editingAlias);
				editingAlias = null;
				aliasInput = "";
			}
			GUILayout.EndHorizontal();
		}
		GUILayout.EndVertical();
		GUILayout.Space(10f);
		GUILayout.EndHorizontal();
	}

	private void DrawResizeHandle()
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		Rect val = default(Rect);
		((Rect)(ref val))..ctor(((Rect)(ref windowRect)).width - 24f, ((Rect)(ref windowRect)).height - 24f, 22f, 22f);
		GUI.Label(val, "#", smallTextStyle);
	}

	private void LoadScopePlanets()
	{
		visiblePlanets.Clear();
		if (selectedScope == 0)
		{
			visiblePlanets.AddRange(favorites);
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded favorites: " + visiblePlanets.Count));
		}
		else if (selectedScope == 1)
		{
			LoadLocalSystemPlanets();
		}
		else if (selectedScope == 2)
		{
			LoadEntireGalaxyPlanets();
		}
	}

	private void LoadLocalSystemPlanets()
	{
		PlanetData localPlanet = GameMain.localPlanet;
		if (localPlanet == null || localPlanet.star == null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not detect current star system.");
			return;
		}
		StarData star = localPlanet.star;
		if (star.planets == null || star.planets.Length == 0)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"No planets found in current star system.");
			return;
		}
		PlanetData[] planets = star.planets;
		foreach (PlanetData planet in planets)
		{
			AddVisiblePlanet(planet);
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded local system planets: " + visiblePlanets.Count));
	}

	private void LoadEntireGalaxyPlanets()
	{
		if (GameMain.galaxy == null || GameMain.galaxy.stars == null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Galaxy data not available.");
			return;
		}
		StarData[] stars = GameMain.galaxy.stars;
		foreach (StarData val in stars)
		{
			if (val != null && val.planets != null)
			{
				PlanetData[] planets = val.planets;
				foreach (PlanetData planet in planets)
				{
					AddVisiblePlanet(planet);
				}
			}
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded entire galaxy planets: " + visiblePlanets.Count));
	}

	private void AddVisiblePlanet(PlanetData planet)
	{
		if (planet != null)
		{
			string planetName = GetPlanetName(planet);
			if (!string.IsNullOrEmpty(planetName))
			{
				visiblePlanets.Add(new PlanetEntry
				{
					Name = planetName,
					Planet = planet
				});
			}
		}
	}

	private bool IsFavorite(PlanetEntry entry)
	{
		if (entry == null || entry.Planet == null)
		{
			return false;
		}
		return favorites.Any((PlanetEntry f) => f.Planet != null && f.Planet.id == entry.Planet.id);
	}

	private void ToggleFavorite(PlanetEntry entry)
	{
		if (entry == null || entry.Planet == null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot toggle favorite. Planet is null.");
		}
		else if (IsFavorite(entry))
		{
			favorites.RemoveAll((PlanetEntry f) => f.Planet != null && f.Planet.id == entry.Planet.id);
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Removed favorite planet: " + entry.Name));
			if (selectedScope == 0)
			{
				LoadScopePlanets();
			}
		}
		else
		{
			favorites.Add(new PlanetEntry
			{
				Name = entry.Name,
				Planet = entry.Planet
			});
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Added favorite planet: " + entry.Name));
		}
	}

	private string GetAlias(PlanetEntry entry)
	{
		if (entry == null || entry.Planet == null)
		{
			return "";
		}
		if (aliases.TryGetValue(entry.Planet.id, out var value))
		{
			return value;
		}
		return "";
	}

	private void SaveAlias(PlanetEntry entry, string alias)
	{
		if (entry != null && entry.Planet != null)
		{
			alias = alias?.Trim() ?? "";
			if (string.IsNullOrEmpty(alias))
			{
				ClearAlias(entry);
				return;
			}
			aliases[entry.Planet.id] = alias;
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Alias set: " + entry.Name + " => " + alias));
		}
	}

	private void ClearAlias(PlanetEntry entry)
	{
		if (entry != null && entry.Planet != null && aliases.ContainsKey(entry.Planet.id))
		{
			aliases.Remove(entry.Planet.id);
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Alias cleared: " + entry.Name));
		}
	}

	private void TogglePlanetIndicator(PlanetEntry entry)
	{
		if (entry == null || entry.Planet == null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot toggle indicator. Planet is null.");
			return;
		}
		if (activeIndicatorPlanetId == entry.Planet.id)
		{
			ClearPlanetIndicator();
			return;
		}
		ActivatePlanetIndicator(entry);
		activeIndicatorPlanetId = entry.Planet.id;
	}

	private void ActivatePlanetIndicator(PlanetEntry entry)
	{
		try
		{
			object mainPlayer = GameMain.mainPlayer;
			if (mainPlayer == null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot activate indicator. mainPlayer is null.");
				return;
			}
			object fieldOrProperty = GetFieldOrProperty(mainPlayer, "navigation");
			if (fieldOrProperty == null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot activate indicator. Player navigation not found.");
				return;
			}
			int astroId = entry.Planet.astroId;
			string text = ((!string.IsNullOrEmpty(GetAlias(entry))) ? GetAlias(entry) : entry.Name);
			bool flag = false;
			flag |= SetFieldOrProperty(fieldOrProperty, "indicatorAstroId", astroId);
			flag |= SetFieldOrProperty(fieldOrProperty, "indicatorEntityId", 0);
			flag |= SetFieldOrProperty(fieldOrProperty, "indicatorMsg", text);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Indicator requested for {text}. AstroId: {astroId}. Success: {flag}");
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Indicator activation failed: " + ex.Message));
		}
	}

	private void ClearPlanetIndicator()
	{
		try
		{
			object mainPlayer = GameMain.mainPlayer;
			if (mainPlayer == null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot clear indicator. mainPlayer is null.");
				activeIndicatorPlanetId = -1;
				return;
			}
			object fieldOrProperty = GetFieldOrProperty(mainPlayer, "navigation");
			if (fieldOrProperty == null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot clear indicator. Player navigation not found.");
				activeIndicatorPlanetId = -1;
				return;
			}
			bool flag = false;
			flag |= SetFieldOrProperty(fieldOrProperty, "indicatorAstroId", 0);
			flag |= SetFieldOrProperty(fieldOrProperty, "indicatorEntityId", 0);
			flag |= SetFieldOrProperty(fieldOrProperty, "indicatorMsg", "");
			activeIndicatorPlanetId = -1;
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Indicator cleared. Success: " + flag));
		}
		catch (Exception ex)
		{
			activeIndicatorPlanetId = -1;
			((BaseUnityPlugin)this).Logger.LogError((object)("Indicator clear failed: " + ex.Message));
		}
	}

	private object GetFieldOrProperty(object target, string name)
	{
		Type type = target.GetType();
		FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (field != null)
		{
			return field.GetValue(target);
		}
		PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (property != null)
		{
			return property.GetValue(target, null);
		}
		return null;
	}

	private bool SetFieldOrProperty(object target, string name, object value)
	{
		Type type = target.GetType();
		FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(target, value);
			return true;
		}
		PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (property != null && property.CanWrite)
		{
			property.SetValue(target, value, null);
			return true;
		}
		return false;
	}

	private string GetPlanetName(PlanetData planet)
	{
		if (planet == null)
		{
			return null;
		}
		if (!string.IsNullOrEmpty(planet.displayName))
		{
			return planet.displayName;
		}
		return planet.name;
	}

	private void SetupStyles()
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Expected O, but got Unknown
		//IL_0085: 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_00c0: Expected O, but got Unknown
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Expected O, but got Unknown
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Expected O, but got Unknown
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dd: Expected O, but got Unknown
		//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: Expected O, but got Unknown
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_035d: Unknown result type (might be due to invalid IL or missing references)
		//IL_038f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ca: Expected O, but got Unknown
		//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0406: Unknown result type (might be due to invalid IL or missing references)
		//IL_0410: Expected O, but got Unknown
		if (!stylesReady)
		{
			titleStyle = new GUIStyle(GUI.skin.label);
			titleStyle.normal.textColor = textColor;
			titleStyle.fontSize = 15;
			titleStyle.fontStyle = (FontStyle)1;
			titleStyle.alignment = (TextAnchor)3;
			rowStyle = new GUIStyle(GUI.skin.label);
			rowStyle.normal.textColor = textColor;
			rowStyle.fontSize = 14;
			rowStyle.alignment = (TextAnchor)3;
			smallTextStyle = new GUIStyle(GUI.skin.label);
			smallTextStyle.normal.textColor = subTextColor;
			smallTextStyle.fontSize = 11;
			smallTextStyle.alignment = (TextAnchor)3;
			buttonStyle = new GUIStyle(GUI.skin.button);
			buttonStyle.normal.textColor = textColor;
			buttonStyle.hover.textColor = Color.white;
			buttonStyle.active.textColor = Color.white;
			buttonStyle.fontSize = 13;
			buttonStyle.alignment = (TextAnchor)4;
			buttonStyle.normal.background = MakeTex(2, 2, new Color(0.02f, 0.08f, 0.1f, 0.7f));
			buttonStyle.hover.background = MakeTex(2, 2, new Color(0.07f, 0.2f, 0.24f, 0.85f));
			buttonStyle.active.background = MakeTex(2, 2, new Color(0.06f, 0.18f, 0.22f, 0.9f));
			selectedScopeButtonStyle = new GUIStyle(buttonStyle);
			selectedScopeButtonStyle.normal.background = MakeTex(2, 2, new Color(0.035f, 0.14f, 0.17f, 0.92f));
			selectedScopeButtonStyle.hover.background = MakeTex(2, 2, new Color(0.06f, 0.2f, 0.24f, 0.95f));
			selectedScopeButtonStyle.active.background = MakeTex(2, 2, new Color(0.06f, 0.2f, 0.24f, 0.95f));
			selectedScopeButtonStyle.normal.textColor = new Color(0.72f, 1f, 1f, 1f);
			miniButtonStyle = new GUIStyle(buttonStyle);
			miniButtonStyle.fontSize = 14;
			miniButtonStyle.fontStyle = (FontStyle)1;
			activeIndicatorButtonStyle = new GUIStyle(miniButtonStyle);
			activeIndicatorButtonStyle.normal.background = MakeTex(2, 2, new Color(0.08f, 0.32f, 0.36f, 0.95f));
			activeIndicatorButtonStyle.hover.background = MakeTex(2, 2, new Color(0.1f, 0.42f, 0.48f, 1f));
			activeIndicatorButtonStyle.active.background = MakeTex(2, 2, new Color(0.12f, 0.52f, 0.58f, 1f));
			activeIndicatorButtonStyle.normal.textColor = Color.white;
			panelStyle = new GUIStyle(GUI.skin.box);
			panelStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.04f, 0.05f, 0.55f));
			panelStyle.padding = new RectOffset(8, 8, 8, 8);
			stylesReady = true;
		}
	}

	private void HandleDrag()
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Invalid comparison between Unknown and I4
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Invalid comparison between Unknown and I4
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: 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)
		Event current = Event.current;
		Rect val = default(Rect);
		((Rect)(ref val))..ctor(((Rect)(ref windowRect)).x, ((Rect)(ref windowRect)).y, ((Rect)(ref windowRect)).width - 40f, 34f);
		if ((int)current.type == 0 && ((Rect)(ref val)).Contains(current.mousePosition))
		{
			draggingWindow = true;
			dragOffset = current.mousePosition - ((Rect)(ref windowRect)).position;
			current.Use();
		}
		if ((int)current.type == 1)
		{
			draggingWindow = false;
		}
		if (draggingWindow && (int)current.type == 3)
		{
			((Rect)(ref windowRect)).position = current.mousePosition - dragOffset;
			current.Use();
		}
	}

	private void HandleResize()
	{
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Invalid comparison between Unknown and I4
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Invalid comparison between Unknown and I4
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: 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)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		if (!minimized)
		{
			Event current = Event.current;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref windowRect)).xMax - 26f, ((Rect)(ref windowRect)).yMax - 26f, 26f, 26f);
			if ((int)current.type == 0 && ((Rect)(ref val)).Contains(current.mousePosition))
			{
				resizingWindow = true;
				resizeStartMouse = current.mousePosition;
				resizeStartSize = new Vector2(((Rect)(ref windowRect)).width, ((Rect)(ref windowRect)).height);
				current.Use();
			}
			if ((int)current.type == 1)
			{
				resizingWindow = false;
			}
			if (resizingWindow && (int)current.type == 3)
			{
				Vector2 val2 = current.mousePosition - resizeStartMouse;
				((Rect)(ref windowRect)).width = Mathf.Clamp(resizeStartSize.x + val2.x, 390f, 900f);
				((Rect)(ref windowRect)).height = Mathf.Clamp(resizeStartSize.y + val2.y, 320f, 900f);
				current.Use();
			}
		}
	}

	private void DrawBorder(Rect rect, Color color, int thickness)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: 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_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		GUI.color = color;
		GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, (float)thickness), (Texture)(object)Texture2D.whiteTexture);
		GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - (float)thickness, ((Rect)(ref rect)).width, (float)thickness), (Texture)(object)Texture2D.whiteTexture);
		GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, (float)thickness, ((Rect)(ref rect)).height), (Texture)(object)Texture2D.whiteTexture);
		GUI.DrawTexture(new Rect(((Rect)(ref rect)).xMax - (float)thickness, ((Rect)(ref rect)).y, (float)thickness, ((Rect)(ref rect)).height), (Texture)(object)Texture2D.whiteTexture);
		GUI.color = Color.white;
	}

	private Texture2D MakeTex(int width, int height, Color color)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: 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_002e: Expected O, but got Unknown
		Color[] array = (Color[])(object)new Color[width * height];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = color;
		}
		Texture2D val = new Texture2D(width, height);
		val.SetPixels(array);
		val.Apply();
		return val;
	}
}