Decompiled source of DSPCruiseAssist v0.1.4

DSPCruiseAssist.dll

Decompiled a year ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
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("CruiseAssist")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CruiseAssist")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9cdb5e0f-fb97-46ff-a4fb-a9a400443fd3")]
[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 tanu.CruiseAssist;

internal abstract class ConfigManager
{
	public enum Step
	{
		AWAKE,
		GAME_MAIN_BEGIN,
		UNIVERSE_GEN_CREATE_GALAXY,
		STATE,
		CHANGE_SEED
	}

	private static ConfigManager instance;

	private static Dictionary<ConfigDefinition, string> orphanedEntries;

	public static ConfigFile Config { get; private set; }

	protected ConfigManager(ConfigFile config)
	{
		instance = this;
		Config = config;
		Config.SaveOnConfigSet = false;
	}

	public static void CheckConfig(Step step)
	{
		instance.CheckConfigImplements(step);
	}

	protected abstract void CheckConfigImplements(Step step);

	public static ConfigEntry<T> Bind<T>(ConfigDefinition configDefinition, T defaultValue, ConfigDescription configDescription = null)
	{
		return Config.Bind<T>(configDefinition, defaultValue, configDescription);
	}

	public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, ConfigDescription configDescription = null)
	{
		return Config.Bind<T>(section, key, defaultValue, configDescription);
	}

	public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, string description)
	{
		return Config.Bind<T>(section, key, defaultValue, description);
	}

	public static ConfigEntry<T> GetEntry<T>(ConfigDefinition configDefinition)
	{
		try
		{
			return (ConfigEntry<T>)(object)Config[configDefinition];
		}
		catch (KeyNotFoundException ex)
		{
			LogManager.LogError($"{ex.GetType()}: configDefinition={configDefinition}");
			throw;
		}
	}

	public static ConfigEntry<T> GetEntry<T>(string section, string key)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Expected O, but got Unknown
		return GetEntry<T>(new ConfigDefinition(section, key));
	}

	public static T GetValue<T>(ConfigDefinition configDefinition)
	{
		return GetEntry<T>(configDefinition).Value;
	}

	public static T GetValue<T>(string section, string key)
	{
		return GetEntry<T>(section, key).Value;
	}

	public static bool ContainsKey(ConfigDefinition configDefinition)
	{
		return Config.ContainsKey(configDefinition);
	}

	public static bool ContainsKey(string section, string key)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		return Config.ContainsKey(new ConfigDefinition(section, key));
	}

	public static bool UpdateEntry<T>(string section, string key, T value) where T : IComparable
	{
		ConfigEntry<T> entry = GetEntry<T>(section, key);
		if (entry.Value.CompareTo(value) == 0)
		{
			return false;
		}
		entry.Value = value;
		return true;
	}

	public static bool RemoveEntry(ConfigDefinition key)
	{
		return Config.Remove(key);
	}

	public static Dictionary<ConfigDefinition, string> GetOrphanedEntries()
	{
		if (orphanedEntries == null)
		{
			orphanedEntries = Traverse.Create((object)Config).Property<Dictionary<ConfigDefinition, string>>("OrphanedEntries", (object[])null).Value;
		}
		return orphanedEntries;
	}

	public static void Migration<T>(string newSection, string newKey, T defaultValue, string oldSection, string oldKey)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		GetOrphanedEntries();
		ConfigDefinition key = new ConfigDefinition(oldSection, oldKey);
		if (orphanedEntries.TryGetValue(key, out var value))
		{
			((ConfigEntryBase)Bind(newSection, newKey, defaultValue)).SetSerializedValue(value);
			orphanedEntries.Remove(key);
			LogManager.LogInfo("migration " + oldSection + "." + oldKey + "(" + value + ") => " + newSection + "." + newKey);
		}
	}

	public static void Save(bool clearOrphanedEntries = false)
	{
		if (clearOrphanedEntries)
		{
			GetOrphanedEntries().Clear();
		}
		Config.Save();
		LogManager.LogInfo("save config.");
	}

	public static void Clear()
	{
		Config.Clear();
	}

	public static void Reload()
	{
		Config.Reload();
	}
}
internal class CruiseAssistConfigManager : ConfigManager
{
	public CruiseAssistConfigManager(ConfigFile Config)
		: base(Config)
	{
	}

	protected override void CheckConfigImplements(Step step)
	{
		bool flag = false;
		if (step == Step.AWAKE)
		{
			ConfigEntry<string> val = ConfigManager.Bind("Base", "ModVersion", "0.1.37", "Don't change.");
			val.Value = "0.0.37";
			ConfigManager.Migration("State", "MainWindow0Left", 100, "State", "InfoWindowLeft");
			ConfigManager.Migration("State", "MainWindow0Top", 100, "State", "InfoWindowTop");
			ConfigManager.Migration("State", "MainWindow0Left", 100, "State", "MainWindowLeft");
			ConfigManager.Migration("State", "MainWindow0Top", 100, "State", "MainWindowTop");
			ConfigManager.Migration("State", "StarListWindow0Left", 100, "State", "StarListWindowLeft");
			ConfigManager.Migration("State", "StarListWindow0Top", 100, "State", "StarListWindowTop");
			ConfigManager.Migration("Setting", "CloseStarListWhenSetTargetPlanet", defaultValue: false, "Setting", "HideStarListWhenSetTargetPlanet");
			flag = true;
		}
		if (step == Step.AWAKE || step == Step.GAME_MAIN_BEGIN)
		{
			CruiseAssistDebugUI.Show = ConfigManager.Bind("Debug", "DebugWindowShow", defaultValue: false).Value;
			CruiseAssistPlugin.Enable = ConfigManager.Bind("Setting", "Enable", defaultValue: true).Value;
			CruiseAssistPlugin.Conf.MarkVisitedFlag = ConfigManager.Bind("Setting", "MarkVisited", defaultValue: true).Value;
			CruiseAssistPlugin.Conf.SelectFocusFlag = ConfigManager.Bind("Setting", "SelectFocus", defaultValue: true).Value;
			CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag = ConfigManager.Bind("Setting", "HideDuplicateHistory", defaultValue: true).Value;
			CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag = ConfigManager.Bind("Setting", "AutoDisableLockCursor", defaultValue: false).Value;
			CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag = ConfigManager.Bind("Setting", "ShowMainWindowWhenTargetSelectedEvenNotSailMode", defaultValue: true).Value;
			CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag = ConfigManager.Bind("Setting", "CloseStarListWhenSetTargetPlanet", defaultValue: false).Value;
			CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag = ConfigManager.Bind("Setting", "HideBottomCloseButton", defaultValue: true).Value;
			CruiseAssistMainUI.Scale = ConfigManager.Bind("Setting", "UIScale", 150).Value;
			string value = ConfigManager.Bind("Setting", "MainWindowViewMode", CruiseAssistMainUIViewMode.FULL.ToString()).Value;
			EnumUtils.TryParse<CruiseAssistMainUIViewMode>(value, out CruiseAssistMainUI.ViewMode);
			for (int i = 0; i < 2; i++)
			{
				((Rect)(ref CruiseAssistMainUI.Rect[i])).x = ConfigManager.Bind("State", $"MainWindow{i}Left", 100).Value;
				((Rect)(ref CruiseAssistMainUI.Rect[i])).y = ConfigManager.Bind("State", $"MainWindow{i}Top", 100).Value;
				((Rect)(ref CruiseAssistStarListUI.Rect[i])).x = ConfigManager.Bind("State", $"StarListWindow{i}Left", 100).Value;
				((Rect)(ref CruiseAssistStarListUI.Rect[i])).y = ConfigManager.Bind("State", $"StarListWindow{i}Top", 100).Value;
				((Rect)(ref CruiseAssistConfigUI.Rect[i])).x = ConfigManager.Bind("State", $"ConfigWindow{i}Left", 100).Value;
				((Rect)(ref CruiseAssistConfigUI.Rect[i])).y = ConfigManager.Bind("State", $"ConfigWindow{i}Top", 100).Value;
			}
			CruiseAssistStarListUI.ListSelected = ConfigManager.Bind("State", "StarListWindowListSelected", 0).Value;
			((Rect)(ref CruiseAssistDebugUI.Rect)).x = ConfigManager.Bind("State", "DebugWindowLeft", 100).Value;
			((Rect)(ref CruiseAssistDebugUI.Rect)).y = ConfigManager.Bind("State", "DebugWindowTop", 100).Value;
		}
		if (step == Step.AWAKE || step == Step.GAME_MAIN_BEGIN || step == Step.STATE || step == Step.CHANGE_SEED)
		{
			if (DSPGame.IsMenuDemo || GameMain.galaxy == null)
			{
				if (CruiseAssistPlugin.Seed != -1)
				{
					CruiseAssistPlugin.Seed = -1;
					CruiseAssistPlugin.History = new List<int>();
					CruiseAssistPlugin.Bookmark = new List<int>();
					LogManager.LogInfo("clear seed.");
				}
			}
			else if (CruiseAssistPlugin.Seed != GameMain.galaxy.seed)
			{
				CruiseAssistPlugin.Seed = GameMain.galaxy.seed;
				CruiseAssistPlugin.History = ListUtils.ParseToIntList(ConfigManager.Bind("Save", $"History_{CruiseAssistPlugin.Seed}", "").Value);
				CruiseAssistPlugin.Bookmark = ListUtils.ParseToIntList(ConfigManager.Bind("Save", $"Bookmark_{CruiseAssistPlugin.Seed}", "").Value);
				LogManager.LogInfo($"change seed {CruiseAssistPlugin.Seed}.");
			}
		}
		if (step == Step.STATE)
		{
			LogManager.LogInfo("check state.");
			flag |= ConfigManager.UpdateEntry("Setting", "Enable", CruiseAssistPlugin.Enable);
			flag |= ConfigManager.UpdateEntry("Setting", "MarkVisited", CruiseAssistPlugin.Conf.MarkVisitedFlag);
			flag |= ConfigManager.UpdateEntry("Setting", "SelectFocus", CruiseAssistPlugin.Conf.SelectFocusFlag);
			flag |= ConfigManager.UpdateEntry("Setting", "HideDuplicateHistory", CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag);
			flag |= ConfigManager.UpdateEntry("Setting", "AutoDisableLockCursor", CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag);
			flag |= ConfigManager.UpdateEntry("Setting", "ShowMainWindowWhenTargetSelectedEvenNotSailMode", CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag);
			flag |= ConfigManager.UpdateEntry("Setting", "CloseStarListWhenSetTargetPlanet", CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag);
			flag |= ConfigManager.UpdateEntry("Setting", "HideBottomCloseButton", CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag);
			flag |= ConfigManager.UpdateEntry("Setting", "UIScale", (int)CruiseAssistMainUI.Scale);
			flag |= ConfigManager.UpdateEntry("Setting", "MainWindowViewMode", CruiseAssistMainUI.ViewMode.ToString());
			for (int j = 0; j < 2; j++)
			{
				flag |= ConfigManager.UpdateEntry("State", $"MainWindow{j}Left", (int)((Rect)(ref CruiseAssistMainUI.Rect[j])).x);
				flag |= ConfigManager.UpdateEntry("State", $"MainWindow{j}Top", (int)((Rect)(ref CruiseAssistMainUI.Rect[j])).y);
				flag |= ConfigManager.UpdateEntry("State", $"StarListWindow{j}Left", (int)((Rect)(ref CruiseAssistStarListUI.Rect[j])).x);
				flag |= ConfigManager.UpdateEntry("State", $"StarListWindow{j}Top", (int)((Rect)(ref CruiseAssistStarListUI.Rect[j])).y);
				flag |= ConfigManager.UpdateEntry("State", $"ConfigWindow{j}Left", (int)((Rect)(ref CruiseAssistConfigUI.Rect[j])).x);
				flag |= ConfigManager.UpdateEntry("State", $"ConfigWindow{j}Top", (int)((Rect)(ref CruiseAssistConfigUI.Rect[j])).y);
			}
			flag |= ConfigManager.UpdateEntry("State", "StarListWindowListSelected", CruiseAssistStarListUI.ListSelected);
			flag |= ConfigManager.UpdateEntry("State", "DebugWindowLeft", (int)((Rect)(ref CruiseAssistDebugUI.Rect)).x);
			flag |= ConfigManager.UpdateEntry("State", "DebugWindowTop", (int)((Rect)(ref CruiseAssistDebugUI.Rect)).y);
			if (CruiseAssistPlugin.Seed != -1)
			{
				flag |= ConfigManager.UpdateEntry("Save", $"History_{CruiseAssistPlugin.Seed}", ListUtils.ToString(CruiseAssistPlugin.History));
				flag |= ConfigManager.UpdateEntry("Save", $"Bookmark_{CruiseAssistPlugin.Seed}", ListUtils.ToString(CruiseAssistPlugin.Bookmark));
			}
			CruiseAssistMainUI.NextCheckGameTick = long.MaxValue;
		}
		if (flag)
		{
			ConfigManager.Save();
		}
	}
}
public class CruiseAssistConfigUI
{
	private static int wIdx = 0;

	public const float WindowWidth = 400f;

	public const float WindowHeight = 400f;

	public static bool[] Show = new bool[2];

	public static Rect[] Rect = (Rect[])(object)new Rect[2]
	{
		new Rect(0f, 0f, 400f, 400f),
		new Rect(0f, 0f, 400f, 400f)
	};

	private static float[] lastCheckWindowLeft = new float[2]
	{
		float.MinValue,
		float.MinValue
	};

	private static float[] lastCheckWindowTop = new float[2]
	{
		float.MinValue,
		float.MinValue
	};

	public static float TempScale;

	public static void OnGUI()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		//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)
		wIdx = CruiseAssistMainUI.wIdx;
		Rect[wIdx] = GUILayout.Window(99030293, Rect[wIdx], new WindowFunction(WindowFunction), "CruiseAssist - Config", CruiseAssistMainUI.WindowStyle, Array.Empty<GUILayoutOption>());
		float num = CruiseAssistMainUI.Scale / 100f;
		if ((float)Screen.width / num < ((Rect)(ref Rect[wIdx])).xMax)
		{
			((Rect)(ref Rect[wIdx])).x = (float)Screen.width / num - ((Rect)(ref Rect[wIdx])).width;
		}
		if (((Rect)(ref Rect[wIdx])).x < 0f)
		{
			((Rect)(ref Rect[wIdx])).x = 0f;
		}
		if ((float)Screen.height / num < ((Rect)(ref Rect[wIdx])).yMax)
		{
			((Rect)(ref Rect[wIdx])).y = (float)Screen.height / num - ((Rect)(ref Rect[wIdx])).height;
		}
		if (((Rect)(ref Rect[wIdx])).y < 0f)
		{
			((Rect)(ref Rect[wIdx])).y = 0f;
		}
		if (lastCheckWindowLeft[wIdx] != float.MinValue && (((Rect)(ref Rect[wIdx])).x != lastCheckWindowLeft[wIdx] || ((Rect)(ref Rect[wIdx])).y != lastCheckWindowTop[wIdx]))
		{
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		lastCheckWindowLeft[wIdx] = ((Rect)(ref Rect[wIdx])).x;
		lastCheckWindowTop[wIdx] = ((Rect)(ref Rect[wIdx])).y;
	}

	public static void WindowFunction(int windowId)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: 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_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Expected O, but got Unknown
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Expected O, but got Unknown
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Expected O, but got Unknown
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Expected O, but got Unknown
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Expected O, but got Unknown
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Expected O, but got Unknown
		//IL_0286: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Expected O, but got Unknown
		//IL_030b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0312: Expected O, but got Unknown
		//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_036f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_042d: 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_04eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_054a: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ee: Expected O, but got Unknown
		//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0690: Unknown result type (might be due to invalid IL or missing references)
		//IL_063e: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label("Main Window Style :", new GUIStyle(GUI.skin.label)
		{
			fixedWidth = 120f,
			fixedHeight = 20f,
			fontSize = 12,
			alignment = (TextAnchor)3
		}, Array.Empty<GUILayoutOption>());
		GUIStyle val = new GUIStyle(CruiseAssistMainUI.BaseToolbarButtonStyle);
		val.fixedWidth = 80f;
		val.fixedHeight = 20f;
		val.fontSize = 12;
		string[] array = new string[2] { "FULL", "MINI" };
		int num = ((CruiseAssistMainUI.ViewMode != 0) ? 1 : 0);
		GUI.changed = false;
		int num2 = GUILayout.Toolbar(num, array, val, Array.Empty<GUILayoutOption>());
		if (GUI.changed)
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
		}
		if (num2 != num)
		{
			switch (num2)
			{
			case 1:
				CruiseAssistMainUI.ViewMode = CruiseAssistMainUIViewMode.MINI;
				break;
			case 0:
				CruiseAssistMainUI.ViewMode = CruiseAssistMainUIViewMode.FULL;
				break;
			}
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label("UI Scale :", new GUIStyle(GUI.skin.label)
		{
			fixedWidth = 60f,
			fixedHeight = 20f,
			fontSize = 12,
			alignment = (TextAnchor)3
		}, Array.Empty<GUILayoutOption>());
		GUIStyle val2 = new GUIStyle(CruiseAssistMainUI.BaseHorizontalSliderStyle);
		val2.fixedWidth = 180f;
		val2.margin.top = 10;
		val2.alignment = (TextAnchor)3;
		GUIStyle val3 = new GUIStyle(CruiseAssistMainUI.BaseHorizontalSliderThumbStyle);
		val3.border = new RectOffset(1, 1, 8, 8);
		TempScale = GUILayout.HorizontalSlider(TempScale, 80f, 240f, val2, val3, Array.Empty<GUILayoutOption>());
		TempScale = (int)TempScale / 5 * 5;
		GUIStyle val4 = new GUIStyle(GUI.skin.label);
		val4.fixedWidth = 40f;
		val4.fixedHeight = 20f;
		val4.fontSize = 12;
		val4.alignment = (TextAnchor)3;
		GUILayout.Label(TempScale.ToString("0") + "%", val4, Array.Empty<GUILayoutOption>());
		GUIStyle val5 = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
		{
			fixedWidth = 60f,
			fixedHeight = 18f
		};
		val5.margin.top = 6;
		val5.fontSize = 12;
		if (GUILayout.Button("SET", val5, Array.Empty<GUILayoutOption>()))
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			CruiseAssistMainUI.Scale = TempScale;
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		GUILayout.EndHorizontal();
		GUIStyle val6 = new GUIStyle(CruiseAssistMainUI.BaseToggleStyle);
		val6.fixedHeight = 20f;
		val6.fontSize = 12;
		val6.alignment = (TextAnchor)6;
		GUI.changed = false;
		CruiseAssistPlugin.Conf.MarkVisitedFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.MarkVisitedFlag, Localization.Translate("Mark the visited system and planet."), val6, Array.Empty<GUILayoutOption>());
		if (GUI.changed)
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		GUI.changed = false;
		CruiseAssistPlugin.Conf.SelectFocusFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.SelectFocusFlag, Localization.Translate("Focus when select target."), val6, Array.Empty<GUILayoutOption>());
		if (GUI.changed)
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		GUI.changed = false;
		CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag, Localization.Translate("Hide duplicate history."), val6, Array.Empty<GUILayoutOption>());
		if (GUI.changed)
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		GUI.changed = false;
		CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag, Localization.Translate("Disable lock cursor when starting sail mode."), val6, Array.Empty<GUILayoutOption>());
		if (GUI.changed)
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		GUI.changed = false;
		CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag, Localization.Translate("Show main window when target selected, even not sail mode."), val6, Array.Empty<GUILayoutOption>());
		if (GUI.changed)
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		GUI.changed = false;
		CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag, Localization.Translate("Close StarList when set target planet."), val6, Array.Empty<GUILayoutOption>());
		if (GUI.changed)
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		GUI.changed = false;
		CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag, Localization.Translate("Hide bottom close button."), val6, Array.Empty<GUILayoutOption>());
		if (GUI.changed)
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		GUILayout.FlexibleSpace();
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.FlexibleSpace();
		GUIStyle val7 = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle);
		val7.fixedWidth = 80f;
		val7.fixedHeight = 20f;
		val7.fontSize = 12;
		if (!CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag && GUILayout.Button("Close", val7, Array.Empty<GUILayoutOption>()))
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			Show[wIdx] = false;
		}
		GUILayout.EndHorizontal();
		GUILayout.EndVertical();
		if (GUI.Button(new Rect(((Rect)(ref Rect[wIdx])).width - 16f, 1f, 16f, 16f), "", CruiseAssistMainUI.CloseButtonStyle))
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			Show[wIdx] = false;
		}
		GUI.DragWindow();
	}
}
public class CruiseAssistDebugUI
{
	public static bool Show = false;

	public static Rect Rect = new Rect(0f, 0f, 400f, 400f);

	private static float lastCheckWindowLeft = float.MinValue;

	private static float lastCheckWindowTop = float.MinValue;

	private static Vector2 scrollPos = Vector2.zero;

	public static void OnGUI()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected O, but got Unknown
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		GUIStyle val = new GUIStyle(GUI.skin.window);
		val.fontSize = 11;
		Rect = GUILayout.Window(99030294, Rect, new WindowFunction(WindowFunction), "CruiseAssist - Debug", val, Array.Empty<GUILayoutOption>());
		float num = CruiseAssistMainUI.Scale / 100f;
		if ((float)Screen.width < ((Rect)(ref Rect)).xMax)
		{
			((Rect)(ref Rect)).x = (float)Screen.width - ((Rect)(ref Rect)).width;
		}
		if (((Rect)(ref Rect)).x < 0f)
		{
			((Rect)(ref Rect)).x = 0f;
		}
		if ((float)Screen.height < ((Rect)(ref Rect)).yMax)
		{
			((Rect)(ref Rect)).y = (float)Screen.height - ((Rect)(ref Rect)).height;
		}
		if (((Rect)(ref Rect)).y < 0f)
		{
			((Rect)(ref Rect)).y = 0f;
		}
		if (lastCheckWindowLeft != float.MinValue && (((Rect)(ref Rect)).x != lastCheckWindowLeft || ((Rect)(ref Rect)).y != lastCheckWindowTop))
		{
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		lastCheckWindowLeft = ((Rect)(ref Rect)).x;
		lastCheckWindowTop = ((Rect)(ref Rect)).y;
	}

	public static void WindowFunction(int windowId)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
		GUIStyle val = new GUIStyle(GUI.skin.label);
		val.fontSize = 12;
		scrollPos = GUILayout.BeginScrollView(scrollPos, Array.Empty<GUILayoutOption>());
		string format = "CruiseAssistPlugin.ReticuleTargetStar.id={0}";
		GUILayout.Label(string.Format(format, CruiseAssistPlugin.ReticuleTargetStar?.id), val, Array.Empty<GUILayoutOption>());
		string format2 = "CruiseAssistPlugin.ReticuleTargetPlanet.id={0}";
		GUILayout.Label(string.Format(format2, CruiseAssistPlugin.ReticuleTargetPlanet?.id), val, Array.Empty<GUILayoutOption>());
		string format3 = "CruiseAssistPlugin.SelectTargetStar.id={0}";
		GUILayout.Label(string.Format(format3, CruiseAssistPlugin.SelectTargetStar?.id), val, Array.Empty<GUILayoutOption>());
		string format4 = "CruiseAssistPlugin.SelectTargetPlanet.id={0}";
		GUILayout.Label(string.Format(format4, CruiseAssistPlugin.SelectTargetPlanet?.id), val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GameMain.mainPlayer.navigation.indicatorAstroId={GameMain.mainPlayer.navigation.indicatorAstroId}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GameMain.mainPlayer.controller.input0.w={GameMain.mainPlayer.controller.input0.w}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GameMain.mainPlayer.controller.input0.x={GameMain.mainPlayer.controller.input0.x}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GameMain.mainPlayer.controller.input0.y={GameMain.mainPlayer.controller.input0.y}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GameMain.mainPlayer.controller.input0.z={GameMain.mainPlayer.controller.input0.z}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GameMain.mainPlayer.controller.input1.w={GameMain.mainPlayer.controller.input1.w}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GameMain.mainPlayer.controller.input1.x={GameMain.mainPlayer.controller.input1.x}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GameMain.mainPlayer.controller.input1.y={GameMain.mainPlayer.controller.input1.y}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GameMain.mainPlayer.controller.input1.z={GameMain.mainPlayer.controller.input1.z}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"VFInput._sailSpeedUp={VFInput._sailSpeedUp}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"CruiseAssistPlugin.Enable={CruiseAssistPlugin.Enable}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"CruiseAssistPlugin.History={CruiseAssistPlugin.History.Count()}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label("CruiseAssistPlugin.History=" + ListUtils.ToString(CruiseAssistPlugin.History), val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GUI.skin.window.margin.top={GUI.skin.window.margin.top}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GUI.skin.window.border.top={GUI.skin.window.border.top}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GUI.skin.window.padding.top={GUI.skin.window.padding.top}", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label($"GUI.skin.window.overflow.top={GUI.skin.window.overflow.top}", val, Array.Empty<GUILayoutOption>());
		GUILayout.EndScrollView();
		GUILayout.EndVertical();
		GUI.DragWindow();
	}
}
public interface CruiseAssistExtensionAPI
{
	void CheckConfig(string step);

	void SetTargetAstroId(int astroId);

	bool OperateWalk(PlayerMove_Walk __instance);

	bool OperateDrift(PlayerMove_Drift __instance);

	bool OperateFly(PlayerMove_Fly __instance);

	bool OperateSail(PlayerMove_Sail __instance);

	void SetInactive();

	void CancelOperate();

	void OnGUI();
}
public class CruiseAssistMainUI
{
	public static float Scale = 150f;

	public static int wIdx = 0;

	public static CruiseAssistMainUIViewMode ViewMode = CruiseAssistMainUIViewMode.FULL;

	public const float WindowWidthFull = 398f;

	public const float WindowHeightFull = 150f;

	public const float WindowWidthMini = 288f;

	public const float WindowHeightMini = 70f;

	public static Rect[] Rect = (Rect[])(object)new Rect[2]
	{
		new Rect(0f, 0f, 398f, 150f),
		new Rect(0f, 0f, 398f, 150f)
	};

	private static float[] lastCheckWindowLeft = new float[2]
	{
		float.MinValue,
		float.MinValue
	};

	private static float[] lastCheckWindowTop = new float[2]
	{
		float.MinValue,
		float.MinValue
	};

	public static long NextCheckGameTick = long.MaxValue;

	public static Texture2D WhiteBorderBackgroundTexture = null;

	public static Texture2D GrayBorderBackgroundTexture = null;

	public static Texture2D WhiteBorderTexture = null;

	public static Texture2D GrayBorderTexture = null;

	public static Texture2D BlackTexture = null;

	public static Texture2D WhiteTexture = null;

	public static Texture2D ToggleOnTexture = null;

	public static Texture2D ToggleOffTexture = null;

	public static Texture2D CloseButtonGrayBorderTexture = null;

	public static Texture2D CloseButtonWhiteBorderTexture = null;

	public static GUIStyle WindowStyle = null;

	public static GUIStyle BaseButtonStyle = null;

	public static GUIStyle BaseToolbarButtonStyle = null;

	public static GUIStyle BaseVerticalScrollBarStyle = null;

	public static GUIStyle BaseHorizontalSliderStyle = null;

	public static GUIStyle BaseHorizontalSliderThumbStyle = null;

	public static GUIStyle BaseToggleStyle = null;

	public static GUIStyle BaseTextFieldStyle = null;

	public static GUIStyle CloseButtonStyle = null;

	private static List<GUIStyle> verticalScrollBarSkins = null;

	public static void OnGUI()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Expected O, but got Unknown
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Expected O, but got Unknown
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0268: Expected O, but got Unknown
		//IL_0317: Unknown result type (might be due to invalid IL or missing references)
		//IL_0321: Expected O, but got Unknown
		//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ad: Expected O, but got Unknown
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_043b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0445: Expected O, but got Unknown
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0506: Expected O, but got Unknown
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: 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_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f0: Expected O, but got Unknown
		//IL_0345: Unknown result type (might be due to invalid IL or missing references)
		//IL_0347: Unknown result type (might be due to invalid IL or missing references)
		//IL_02af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: 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_0204: 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_072f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0739: Expected O, but got Unknown
		//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03df: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0867: Unknown result type (might be due to invalid IL or missing references)
		//IL_0871: Expected O, but got Unknown
		//IL_0888: Unknown result type (might be due to invalid IL or missing references)
		//IL_089d: Unknown result type (might be due to invalid IL or missing references)
		//IL_08b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_08dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_08f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0906: Unknown result type (might be due to invalid IL or missing references)
		//IL_091b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_09f9: Expected O, but got Unknown
		//IL_0a03: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a18: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a2d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a42: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a57: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a6c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a81: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a96: Unknown result type (might be due to invalid IL or missing references)
		//IL_048d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b62: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b6c: Expected O, but got Unknown
		//IL_0b76: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b8b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ba0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bb5: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_057b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0493: Unknown result type (might be due to invalid IL or missing references)
		//IL_049e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bf6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c00: Expected O, but got Unknown
		//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0801: Unknown result type (might be due to invalid IL or missing references)
		//IL_0818: Unknown result type (might be due to invalid IL or missing references)
		//IL_081a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0677: Unknown result type (might be due to invalid IL or missing references)
		//IL_057d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0588: Unknown result type (might be due to invalid IL or missing references)
		//IL_058a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cd9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ce3: Expected O, but got Unknown
		//IL_07ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_0679: Unknown result type (might be due to invalid IL or missing references)
		//IL_0684: Unknown result type (might be due to invalid IL or missing references)
		//IL_0686: Unknown result type (might be due to invalid IL or missing references)
		//IL_0491: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dac: Unknown result type (might be due to invalid IL or missing references)
		//IL_0db6: Expected O, but got Unknown
		//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_07bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_07bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e7f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e89: Expected O, but got Unknown
		//IL_0573: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f52: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f5c: Expected O, but got Unknown
		//IL_066f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1025: Unknown result type (might be due to invalid IL or missing references)
		//IL_102f: Expected O, but got Unknown
		//IL_07a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_1102: Unknown result type (might be due to invalid IL or missing references)
		//IL_1109: Expected O, but got Unknown
		//IL_11bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_11c4: Expected O, but got Unknown
		//IL_1278: Unknown result type (might be due to invalid IL or missing references)
		//IL_127f: Expected O, but got Unknown
		//IL_0577: Unknown result type (might be due to invalid IL or missing references)
		//IL_0673: Unknown result type (might be due to invalid IL or missing references)
		//IL_13f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_1404: Unknown result type (might be due to invalid IL or missing references)
		//IL_141d: Expected O, but got Unknown
		//IL_1418: Unknown result type (might be due to invalid IL or missing references)
		//IL_141d: Unknown result type (might be due to invalid IL or missing references)
		//IL_07aa: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)WhiteBorderBackgroundTexture == (Object)null)
		{
			WhiteBorderBackgroundTexture = new Texture2D(64, 64, (TextureFormat)4, false);
			Color32 val = default(Color32);
			((Color32)(ref val))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			Color32 val2 = default(Color32);
			((Color32)(ref val2))..ctor((byte)0, (byte)0, (byte)0, (byte)224);
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					Color32 val3 = ((i <= 0 || j <= 0 || i >= 63 || j >= 63) ? val : val2);
					WhiteBorderBackgroundTexture.SetPixel(j, i, Color32.op_Implicit(val3));
				}
			}
			WhiteBorderBackgroundTexture.Apply();
		}
		if ((Object)(object)GrayBorderBackgroundTexture == (Object)null)
		{
			GrayBorderBackgroundTexture = new Texture2D(64, 64, (TextureFormat)4, false);
			Color32 val4 = default(Color32);
			((Color32)(ref val4))..ctor((byte)64, (byte)64, (byte)64, byte.MaxValue);
			Color32 val5 = default(Color32);
			((Color32)(ref val5))..ctor((byte)0, (byte)0, (byte)0, (byte)224);
			for (int k = 0; k < 64; k++)
			{
				for (int l = 0; l < 64; l++)
				{
					Color32 val6 = ((k <= 0 || l <= 0 || k >= 63 || l >= 63) ? val4 : val5);
					GrayBorderBackgroundTexture.SetPixel(l, k, Color32.op_Implicit(val6));
				}
			}
			GrayBorderBackgroundTexture.Apply();
		}
		if ((Object)(object)WhiteBorderTexture == (Object)null)
		{
			WhiteBorderTexture = new Texture2D(64, 64, (TextureFormat)4, false);
			Color32 val7 = default(Color32);
			((Color32)(ref val7))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			Color32 val8 = default(Color32);
			((Color32)(ref val8))..ctor((byte)0, (byte)0, (byte)0, byte.MaxValue);
			for (int m = 0; m < 64; m++)
			{
				for (int n = 0; n < 64; n++)
				{
					Color32 val9 = ((m <= 0 || n <= 0 || m >= 63 || n >= 63) ? val7 : val8);
					WhiteBorderTexture.SetPixel(n, m, Color32.op_Implicit(val9));
				}
			}
			WhiteBorderTexture.Apply();
		}
		if ((Object)(object)GrayBorderTexture == (Object)null)
		{
			GrayBorderTexture = new Texture2D(64, 64, (TextureFormat)4, false);
			Color32 val10 = default(Color32);
			((Color32)(ref val10))..ctor((byte)64, (byte)64, (byte)64, byte.MaxValue);
			Color32 val11 = default(Color32);
			((Color32)(ref val11))..ctor((byte)0, (byte)0, (byte)0, byte.MaxValue);
			for (int num = 0; num < 64; num++)
			{
				for (int num2 = 0; num2 < 64; num2++)
				{
					Color32 val12 = ((num <= 0 || num2 <= 0 || num >= 63 || num2 >= 63) ? val10 : val11);
					GrayBorderTexture.SetPixel(num2, num, Color32.op_Implicit(val12));
				}
			}
			GrayBorderTexture.Apply();
		}
		if ((Object)(object)BlackTexture == (Object)null)
		{
			BlackTexture = new Texture2D(64, 64, (TextureFormat)4, false);
			Color32 val13 = default(Color32);
			((Color32)(ref val13))..ctor((byte)0, (byte)0, (byte)0, byte.MaxValue);
			for (int num3 = 0; num3 < 64; num3++)
			{
				for (int num4 = 0; num4 < 64; num4++)
				{
					BlackTexture.SetPixel(num4, num3, Color32.op_Implicit(val13));
				}
			}
			BlackTexture.Apply();
		}
		if ((Object)(object)WhiteTexture == (Object)null)
		{
			WhiteTexture = new Texture2D(64, 64, (TextureFormat)4, false);
			Color32 val14 = default(Color32);
			((Color32)(ref val14))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			for (int num5 = 0; num5 < 64; num5++)
			{
				for (int num6 = 0; num6 < 64; num6++)
				{
					WhiteTexture.SetPixel(num6, num5, Color32.op_Implicit(val14));
				}
			}
			WhiteTexture.Apply();
		}
		if ((Object)(object)ToggleOnTexture == (Object)null)
		{
			ToggleOnTexture = new Texture2D(16, 16, (TextureFormat)4, false);
			Color32 val15 = default(Color32);
			((Color32)(ref val15))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			Color32 val16 = default(Color32);
			((Color32)(ref val16))..ctor((byte)0, (byte)0, (byte)0, (byte)0);
			for (int num7 = 0; num7 < 16; num7++)
			{
				for (int num8 = 0; num8 < 16; num8++)
				{
					Color32 val17 = ((num8 >= 1 && num8 <= 12 && num7 >= 2 && num7 <= 13) ? val15 : val16);
					ToggleOnTexture.SetPixel(num8, num7, Color32.op_Implicit(val17));
				}
			}
			ToggleOnTexture.Apply();
		}
		if ((Object)(object)ToggleOffTexture == (Object)null)
		{
			ToggleOffTexture = new Texture2D(16, 16, (TextureFormat)4, false);
			Color32 val18 = default(Color32);
			((Color32)(ref val18))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			Color32 val19 = default(Color32);
			((Color32)(ref val19))..ctor((byte)0, (byte)0, (byte)0, byte.MaxValue);
			Color32 val20 = default(Color32);
			((Color32)(ref val20))..ctor((byte)0, (byte)0, (byte)0, (byte)0);
			for (int num9 = 0; num9 < 16; num9++)
			{
				for (int num10 = 0; num10 < 16; num10++)
				{
					Color32 val21 = ((num10 < 1 || num10 > 12 || num9 < 2 || num9 > 13) ? val20 : ((num10 > 1 && num10 < 12 && num9 > 2 && num9 < 13) ? val19 : val18));
					ToggleOffTexture.SetPixel(num10, num9, Color32.op_Implicit(val21));
				}
			}
			ToggleOffTexture.Apply();
		}
		if ((Object)(object)CloseButtonGrayBorderTexture == (Object)null)
		{
			CloseButtonGrayBorderTexture = new Texture2D(16, 16, (TextureFormat)4, false);
			Color32 val22 = default(Color32);
			((Color32)(ref val22))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			Color32 val23 = default(Color32);
			((Color32)(ref val23))..ctor((byte)64, (byte)64, (byte)64, byte.MaxValue);
			Color32 val24 = default(Color32);
			((Color32)(ref val24))..ctor((byte)0, (byte)0, (byte)0, byte.MaxValue);
			Color32 val25 = default(Color32);
			((Color32)(ref val25))..ctor((byte)0, (byte)0, (byte)0, (byte)0);
			for (int num11 = 0; num11 < 16; num11++)
			{
				for (int num12 = 0; num12 < 16; num12++)
				{
					Color32 val26 = ((num12 < 1 || num12 > 12 || num11 < 2 || num11 > 13) ? val25 : ((num12 > 1 && num12 < 12 && num11 > 2 && num11 < 13) ? val24 : val23));
					CloseButtonGrayBorderTexture.SetPixel(num12, num11, Color32.op_Implicit(val26));
				}
			}
			for (int num13 = 4; num13 <= 9; num13++)
			{
				CloseButtonGrayBorderTexture.SetPixel(num13, num13 + 1, Color32.op_Implicit(val22));
				CloseButtonGrayBorderTexture.SetPixel(num13, 14 - num13, Color32.op_Implicit(val22));
			}
			CloseButtonGrayBorderTexture.Apply();
		}
		if ((Object)(object)CloseButtonWhiteBorderTexture == (Object)null)
		{
			CloseButtonWhiteBorderTexture = new Texture2D(16, 16, (TextureFormat)4, false);
			Color32 val27 = default(Color32);
			((Color32)(ref val27))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			Color32 val28 = default(Color32);
			((Color32)(ref val28))..ctor((byte)0, (byte)0, (byte)0, byte.MaxValue);
			Color32 val29 = default(Color32);
			((Color32)(ref val29))..ctor((byte)0, (byte)0, (byte)0, (byte)0);
			for (int num14 = 0; num14 < 16; num14++)
			{
				for (int num15 = 0; num15 < 16; num15++)
				{
					Color32 val30 = ((num15 < 1 || num15 > 12 || num14 < 2 || num14 > 13) ? val29 : ((num15 > 1 && num15 < 12 && num14 > 2 && num14 < 13) ? val28 : val27));
					CloseButtonWhiteBorderTexture.SetPixel(num15, num14, Color32.op_Implicit(val30));
				}
			}
			for (int num16 = 4; num16 <= 9; num16++)
			{
				CloseButtonWhiteBorderTexture.SetPixel(num16, num16 + 1, Color32.op_Implicit(val27));
				CloseButtonWhiteBorderTexture.SetPixel(num16, 14 - num16, Color32.op_Implicit(val27));
			}
			CloseButtonWhiteBorderTexture.Apply();
		}
		if (WindowStyle == null)
		{
			WindowStyle = new GUIStyle(GUI.skin.window);
			WindowStyle.fontSize = 11;
			WindowStyle.normal.textColor = Color.white;
			WindowStyle.hover.textColor = Color.white;
			WindowStyle.active.textColor = Color.white;
			WindowStyle.focused.textColor = Color.white;
			WindowStyle.onNormal.textColor = Color.white;
			WindowStyle.onHover.textColor = Color.white;
			WindowStyle.onActive.textColor = Color.white;
			WindowStyle.onFocused.textColor = Color.white;
			WindowStyle.normal.background = GrayBorderBackgroundTexture;
			WindowStyle.hover.background = GrayBorderBackgroundTexture;
			WindowStyle.active.background = GrayBorderBackgroundTexture;
			WindowStyle.focused.background = GrayBorderBackgroundTexture;
			WindowStyle.onNormal.background = WhiteBorderBackgroundTexture;
			WindowStyle.onHover.background = WhiteBorderBackgroundTexture;
			WindowStyle.onActive.background = WhiteBorderBackgroundTexture;
			WindowStyle.onFocused.background = WhiteBorderBackgroundTexture;
		}
		if (BaseButtonStyle == null)
		{
			BaseButtonStyle = new GUIStyle(GUI.skin.button);
			BaseButtonStyle.normal.textColor = Color.white;
			BaseButtonStyle.hover.textColor = Color.white;
			BaseButtonStyle.active.textColor = Color.white;
			BaseButtonStyle.focused.textColor = Color.white;
			BaseButtonStyle.onNormal.textColor = Color.white;
			BaseButtonStyle.onHover.textColor = Color.white;
			BaseButtonStyle.onActive.textColor = Color.white;
			BaseButtonStyle.onFocused.textColor = Color.white;
			BaseButtonStyle.normal.background = GrayBorderTexture;
			BaseButtonStyle.hover.background = WhiteBorderTexture;
			BaseButtonStyle.active.background = WhiteBorderTexture;
			BaseButtonStyle.focused.background = WhiteBorderTexture;
			BaseButtonStyle.onNormal.background = GrayBorderTexture;
			BaseButtonStyle.onHover.background = WhiteBorderTexture;
			BaseButtonStyle.onActive.background = WhiteBorderTexture;
			BaseButtonStyle.onFocused.background = WhiteBorderTexture;
		}
		if (BaseToolbarButtonStyle == null)
		{
			BaseToolbarButtonStyle = new GUIStyle(BaseButtonStyle);
			BaseToolbarButtonStyle.normal.textColor = Color.gray;
			BaseToolbarButtonStyle.hover.textColor = Color.gray;
			BaseToolbarButtonStyle.active.textColor = Color.gray;
			BaseToolbarButtonStyle.focused.textColor = Color.gray;
			BaseToolbarButtonStyle.onNormal.background = WhiteBorderBackgroundTexture;
		}
		if (BaseVerticalScrollBarStyle == null)
		{
			BaseVerticalScrollBarStyle = new GUIStyle(GUI.skin.verticalScrollbar);
			BaseVerticalScrollBarStyle.name = "cruiseassist.verticalscrollbar";
			BaseVerticalScrollBarStyle.normal.background = GrayBorderTexture;
			BaseVerticalScrollBarStyle.hover.background = GrayBorderTexture;
			BaseVerticalScrollBarStyle.active.background = GrayBorderTexture;
			BaseVerticalScrollBarStyle.focused.background = GrayBorderTexture;
			BaseVerticalScrollBarStyle.onNormal.background = GrayBorderTexture;
			BaseVerticalScrollBarStyle.onHover.background = GrayBorderTexture;
			BaseVerticalScrollBarStyle.onActive.background = GrayBorderTexture;
			BaseVerticalScrollBarStyle.onFocused.background = GrayBorderTexture;
		}
		if (BaseHorizontalSliderStyle == null)
		{
			BaseHorizontalSliderStyle = new GUIStyle(GUI.skin.horizontalSlider);
			BaseHorizontalSliderStyle.normal.background = GrayBorderTexture;
			BaseHorizontalSliderStyle.hover.background = GrayBorderTexture;
			BaseHorizontalSliderStyle.active.background = GrayBorderTexture;
			BaseHorizontalSliderStyle.focused.background = GrayBorderTexture;
			BaseHorizontalSliderStyle.onNormal.background = GrayBorderTexture;
			BaseHorizontalSliderStyle.onHover.background = GrayBorderTexture;
			BaseHorizontalSliderStyle.onActive.background = GrayBorderTexture;
			BaseHorizontalSliderStyle.onFocused.background = GrayBorderTexture;
		}
		if (BaseHorizontalSliderThumbStyle == null)
		{
			BaseHorizontalSliderThumbStyle = new GUIStyle(GUI.skin.horizontalSliderThumb);
			BaseHorizontalSliderThumbStyle.normal.background = WhiteBorderTexture;
			BaseHorizontalSliderThumbStyle.hover.background = WhiteBorderTexture;
			BaseHorizontalSliderThumbStyle.active.background = WhiteBorderTexture;
			BaseHorizontalSliderThumbStyle.focused.background = WhiteBorderTexture;
			BaseHorizontalSliderThumbStyle.onNormal.background = WhiteBorderTexture;
			BaseHorizontalSliderThumbStyle.onHover.background = WhiteBorderTexture;
			BaseHorizontalSliderThumbStyle.onActive.background = WhiteBorderTexture;
			BaseHorizontalSliderThumbStyle.onFocused.background = WhiteBorderTexture;
		}
		if (BaseToggleStyle == null)
		{
			BaseToggleStyle = new GUIStyle(GUI.skin.toggle);
			BaseToggleStyle.normal.background = ToggleOffTexture;
			BaseToggleStyle.hover.background = ToggleOffTexture;
			BaseToggleStyle.active.background = ToggleOffTexture;
			BaseToggleStyle.focused.background = ToggleOffTexture;
			BaseToggleStyle.onNormal.background = ToggleOnTexture;
			BaseToggleStyle.onHover.background = ToggleOnTexture;
			BaseToggleStyle.onActive.background = ToggleOnTexture;
			BaseToggleStyle.onFocused.background = ToggleOnTexture;
		}
		if (BaseTextFieldStyle == null)
		{
			BaseTextFieldStyle = new GUIStyle(GUI.skin.textField);
			BaseTextFieldStyle.normal.background = WhiteBorderTexture;
			BaseTextFieldStyle.hover.background = WhiteBorderTexture;
			BaseTextFieldStyle.active.background = WhiteBorderTexture;
			BaseTextFieldStyle.focused.background = WhiteBorderTexture;
			BaseTextFieldStyle.onNormal.background = WhiteBorderTexture;
			BaseTextFieldStyle.onHover.background = WhiteBorderTexture;
			BaseTextFieldStyle.onActive.background = WhiteBorderTexture;
			BaseTextFieldStyle.onFocused.background = WhiteBorderTexture;
		}
		if (CloseButtonStyle == null)
		{
			CloseButtonStyle = new GUIStyle(GUI.skin.button);
			CloseButtonStyle.normal.background = CloseButtonGrayBorderTexture;
			CloseButtonStyle.hover.background = CloseButtonWhiteBorderTexture;
			CloseButtonStyle.active.background = CloseButtonWhiteBorderTexture;
			CloseButtonStyle.focused.background = CloseButtonWhiteBorderTexture;
			CloseButtonStyle.onNormal.background = CloseButtonGrayBorderTexture;
			CloseButtonStyle.onHover.background = CloseButtonWhiteBorderTexture;
			CloseButtonStyle.onActive.background = CloseButtonWhiteBorderTexture;
			CloseButtonStyle.onFocused.background = CloseButtonWhiteBorderTexture;
		}
		if (verticalScrollBarSkins == null)
		{
			verticalScrollBarSkins = new List<GUIStyle>();
			GUIStyle val31 = new GUIStyle(GUI.skin.verticalScrollbarThumb);
			val31.name = "cruiseassist.verticalscrollbarthumb";
			val31.normal.background = WhiteBorderTexture;
			val31.hover.background = WhiteBorderTexture;
			val31.active.background = WhiteBorderTexture;
			val31.focused.background = WhiteBorderTexture;
			val31.onNormal.background = WhiteBorderTexture;
			val31.onHover.background = WhiteBorderTexture;
			val31.onActive.background = WhiteBorderTexture;
			val31.onFocused.background = WhiteBorderTexture;
			verticalScrollBarSkins.Add(val31);
			GUIStyle val32 = new GUIStyle(GUI.skin.verticalScrollbarUpButton);
			val32.name = "cruiseassist.verticalscrollbarupbutton";
			val32.normal.background = BlackTexture;
			val32.hover.background = BlackTexture;
			val32.active.background = BlackTexture;
			val32.focused.background = BlackTexture;
			val32.onNormal.background = BlackTexture;
			val32.onHover.background = BlackTexture;
			val32.onActive.background = BlackTexture;
			val32.onFocused.background = BlackTexture;
			verticalScrollBarSkins.Add(val32);
			GUIStyle val33 = new GUIStyle(GUI.skin.verticalScrollbarDownButton);
			val33.name = "cruiseassist.verticalscrollbardownbutton";
			val33.normal.background = BlackTexture;
			val33.hover.background = BlackTexture;
			val33.active.background = BlackTexture;
			val33.focused.background = BlackTexture;
			val33.onNormal.background = BlackTexture;
			val33.onHover.background = BlackTexture;
			val33.onActive.background = BlackTexture;
			val33.onFocused.background = BlackTexture;
			verticalScrollBarSkins.Add(val33);
			GUI.skin.customStyles = GUI.skin.customStyles.Concat(verticalScrollBarSkins).ToArray();
		}
		switch (ViewMode)
		{
		case CruiseAssistMainUIViewMode.MINI:
			((Rect)(ref Rect[wIdx])).width = 288f;
			((Rect)(ref Rect[wIdx])).height = 70f;
			break;
		case CruiseAssistMainUIViewMode.FULL:
			((Rect)(ref Rect[wIdx])).width = 398f;
			((Rect)(ref Rect[wIdx])).height = 150f;
			break;
		}
		Rect[wIdx] = GUILayout.Window(99030291, Rect[wIdx], new WindowFunction(WindowFunction), "CruiseAssist", WindowStyle, Array.Empty<GUILayoutOption>());
		float num17 = Scale / 100f;
		if ((float)Screen.width / num17 < ((Rect)(ref Rect[wIdx])).xMax)
		{
			((Rect)(ref Rect[wIdx])).x = (float)Screen.width / num17 - ((Rect)(ref Rect[wIdx])).width;
		}
		if (((Rect)(ref Rect[wIdx])).x < 0f)
		{
			((Rect)(ref Rect[wIdx])).x = 0f;
		}
		if ((float)Screen.height / num17 < ((Rect)(ref Rect[wIdx])).yMax)
		{
			((Rect)(ref Rect[wIdx])).y = (float)Screen.height / num17 - ((Rect)(ref Rect[wIdx])).height;
		}
		if (((Rect)(ref Rect[wIdx])).y < 0f)
		{
			((Rect)(ref Rect[wIdx])).y = 0f;
		}
		if (lastCheckWindowLeft[wIdx] != float.MinValue && (((Rect)(ref Rect[wIdx])).x != lastCheckWindowLeft[wIdx] || ((Rect)(ref Rect[wIdx])).y != lastCheckWindowTop[wIdx]))
		{
			NextCheckGameTick = GameMain.gameTick + 300;
		}
		lastCheckWindowLeft[wIdx] = ((Rect)(ref Rect[wIdx])).x;
		lastCheckWindowTop[wIdx] = ((Rect)(ref Rect[wIdx])).y;
		if (NextCheckGameTick <= GameMain.gameTick)
		{
			ConfigManager.CheckConfig(ConfigManager.Step.STATE);
		}
	}

	public static void WindowFunction(int windowId)
	{
		//IL_0418: Unknown result type (might be due to invalid IL or missing references)
		//IL_041e: Expected O, but got Unknown
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d2: Expected O, but got Unknown
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0527: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: 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_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Expected O, but got Unknown
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Expected O, but got Unknown
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Expected O, but got Unknown
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Expected O, but got Unknown
		//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0604: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_0651: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_025c: 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_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0294: Expected O, but got Unknown
		//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Expected O, but got Unknown
		//IL_030e: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
		if (ViewMode == CruiseAssistMainUIViewMode.FULL)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			Color textColor = ((CruiseAssistPlugin.State == CruiseAssistState.TO_STAR) ? Color.cyan : Color.white);
			Color textColor2 = ((CruiseAssistPlugin.State == CruiseAssistState.TO_PLANET) ? Color.cyan : Color.white);
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUIStyle val = new GUIStyle(GUI.skin.label);
			val.fixedWidth = 50f;
			val.fixedHeight = 36f;
			val.fontSize = 12;
			val.alignment = (TextAnchor)0;
			GUIStyle val2 = new GUIStyle(val);
			val.normal.textColor = textColor;
			GUILayout.Label("Target\n System:", val, Array.Empty<GUILayoutOption>());
			val2.normal.textColor = textColor2;
			GUILayout.Label("Target\n Planet:", val2, Array.Empty<GUILayoutOption>());
			GUILayout.EndVertical();
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUIStyle val3 = new GUIStyle(GUI.skin.label);
			val3.fixedWidth = 240f;
			val3.fixedHeight = 36f;
			val3.fontSize = 14;
			val3.alignment = (TextAnchor)3;
			GUIStyle val4 = new GUIStyle(val3);
			if (CruiseAssistPlugin.TargetStar != null && ((GameMain.localStar != null && CruiseAssistPlugin.TargetStar.id != GameMain.localStar.id) || CruiseAssistPlugin.TargetPlanet == null))
			{
				val3.normal.textColor = textColor;
				GUILayout.Label(CruiseAssistPlugin.GetStarName(CruiseAssistPlugin.TargetStar), val3, Array.Empty<GUILayoutOption>());
			}
			else
			{
				GUILayout.Label(" ", val3, Array.Empty<GUILayoutOption>());
			}
			if (CruiseAssistPlugin.TargetPlanet != null)
			{
				val4.normal.textColor = textColor2;
				GUILayout.Label(CruiseAssistPlugin.GetPlanetName(CruiseAssistPlugin.TargetPlanet), val4, Array.Empty<GUILayoutOption>());
			}
			else
			{
				GUILayout.Label(" ", val4, Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndVertical();
			GUILayout.FlexibleSpace();
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			PlayerMove_Sail actionSail = GameMain.mainPlayer.controller.actionSail;
			VectorLF3 visual_uvel = actionSail.visual_uvel;
			double magnitude;
			if (GameMain.mainPlayer.warping)
			{
				VectorLF3 val5 = visual_uvel + actionSail.currentWarpVelocity;
				magnitude = ((VectorLF3)(ref val5)).magnitude;
			}
			else
			{
				magnitude = ((VectorLF3)(ref visual_uvel)).magnitude;
			}
			GUIStyle val6 = new GUIStyle(GUI.skin.label);
			val6.fixedWidth = 80f;
			val6.fixedHeight = 36f;
			val6.fontSize = 12;
			val6.alignment = (TextAnchor)5;
			GUIStyle val7 = new GUIStyle(val6);
			if (CruiseAssistPlugin.TargetStar != null && ((GameMain.localStar != null && CruiseAssistPlugin.TargetStar.id != GameMain.localStar.id) || CruiseAssistPlugin.TargetPlanet == null))
			{
				val6.normal.textColor = textColor;
				string text = (GameMain.mainPlayer.sailing ? TimeToString(CruiseAssistPlugin.TargetRange / magnitude) : "-- -- --");
				GUILayout.Label(RangeToString(CruiseAssistPlugin.TargetRange) + "\n" + text, val6, Array.Empty<GUILayoutOption>());
			}
			else
			{
				GUILayout.Label(" \n ", val6, Array.Empty<GUILayoutOption>());
			}
			if (CruiseAssistPlugin.TargetPlanet != null)
			{
				val7.normal.textColor = textColor2;
				string text2 = (GameMain.mainPlayer.sailing ? TimeToString(CruiseAssistPlugin.TargetRange / magnitude) : "-- -- --");
				GUILayout.Label(RangeToString(CruiseAssistPlugin.TargetRange) + "\n" + text2, val7, Array.Empty<GUILayoutOption>());
			}
			else
			{
				GUILayout.Label(" \n ", val7, Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndVertical();
			GUILayout.EndHorizontal();
			GUILayout.FlexibleSpace();
		}
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUIStyle val8 = new GUIStyle(GUI.skin.label);
		val8.fixedWidth = 160f;
		val8.fixedHeight = 32f;
		val8.fontSize = 14;
		val8.alignment = (TextAnchor)3;
		if (!CruiseAssistPlugin.Enable)
		{
			GUILayout.Label("Cruise Assist Disabled.", val8, Array.Empty<GUILayoutOption>());
		}
		else if (CruiseAssistPlugin.State == CruiseAssistState.INACTIVE || CruiseAssistPlugin.Interrupt)
		{
			GUILayout.Label("Cruise Assist Inactive.", val8, Array.Empty<GUILayoutOption>());
		}
		else
		{
			val8.normal.textColor = Color.cyan;
			GUILayout.Label("Cruise Assist Active.", val8, Array.Empty<GUILayoutOption>());
		}
		GUILayout.FlexibleSpace();
		GUIStyle val9 = new GUIStyle(BaseButtonStyle);
		val9.fixedWidth = 50f;
		val9.fixedHeight = 18f;
		val9.fontSize = 11;
		val9.alignment = (TextAnchor)4;
		GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
		if (GUILayout.Button("Config", val9, Array.Empty<GUILayoutOption>()))
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			bool[] show = CruiseAssistConfigUI.Show;
			int num = wIdx;
			show[num] = !show[num];
			if (CruiseAssistConfigUI.Show[wIdx])
			{
				CruiseAssistConfigUI.TempScale = Scale;
			}
		}
		if (GUILayout.Button(CruiseAssistPlugin.Enable ? "Enable" : "Disable", val9, Array.Empty<GUILayoutOption>()))
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			CruiseAssistPlugin.Enable = !CruiseAssistPlugin.Enable;
			NextCheckGameTick = GameMain.gameTick + 300;
		}
		GUILayout.EndVertical();
		GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
		if (GUILayout.Button("StarList", val9, Array.Empty<GUILayoutOption>()))
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			bool[] show2 = CruiseAssistStarListUI.Show;
			int num2 = wIdx;
			show2[num2] = !show2[num2];
		}
		if (GUILayout.Button("Cancel", val9, Array.Empty<GUILayoutOption>()))
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			CruiseAssistStarListUI.SelectStar(null, null);
		}
		GUILayout.EndVertical();
		GUILayout.EndHorizontal();
		GUILayout.EndVertical();
		GUI.DragWindow();
	}

	public static string RangeToString(double range)
	{
		if (range < 10000.0)
		{
			return (int)(range + 0.5) + "m ";
		}
		if (range < 600000.0)
		{
			return (range / 40000.0).ToString("0.00") + "AU";
		}
		return (range / 2400000.0).ToString("0.00") + "Ly";
	}

	public static string TimeToString(double time)
	{
		int num = (int)(time + 0.5);
		int num2 = num / 60;
		int num3 = num2 / 60;
		num %= 60;
		num2 %= 60;
		return $"{num3:00} {num2:00} {num:00}";
	}
}
public enum CruiseAssistMainUIViewMode
{
	FULL,
	MINI
}
[BepInPlugin("Appun.DSP.plugin.CruiseAssist", "DSPCruiseAssist", "0.1.3")]
public class CruiseAssistPlugin : BaseUnityPlugin
{
	public class Conf
	{
		public static bool MarkVisitedFlag = true;

		public static bool SelectFocusFlag = true;

		public static bool HideDuplicateHistoryFlag = true;

		public static bool AutoDisableLockCursorFlag = false;

		public static bool ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag = true;

		public static bool CloseStarListWhenSetTargetPlanetFlag = false;

		public static bool HideBottomCloseButtonFlag = true;
	}

	public const string ModGuid = "tanu.CruiseAssist";

	public const string ModName = "CruiseAssist";

	public const string ModVersion = "0.0.37";

	public static bool Enable = true;

	public static bool TargetSelected = false;

	public static StarData ReticuleTargetStar = null;

	public static PlanetData ReticuleTargetPlanet = null;

	public static StarData SelectTargetStar = null;

	public static PlanetData SelectTargetPlanet = null;

	public static int SelectTargetAstroId = 0;

	public static StarData TargetStar = null;

	public static PlanetData TargetPlanet = null;

	public static VectorLF3 TargetUPos = VectorLF3.zero;

	public static double TargetRange = 0.0;

	public static CruiseAssistState State = CruiseAssistState.INACTIVE;

	public static bool Interrupt = false;

	public static int Seed = -1;

	public static List<int> History = new List<int>();

	public static List<int> Bookmark = new List<int>();

	public static Func<StarData, string> GetStarName = (StarData star) => star.displayName;

	public static Func<PlanetData, string> GetPlanetName = (PlanetData planet) => planet.displayName;

	internal static List<CruiseAssistExtensionAPI> extensions = new List<CruiseAssistExtensionAPI>();

	private Harmony harmony;

	public void Awake()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		LogManager.Logger = ((BaseUnityPlugin)this).Logger;
		new CruiseAssistConfigManager(((BaseUnityPlugin)this).Config);
		ConfigManager.CheckConfig(ConfigManager.Step.AWAKE);
		harmony = new Harmony("tanu.CruiseAssist.Patch");
		harmony.PatchAll(typeof(Patch_GameMain));
		harmony.PatchAll(typeof(Patch_UISailPanel));
		harmony.PatchAll(typeof(Patch_UIStarmap));
		harmony.PatchAll(typeof(Patch_UITechTree));
		harmony.PatchAll(typeof(Patch_PlayerMoveWalk));
		harmony.PatchAll(typeof(Patch_PlayerMoveDrift));
		harmony.PatchAll(typeof(Patch_PlayerMoveFly));
		harmony.PatchAll(typeof(Patch_PlayerMoveSail));
	}

	public void OnDestroy()
	{
		harmony.UnpatchSelf();
	}

	public static void RegistExtension(CruiseAssistExtensionAPI extension)
	{
		extensions.Add(extension);
	}

	public static void UnregistExtension(Type type)
	{
		extensions.RemoveAll((CruiseAssistExtensionAPI extension) => extension.GetType().FullName == type.FullName);
	}

	public void OnGUI()
	{
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_025d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		if (DSPGame.IsMenuDemo || GameMain.mainPlayer == null || UIMechaEditor.isOpened)
		{
			return;
		}
		UIGame uiGame = UIRoot.instance.uiGame;
		if (uiGame.guideComplete && !((ManualBehaviour)uiGame.techTree).active && !((ManualBehaviour)uiGame.escMenu).active && !((ManualBehaviour)uiGame.dysonEditor).active && !uiGame.hideAllUI0 && !uiGame.hideAllUI1 && (!((Object)(object)UIMilkyWayLoadingSplash.instance != (Object)null) || !((ManualBehaviour)UIMilkyWayLoadingSplash.instance).active) && (!((Object)(object)UIRoot.instance.uiMilkyWay != (Object)null) || !((ManualBehaviour)UIRoot.instance.uiMilkyWay).active) && (GameMain.mainPlayer.sailing || ((ManualBehaviour)uiGame.starmap).active || (Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag && TargetSelected)))
		{
			if (Seed != GameMain.galaxy.seed)
			{
				ConfigManager.CheckConfig(ConfigManager.Step.CHANGE_SEED);
			}
			CruiseAssistMainUI.wIdx = (((ManualBehaviour)uiGame.starmap).active ? 1 : 0);
			float num = CruiseAssistMainUI.Scale / 100f;
			GUIUtility.ScaleAroundPivot(new Vector2(num, num), Vector2.zero);
			CruiseAssistMainUI.OnGUI();
			if (CruiseAssistStarListUI.Show[CruiseAssistMainUI.wIdx])
			{
				CruiseAssistStarListUI.OnGUI();
			}
			if (CruiseAssistConfigUI.Show[CruiseAssistMainUI.wIdx])
			{
				CruiseAssistConfigUI.OnGUI();
			}
			if (CruiseAssistDebugUI.Show)
			{
				CruiseAssistDebugUI.OnGUI();
			}
			bool flag = ResetInput(CruiseAssistMainUI.Rect[CruiseAssistMainUI.wIdx], num);
			if (!flag && CruiseAssistStarListUI.Show[CruiseAssistMainUI.wIdx])
			{
				flag = ResetInput(CruiseAssistStarListUI.Rect[CruiseAssistMainUI.wIdx], num);
			}
			if (!flag && CruiseAssistConfigUI.Show[CruiseAssistMainUI.wIdx])
			{
				flag = ResetInput(CruiseAssistConfigUI.Rect[CruiseAssistMainUI.wIdx], num);
			}
			if (!flag && CruiseAssistDebugUI.Show)
			{
				flag = ResetInput(CruiseAssistDebugUI.Rect, num);
			}
			extensions.ForEach(delegate(CruiseAssistExtensionAPI extension)
			{
				extension.OnGUI();
			});
		}
	}

	private bool ResetInput(Rect rect, float scale)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		float num = ((Rect)(ref rect)).xMin * scale;
		float num2 = ((Rect)(ref rect)).xMax * scale;
		float num3 = ((Rect)(ref rect)).yMin * scale;
		float num4 = ((Rect)(ref rect)).yMax * scale;
		float x = Input.mousePosition.x;
		float num5 = (float)Screen.height - Input.mousePosition.y;
		if (num <= x && x <= num2 && num3 <= num5 && num5 <= num4)
		{
			int[] source = new int[3] { 0, 1, 2 };
			if (((IEnumerable<int>)source).Any((Func<int, bool>)Input.GetMouseButton) || Input.mouseScrollDelta.y != 0f)
			{
				Input.ResetInputAxes();
				return true;
			}
		}
		return false;
	}
}
public class CruiseAssistStarListUI
{
	private static int wIdx = 0;

	public const float WindowWidth = 400f;

	public const float WindowHeight = 480f;

	public static bool[] Show = new bool[2];

	public static Rect[] Rect = (Rect[])(object)new Rect[2]
	{
		new Rect(0f, 0f, 400f, 480f),
		new Rect(0f, 0f, 400f, 480f)
	};

	public static int ListSelected = 0;

	public static int[] actionSelected = new int[3];

	private static float[] lastCheckWindowLeft = new float[2]
	{
		float.MinValue,
		float.MinValue
	};

	private static float[] lastCheckWindowTop = new float[2]
	{
		float.MinValue,
		float.MinValue
	};

	private static Vector2[] scrollPos = (Vector2[])(object)new Vector2[3]
	{
		Vector2.zero,
		Vector2.zero,
		Vector2.zero
	};

	private const string VisitedMark = "● ";

	private const string NonVisitMark = "";

	public static void OnGUI()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		//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)
		wIdx = CruiseAssistMainUI.wIdx;
		Rect[wIdx] = GUILayout.Window(99030292, Rect[wIdx], new WindowFunction(WindowFunction), "CruiseAssist - StarList", CruiseAssistMainUI.WindowStyle, Array.Empty<GUILayoutOption>());
		float num = CruiseAssistMainUI.Scale / 100f;
		if ((float)Screen.width / num < ((Rect)(ref Rect[wIdx])).xMax)
		{
			((Rect)(ref Rect[wIdx])).x = (float)Screen.width / num - ((Rect)(ref Rect[wIdx])).width;
		}
		if (((Rect)(ref Rect[wIdx])).x < 0f)
		{
			((Rect)(ref Rect[wIdx])).x = 0f;
		}
		if ((float)Screen.height / num < ((Rect)(ref Rect[wIdx])).yMax)
		{
			((Rect)(ref Rect[wIdx])).y = (float)Screen.height / num - ((Rect)(ref Rect[wIdx])).height;
		}
		if (((Rect)(ref Rect[wIdx])).y < 0f)
		{
			((Rect)(ref Rect[wIdx])).y = 0f;
		}
		if (lastCheckWindowLeft[wIdx] != float.MinValue && (((Rect)(ref Rect[wIdx])).x != lastCheckWindowLeft[wIdx] || ((Rect)(ref Rect[wIdx])).y != lastCheckWindowTop[wIdx]))
		{
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		lastCheckWindowLeft[wIdx] = ((Rect)(ref Rect[wIdx])).x;
		lastCheckWindowTop[wIdx] = ((Rect)(ref Rect[wIdx])).y;
	}

	public static void WindowFunction(int windowId)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		//IL_0097: 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_00e8: Expected O, but got Unknown
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Expected O, but got Unknown
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Expected O, but got Unknown
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Expected O, but got Unknown
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Expected O, but got Unknown
		//IL_0232: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Expected O, but got Unknown
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Expected O, but got Unknown
		//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b2: Expected O, but got Unknown
		//IL_0420: Unknown result type (might be due to invalid IL or missing references)
		//IL_0427: Expected O, but got Unknown
		//IL_04df: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0553: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUIStyle val = new GUIStyle(CruiseAssistMainUI.BaseToolbarButtonStyle);
		val.fixedWidth = 80f;
		val.fixedHeight = 20f;
		val.fontSize = 12;
		string[] array = new string[3] { "Normal", "History", "Bookmark" };
		GUI.changed = false;
		int num = GUILayout.Toolbar(ListSelected, array, val, Array.Empty<GUILayoutOption>());
		if (GUI.changed)
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
		}
		if (num != ListSelected)
		{
			ListSelected = num;
			CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
		}
		GUILayout.EndHorizontal();
		GUIStyle val2 = new GUIStyle(CruiseAssistMainUI.BaseVerticalScrollBarStyle);
		scrollPos[ListSelected] = GUILayout.BeginScrollView(scrollPos[ListSelected], GUIStyle.none, val2, Array.Empty<GUILayoutOption>());
		GUIStyle nameLabelStyle = new GUIStyle(GUI.skin.label);
		nameLabelStyle.fixedWidth = 240f;
		nameLabelStyle.stretchHeight = true;
		nameLabelStyle.fontSize = 14;
		nameLabelStyle.alignment = (TextAnchor)3;
		GUIStyle nRangeLabelStyle = new GUIStyle(GUI.skin.label);
		nRangeLabelStyle.fixedWidth = 60f;
		nRangeLabelStyle.fixedHeight = 20f;
		nRangeLabelStyle.fontSize = 14;
		nRangeLabelStyle.alignment = (TextAnchor)5;
		GUIStyle hRangeLabelStyle = new GUIStyle(nRangeLabelStyle);
		hRangeLabelStyle.fixedHeight = 40f;
		GUIStyle nActionButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle);
		nActionButtonStyle.fixedWidth = 40f;
		nActionButtonStyle.fixedHeight = 18f;
		nActionButtonStyle.margin.top = 6;
		nActionButtonStyle.fontSize = 12;
		GUIStyle hActionButtonStyle = new GUIStyle(nActionButtonStyle);
		hActionButtonStyle.margin.top = 16;
		GUIStyle nSortButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle);
		nSortButtonStyle.fixedWidth = 20f;
		nSortButtonStyle.fixedHeight = 18f;
		nSortButtonStyle.margin.top = 6;
		nSortButtonStyle.fontSize = 12;
		GUIStyle hSortButtonStyle = new GUIStyle(nSortButtonStyle);
		hSortButtonStyle.margin.top = 16;
		if (ListSelected == 0)
		{
			CollectionExtensions.Do<Tuple<StarData, double>>((IEnumerable<Tuple<StarData, double>>)(from tuple in GameMain.galaxy.stars.Select(delegate(StarData star)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0016: Unknown result type (might be due to invalid IL or missing references)
					VectorLF3 val8 = star.uPosition - GameMain.mainPlayer.uPosition;
					return new Tuple<StarData, double>(star, ((VectorLF3)(ref val8)).magnitude);
				})
				orderby tuple.v2
				select tuple), (Action<Tuple<StarData, double>>)delegate(Tuple<StarData, double> tuple)
			{
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_0197: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_0111: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_01d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_027b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0290: Expected O, but got Unknown
				//IL_0314: Unknown result type (might be due to invalid IL or missing references)
				StarData star3 = tuple.v1;
				double range = tuple.v2;
				string starName = CruiseAssistPlugin.GetStarName(star3);
				bool flag3 = false;
				if (GameMain.localStar != null && star3.id == GameMain.localStar.id)
				{
					flag3 = true;
				}
				else if (CruiseAssistPlugin.SelectTargetStar != null && star3.id == CruiseAssistPlugin.SelectTargetStar.id && GameMain.history.universeObserveLevel >= ((range >= 14400000.0) ? 4 : 3))
				{
					flag3 = true;
				}
				if (flag3)
				{
					IEnumerable<Tuple<PlanetData, double>> enumerable4 = star3.planets.Select(delegate(PlanetData planet)
					{
						//IL_0002: Unknown result type (might be due to invalid IL or missing references)
						//IL_000c: Unknown result type (might be due to invalid IL or missing references)
						//IL_0011: Unknown result type (might be due to invalid IL or missing references)
						//IL_0016: Unknown result type (might be due to invalid IL or missing references)
						VectorLF3 val7 = planet.uPosition - GameMain.mainPlayer.uPosition;
						return new Tuple<PlanetData, double>(planet, ((VectorLF3)(ref val7)).magnitude);
					});
					VectorLF3 val6 = star3.uPosition - GameMain.mainPlayer.uPosition;
					CollectionExtensions.Do<Tuple<PlanetData, double>>((IEnumerable<Tuple<PlanetData, double>>)(from tuple2 in CollectionExtensions.AddItem<Tuple<PlanetData, double>>(enumerable4, new Tuple<PlanetData, double>(null, ((VectorLF3)(ref val6)).magnitude))
						orderby tuple2.v2
						select tuple2), (Action<Tuple<PlanetData, double>>)delegate(Tuple<PlanetData, double> tuple2)
					{
						//IL_002c: Unknown result type (might be due to invalid IL or missing references)
						//IL_0047: Unknown result type (might be due to invalid IL or missing references)
						//IL_01af: Unknown result type (might be due to invalid IL or missing references)
						//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
						//IL_00a5: 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_0246: Unknown result type (might be due to invalid IL or missing references)
						//IL_0260: Expected O, but got Unknown
						//IL_0156: Unknown result type (might be due to invalid IL or missing references)
						//IL_0170: Expected O, but got Unknown
						//IL_0322: Unknown result type (might be due to invalid IL or missing references)
						GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
						PlanetData v = tuple2.v1;
						double v2 = tuple2.v2;
						nameLabelStyle.normal.textColor = Color.white;
						nRangeLabelStyle.normal.textColor = Color.white;
						float num5;
						if (v == null)
						{
							if (CruiseAssistPlugin.SelectTargetPlanet == null && CruiseAssistPlugin.SelectTargetStar != null && star3.id == CruiseAssistPlugin.SelectTargetStar.id)
							{
								nameLabelStyle.normal.textColor = Color.cyan;
								nRangeLabelStyle.normal.textColor = Color.cyan;
							}
							string text6 = starName;
							if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
							{
								text6 = ((star3.planets.Where((PlanetData p) => p.factory != null).Count() > 0) ? "● " : "") + text6;
							}
							GUILayout.Label(text6, nameLabelStyle, Array.Empty<GUILayoutOption>());
							num5 = nameLabelStyle.CalcHeight(new GUIContent(text6), nameLabelStyle.fixedWidth);
						}
						else
						{
							if (CruiseAssistPlugin.SelectTargetPlanet != null && v.id == CruiseAssistPlugin.SelectTargetPlanet.id)
							{
								nameLabelStyle.normal.textColor = Color.cyan;
								nRangeLabelStyle.normal.textColor = Color.cyan;
							}
							string text7 = starName + " - " + CruiseAssistPlugin.GetPlanetName(v);
							if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
							{
								text7 = ((v.factory != null) ? "● " : "") + text7;
							}
							GUILayout.Label(text7, nameLabelStyle, Array.Empty<GUILayoutOption>());
							num5 = nameLabelStyle.CalcHeight(new GUIContent(text7), nameLabelStyle.fixedWidth);
						}
						GUILayout.FlexibleSpace();
						GUILayout.Label(CruiseAssistMainUI.RangeToString((v == null) ? range : v2), (num5 < 30f) ? nRangeLabelStyle : hRangeLabelStyle, Array.Empty<GUILayoutOption>());
						string text8 = ((actionSelected[ListSelected] == 0) ? "SET" : ((v == null) ? "-" : (CruiseAssistPlugin.Bookmark.Contains(v.id) ? "DEL" : "ADD")));
						if (GUILayout.Button(text8, (num5 < 30f) ? nActionButtonStyle : hActionButtonStyle, Array.Empty<GUILayoutOption>()))
						{
							VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
							if (actionSelected[ListSelected] == 0)
							{
								SelectStar(star3, v);
								if (CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag)
								{
									Show[wIdx] = false;
								}
							}
							else if (v != null)
							{
								if (CruiseAssistPlugin.Bookmark.Contains(v.id))
								{
									CruiseAssistPlugin.Bookmark.Remove(v.id);
								}
								else if (CruiseAssistPlugin.Bookmark.Count <= 128)
								{
									CruiseAssistPlugin.Bookmark.Add(v.id);
									CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
								}
							}
						}
						GUILayout.EndHorizontal();
					});
				}
				else
				{
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					nameLabelStyle.normal.textColor = Color.white;
					nRangeLabelStyle.normal.textColor = Color.white;
					if (CruiseAssistPlugin.SelectTargetStar != null && star3.id == CruiseAssistPlugin.SelectTargetStar.id)
					{
						nameLabelStyle.normal.textColor = Color.cyan;
						nRangeLabelStyle.normal.textColor = Color.cyan;
					}
					string text4 = starName;
					if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
					{
						text4 = ((star3.planets.Where((PlanetData p) => p.factory != null).Count() > 0) ? "● " : "") + text4;
					}
					GUILayout.Label(text4, nameLabelStyle, Array.Empty<GUILayoutOption>());
					float num4 = nameLabelStyle.CalcHeight(new GUIContent(text4), nameLabelStyle.fixedWidth);
					GUILayout.FlexibleSpace();
					GUILayout.Label(CruiseAssistMainUI.RangeToString(range), (num4 < 30f) ? nRangeLabelStyle : hRangeLabelStyle, Array.Empty<GUILayoutOption>());
					string text5 = ((actionSelected[ListSelected] == 0) ? "SET" : "-");
					if (GUILayout.Button(text5, (num4 < 30f) ? nActionButtonStyle : hActionButtonStyle, Array.Empty<GUILayoutOption>()))
					{
						VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
						if (actionSelected[ListSelected] == 0)
						{
							SelectStar(star3, null);
						}
					}
					GUILayout.EndHorizontal();
				}
			});
		}
		else if (ListSelected == 1 || ListSelected == 2)
		{
			bool highlighted = false;
			IEnumerable<int> enumerable2;
			if (ListSelected != 1)
			{
				IEnumerable<int> enumerable = CruiseAssistPlugin.Bookmark.ToList();
				enumerable2 = enumerable;
			}
			else
			{
				enumerable2 = Enumerable.Reverse(CruiseAssistPlugin.History);
			}
			IEnumerable<int> enumerable3 = enumerable2;
			if (ListSelected == 1 && actionSelected[ListSelected] != 2 && CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag)
			{
				enumerable3 = enumerable3.Distinct();
			}
			int listIndex = -1;
			CollectionExtensions.Do<int>(enumerable3, (Action<int>)delegate(int id)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: 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_0059: 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_008f: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_017e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0198: Expected O, but got Unknown
				//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_026c: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
				listIndex++;
				PlanetData val4 = GameMain.galaxy.PlanetById(id);
				if (val4 != null)
				{
					StarData star2 = val4.star;
					string text = CruiseAssistPlugin.GetStarName(star2);
					VectorLF3 val5 = val4.uPosition - GameMain.mainPlayer.uPosition;
					double magnitude = ((VectorLF3)(ref val5)).magnitude;
					nameLabelStyle.normal.textColor = Color.white;
					nRangeLabelStyle.normal.textColor = Color.white;
					if (!highlighted && CruiseAssistPlugin.SelectTargetPlanet != null && val4.id == CruiseAssistPlugin.SelectTargetPlanet.id)
					{
						nameLabelStyle.normal.textColor = Color.cyan;
						nRangeLabelStyle.normal.textColor = Color.cyan;
						highlighted = true;
					}
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					string text2 = text + " - " + CruiseAssistPlugin.GetPlanetName(val4);
					if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
					{
						text2 = ((val4.factory != null) ? "● " : "") + text2;
					}
					GUILayout.Label(text2, nameLabelStyle, Array.Empty<GUILayoutOption>());
					float num2 = nameLabelStyle.CalcHeight(new GUIContent(text2), nameLabelStyle.fixedWidth);
					GUILayout.FlexibleSpace();
					GUILayout.Label(CruiseAssistMainUI.RangeToString(magnitude), (num2 < 30f) ? nRangeLabelStyle : hRangeLabelStyle, Array.Empty<GUILayoutOption>());
					if (ListSelected == 2 && actionSelected[ListSelected] == 1)
					{
						int num3 = CruiseAssistPlugin.Bookmark.IndexOf(id);
						bool flag = num3 == 0;
						bool flag2 = num3 == CruiseAssistPlugin.Bookmark.Count - 1;
						if (GUILayout.Button(flag2 ? "-" : "↓", (num2 < 30f) ? nSortButtonStyle : hSortButtonStyle, Array.Empty<GUILayoutOption>()))
						{
							VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
							if (!flag2)
							{
								CruiseAssistPlugin.Bookmark.RemoveAt(num3);
								CruiseAssistPlugin.Bookmark.Insert(num3 + 1, id);
							}
						}
						if (GUILayout.Button(flag ? "-" : "↑", (num2 < 30f) ? nSortButtonStyle : hSortButtonStyle, Array.Empty<GUILayoutOption>()))
						{
							VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
							if (!flag)
							{
								CruiseAssistPlugin.Bookmark.RemoveAt(num3);
								CruiseAssistPlugin.Bookmark.Insert(num3 - 1, id);
							}
						}
					}
					else
					{
						string text3 = ((actionSelected[ListSelected] == 0) ? "SET" : ((actionSelected[ListSelected] != 2) ? (CruiseAssistPlugin.Bookmark.Contains(id) ? "DEL" : "ADD") : ((ListSelected == 1 && listIndex == 0) ? "-" : "DEL")));
						if (GUILayout.Button(text3, (num2 < 30f) ? nActionButtonStyle : hActionButtonStyle, Array.Empty<GUILayoutOption>()))
						{
							VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
							if (actionSelected[ListSelected] == 0)
							{
								SelectStar(star2, val4);
								if (CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag)
								{
									Show[wIdx] = false;
								}
							}
							else if (actionSelected[ListSelected] == 1)
							{
								if (ListSelected == 1)
								{
									if (CruiseAssistPlugin.Bookmark.Contains(id))
									{
										CruiseAssistPlugin.Bookmark.Remove(id);
									}
									else if (CruiseAssistPlugin.Bookmark.Count <= 128)
									{
										CruiseAssistPlugin.Bookmark.Add(id);
										CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
									}
								}
							}
							else if (actionSelected[ListSelected] == 2)
							{
								if (ListSelected == 1)
								{
									if (listIndex != 0)
									{
										CruiseAssistPlugin.History.RemoveAt(CruiseAssistPlugin.History.Count - 1 - listIndex);
										CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
									}
								}
								else if (ListSelected == 2)
								{
									CruiseAssistPlugin.Bookmark.Remove(val4.id);
									CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
								}
							}
						}
					}
					GUILayout.EndHorizontal();
				}
			});
		}
		GUILayout.EndScrollView();
		GUILayout.FlexibleSpace();
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUIStyle val3 = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle);
		val3.fixedWidth = 80f;
		val3.fixedHeight = 20f;
		val3.fontSize = 12;
		string[][] array2 = new string[3][]
		{
			new string[2] { "Target", "Bookmark" },
			new string[3] { "Target", "Bookmark", "Delete" },
			new string[3] { "Target", "Sort", "Delete" }
		};
		if (GUILayout.Button(array2[ListSelected][actionSelected[ListSelected]], val3, Array.Empty<GUILayoutOption>()))
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			actionSelected[ListSelected]++;
			actionSelected[ListSelected] %= array2[ListSelected].Length;
		}
		GUILayout.FlexibleSpace();
		if (!CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag && GUILayout.Button("Close", val3, Array.Empty<GUILayoutOption>()))
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			Show[wIdx] = false;
		}
		GUILayout.EndHorizontal();
		GUILayout.EndVertical();
		if (GUI.Button(new Rect(((Rect)(ref Rect[wIdx])).width - 16f, 1f, 16f, 16f), "", CruiseAssistMainUI.CloseButtonStyle))
		{
			VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
			Show[wIdx] = false;
		}
		GUI.DragWindow();
	}

	public static void SelectStar(StarData star, PlanetData planet)
	{
		CruiseAssistPlugin.SelectTargetStar = star;
		CruiseAssistPlugin.SelectTargetPlanet = planet;
		UIGame uiGame = UIRoot.instance.uiGame;
		if (CruiseAssistPlugin.Conf.SelectFocusFlag && ((ManualBehaviour)uiGame.starmap).active)
		{
			if (star != null)
			{
				UIStarmapStar val = uiGame.starmap.starUIs.Where((UIStarmapStar s) => s.star.id == star.id).FirstOrDefault();
				if ((Object)(object)val != (Object)null)
				{
					UIStarmap_OnStarClick(uiGame.starmap, val);
					uiGame.starmap.OnCursorFunction2Click(0);
				}
			}
			if (planet != null)
			{
				UIStarmapPlanet val2 = uiGame.starmap.planetUIs.Where((UIStarmapPlanet p) => p.planet.id == planet.id).FirstOrDefault();
				if ((Object)(object)val2 != (Object)null)
				{
					UIStarmap_OnPlanetClick(uiGame.starmap, val2);
					uiGame.starmap.OnCursorFunction2Click(0);
				}
			}
		}
		if (planet != null)
		{
			GameMain.mainPlayer.navigation.indicatorAstroId = planet.id;
		}
		else if (star != null)
		{
			GameMain.mainPlayer.navigation.indicatorAstroId = star.id * 100;
		}
		else
		{
			GameMain.mainPlayer.navigation.indicatorAstroId = 0;
		}
		CruiseAssistPlugin.SelectTargetAstroId = GameMain.mainPlayer.navigation.indicatorAstroId;
		CruiseAssistPlugin.extensions.ForEach(delegate(CruiseAssistExtensionAPI extension)
		{
			extension.SetTargetAstroId(CruiseAssistPlugin.SelectTargetAstroId);
		});
	}

	private static void UIStarmap_OnStarClick(UIStarmap starmap, UIStarmapStar star)
	{
		Traverse val = Traverse.Create((object)starmap);
		if ((Object)(object)starmap.focusStar != (Object)(object)star)
		{
			if (starmap.viewPlanet != null || (starmap.viewStar != null && star.star != starmap.viewStar))
			{
				starmap.screenCameraController.DisablePositionLock();
			}
			starmap.focusPlanet = null;
			starmap.focusStar = star;
			val.Field("_lastClickTime").SetValue((object)0.0);
		}
		val.Field("forceUpdateCursorView").SetValue((object)true);
	}

	private static void UIStarmap_OnPlanetClick(UIStarmap starmap, UIStarmapPlanet planet)
	{
		Traverse val = Traverse.Create((object)starmap);
		if ((Object)(object)starmap.focusPlanet != (Object)(object)planet)
		{
			if ((starmap.viewPlanet != null && planet.planet != starmap.viewPlanet) || starmap.viewStar != null)
			{
				starmap.screenCameraController.DisablePositionLock();
			}
			starmap.focusPlanet = planet;
			starmap.focusStar = null;
			val.Field("_lastClickTime").SetValue((object)0.0);
		}
		val.Field("forceUpdateCursorView").SetValue((object)true);
	}
}
public enum CruiseAssistState
{
	TO_STAR,
	TO_PLANET,
	INACTIVE
}
internal class EnumUtils
{
	public static bool TryParse<TEnum>(string value, out TEnum result) where TEnum : struct
	{
		if (value == null || !Enum.IsDefined(typeof(TEnum), value))
		{
			result = (TEnum)Enum.GetValues(typeof(TEnum)).GetValue(0);
			return false;
		}
		result = (TEnum)Enum.Parse(typeof(TEnum), value);
		return true;
	}
}
internal class ListUtils
{
	public static string ToString(List<int> list)
	{
		if (list == null || list.Count == 0)
		{
			return "";
		}
		return list.Select((int id) => id.ToString()).Aggregate((string a, string b) => a + "," + b);
	}

	public static string ToString(List<string> list)
	{
		if (list == null || list.Count == 0)
		{
			return "";
		}
		return list.Aggregate((string a, string b) => a + "," + b);
	}

	public static List<int> ParseToIntList(string str)
	{
		if (str == null || str.Length == 0)
		{
			return new List<int>();
		}
		int result;
		return (from s in str.Split(new char[1] { ',' })
			where int.TryParse(s, out result)
			select s).Select(int.Parse).ToList();
	}

	public static List<string> ParseToStringList(string str)
	{
		if (str == null || str.Length == 0)
		{
			return new List<string>();
		}
		return str.Split(new char[1] { ',' }).ToList();
	}
}
internal static class LogManager
{
	public static ManualLogSource Logger { private get; set; }

	public static void LogInfo(object data)
	{
		Logger.LogInfo(data);
	}

	public static void LogInfo(MethodBase method)
	{
		Logger.LogInfo((object)(method.DeclaringType.Name + "." + method.Name));
	}

	public static void LogInfo(MethodBase method, object data)
	{
		Logger.LogInfo((object)(method.DeclaringType.Name + "." + method.Name + ": " + data));
	}

	public static void LogError(object data)
	{
		Logger.LogError(data);
	}

	public static void LogError(MethodBase method, object data)
	{
		Logger.LogError((object)(method.DeclaringType.Name + "." + method.Name + ": " + data));
	}
}
[HarmonyPatch(typeof(GameMain))]
internal class Patch_GameMain
{
	[HarmonyPatch("Begin")]
	[HarmonyPostfix]
	public static void Begin_Postfix()
	{
		ConfigManager.CheckConfig(ConfigManager.Step.GAME_MAIN_BEGIN);
		CruiseAssistPlugin.extensions.ForEach(delegate(CruiseAssistExtensionAPI extension)
		{
			extension.CheckConfig(ConfigManager.Step.GAME_MAIN_BEGIN.ToString());
		});
	}

	[HarmonyPatch("Pause")]
	[HarmonyPrefix]
	public static void Pause_Prefix()
	{
		ConfigManager.CheckConfig(ConfigManager.Step.STATE);
		CruiseAssistPlugin.extensions.ForEach(delegate(CruiseAssistExtensionAPI extension)
		{
			extension.CheckConfig(ConfigManager.Step.STATE.ToString());
		});
	}
}
[HarmonyPatch(typeof(PlayerMove_Drift))]
internal class Patch_PlayerMoveDrift
{
	[HarmonyPatch("GameTick")]
	[HarmonyPrefix]
	public static void GameTick_Prefix(PlayerMove_Drift __instance)
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Invalid comparison between Unknown and I4
		//IL_005e: 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)
		if (!CruiseAssistPlugin.Enable || !CruiseAssistPlugin.TargetSelected || (int)((PlayerAction)__instance).controller.movementStateInFrame != 1)
		{
			return;
		}
		if (VFInput._moveForward.pressing || VFInput._pullUp.pressing)
		{
			CruiseAssistPlugin.Int