using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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;
public 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();
}
}
public static class MyLogger
{
public static string LogString = "";
private static int _logStringMaxLength = 2000;
public static void LogToGame(string message)
{
string text = "\r\n" + message;
if (LogString.Length + text.Length > _logStringMaxLength)
{
int startIndex = LogString.Length + text.Length - _logStringMaxLength;
LogString = LogString.Substring(startIndex);
}
LogString += text;
}
public static void LogMessageToFile(string message, string filePath = "MyDspLog.txt")
{
using StreamWriter streamWriter = new StreamWriter(filePath, append: true);
streamWriter.WriteLine($"[{DateTime.Now}] Message :");
streamWriter.WriteLine(message ?? "");
}
public static void LogExceptionToFile(Exception ex, string filePath = "MyDspLog.txt")
{
using StreamWriter streamWriter = new StreamWriter(filePath, append: true);
streamWriter.WriteLine($"[{DateTime.Now}] An exception occurred:");
streamWriter.WriteLine("Message: " + ex.Message);
if (!string.IsNullOrEmpty(ex.StackTrace))
{
string[] array = ex.StackTrace.Split(new string[1] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
if (array.Length != 0)
{
string text = array[0];
int num = text.LastIndexOf(" in ");
if (num != -1)
{
string text2 = text.Substring(num + 4);
streamWriter.WriteLine("File and Line: " + text2);
}
}
}
streamWriter.WriteLine("StackTrace: " + ex.StackTrace);
if (ex.TargetSite != null)
{
streamWriter.WriteLine($"TargetSite: {ex.TargetSite}");
}
if (ex.Data.Count > 0)
{
streamWriter.WriteLine("Additional Information:");
foreach (object key in ex.Data.Keys)
{
streamWriter.WriteLine($"- {key}: {ex.Data[key]}");
}
}
streamWriter.WriteLine();
}
}
public 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.0.40", "Don't change.");
val.Value = "0.0.40";
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");
flag = true;
}
if (step == Step.AWAKE || step == Step.GAME_MAIN_BEGIN)
{
CruiseAssistDebugUI.Show = ConfigManager.Bind("Debug", "DebugWindowShow", defaultValue: false).Value;
CruiseAssist.Enable = ConfigManager.Bind("Setting", "Enable", defaultValue: true).Value;
CruiseAssist.MarkVisitedFlag = ConfigManager.Bind("Setting", "MarkVisited", defaultValue: true).Value;
CruiseAssist.SelectFocusFlag = ConfigManager.Bind("Setting", "SelectFocus", defaultValue: true).Value;
CruiseAssist.HideDuplicateHistoryFlag = ConfigManager.Bind("Setting", "HideDuplicateHistory", defaultValue: true).Value;
CruiseAssist.AutoDisableLockCursorFlag = ConfigManager.Bind("Setting", "AutoDisableLockCursor", defaultValue: false).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 (!DSPGame.IsMenuDemo && GameMain.galaxy != null)
{
CruiseAssist.History = ListUtils.ParseToIntList(ConfigManager.Bind("Save", $"History_{GameMain.galaxy.seed}", "").Value);
CruiseAssist.Bookmark = ListUtils.ParseToIntList(ConfigManager.Bind("Save", $"Bookmark_{GameMain.galaxy.seed}", "").Value);
}
else
{
CruiseAssist.History = new List<int>();
CruiseAssist.Bookmark = new List<int>();
}
}
else if (step == Step.STATE)
{
LogManager.LogInfo("check state.");
flag |= ConfigManager.UpdateEntry("Setting", "Enable", CruiseAssist.Enable);
flag |= ConfigManager.UpdateEntry("Setting", "MarkVisited", CruiseAssist.MarkVisitedFlag);
flag |= ConfigManager.UpdateEntry("Setting", "SelectFocus", CruiseAssist.SelectFocusFlag);
flag |= ConfigManager.UpdateEntry("Setting", "HideDuplicateHistory", CruiseAssist.HideDuplicateHistoryFlag);
flag |= ConfigManager.UpdateEntry("Setting", "AutoDisableLockCursor", CruiseAssist.AutoDisableLockCursorFlag);
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 (!DSPGame.IsMenuDemo && GameMain.galaxy != null)
{
if (!ConfigManager.ContainsKey("Save", $"History_{GameMain.galaxy.seed}") || !ConfigManager.ContainsKey("Save", $"Bookmark_{GameMain.galaxy.seed}"))
{
ConfigManager.Bind("Save", $"History_{GameMain.galaxy.seed}", "");
ConfigManager.Bind("Save", $"Bookmark_{GameMain.galaxy.seed}", "");
flag = true;
}
flag |= ConfigManager.UpdateEntry("Save", $"History_{GameMain.galaxy.seed}", ListUtils.ToString(CruiseAssist.History));
flag |= ConfigManager.UpdateEntry("Save", $"Bookmark_{GameMain.galaxy.seed}", ListUtils.ToString(CruiseAssist.Bookmark));
}
CruiseAssistMainUI.NextCheckGameTick = long.MaxValue;
}
if (flag)
{
ConfigManager.Save();
}
}
}
[BepInPlugin("abukaff.CruiseAssist", "CruiseAssist", "0.0.40")]
public class CruiseAssist : BaseUnityPlugin
{
public const string ModGuid = "abukaff.CruiseAssist";
public const string ModName = "CruiseAssist";
public const string ModVersion = "0.0.40";
public static bool Enable = true;
public static bool MarkVisitedFlag = true;
public static bool SelectFocusFlag = false;
public static bool HideDuplicateHistoryFlag = true;
public static bool AutoDisableLockCursorFlag = false;
public static bool HideInStarmap = 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 CruiseAssistState State = CruiseAssistState.INACTIVE;
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;
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("abukaff.CruiseAssist.Patch");
harmony.PatchAll(typeof(Patch_GameMain));
harmony.PatchAll(typeof(Patch_UISailPanel));
harmony.PatchAll(typeof(Patch_UIStarmap));
harmony.PatchAll(typeof(Patch_PlayerMoveSail));
}
public void OnDestroy()
{
harmony.UnpatchAll((string)null);
}
public void OnGUI()
{
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: 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)
if (DSPGame.IsMenuDemo || GameMain.mainPlayer == null)
{
return;
}
UIGame uiGame = UIRoot.instance.uiGame;
if (uiGame.guideComplete && !((ManualBehaviour)uiGame.techTree).active && !((ManualBehaviour)uiGame.escMenu).active && !((ManualBehaviour)uiGame.globemap).active && !uiGame.hideAllUI0 && !uiGame.hideAllUI1 && (!((ManualBehaviour)uiGame.starmap).active || !HideInStarmap) && (GameMain.mainPlayer.sailing || ((ManualBehaviour)uiGame.starmap).active))
{
Check();
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 = false;
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);
}
}
}
private void Check()
{
try
{
int indicatorAstroId = GameMain.mainPlayer.navigation.indicatorAstroId;
if (SelectTargetAstroId != indicatorAstroId)
{
SelectTargetAstroId = indicatorAstroId;
if (indicatorAstroId % 100 != 0)
{
SelectTargetPlanet = GameMain.galaxy.PlanetById(indicatorAstroId);
SelectTargetStar = SelectTargetPlanet.star;
}
else
{
SelectTargetPlanet = null;
SelectTargetStar = GameMain.galaxy.StarById(indicatorAstroId / 100);
}
}
if (GameMain.localPlanet != null && (History.Count == 0 || History.Last() != GameMain.localPlanet.id))
{
if (History.Count >= 128)
{
History.RemoveAt(0);
}
History.Add(GameMain.localPlanet.id);
ConfigManager.CheckConfig(ConfigManager.Step.STATE);
}
}
catch (Exception ex)
{
MyLogger.LogToGame(ex.Message);
}
}
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_008e: 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 abstract class ConfigManager
{
public enum Step
{
AWAKE,
GAME_MAIN_BEGIN,
UNIVERSE_GEN_CREATE_GALAXY,
STATE
}
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_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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.");
}
}
[HarmonyPatch(typeof(UIStarmap))]
public class Patch_UIStarmap
{
[HarmonyPatch("_OnClose")]
[HarmonyPrefix]
public static void OnClose_Prefix()
{
ConfigManager.CheckConfig(ConfigManager.Step.STATE);
}
}
[HarmonyPatch(typeof(UITechTree))]
public class Patch_UITechTree
{
[HarmonyPatch("_OnOpen")]
[HarmonyPrefix]
public static void OnOpen_Prefix()
{
ConfigManager.CheckConfig(ConfigManager.Step.STATE);
}
}
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 = float.MinValue;
private static float lastCheckWindowTop = float.MinValue;
public static float TempScale = 150f;
public static void OnGUI()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
wIdx = CruiseAssistMainUI.wIdx;
GUIStyle val = new GUIStyle(GUI.skin.window);
val.fontSize = 11;
Rect[wIdx] = GUILayout.Window(99030293, Rect[wIdx], new WindowFunction(WindowFunction), "CruiseAssist - Config", val, 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 != float.MinValue && (((Rect)(ref Rect[wIdx])).x != lastCheckWindowLeft || ((Rect)(ref Rect[wIdx])).y != lastCheckWindowTop))
{
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
}
lastCheckWindowLeft = ((Rect)(ref Rect[wIdx])).x;
lastCheckWindowTop = ((Rect)(ref Rect[wIdx])).y;
}
public static void WindowFunction(int windowId)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Expected O, but got Unknown
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Expected O, but got Unknown
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Expected O, but got Unknown
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Expected O, but got Unknown
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Expected O, but got Unknown
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0316: Expected O, but got Unknown
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Unknown result type (might be due to invalid IL or missing references)
//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
//IL_040d: Unknown result type (might be due to invalid IL or missing references)
//IL_0463: 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_0503: Expected O, but got Unknown
//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0545: 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(GUI.skin.label);
val.fixedWidth = 120f;
val.fixedHeight = 20f;
val.fontSize = 12;
val.alignment = (TextAnchor)3;
GUILayout.Label("Main Window Style :", val, Array.Empty<GUILayoutOption>());
GUIStyle val2 = new GUIStyle(GUI.skin.button);
val2.fixedWidth = 80f;
val2.fixedHeight = 20f;
val2.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, val2, 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 0:
CruiseAssistMainUI.ViewMode = CruiseAssistMainUIViewMode.FULL;
break;
case 1:
CruiseAssistMainUI.ViewMode = CruiseAssistMainUIViewMode.MINI;
break;
}
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUIStyle val3 = new GUIStyle(GUI.skin.label);
val3.fixedWidth = 60f;
val3.fixedHeight = 20f;
val3.fontSize = 12;
val3.alignment = (TextAnchor)3;
GUILayout.Label("UI Scale :", val3, Array.Empty<GUILayoutOption>());
GUIStyle val4 = new GUIStyle(GUI.skin.horizontalSlider);
val4.fixedWidth = 180f;
val4.margin.top = 10;
val4.alignment = (TextAnchor)3;
GUIStyle val5 = new GUIStyle(GUI.skin.horizontalSliderThumb);
TempScale = GUILayout.HorizontalSlider(TempScale, 80f, 240f, val4, val5, Array.Empty<GUILayoutOption>());
TempScale = (int)TempScale / 5 * 5;
GUIStyle val6 = new GUIStyle(GUI.skin.label);
val6.fixedWidth = 40f;
val6.fixedHeight = 20f;
val6.fontSize = 12;
val6.alignment = (TextAnchor)3;
GUILayout.Label(TempScale.ToString("0") + "%", val6, Array.Empty<GUILayoutOption>());
GUIStyle val7 = new GUIStyle(GUI.skin.button);
val7.fixedWidth = 60f;
val7.fixedHeight = 18f;
val7.margin.top = 6;
val7.fontSize = 12;
if (GUILayout.Button("SET", val7, 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 val8 = new GUIStyle(GUI.skin.toggle);
val8.fixedHeight = 20f;
val8.fontSize = 12;
GUI.changed = false;
CruiseAssist.MarkVisitedFlag = GUILayout.Toggle(CruiseAssist.MarkVisitedFlag, "Mark the visited system and planet.", val8, 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;
CruiseAssist.SelectFocusFlag = GUILayout.Toggle(CruiseAssist.SelectFocusFlag, "Focus when target selected.", val8, 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;
CruiseAssist.HideDuplicateHistoryFlag = GUILayout.Toggle(CruiseAssist.HideDuplicateHistoryFlag, "Hide duplicate history.", val8, 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;
CruiseAssist.AutoDisableLockCursorFlag = GUILayout.Toggle(CruiseAssist.AutoDisableLockCursorFlag, "Disable lock cursor when starting sail mode.", val8, 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;
CruiseAssist.HideInStarmap = GUILayout.Toggle(CruiseAssist.HideInStarmap, "Hide in starmap view", val8, 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 val9 = new GUIStyle(GUI.skin.button);
val9.fixedWidth = 80f;
val9.fixedHeight = 20f;
val9.fontSize = 12;
if (GUILayout.Button("Close", val9, Array.Empty<GUILayoutOption>()))
{
VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
Show[wIdx] = false;
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
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 long nextCheckGameTick = long.MaxValue;
private static Vector2 scrollPos = Vector2.zero;
public static int ListSelected = 0;
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))
{
nextCheckGameTick = GameMain.gameTick + 300;
}
lastCheckWindowLeft = ((Rect)(ref Rect)).x;
lastCheckWindowTop = ((Rect)(ref Rect)).y;
if (nextCheckGameTick <= GameMain.gameTick)
{
ConfigManager.CheckConfig(ConfigManager.Step.STATE);
nextCheckGameTick = long.MaxValue;
}
}
public static void WindowFunction(int windowId)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
//IL_04f0: Expected O, but got Unknown
//IL_0502: Unknown result type (might be due to invalid IL or missing references)
//IL_050c: Unknown result type (might be due to invalid IL or missing references)
//IL_0511: 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_00d7: Expected O, but got Unknown
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
string[] array = new string[2] { "Debug", "Logs" };
GUIStyle val = new GUIStyle(GUI.skin.button);
val.fixedWidth = 80f;
val.fixedHeight = 20f;
val.fontSize = 12;
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);
}
ListSelected = ((num != ListSelected) ? num : ListSelected);
GUILayout.EndHorizontal();
if (ListSelected == 0)
{
GUIStyle val2 = new GUIStyle(GUI.skin.label);
val2.fontSize = 12;
scrollPos = GUILayout.BeginScrollView(scrollPos, Array.Empty<GUILayoutOption>());
GUILayout.Label($"CruiseAssist.ReticuleTargetStar.id={CruiseAssist.ReticuleTargetStar?.id}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"CruiseAssist.ReticuleTargetPlanet.id={CruiseAssist.ReticuleTargetPlanet?.id}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"CruiseAssist.SelectTargetStar.id={CruiseAssist.SelectTargetStar?.id}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"CruiseAssist.SelectTargetPlanet.id={CruiseAssist.SelectTargetPlanet?.id}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GameMain.mainPlayer.navigation.indicatorAstroId={GameMain.mainPlayer.navigation.indicatorAstroId}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GameMain.mainPlayer.controller.input0.w={GameMain.mainPlayer.controller.input0.w}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GameMain.mainPlayer.controller.input0.x={GameMain.mainPlayer.controller.input0.x}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GameMain.mainPlayer.controller.input0.y={GameMain.mainPlayer.controller.input0.y}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GameMain.mainPlayer.controller.input0.z={GameMain.mainPlayer.controller.input0.z}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GameMain.mainPlayer.controller.input1.w={GameMain.mainPlayer.controller.input1.w}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GameMain.mainPlayer.controller.input1.x={GameMain.mainPlayer.controller.input1.x}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GameMain.mainPlayer.controller.input1.y={GameMain.mainPlayer.controller.input1.y}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GameMain.mainPlayer.controller.input1.z={GameMain.mainPlayer.controller.input1.z}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"VFInput._sailSpeedUp={VFInput._sailSpeedUp}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"CruiseAssist.Enable={CruiseAssist.Enable}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"CruiseAssist.History={CruiseAssist.History.Count()}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label("CruiseAssist.History=" + ListUtils.ToString(CruiseAssist.History), val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GUI.skin.window.margin.top={GUI.skin.window.margin.top}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GUI.skin.window.border.top={GUI.skin.window.border.top}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GUI.skin.window.padding.top={GUI.skin.window.padding.top}", val2, Array.Empty<GUILayoutOption>());
GUILayout.Label($"GUI.skin.window.overflow.top={GUI.skin.window.overflow.top}", val2, Array.Empty<GUILayoutOption>());
GUILayout.EndScrollView();
}
else
{
GUIStyle val3 = new GUIStyle(GUI.skin.textArea);
val3.stretchWidth = true;
val3.stretchHeight = true;
scrollPos = GUILayout.BeginScrollView(scrollPos, Array.Empty<GUILayoutOption>());
GUILayout.TextArea(MyLogger.LogString, val3, Array.Empty<GUILayoutOption>());
GUILayout.EndScrollView();
}
GUILayout.EndVertical();
GUI.DragWindow();
}
}
public enum CruiseAssistMainUIViewMode
{
FULL,
MINI
}
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 = float.MinValue;
private static float lastCheckWindowTop = 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 = "";
private static string searchString = "";
public static void OnGUI()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
wIdx = CruiseAssistMainUI.wIdx;
GUIStyle val = new GUIStyle(GUI.skin.window);
val.fontSize = 11;
Rect[wIdx] = GUILayout.Window(99030292, Rect[wIdx], new WindowFunction(WindowFunction), "CruiseAssist - StarList", val, 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 != float.MinValue && (((Rect)(ref Rect[wIdx])).x != lastCheckWindowLeft || ((Rect)(ref Rect[wIdx])).y != lastCheckWindowTop))
{
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
}
lastCheckWindowLeft = ((Rect)(ref Rect[wIdx])).x;
lastCheckWindowTop = ((Rect)(ref Rect[wIdx])).y;
}
public static void WindowFunction(int windowId)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Expected O, but got Unknown
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Expected O, but got Unknown
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Expected O, but got Unknown
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Expected O, but got Unknown
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Expected O, but got Unknown
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Expected O, but got Unknown
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Expected O, but got Unknown
//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ff: Expected O, but got Unknown
//IL_04b3: 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)
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUIStyle val = new GUIStyle(GUI.skin.button);
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();
scrollPos[ListSelected] = GUILayout.BeginScrollView(scrollPos[ListSelected], 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(GUI.skin.button);
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(GUI.skin.button);
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 val7 = star.uPosition - GameMain.mainPlayer.uPosition;
return new Tuple<StarData, double>(star, ((VectorLF3)(ref val7)).magnitude);
})
orderby tuple.v2
select tuple), (Action<Tuple<StarData, double>>)delegate(Tuple<StarData, double> tuple)
{
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Expected O, but got Unknown
//IL_031e: Unknown result type (might be due to invalid IL or missing references)
StarData star3 = tuple.v1;
double range = tuple.v2;
string starName = CruiseAssist.GetStarName(star3);
bool flag3 = false;
if (GameMain.localStar != null && star3.id == GameMain.localStar.id)
{
flag3 = true;
}
else if (CruiseAssist.SelectTargetStar != null && star3.id == CruiseAssist.SelectTargetStar.id && GameMain.history.universeObserveLevel >= ((range >= 14400000.0) ? 4 : 3))
{
flag3 = true;
}
if (flag3)
{
IEnumerable<Tuple<PlanetData, double>> enumerable4 = from x in 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 val6 = planet.uPosition - GameMain.mainPlayer.uPosition;
return new Tuple<PlanetData, double>(planet, ((VectorLF3)(ref val6)).magnitude);
})
where x.v1.displayName.ToLower().Contains(searchString.ToLower())
select x;
VectorLF3 val5 = 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 val5)).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_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Expected O, but got Unknown
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Expected O, but got Unknown
//IL_030a: 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 num6;
if (v == null)
{
if (CruiseAssist.SelectTargetPlanet == null && CruiseAssist.SelectTargetStar != null && star3.id == CruiseAssist.SelectTargetStar.id)
{
nameLabelStyle.normal.textColor = Color.cyan;
nRangeLabelStyle.normal.textColor = Color.cyan;
}
string text6 = starName;
if (CruiseAssist.MarkVisitedFlag)
{
text6 = ((star3.planets.Where((PlanetData p) => p.factory != null).Count() > 0) ? "● " : "") + text6;
}
GUILayout.Label(text6, nameLabelStyle, Array.Empty<GUILayoutOption>());
num6 = nameLabelStyle.CalcHeight(new GUIContent(text6), nameLabelStyle.fixedWidth);
}
else
{
if (CruiseAssist.SelectTargetPlanet != null && v.id == CruiseAssist.SelectTargetPlanet.id)
{
nameLabelStyle.normal.textColor = Color.cyan;
nRangeLabelStyle.normal.textColor = Color.cyan;
}
string text7 = starName + " - " + CruiseAssist.GetPlanetName(v);
if (CruiseAssist.MarkVisitedFlag)
{
text7 = ((v.factory != null) ? "● " : "") + text7;
}
GUILayout.Label(text7, nameLabelStyle, Array.Empty<GUILayoutOption>());
num6 = nameLabelStyle.CalcHeight(new GUIContent(text7), nameLabelStyle.fixedWidth);
}
GUILayout.FlexibleSpace();
GUILayout.Label(CruiseAssistMainUI.RangeToString((v == null) ? range : v2), (num6 < 30f) ? nRangeLabelStyle : hRangeLabelStyle, Array.Empty<GUILayoutOption>());
string text8 = ((actionSelected[ListSelected] == 0) ? "SET" : ((v == null) ? "-" : (CruiseAssist.Bookmark.Contains(v.id) ? "DEL" : "ADD")));
if (GUILayout.Button(text8, (num6 < 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);
}
else if (v != null)
{
if (CruiseAssist.Bookmark.Contains(v.id))
{
CruiseAssist.Bookmark.Remove(v.id);
}
else if (CruiseAssist.Bookmark.Count <= 128)
{
CruiseAssist.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 (CruiseAssist.SelectTargetStar != null && star3.id == CruiseAssist.SelectTargetStar.id)
{
nameLabelStyle.normal.textColor = Color.cyan;
nRangeLabelStyle.normal.textColor = Color.cyan;
}
string text4 = starName;
if (CruiseAssist.MarkVisitedFlag)
{
text4 = ((star3.planets.Where((PlanetData p) => p.factory != null).Count() > 0) ? "● " : "") + text4;
}
GUILayout.Label(text4, nameLabelStyle, Array.Empty<GUILayoutOption>());
float num5 = nameLabelStyle.CalcHeight(new GUIContent(text4), nameLabelStyle.fixedWidth);
GUILayout.FlexibleSpace();
GUILayout.Label(CruiseAssistMainUI.RangeToString(range), (num5 < 30f) ? nRangeLabelStyle : hRangeLabelStyle, Array.Empty<GUILayoutOption>());
string text5 = ((actionSelected[ListSelected] == 0) ? "SET" : "-");
if (GUILayout.Button(text5, (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, null);
}
}
GUILayout.EndHorizontal();
}
});
}
else if (ListSelected == 1 || ListSelected == 2)
{
bool highlighted = false;
IEnumerable<int> enumerable2;
if (ListSelected != 1)
{
IEnumerable<int> enumerable = CruiseAssist.Bookmark.ToList();
enumerable2 = enumerable;
}
else
{
enumerable2 = Enumerable.Reverse(CruiseAssist.History);
}
IEnumerable<int> enumerable3 = enumerable2;
if (ListSelected == 1 && actionSelected[ListSelected] != 2 && CruiseAssist.HideDuplicateHistoryFlag)
{
enumerable3 = enumerable3.Distinct();
}
int listIndex = -1;
CollectionExtensions.Do<int>(enumerable3, (Action<int>)delegate(int id)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Expected O, but got Unknown
//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
int num2 = listIndex + 1;
listIndex = num2;
PlanetData val3 = GameMain.galaxy.PlanetById(id);
if (val3 != null)
{
StarData star2 = val3.star;
string text = CruiseAssist.GetStarName(star2);
VectorLF3 val4 = val3.uPosition - GameMain.mainPlayer.uPosition;
double magnitude = ((VectorLF3)(ref val4)).magnitude;
nameLabelStyle.normal.textColor = Color.white;
nRangeLabelStyle.normal.textColor = Color.white;
if (!highlighted && CruiseAssist.SelectTargetPlanet != null && val3.id == CruiseAssist.SelectTargetPlanet.id)
{
nameLabelStyle.normal.textColor = Color.cyan;
nRangeLabelStyle.normal.textColor = Color.cyan;
highlighted = true;
}
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
string text2 = text + " - " + CruiseAssist.GetPlanetName(val3);
if (CruiseAssist.MarkVisitedFlag)
{
text2 = ((val3.factory != null) ? "● " : "") + text2;
}
GUILayout.Label(text2, nameLabelStyle, Array.Empty<GUILayoutOption>());
float num3 = nameLabelStyle.CalcHeight(new GUIContent(text2), nameLabelStyle.fixedWidth);
GUILayout.FlexibleSpace();
GUILayout.Label(CruiseAssistMainUI.RangeToString(magnitude), (num3 < 30f) ? nRangeLabelStyle : hRangeLabelStyle, Array.Empty<GUILayoutOption>());
if (ListSelected == 2 && actionSelected[ListSelected] == 1)
{
int num4 = CruiseAssist.Bookmark.IndexOf(id);
bool flag = num4 == 0;
bool flag2 = num4 == CruiseAssist.Bookmark.Count - 1;
if (GUILayout.Button(flag2 ? "-" : "↓", (num3 < 30f) ? nSortButtonStyle : hSortButtonStyle, Array.Empty<GUILayoutOption>()))
{
VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
if (!flag2)
{
CruiseAssist.Bookmark.RemoveAt(num4);
CruiseAssist.Bookmark.Insert(num4 + 1, id);
}
}
if (GUILayout.Button(flag ? "-" : "↑", (num3 < 30f) ? nSortButtonStyle : hSortButtonStyle, Array.Empty<GUILayoutOption>()))
{
VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
if (!flag)
{
CruiseAssist.Bookmark.RemoveAt(num4);
CruiseAssist.Bookmark.Insert(num4 - 1, id);
}
}
}
else
{
string text3 = ((actionSelected[ListSelected] == 0) ? "SET" : ((actionSelected[ListSelected] != 2) ? (CruiseAssist.Bookmark.Contains(id) ? "DEL" : "ADD") : ((ListSelected == 1 && listIndex == 0) ? "-" : "DEL")));
if (GUILayout.Button(text3, (num3 < 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, val3);
}
else if (actionSelected[ListSelected] == 1)
{
if (ListSelected == 1)
{
if (CruiseAssist.Bookmark.Contains(id))
{
CruiseAssist.Bookmark.Remove(id);
}
else if (CruiseAssist.Bookmark.Count <= 128)
{
CruiseAssist.Bookmark.Add(id);
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
}
}
}
else if (actionSelected[ListSelected] == 2)
{
if (ListSelected == 1)
{
if (listIndex != 0)
{
CruiseAssist.History.RemoveAt(CruiseAssist.History.Count - 1 - listIndex);
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
}
}
else if (ListSelected == 2)
{
CruiseAssist.Bookmark.Remove(val3.id);
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300;
}
}
}
}
GUILayout.EndHorizontal();
}
});
}
GUILayout.EndScrollView();
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUIStyle val2 = new GUIStyle(GUI.skin.button);
val2.fixedWidth = 80f;
val2.fixedHeight = 20f;
val2.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]], val2, Array.Empty<GUILayoutOption>()))
{
VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
actionSelected[ListSelected]++;
actionSelected[ListSelected] %= array2[ListSelected].Length;
}
searchString = GUILayout.TextField(searchString, Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Close", val2, Array.Empty<GUILayoutOption>()))
{
VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
Show[wIdx] = false;
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUI.DragWindow();
}
public static void SelectStar(StarData star, PlanetData planet)
{
CruiseAssist.SelectTargetStar = star;
CruiseAssist.SelectTargetPlanet = planet;
UIGame uiGame = UIRoot.instance.uiGame;
if (CruiseAssist.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;
}
CruiseAssist.SelectTargetAstroId = GameMain.mainPlayer.navigation.indicatorAstroId;
}
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
}
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 = 273f;
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 = float.MinValue;
private static float lastCheckWindowTop = float.MinValue;
public static long NextCheckGameTick = long.MaxValue;
public static void OnGUI()
{
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
switch (ViewMode)
{
case CruiseAssistMainUIViewMode.FULL:
((Rect)(ref Rect[wIdx])).width = 398f;
((Rect)(ref Rect[wIdx])).height = 150f;
break;
case CruiseAssistMainUIViewMode.MINI:
((Rect)(ref Rect[wIdx])).width = 273f;
((Rect)(ref Rect[wIdx])).height = 70f;
break;
}
GUIStyle val = new GUIStyle(GUI.skin.window);
val.fontSize = 11;
Rect[wIdx] = GUILayout.Window(99030291, Rect[wIdx], new WindowFunction(WindowFunction), "CruiseAssist", val, Array.Empty<GUILayoutOption>());
float num = 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 != float.MinValue && (((Rect)(ref Rect[wIdx])).x != lastCheckWindowLeft || ((Rect)(ref Rect[wIdx])).y != lastCheckWindowTop))
{
NextCheckGameTick = GameMain.gameTick + 300;
}
lastCheckWindowLeft = ((Rect)(ref Rect[wIdx])).x;
lastCheckWindowTop = ((Rect)(ref Rect[wIdx])).y;
if (NextCheckGameTick <= GameMain.gameTick)
{
ConfigManager.CheckConfig(ConfigManager.Step.STATE);
NextCheckGameTick = long.MaxValue;
}
}
public static void WindowFunction(int windowId)
{
//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
//IL_03d0: Expected O, but got Unknown
//IL_0429: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0457: Unknown result type (might be due to invalid IL or missing references)
//IL_045e: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Expected O, but got Unknown
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Expected O, but got Unknown
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Expected O, but got Unknown
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0523: Unknown result type (might be due to invalid IL or missing references)
//IL_0581: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Expected O, but got Unknown
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Expected O, but got Unknown
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Unknown result type (might be due to invalid IL or missing references)
//IL_033b: Unknown result type (might be due to invalid IL or missing references)
//IL_0345: Unknown result type (might be due to invalid IL or missing references)
//IL_034a: Unknown result type (might be due to invalid IL or missing references)
//IL_034f: 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 = ((CruiseAssist.State == CruiseAssistState.TO_STAR) ? Color.cyan : Color.white);
Color textColor2 = ((CruiseAssist.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 (CruiseAssist.TargetStar != null)
{
val3.normal.textColor = textColor;
GUILayout.Label(CruiseAssist.GetStarName(CruiseAssist.TargetStar), val3, Array.Empty<GUILayoutOption>());
}
else
{
GUILayout.Label(" ", val3, Array.Empty<GUILayoutOption>());
}
if (CruiseAssist.TargetPlanet != null)
{
val4.normal.textColor = textColor2;
GUILayout.Label(CruiseAssist.GetPlanetName(CruiseAssist.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;
VectorLF3 val5;
double magnitude;
if (GameMain.mainPlayer.warping)
{
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 (CruiseAssist.TargetStar != null)
{
val6.normal.textColor = textColor;
val5 = CruiseAssist.TargetStar.uPosition - GameMain.mainPlayer.uPosition;
double num = ((VectorLF3)(ref val5)).magnitude - (double)(CruiseAssist.TargetStar.viewRadius - 120f);
GUILayout.Label(RangeToString(num) + "\n" + TimeToString(num / magnitude), val6, Array.Empty<GUILayoutOption>());
}
else
{
GUILayout.Label(" \n ", val6, Array.Empty<GUILayoutOption>());
}
if (CruiseAssist.TargetPlanet != null)
{
val7.normal.textColor = textColor2;
val5 = CruiseAssist.TargetPlanet.uPosition - GameMain.mainPlayer.uPosition;
double num2 = ((VectorLF3)(ref val5)).magnitude - (double)CruiseAssist.TargetPlanet.realRadius;
GUILayout.Label(RangeToString(num2) + "\n" + TimeToString(num2 / magnitude), val7, Array.Empty<GUILayoutOption>());
}
else
{
GUILayout.Label(" \n ", val7, Array.Empty<GUILayoutOption>());
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUIStyle val8 = new GUIStyle(GUI.skin.label);
val8.fixedWidth = 145f;
val8.fixedHeight = 32f;
val8.fontSize = 14;
val8.alignment = (TextAnchor)3;
if (CruiseAssist.State == CruiseAssistState.INACTIVE)
{
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(GUI.skin.button);
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);
ref bool reference = ref CruiseAssistConfigUI.Show[wIdx];
reference = !reference;
if (CruiseAssistConfigUI.Show[wIdx])
{
CruiseAssistConfigUI.TempScale = Scale;
}
}
if (GUILayout.Button(CruiseAssist.Enable ? "Enable" : "Disable", val9, Array.Empty<GUILayoutOption>()))
{
VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 0, -1, -1L);
CruiseAssist.Enable = !CruiseAssist.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);
ref bool reference2 = ref CruiseAssistStarListUI.Show[wIdx];
reference2 = !reference2;
}
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 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;
}
}
public 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 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(PlayerMove_Sail))]
public class Patch_PlayerMoveSail
{
[HarmonyPatch("GameTick")]
[HarmonyPrefix]
public static void GameTick_Prefix(PlayerMove_Sail __instance)
{
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: 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_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_0285: 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_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
CruiseAssist.State = CruiseAssistState.INACTIVE;
Player player = ((PlayerAction)__instance).player;
if (!player.sailing || !CruiseAssist.Enable)
{
return;
}
CruiseAssist.TargetStar = null;
CruiseAssist.TargetPlanet = null;
if (CruiseAssist.SelectTargetStar != null)
{
if (GameMain.localStar != null && CruiseAssist.SelectTargetStar.id == GameMain.localStar.id)
{
if (CruiseAssist.SelectTargetPlanet == null && GameMain.localPlanet != null)
{
CruiseAssist.SelectTargetStar = null;
CruiseAssist.SelectTargetAstroId = 0;
GameMain.mainPlayer.navigation.indicatorAstroId = 0;
return;
}
if (CruiseAssist.SelectTargetPlanet != null)
{
if (GameMain.localPlanet != null && CruiseAssist.SelectTargetPlanet.id == GameMain.localPlanet.id)
{
CruiseAssist.SelectTargetStar = null;
CruiseAssist.SelectTargetPlanet = null;
CruiseAssist.SelectTargetAstroId = 0;
GameMain.mainPlayer.navigation.indicatorAstroId = 0;
return;
}
CruiseAssist.TargetPlanet = CruiseAssist.SelectTargetPlanet;
}
else if (CruiseAssist.ReticuleTargetPlanet != null)
{
CruiseAssist.TargetPlanet = CruiseAssist.ReticuleTargetPlanet;
}
}
else
{
CruiseAssist.TargetStar = CruiseAssist.SelectTargetStar;
}
}
else if (CruiseAssist.ReticuleTargetPlanet != null)
{
CruiseAssist.TargetPlanet = CruiseAssist.ReticuleTargetPlanet;
}
else if (CruiseAssist.ReticuleTargetStar != null)
{
CruiseAssist.TargetStar = CruiseAssist.ReticuleTargetStar;
}
if (GameMain.mainPlayer.controller.input0 != Vector4.zero || GameMain.mainPlayer.controller.input1 != Vector4.zero)
{
return;
}
VectorLF3 val;
if (CruiseAssist.TargetPlanet != null)
{
CruiseAssist.State = CruiseAssistState.TO_PLANET;
val = CruiseAssist.TargetPlanet.uPosition - player.uPosition;
}
else
{
if (CruiseAssist.TargetStar == null)
{
return;
}
CruiseAssist.State = CruiseAssistState.TO_STAR;
val = CruiseAssist.TargetStar.uPosition - player.uPosition;
}
float num = Vector3.Angle(VectorLF3.op_Implicit(val), VectorLF3.op_Implicit(player.uVelocity));
float num2 = 1.6f / Mathf.Max(10f, num);
double magnitude = ((VectorLF3)(ref player.controller.actionSail.visual_uvel)).magnitude;
player.uVelocity = VectorLF3.op_Implicit(Vector3.Slerp(VectorLF3.op_Implicit(player.uVelocity), VectorLF3.op_Implicit(((VectorLF3)(ref val)).normalized * magnitude), num2));
}
}
[HarmonyPatch(typeof(GameMain))]
public class Patch_GameMain
{
[HarmonyPatch("Begin")]
[HarmonyPostfix]
public static void Begin_Postfix()
{
ConfigManager.CheckConfig(ConfigManager.Step.GAME_MAIN_BEGIN);
}
[HarmonyPatch("Pause")]
[HarmonyPrefix]
public static void Pause_Prefix()
{
ConfigManager.CheckConfig(ConfigManager.Step.STATE);
}
}
[HarmonyPatch(typeof(UISailPanel))]
public class Patch_UISailPanel
{
[HarmonyPatch("_OnUpdate")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Expected O, but got Unknown
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Expected O, but got Unknown
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Expected O, but got Unknown
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Expected O, but got Unknown
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Expected O, but got Unknown
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Expected O, but got Unknown
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Expected O, but got Unknown
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Expected O, but got Unknown
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Expected O, but got Unknown
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Expected O, but got Unknown
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Expected O, but got Unknown
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0252: Expected O, but got Unknown
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Expected O, but got Unknown
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null)
});
val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate<Action>((Action)delegate
{
CruiseAssist.ReticuleTargetPlanet = null;
CruiseAssist.ReticuleTargetStar = null;
}) });
val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[7]
{
new CodeMatch((OpCode?)OpCodes.Bge_Un, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null)
});
val.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldloc_0, (object)null)
}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(StarData), "planets"))
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldloc_S, (object)21)
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate<Action<PlanetData[], int>>((Action<PlanetData[], int>)delegate(PlanetData[] planets, int planetIndex)
{
CruiseAssist.ReticuleTargetPlanet = planets[planetIndex];
}) });
val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[7]
{
new CodeMatch((OpCode?)OpCodes.Bge_Un, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null)
});
val.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldloc_S, (object)20)
}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(GalaxyData), "stars"))
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldloc_S, (object)24)
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate<Action<StarData[], int>>((Action<StarData[], int>)delegate(StarData[] stars, int starIndex)
{
CruiseAssist.ReticuleTargetStar = stars[starIndex];
}) });
return val.InstructionEnumeration();
}
[HarmonyPatch("_OnOpen")]
[HarmonyPrefix]
public static void OnOpen_Prefix()
{
if (CruiseAssist.AutoDisableLockCursorFlag)
{
UIRoot.instance.uiGame.disableLockCursor = true;
}
}
[HarmonyPatch("_OnClose")]
[HarmonyPrefix]
public static void OnClose_Prefix()
{
ConfigManager.CheckConfig(ConfigManager.Step.STATE);
}
}
public struct Tuple<T1, T2>
{
public T1 v1 { get; set; }
public T2 v2 { get; set; }
public Tuple(T1 v1, T2 v2)
{
this.v1 = v1;
this.v2 = v2;
}
}