mirror of
https://github.com/soarqin/DSP_Mods_TO.git
synced 2026-02-04 14:12:18 +08:00
WIP
This commit is contained in:
@@ -12,72 +12,37 @@ internal class CruiseAssistConfigManager(ConfigFile config) : ConfigManager(conf
|
||||
protected override void CheckConfigImplements(Step step)
|
||||
{
|
||||
var saveFlag = false;
|
||||
if (step == Step.Awake)
|
||||
switch (step)
|
||||
{
|
||||
var configEntry = Bind("Base", "ModVersion", "0.0.37", "Don't change.");
|
||||
configEntry.Value = "0.0.37";
|
||||
Migration("State", "MainWindow0Left", 100, "State", "InfoWindowLeft");
|
||||
Migration("State", "MainWindow0Top", 100, "State", "InfoWindowTop");
|
||||
Migration("State", "MainWindow0Left", 100, "State", "MainWindowLeft");
|
||||
Migration("State", "MainWindow0Top", 100, "State", "MainWindowTop");
|
||||
Migration("State", "StarListWindow0Left", 100, "State", "StarListWindowLeft");
|
||||
Migration("State", "StarListWindow0Top", 100, "State", "StarListWindowTop");
|
||||
Migration("Setting", "CloseStarListWhenSetTargetPlanet", false, "Setting", "HideStarListWhenSetTargetPlanet");
|
||||
saveFlag = true;
|
||||
case Step.Awake:
|
||||
saveFlag = OnAwake();
|
||||
OnAwakeOrGameMainBegin();
|
||||
OnAwakeOrGameMainBeginOrStateOrChangeSeed();
|
||||
break;
|
||||
case Step.GameMainBegin:
|
||||
OnAwakeOrGameMainBegin();
|
||||
OnAwakeOrGameMainBeginOrStateOrChangeSeed();
|
||||
break;
|
||||
case Step.ChangeSeed:
|
||||
OnAwakeOrGameMainBeginOrStateOrChangeSeed();
|
||||
break;
|
||||
case Step.State:
|
||||
OnAwakeOrGameMainBeginOrStateOrChangeSeed();
|
||||
saveFlag = OnState();
|
||||
break;
|
||||
case Step.UniverseGenCreateGalaxy:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (step is Step.Awake or Step.GameMainBegin)
|
||||
if (saveFlag)
|
||||
{
|
||||
CruiseAssistDebugUI.Show = Bind("Debug", "DebugWindowShow", false).Value;
|
||||
CruiseAssistPlugin.Enable = Bind("Setting", "Enable", true).Value;
|
||||
CruiseAssistPlugin.Conf.MarkVisitedFlag = Bind("Setting", "MarkVisited", true).Value;
|
||||
CruiseAssistPlugin.Conf.SelectFocusFlag = Bind("Setting", "SelectFocus", true).Value;
|
||||
CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag = Bind("Setting", "HideDuplicateHistory", true).Value;
|
||||
CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag = Bind("Setting", "AutoDisableLockCursor", false).Value;
|
||||
CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag = Bind("Setting", "ShowMainWindowWhenTargetSelectedEvenNotSailMode", true).Value;
|
||||
CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag = Bind("Setting", "CloseStarListWhenSetTargetPlanet", false).Value;
|
||||
CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag = Bind("Setting", "HideBottomCloseButton", true).Value;
|
||||
CruiseAssistMainUI.Scale = Bind("Setting", "UIScale", 150).Value;
|
||||
var viewModeStr = Bind("Setting", "MainWindowViewMode", CruiseAssistMainUIViewMode.Full.ToString()).Value;
|
||||
EnumUtils.TryParse(viewModeStr, out CruiseAssistMainUI.ViewMode);
|
||||
for (var i = 0; i < 2; i++)
|
||||
{
|
||||
CruiseAssistMainUI.Rect[i].x = Bind("State", $"MainWindow{i}Left", 100).Value;
|
||||
CruiseAssistMainUI.Rect[i].y = Bind("State", $"MainWindow{i}Top", 100).Value;
|
||||
CruiseAssistStarListUI.Rect[i].x = Bind("State", $"StarListWindow{i}Left", 100).Value;
|
||||
CruiseAssistStarListUI.Rect[i].y = Bind("State", $"StarListWindow{i}Top", 100).Value;
|
||||
CruiseAssistConfigUI.Rect[i].x = Bind("State", $"ConfigWindow{i}Left", 100).Value;
|
||||
CruiseAssistConfigUI.Rect[i].y = Bind("State", $"ConfigWindow{i}Top", 100).Value;
|
||||
}
|
||||
CruiseAssistStarListUI.ListSelected = Bind("State", "StarListWindowListSelected", 0).Value;
|
||||
CruiseAssistDebugUI.Rect.x = Bind("State", "DebugWindowLeft", 100).Value;
|
||||
CruiseAssistDebugUI.Rect.y = Bind("State", "DebugWindowTop", 100).Value;
|
||||
}
|
||||
if (step is Step.Awake or Step.GameMainBegin or Step.State or Step.ChangeSeed)
|
||||
{
|
||||
if (DSPGame.IsMenuDemo || GameMain.galaxy == null)
|
||||
{
|
||||
var flag6 = CruiseAssistPlugin.Seed != -1;
|
||||
if (flag6)
|
||||
{
|
||||
CruiseAssistPlugin.Seed = -1;
|
||||
CruiseAssistPlugin.History = new List<int>();
|
||||
CruiseAssistPlugin.Bookmark = new List<int>();
|
||||
LogManager.LogInfo("clear seed.");
|
||||
Save();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.Seed != GameMain.galaxy.seed)
|
||||
{
|
||||
CruiseAssistPlugin.Seed = GameMain.galaxy.seed;
|
||||
CruiseAssistPlugin.History = ListUtils.ParseToIntList(Bind("Save", $"History_{CruiseAssistPlugin.Seed}", "").Value);
|
||||
CruiseAssistPlugin.Bookmark = ListUtils.ParseToIntList(Bind("Save", $"Bookmark_{CruiseAssistPlugin.Seed}", "").Value);
|
||||
LogManager.LogInfo($"change seed {CruiseAssistPlugin.Seed}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (step == Step.State)
|
||||
|
||||
private static bool OnState()
|
||||
{
|
||||
var saveFlag = false;
|
||||
LogManager.LogInfo("check state.");
|
||||
saveFlag |= UpdateEntry("Setting", "Enable", CruiseAssistPlugin.Enable);
|
||||
saveFlag |= UpdateEntry("Setting", "MarkVisited", CruiseAssistPlugin.Conf.MarkVisitedFlag);
|
||||
@@ -107,10 +72,69 @@ internal class CruiseAssistConfigManager(ConfigFile config) : ConfigManager(conf
|
||||
saveFlag |= UpdateEntry("Save", $"Bookmark_{CruiseAssistPlugin.Seed}", ListUtils.ToString(CruiseAssistPlugin.Bookmark));
|
||||
}
|
||||
CruiseAssistMainUI.NextCheckGameTick = long.MaxValue;
|
||||
return saveFlag;
|
||||
}
|
||||
if (saveFlag)
|
||||
|
||||
private static void OnAwakeOrGameMainBeginOrStateOrChangeSeed()
|
||||
{
|
||||
Save();
|
||||
if (DSPGame.IsMenuDemo || GameMain.galaxy == null)
|
||||
{
|
||||
var reset = CruiseAssistPlugin.Seed != -1;
|
||||
if (!reset) return;
|
||||
CruiseAssistPlugin.Seed = -1;
|
||||
CruiseAssistPlugin.History = new List<int>();
|
||||
CruiseAssistPlugin.Bookmark = new List<int>();
|
||||
LogManager.LogInfo("clear seed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.Seed == GameMain.galaxy.seed) return;
|
||||
CruiseAssistPlugin.Seed = GameMain.galaxy.seed;
|
||||
CruiseAssistPlugin.History = ListUtils.ParseToIntList(Bind("Save", $"History_{CruiseAssistPlugin.Seed}", "").Value);
|
||||
CruiseAssistPlugin.Bookmark = ListUtils.ParseToIntList(Bind("Save", $"Bookmark_{CruiseAssistPlugin.Seed}", "").Value);
|
||||
LogManager.LogInfo($"change seed {CruiseAssistPlugin.Seed}.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnAwakeOrGameMainBegin()
|
||||
{
|
||||
CruiseAssistDebugUI.Show = Bind("Debug", "DebugWindowShow", false).Value;
|
||||
CruiseAssistPlugin.Enable = Bind("Setting", "Enable", true).Value;
|
||||
CruiseAssistPlugin.Conf.MarkVisitedFlag = Bind("Setting", "MarkVisited", true).Value;
|
||||
CruiseAssistPlugin.Conf.SelectFocusFlag = Bind("Setting", "SelectFocus", true).Value;
|
||||
CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag = Bind("Setting", "HideDuplicateHistory", true).Value;
|
||||
CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag = Bind("Setting", "AutoDisableLockCursor", false).Value;
|
||||
CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag = Bind("Setting", "ShowMainWindowWhenTargetSelectedEvenNotSailMode", true).Value;
|
||||
CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag = Bind("Setting", "CloseStarListWhenSetTargetPlanet", false).Value;
|
||||
CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag = Bind("Setting", "HideBottomCloseButton", true).Value;
|
||||
CruiseAssistMainUI.Scale = Bind("Setting", "UIScale", 150).Value;
|
||||
var viewModeStr = Bind("Setting", "MainWindowViewMode", CruiseAssistMainUIViewMode.Full.ToString()).Value;
|
||||
EnumUtils.TryParse(viewModeStr, out CruiseAssistMainUI.ViewMode);
|
||||
for (var i = 0; i < 2; i++)
|
||||
{
|
||||
CruiseAssistMainUI.Rect[i].x = Bind("State", $"MainWindow{i}Left", 100).Value;
|
||||
CruiseAssistMainUI.Rect[i].y = Bind("State", $"MainWindow{i}Top", 100).Value;
|
||||
CruiseAssistStarListUI.Rect[i].x = Bind("State", $"StarListWindow{i}Left", 100).Value;
|
||||
CruiseAssistStarListUI.Rect[i].y = Bind("State", $"StarListWindow{i}Top", 100).Value;
|
||||
CruiseAssistConfigUI.Rect[i].x = Bind("State", $"ConfigWindow{i}Left", 100).Value;
|
||||
CruiseAssistConfigUI.Rect[i].y = Bind("State", $"ConfigWindow{i}Top", 100).Value;
|
||||
}
|
||||
CruiseAssistStarListUI.ListSelected = Bind("State", "StarListWindowListSelected", 0).Value;
|
||||
CruiseAssistDebugUI.Rect.x = Bind("State", "DebugWindowLeft", 100).Value;
|
||||
CruiseAssistDebugUI.Rect.y = Bind("State", "DebugWindowTop", 100).Value;
|
||||
}
|
||||
|
||||
private static bool OnAwake()
|
||||
{
|
||||
var configEntry = Bind("Base", "ModVersion", "0.0.37", "Don't change.");
|
||||
configEntry.Value = "0.0.37";
|
||||
Migration("State", "MainWindow0Left", 100, "State", "InfoWindowLeft");
|
||||
Migration("State", "MainWindow0Top", 100, "State", "InfoWindowTop");
|
||||
Migration("State", "MainWindow0Left", 100, "State", "MainWindowLeft");
|
||||
Migration("State", "MainWindow0Top", 100, "State", "MainWindowTop");
|
||||
Migration("State", "StarListWindow0Left", 100, "State", "StarListWindowLeft");
|
||||
Migration("State", "StarListWindow0Top", 100, "State", "StarListWindowTop");
|
||||
Migration("Setting", "CloseStarListWhenSetTargetPlanet", false, "Setting", "HideStarListWhenSetTargetPlanet");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using BepInEx;
|
||||
using CruiseAssist.Commons;
|
||||
@@ -137,14 +139,38 @@ public class CruiseAssistPlugin : BaseUnityPlugin
|
||||
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 List<int> History = [];
|
||||
public static List<int> HistoryDistinct = [];
|
||||
public static List<int> Bookmark = [];
|
||||
public static HashSet<int> BookmarkSet = [];
|
||||
public static readonly Func<StarData, string> GetStarName = star => star.displayName;
|
||||
public static readonly Func<PlanetData, string> GetPlanetName = planet => planet.displayName;
|
||||
internal static readonly List<ICruiseAssistExtensionAPI> Extensions = [];
|
||||
private Harmony _harmony;
|
||||
private static bool _initialized;
|
||||
|
||||
public static bool HasBookmark(int id) => BookmarkSet.Contains(id);
|
||||
|
||||
public static bool AddBookmark(int id)
|
||||
{
|
||||
if (!BookmarkSet.Add(id)) return false;
|
||||
Bookmark.Add(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool RemoveBookmark(int id)
|
||||
{
|
||||
if (!BookmarkSet.Remove(id)) return false;
|
||||
Bookmark.Remove(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void ClearBookmark()
|
||||
{
|
||||
Bookmark.Clear();
|
||||
BookmarkSet.Clear();
|
||||
}
|
||||
|
||||
public static class Conf
|
||||
{
|
||||
public static bool MarkVisitedFlag = true;
|
||||
|
||||
@@ -32,15 +32,8 @@ internal class Patch_PlayerMoveWalk
|
||||
}
|
||||
}
|
||||
|
||||
if (!CruiseAssistPlugin.Enable)
|
||||
{
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.SetInactive();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!CruiseAssistPlugin.Enable) return;
|
||||
|
||||
var indicatorAstroId = GameMain.mainPlayer.navigation.indicatorAstroId;
|
||||
if (indicatorAstroId != 0 && CruiseAssistPlugin.SelectTargetAstroId != indicatorAstroId)
|
||||
{
|
||||
@@ -65,18 +58,6 @@ internal class Patch_PlayerMoveWalk
|
||||
{
|
||||
if (GameMain.localStar != null && CruiseAssistPlugin.SelectTargetStar.id == GameMain.localStar.id)
|
||||
{
|
||||
if (CruiseAssistPlugin.SelectTargetPlanet == null && GameMain.localPlanet != null)
|
||||
{
|
||||
CruiseAssistPlugin.SelectTargetStar = null;
|
||||
CruiseAssistPlugin.SelectTargetAstroId = 0;
|
||||
GameMain.mainPlayer.navigation.indicatorAstroId = 0;
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.SetInactive();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (CruiseAssistPlugin.SelectTargetPlanet != null)
|
||||
{
|
||||
if (GameMain.localPlanet != null && CruiseAssistPlugin.SelectTargetPlanet.id == GameMain.localPlanet.id)
|
||||
@@ -95,6 +76,17 @@ internal class Patch_PlayerMoveWalk
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GameMain.localPlanet != null)
|
||||
{
|
||||
CruiseAssistPlugin.SelectTargetStar = null;
|
||||
CruiseAssistPlugin.SelectTargetAstroId = 0;
|
||||
GameMain.mainPlayer.navigation.indicatorAstroId = 0;
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.SetInactive();
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (CruiseAssistPlugin.ReticuleTargetPlanet != null)
|
||||
{
|
||||
CruiseAssistPlugin.TargetPlanet = CruiseAssistPlugin.ReticuleTargetPlanet;
|
||||
@@ -157,5 +149,4 @@ internal class Patch_PlayerMoveWalk
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,16 +14,24 @@ internal class Patch_UISailPanel
|
||||
public static IEnumerable<CodeInstruction> OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
var codeMatcher = new CodeMatcher(instructions);
|
||||
codeMatcher.MatchForward(true, new CodeMatch(OpCodes.Ldarg_0));
|
||||
codeMatcher.InsertAndAdvance(
|
||||
codeMatcher.MatchForward(true,
|
||||
new CodeMatch(OpCodes.Ldarg_0)
|
||||
).InsertAndAdvance(
|
||||
Transpilers.EmitDelegate<Action>(delegate
|
||||
{
|
||||
CruiseAssistPlugin.ReticuleTargetPlanet = null;
|
||||
CruiseAssistPlugin.ReticuleTargetStar = null;
|
||||
})
|
||||
);
|
||||
codeMatcher.MatchForward(true, new CodeMatch(OpCodes.Bge_Un), new CodeMatch(OpCodes.Ldloc_S), new CodeMatch(OpCodes.Stloc_S), new CodeMatch(OpCodes.Ldc_I4_1), new CodeMatch(OpCodes.Stloc_S), new CodeMatch(OpCodes.Ldloc_S), new CodeMatch(OpCodes.Stloc_S));
|
||||
codeMatcher.Advance(1).InsertAndAdvance(
|
||||
codeMatcher.MatchForward(true,
|
||||
new CodeMatch(OpCodes.Bge_Un),
|
||||
new CodeMatch(OpCodes.Ldloc_S),
|
||||
new CodeMatch(OpCodes.Stloc_S),
|
||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||
new CodeMatch(OpCodes.Stloc_S),
|
||||
new CodeMatch(OpCodes.Ldloc_S),
|
||||
new CodeMatch(OpCodes.Stloc_S)
|
||||
).Advance(1).InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Ldloc_0),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(StarData), "planets")),
|
||||
new CodeInstruction(OpCodes.Ldloc_S, 21),
|
||||
@@ -39,8 +47,8 @@ internal class Patch_UISailPanel
|
||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||
new CodeMatch(OpCodes.Stloc_S),
|
||||
new CodeMatch(OpCodes.Ldloc_S),
|
||||
new CodeMatch(OpCodes.Stloc_S));
|
||||
codeMatcher.Advance(1).InsertAndAdvance(
|
||||
new CodeMatch(OpCodes.Stloc_S)
|
||||
).Advance(1).InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Ldloc_S, 20),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(GalaxyData), "stars")),
|
||||
new CodeInstruction(OpCodes.Ldloc_S, 24),
|
||||
|
||||
@@ -833,6 +833,13 @@ public static class CruiseAssistMainUI
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistPlugin.Enable = !CruiseAssistPlugin.Enable;
|
||||
if (!CruiseAssistPlugin.Enable)
|
||||
{
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.SetInactive();
|
||||
});
|
||||
}
|
||||
NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CruiseAssist.Commons;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace CruiseAssist.UI;
|
||||
|
||||
@@ -11,7 +10,9 @@ public static class CruiseAssistStarListUI
|
||||
{
|
||||
private static GUIStyle _toolbarStyle;
|
||||
private static GUIStyle _nameLabelStyle;
|
||||
private static GUIStyle _nameLabelHighlightStyle;
|
||||
private static GUIStyle _nRangeLabelStyle;
|
||||
private static GUIStyle _nRangeLabelHighlightStyle;
|
||||
private static GUIStyle _hRangeLabelStyle;
|
||||
private static GUIStyle _nActionButtonStyle;
|
||||
private static GUIStyle _hActionButtonStyle;
|
||||
@@ -20,6 +21,7 @@ public static class CruiseAssistStarListUI
|
||||
private static GUIStyle _verticalScrollbarStyle;
|
||||
private static GUIStyle _commonButtonStyle;
|
||||
private static readonly string[] Tabs = ["Normal", "History", "Bookmark"];
|
||||
|
||||
private static readonly string[][] ButtonTexts =
|
||||
[
|
||||
["Target", "Bookmark"],
|
||||
@@ -40,19 +42,38 @@ public static class CruiseAssistStarListUI
|
||||
fixedWidth = 240f,
|
||||
stretchHeight = true,
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
alignment = TextAnchor.MiddleLeft,
|
||||
};
|
||||
_nameLabelHighlightStyle = new GUIStyle(_nameLabelStyle)
|
||||
{
|
||||
normal =
|
||||
{
|
||||
textColor = Color.cyan
|
||||
}
|
||||
};
|
||||
_nRangeLabelStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 60f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleRight
|
||||
alignment = TextAnchor.MiddleRight,
|
||||
normal = {textColor = Color.white}
|
||||
};
|
||||
_nRangeLabelHighlightStyle = new GUIStyle(_nRangeLabelStyle)
|
||||
{
|
||||
normal =
|
||||
{
|
||||
textColor = Color.cyan
|
||||
}
|
||||
};
|
||||
_hRangeLabelStyle = new GUIStyle(_nRangeLabelStyle)
|
||||
{
|
||||
fixedHeight = 40f
|
||||
};
|
||||
_hRangeLabelHighlightStyle = new GUIStyle(_hRangeLabelStyle)
|
||||
{
|
||||
fixedHeight = 40f
|
||||
};
|
||||
_nActionButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 40f,
|
||||
@@ -153,6 +174,7 @@ public static class CruiseAssistStarListUI
|
||||
ListSelected = selectedIndex;
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
ScrollPos[ListSelected] = GUILayout.BeginScrollView(ScrollPos[ListSelected], GUIStyle.none, _verticalScrollbarStyle);
|
||||
var selectTargetPlanet = CruiseAssistPlugin.SelectTargetPlanet;
|
||||
@@ -160,77 +182,23 @@ public static class CruiseAssistStarListUI
|
||||
{
|
||||
case 0:
|
||||
UpdateStarPlanetList();
|
||||
var localStar = GameMain.localStar;
|
||||
var selectTargetStar = CruiseAssistPlugin.SelectTargetStar;
|
||||
var targetStarId = selectTargetStar == null ? -1 : selectTargetStar.id;
|
||||
GameMain.galaxy.stars.Select(star => new Commons.Tuple<StarData, double>(star, (star.uPosition - GameMain.mainPlayer.uPosition).magnitude)).OrderBy(tuple => tuple.Item2).Do(delegate(Commons.Tuple<StarData, double> tuple)
|
||||
{
|
||||
var star = tuple.Item1;
|
||||
var range = tuple.Item2;
|
||||
var starName = CruiseAssistPlugin.GetStarName(star);
|
||||
var ok = false;
|
||||
if (localStar != null && star.id == localStar.id)
|
||||
{
|
||||
ok = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (star.id == targetStarId && GameMain.history.universeObserveLevel >= (range >= 14400000.0 ? 4 : 3))
|
||||
{
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
star.planets.Select(planet => new Commons.Tuple<PlanetData, double>(planet, (planet.uPosition - GameMain.mainPlayer.uPosition).magnitude)).AddItem(new Commons.Tuple<PlanetData, double>(null, (star.uPosition - GameMain.mainPlayer.uPosition).magnitude)).OrderBy(tuple2 => tuple2.Item2).Do(delegate(Commons.Tuple<PlanetData, double> tuple2)
|
||||
foreach (var celestialBody in _celestialBodies)
|
||||
{
|
||||
var selected = celestialBody.Selected;
|
||||
GUILayout.BeginHorizontal();
|
||||
var planetData = tuple2.Item1;
|
||||
var distance = tuple2.Item2;
|
||||
_nameLabelStyle.normal.textColor = Color.white;
|
||||
_nRangeLabelStyle.normal.textColor = Color.white;
|
||||
float height;
|
||||
if (planetData == null)
|
||||
{
|
||||
if (selectTargetPlanet == null && selectTargetStar != null && star.id == selectTargetStar.id)
|
||||
{
|
||||
_nameLabelStyle.normal.textColor = Color.cyan;
|
||||
_nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
}
|
||||
var name = starName;
|
||||
if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
|
||||
{
|
||||
name = (star.planets.Any(p => p.factory != null) ? VisitedMark : NonVisitMark) + name;
|
||||
}
|
||||
GUILayout.Label(name, _nameLabelStyle);
|
||||
height = _nameLabelStyle.CalcHeight(new GUIContent(name), _nameLabelStyle.fixedWidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (selectTargetPlanet != null && planetData.id == selectTargetPlanet.id)
|
||||
{
|
||||
_nameLabelStyle.normal.textColor = Color.cyan;
|
||||
_nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
}
|
||||
var name = starName + " - " + CruiseAssistPlugin.GetPlanetName(planetData);
|
||||
if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
|
||||
{
|
||||
name = (planetData.factory != null ? VisitedMark : NonVisitMark) + name;
|
||||
}
|
||||
GUILayout.Label(name, _nameLabelStyle);
|
||||
height = _nameLabelStyle.CalcHeight(new GUIContent(name), _nameLabelStyle.fixedWidth);
|
||||
}
|
||||
GUILayout.Label(celestialBody.Name, selected ? _nameLabelHighlightStyle : _nameLabelStyle);
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label(CruiseAssistMainUI.RangeToString(planetData == null ? range : distance), height < 30f ? _nRangeLabelStyle : _hRangeLabelStyle);
|
||||
if (GUILayout.Button(ActionSelected[ListSelected] == 0 ? "SET" : planetData == null ? "-" : CruiseAssistPlugin.Bookmark.Contains(planetData.id) ? "DEL" : "ADD", height < 30f ? _nActionButtonStyle : _hActionButtonStyle))
|
||||
GUILayout.Label(CruiseAssistMainUI.RangeToString(celestialBody.Range), selected ? _nRangeLabelHighlightStyle : _nRangeLabelStyle);
|
||||
if (GUILayout.Button(ActionSelected[ListSelected] == 0 ? "SET" :
|
||||
celestialBody.IsPlanet ? celestialBody.InBookmark ? "DEL" : "ADD" : "-",
|
||||
_nActionButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
var planetData = celestialBody.PlanetData;
|
||||
if (ActionSelected[ListSelected] == 0)
|
||||
{
|
||||
SelectStar(star, planetData);
|
||||
var closeStarListWhenSetTargetPlanetFlag = CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag;
|
||||
if (closeStarListWhenSetTargetPlanetFlag)
|
||||
SelectStar(celestialBody.StarData, planetData);
|
||||
if (CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag)
|
||||
{
|
||||
Show[_wIdx] = false;
|
||||
}
|
||||
@@ -239,15 +207,16 @@ public static class CruiseAssistStarListUI
|
||||
{
|
||||
if (planetData != null)
|
||||
{
|
||||
if (CruiseAssistPlugin.Bookmark.Contains(planetData.id))
|
||||
if (CruiseAssistPlugin.RemoveBookmark(planetData.id))
|
||||
{
|
||||
CruiseAssistPlugin.Bookmark.Remove(planetData.id);
|
||||
celestialBody.InBookmark = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.Bookmark.Count <= 128)
|
||||
{
|
||||
CruiseAssistPlugin.Bookmark.Add(planetData.id);
|
||||
CruiseAssistPlugin.AddBookmark(planetData.id);
|
||||
celestialBody.InBookmark = true;
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
@@ -255,47 +224,17 @@ public static class CruiseAssistStarListUI
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
_nameLabelStyle.normal.textColor = Color.white;
|
||||
_nRangeLabelStyle.normal.textColor = Color.white;
|
||||
if (selectTargetStar != null && star.id == selectTargetStar.id)
|
||||
{
|
||||
_nameLabelStyle.normal.textColor = Color.cyan;
|
||||
_nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
}
|
||||
var name = starName;
|
||||
if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
|
||||
{
|
||||
name = (star.planets.Count(p => p.factory != null) > 0 ? VisitedMark : NonVisitMark) + name;
|
||||
}
|
||||
GUILayout.Label(name, _nameLabelStyle);
|
||||
var height = _nameLabelStyle.CalcHeight(new GUIContent(name), _nameLabelStyle.fixedWidth);
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label(CruiseAssistMainUI.RangeToString(range), height < 30f ? _nRangeLabelStyle : _hRangeLabelStyle);
|
||||
if (GUILayout.Button(ActionSelected[ListSelected] == 0 ? "SET" : "-", height < 30f ? _nActionButtonStyle : _hActionButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
if (ActionSelected[ListSelected] == 0)
|
||||
{
|
||||
SelectStar(star, null);
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 1 or 2:
|
||||
{
|
||||
var highlighted = false;
|
||||
var enumBookmark = ListSelected != 1 ? CruiseAssistPlugin.Bookmark.ToList() : Enumerable.Reverse(CruiseAssistPlugin.History);
|
||||
var enumBookmark = ListSelected != 1 ? CruiseAssistPlugin.Bookmark : Enumerable.Reverse(CruiseAssistPlugin.History);
|
||||
if (ListSelected == 1 && ActionSelected[ListSelected] != 2 && CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag)
|
||||
{
|
||||
enumBookmark = enumBookmark.Distinct();
|
||||
enumBookmark = Enumerable.Reverse(CruiseAssistPlugin.HistoryDistinct);
|
||||
}
|
||||
|
||||
var listIndex = -1;
|
||||
enumBookmark.Do(delegate(int id)
|
||||
{
|
||||
@@ -311,12 +250,14 @@ public static class CruiseAssistStarListUI
|
||||
_nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
highlighted = true;
|
||||
}
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
var name = CruiseAssistPlugin.GetStarName(planetData.star) + " - " + CruiseAssistPlugin.GetPlanetName(planetData);
|
||||
if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
|
||||
{
|
||||
name = (planetData.factory != null ? VisitedMark : NonVisitMark) + name;
|
||||
}
|
||||
|
||||
GUILayout.Label(name, _nameLabelStyle);
|
||||
var height = _nameLabelStyle.CalcHeight(new GUIContent(name), _nameLabelStyle.fixedWidth);
|
||||
GUILayout.FlexibleSpace();
|
||||
@@ -348,7 +289,10 @@ public static class CruiseAssistStarListUI
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUILayout.Button(ActionSelected[ListSelected] == 0 ? "SET" : ActionSelected[ListSelected] == 2 ? ListSelected == 1 && listIndex == 0 ? "-" : "DEL" : CruiseAssistPlugin.Bookmark.Contains(id) ? "DEL" : "ADD", height < 30f ? _nActionButtonStyle : _hActionButtonStyle))
|
||||
if (GUILayout.Button(
|
||||
ActionSelected[ListSelected] == 0 ? "SET" :
|
||||
ActionSelected[ListSelected] == 2 ? ListSelected == 1 && listIndex == 0 ? "-" : "DEL" :
|
||||
CruiseAssistPlugin.Bookmark.Contains(id) ? "DEL" : "ADD", height < 30f ? _nActionButtonStyle : _hActionButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
switch (ActionSelected[ListSelected])
|
||||
@@ -408,11 +352,13 @@ public static class CruiseAssistStarListUI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.EndScrollView();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.BeginHorizontal();
|
||||
@@ -422,12 +368,14 @@ public static class CruiseAssistStarListUI
|
||||
ActionSelected[ListSelected]++;
|
||||
ActionSelected[ListSelected] %= ButtonTexts[ListSelected].Length;
|
||||
}
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
if (!CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag && GUILayout.Button("Close", _commonButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
Show[_wIdx] = false;
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
if (GUI.Button(new Rect(Rect[_wIdx].width - 16f, 1f, 16f, 16f), "", CruiseAssistMainUI.CloseButtonStyle))
|
||||
@@ -435,13 +383,13 @@ public static class CruiseAssistStarListUI
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
Show[_wIdx] = false;
|
||||
}
|
||||
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
public static void SelectStar(StarData star, PlanetData planet)
|
||||
{
|
||||
if (star == CruiseAssistPlugin.SelectTargetStar && planet == CruiseAssistPlugin.SelectTargetPlanet) return;
|
||||
_celestialBodies = null;
|
||||
CruiseAssistPlugin.SelectTargetStar = star;
|
||||
CruiseAssistPlugin.SelectTargetPlanet = planet;
|
||||
var uiGame = UIRoot.instance.uiGame;
|
||||
@@ -483,11 +431,9 @@ public static class CruiseAssistStarListUI
|
||||
GameMain.mainPlayer.navigation.indicatorAstroId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CruiseAssistPlugin.SelectTargetAstroId = GameMain.mainPlayer.navigation.indicatorAstroId;
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.SetTargetAstroId(CruiseAssistPlugin.SelectTargetAstroId);
|
||||
});
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension) { extension.SetTargetAstroId(CruiseAssistPlugin.SelectTargetAstroId); });
|
||||
}
|
||||
|
||||
private static void UIStarmap_OnStarClick(UIStarmap starmap, UIStarmapStar star)
|
||||
@@ -498,10 +444,12 @@ public static class CruiseAssistStarListUI
|
||||
{
|
||||
starmap.screenCameraController.DisablePositionLock();
|
||||
}
|
||||
|
||||
starmap.focusPlanet = null;
|
||||
starmap.focusStar = star;
|
||||
starmap._lastClickTime = 0.0;
|
||||
}
|
||||
|
||||
starmap.forceUpdateCursorView = true;
|
||||
}
|
||||
|
||||
@@ -513,10 +461,12 @@ public static class CruiseAssistStarListUI
|
||||
{
|
||||
starmap.screenCameraController.DisablePositionLock();
|
||||
}
|
||||
|
||||
starmap.focusPlanet = planet;
|
||||
starmap.focusStar = null;
|
||||
starmap._lastClickTime= 0.0;
|
||||
starmap._lastClickTime = 0.0;
|
||||
}
|
||||
|
||||
starmap.forceUpdateCursorView = true;
|
||||
}
|
||||
|
||||
@@ -524,6 +474,8 @@ public static class CruiseAssistStarListUI
|
||||
{
|
||||
_celestialBodies = null;
|
||||
_stars = null;
|
||||
_localStarPlanets = null;
|
||||
_selectedStarPlanets = null;
|
||||
_nextCheckTick = 0;
|
||||
_lastLocalStar = null;
|
||||
_lastLocalPlanet = null;
|
||||
@@ -536,42 +488,23 @@ public static class CruiseAssistStarListUI
|
||||
var num = (int)(value > 0.0 ? value + 0.5 : value - 0.5);
|
||||
if (func == 23 && num > 2)
|
||||
{
|
||||
_celestialBodies = null;
|
||||
_stars = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateStarPlanetList()
|
||||
{
|
||||
var gameMain = GameMain.instance;
|
||||
if (gameMain == null) return;
|
||||
var gameData = GameMain.data;
|
||||
if (gameData == null) return;
|
||||
if (_stars == null) LoadAllStars();
|
||||
if (_celestialBodies == null) LoadCurrentStarPlanets();
|
||||
var localPlanet = gameData.localPlanet;
|
||||
var mainPlayer = gameData.mainPlayer;
|
||||
if (localPlanet != null && localPlanet == _lastLocalPlanet)
|
||||
if (_stars == null)
|
||||
{
|
||||
if (gameMain.timei < _nextCheckTick) return;
|
||||
_nextCheckTick = gameMain.timei + 300;
|
||||
LoadAllStars();
|
||||
LoadLocalStarPlanets();
|
||||
LoadSelectedStarPlanets();
|
||||
SortCelestialBodies();
|
||||
return;
|
||||
}
|
||||
_lastLocalPlanet = localPlanet;
|
||||
_lastPlayerPos = mainPlayer.uPosition;
|
||||
_nextCheckTick = gameMain.timei + 300;
|
||||
var localStar = gameData.localStar;
|
||||
if (localStar == _lastLocalStar)
|
||||
{
|
||||
if ((mainPlayer.uPosition - _lastPlayerPos).sqrMagnitude < 2000.0 * 2000.0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
_lastLocalStar = localStar;
|
||||
if (localStar != null)
|
||||
LoadCurrentStarPlanets();
|
||||
}
|
||||
SortStars();
|
||||
|
||||
var reorder = LoadLocalStarPlanets();
|
||||
if (LoadSelectedStarPlanets() || reorder) SortCelestialBodies();
|
||||
}
|
||||
|
||||
private static void LoadAllStars()
|
||||
@@ -593,54 +526,125 @@ public static class CruiseAssistStarListUI
|
||||
}
|
||||
}
|
||||
|
||||
private static void LoadCurrentStarPlanets()
|
||||
private static bool LoadLocalStarPlanets()
|
||||
{
|
||||
_celestialBodies = [.._stars];
|
||||
var localPlanet = GameMain.data.localPlanet;
|
||||
if (localPlanet != null && localPlanet == _lastLocalPlanet)
|
||||
{
|
||||
if (GameMain.instance.timei < _nextCheckTick) return false;
|
||||
_nextCheckTick = GameMain.instance.timei + 300;
|
||||
return true;
|
||||
}
|
||||
_lastLocalPlanet = GameMain.data.localPlanet;
|
||||
|
||||
var localStar = GameMain.localStar;
|
||||
var markVisitedFlag = CruiseAssistPlugin.Conf.MarkVisitedFlag;
|
||||
if (localStar != null)
|
||||
var mainPlayer = GameMain.data.mainPlayer;
|
||||
var currentPos = mainPlayer.uPosition;
|
||||
if (localStar == _lastLocalStar)
|
||||
{
|
||||
if (GameMain.instance.timei < _nextCheckTick) return false;
|
||||
if ((currentPos - _lastPlayerPos).sqrMagnitude < 2000.0 * 2000.0)
|
||||
return true;
|
||||
}
|
||||
|
||||
_lastLocalStar = localStar;
|
||||
_lastPlayerPos = currentPos;
|
||||
_nextCheckTick = GameMain.instance.timei + 300;
|
||||
|
||||
if (localStar == null)
|
||||
{
|
||||
if (_localStarPlanets is { Count: 0 }) return false;
|
||||
_localStarPlanets = [];
|
||||
return true;
|
||||
}
|
||||
|
||||
_localStarPlanets = [];
|
||||
var markVisitedFlag = CruiseAssistPlugin.Conf.MarkVisitedFlag;
|
||||
foreach (var planet in localStar.planets)
|
||||
{
|
||||
if (planet == null) continue;
|
||||
var visted = markVisitedFlag && planet.factory != null;
|
||||
_celestialBodies.Add(new CelestialBody
|
||||
_localStarPlanets.Add(new CelestialBody
|
||||
{
|
||||
PlanetData = planet,
|
||||
Name = (visted ? VisitedMark : NonVisitMark) + CruiseAssistPlugin.GetPlanetName(planet),
|
||||
Pos = planet.uPosition,
|
||||
IsPlanet = true,
|
||||
Visited = visted,
|
||||
IsPlanet = true
|
||||
InBookmark = CruiseAssistPlugin.HasBookmark(planet.id)
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool LoadSelectedStarPlanets()
|
||||
{
|
||||
var selectedStar = CruiseAssistPlugin.SelectTargetStar;
|
||||
if (selectedStar == null || selectedStar == localStar) return;
|
||||
if (selectedStar == _lastSelectedStar)
|
||||
{
|
||||
if (_selectedStarPlanets != null) return false;
|
||||
_selectedStarPlanets = [];
|
||||
return true;
|
||||
}
|
||||
_lastSelectedStar = selectedStar;
|
||||
if (selectedStar == null || selectedStar == GameMain.localStar)
|
||||
{
|
||||
if (_selectedStarPlanets is { Count: 0 }) return false;
|
||||
_selectedStarPlanets = [];
|
||||
return true;
|
||||
}
|
||||
|
||||
var range = (selectedStar.uPosition - GameMain.mainPlayer.uPosition).magnitude;
|
||||
if (GameMain.history.universeObserveLevel < (range >= 14400000.0 ? 4 : 3)) return;
|
||||
if (GameMain.history.universeObserveLevel < (range >= 14400000.0 ? 4 : 3))
|
||||
{
|
||||
if (_selectedStarPlanets is { Count: 0 }) return false;
|
||||
_selectedStarPlanets = [];
|
||||
return true;
|
||||
}
|
||||
|
||||
_selectedStarPlanets = [];
|
||||
var markVisitedFlag = CruiseAssistPlugin.Conf.MarkVisitedFlag;
|
||||
foreach (var planet in selectedStar.planets)
|
||||
{
|
||||
if (planet == null) continue;
|
||||
var visted = markVisitedFlag && planet.factory != null;
|
||||
_celestialBodies.Add(new CelestialBody
|
||||
_selectedStarPlanets.Add(new CelestialBody
|
||||
{
|
||||
PlanetData = planet,
|
||||
Name = (visted ? VisitedMark : NonVisitMark) + CruiseAssistPlugin.GetPlanetName(planet),
|
||||
Pos = planet.uPosition,
|
||||
IsPlanet = true,
|
||||
Visited = visted,
|
||||
IsPlanet = true
|
||||
InBookmark = CruiseAssistPlugin.HasBookmark(planet.id)
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void SortCelestialBodies()
|
||||
{
|
||||
_celestialBodies = [.._stars, .._localStarPlanets, .._selectedStarPlanets];
|
||||
var uPos = GameMain.mainPlayer.uPosition;
|
||||
var selectedId = CruiseAssistPlugin.SelectTargetPlanet?.id ?? 0;
|
||||
var selectedStarId = CruiseAssistPlugin.SelectTargetStar?.id ?? 0;
|
||||
foreach (var body in _celestialBodies)
|
||||
{
|
||||
if (body.IsPlanet)
|
||||
{
|
||||
body.Pos = body.PlanetData.uPosition;
|
||||
body.Range = (body.Pos - uPos).magnitude - body.PlanetData.realRadius;
|
||||
body.Selected = body.PlanetData.id == selectedId || (body.PlanetData.star?.id ?? 0) == selectedStarId;
|
||||
}
|
||||
else
|
||||
{
|
||||
body.Pos = body.StarData.uPosition;
|
||||
body.Range = (body.Pos - uPos).magnitude - (body.StarData.viewRadius - 120f);
|
||||
body.Selected = body.StarData.id == selectedStarId;
|
||||
}
|
||||
}
|
||||
|
||||
private static void SortStars()
|
||||
{
|
||||
var uPos = GameMain.mainPlayer.uPosition;
|
||||
foreach (var body in _celestialBodies)
|
||||
{
|
||||
body.Range = (body.Pos - uPos).magnitude;
|
||||
}
|
||||
_celestialBodies.Sort((s1, s2) => s1.Range.CompareTo(s2.Range));
|
||||
}
|
||||
|
||||
@@ -651,35 +655,45 @@ public static class CruiseAssistStarListUI
|
||||
public string Name;
|
||||
public VectorLF3 Pos;
|
||||
public double Range;
|
||||
public bool Visited;
|
||||
public bool IsPlanet;
|
||||
public bool Selected;
|
||||
public bool Visited;
|
||||
public bool InBookmark;
|
||||
}
|
||||
|
||||
private static List<CelestialBody> _celestialBodies;
|
||||
private static List<CelestialBody> _stars;
|
||||
private static List<CelestialBody> _localStarPlanets;
|
||||
private static List<CelestialBody> _selectedStarPlanets;
|
||||
|
||||
private static long _nextCheckTick;
|
||||
private static StarData _lastLocalStar;
|
||||
private static PlanetData _lastLocalPlanet;
|
||||
private static StarData _lastSelectedStar;
|
||||
private static VectorLF3 _lastPlayerPos = VectorLF3.zero;
|
||||
private static int _wIdx;
|
||||
public const float WindowWidth = 400f;
|
||||
public const float WindowHeight = 480f;
|
||||
public static readonly bool[] Show = new bool[2];
|
||||
|
||||
public static readonly Rect[] Rect =
|
||||
[
|
||||
new Rect(0f, 0f, 400f, 480f),
|
||||
new Rect(0f, 0f, 400f, 480f)
|
||||
];
|
||||
|
||||
public static int ListSelected;
|
||||
private static readonly int[] ActionSelected = new int[3];
|
||||
private static readonly float[] LastCheckWindowLeft = [float.MinValue, float.MinValue];
|
||||
private static readonly float[] LastCheckWindowTop = [float.MinValue, float.MinValue];
|
||||
|
||||
private static readonly Vector2[] ScrollPos =
|
||||
[
|
||||
Vector2.zero,
|
||||
Vector2.zero,
|
||||
Vector2.zero
|
||||
];
|
||||
|
||||
private const string VisitedMark = "● ";
|
||||
private const string NonVisitMark = "";
|
||||
}
|
||||
Reference in New Issue
Block a user