mirror of
https://github.com/soarqin/DSP_Mods_TO.git
synced 2025-12-14 18:43:29 +08:00
Progression of optimizations
This commit is contained in:
@@ -47,16 +47,30 @@ public class CruiseAssistPlugin : BaseUnityPlugin
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
if (DSPGame.IsMenuDemo || GameMain.mainPlayer == null) return;
|
||||
if (DSPGame.IsMenuDemo) return;
|
||||
var mainPlayer = GameMain.mainPlayer;
|
||||
if (mainPlayer == null) return;
|
||||
if (UIMechaEditor.isOpened) return;
|
||||
var uiGame = UIRoot.instance.uiGame;
|
||||
if (!_initialized)
|
||||
{
|
||||
_initialized = true;
|
||||
CruiseAssistMainUI.OnInit();
|
||||
CruiseAssistConfigUI.OnInit();
|
||||
CruiseAssistStarListUI.OnInit();
|
||||
CruiseAssistDebugUI.OnInit();
|
||||
}
|
||||
|
||||
var uiRoot = UIRoot.instance;
|
||||
var uiGame = uiRoot.uiGame;
|
||||
if (!uiGame.guideComplete || uiGame.techTree.active || uiGame.escMenu.active || uiGame.dysonEditor.active || uiGame.hideAllUI0 || uiGame.hideAllUI1) return;
|
||||
if (UIMilkyWayLoadingSplash.instance != null && UIMilkyWayLoadingSplash.instance.active) return;
|
||||
if (UIRoot.instance.uiMilkyWay != null && UIRoot.instance.uiMilkyWay.active) return;
|
||||
if (!(GameMain.mainPlayer.sailing || uiGame.starmap.active || (Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag && TargetSelected))) return;
|
||||
var uiRootUIMilkyWay = uiRoot.uiMilkyWay;
|
||||
if (uiRootUIMilkyWay != null && uiRootUIMilkyWay.active) return;
|
||||
var starmapActive = uiGame.starmap.active;
|
||||
if (!(mainPlayer.sailing || starmapActive || (Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag && TargetSelected))) return;
|
||||
if (Seed != GameMain.galaxy.seed)
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.ChangeSeed);
|
||||
CruiseAssistMainUI.WIdx = uiGame.starmap.active ? 1 : 0;
|
||||
CruiseAssistMainUI.WIdx = starmapActive ? 1 : 0;
|
||||
var scale = CruiseAssistMainUI.Scale / 100f;
|
||||
GUIUtility.ScaleAroundPivot(new Vector2(scale, scale), Vector2.zero);
|
||||
CruiseAssistMainUI.OnGUI();
|
||||
@@ -91,7 +105,7 @@ public class CruiseAssistPlugin : BaseUnityPlugin
|
||||
});
|
||||
}
|
||||
|
||||
private bool ResetInput(Rect rect, float scale)
|
||||
private static bool ResetInput(Rect rect, float scale)
|
||||
{
|
||||
var num = rect.xMin * scale;
|
||||
var num2 = rect.xMax * scale;
|
||||
@@ -109,59 +123,35 @@ public class CruiseAssistPlugin : BaseUnityPlugin
|
||||
}
|
||||
|
||||
public static bool Enable = true;
|
||||
|
||||
public static bool TargetSelected = false;
|
||||
|
||||
public static StarData ReticuleTargetStar = null;
|
||||
|
||||
public static PlanetData ReticuleTargetPlanet = null;
|
||||
|
||||
public static StarData SelectTargetStar = null;
|
||||
|
||||
public static PlanetData SelectTargetPlanet = null;
|
||||
|
||||
public static int SelectTargetAstroId = 0;
|
||||
|
||||
public static StarData TargetStar = null;
|
||||
|
||||
public static PlanetData TargetPlanet = null;
|
||||
|
||||
public static VectorLF3 TargetUPos = VectorLF3.zero;
|
||||
|
||||
public static double TargetRange = 0.0;
|
||||
|
||||
public static CruiseAssistState State = CruiseAssistState.Inactive;
|
||||
|
||||
public static bool Interrupt = false;
|
||||
|
||||
public static int Seed = -1;
|
||||
|
||||
public static List<int> History = new List<int>();
|
||||
|
||||
public static List<int> Bookmark = new List<int>();
|
||||
|
||||
public static 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 class Conf
|
||||
{
|
||||
public static bool MarkVisitedFlag = true;
|
||||
|
||||
public static bool SelectFocusFlag = true;
|
||||
|
||||
public static bool HideDuplicateHistoryFlag = true;
|
||||
|
||||
public static bool AutoDisableLockCursorFlag = false;
|
||||
|
||||
public static bool ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag = true;
|
||||
|
||||
public static bool CloseStarListWhenSetTargetPlanetFlag = false;
|
||||
|
||||
public static bool HideBottomCloseButtonFlag = true;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,80 @@
|
||||
using System;
|
||||
using CruiseAssist.Enums;
|
||||
using CruiseAssist.Enums;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CruiseAssist.UI;
|
||||
|
||||
public static class CruiseAssistConfigUI
|
||||
{
|
||||
public static void OnInit()
|
||||
{
|
||||
_labelStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 120f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
_toolbarButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseToolbarButtonStyle)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12
|
||||
};
|
||||
_uiScaleStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 60f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
_horizontalSliderStyle = new GUIStyle(CruiseAssistMainUI.BaseHorizontalSliderStyle)
|
||||
{
|
||||
fixedWidth = 180f,
|
||||
margin =
|
||||
{
|
||||
top = 10
|
||||
},
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
_horizontalSliderThunbStyle = new GUIStyle(CruiseAssistMainUI.BaseHorizontalSliderThumbStyle)
|
||||
{
|
||||
border = new RectOffset(1, 1, 8, 8)
|
||||
};
|
||||
_percentStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 40f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
_toggleStyle = new GUIStyle(CruiseAssistMainUI.BaseToggleStyle)
|
||||
{
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.LowerLeft
|
||||
};
|
||||
_setButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 60f,
|
||||
fixedHeight = 18f,
|
||||
margin =
|
||||
{
|
||||
top = 6
|
||||
},
|
||||
fontSize = 12
|
||||
};
|
||||
_closeButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12
|
||||
};
|
||||
}
|
||||
|
||||
public static void OnGUI()
|
||||
{
|
||||
_wIdx = CruiseAssistMainUI.WIdx;
|
||||
Rect[_wIdx] = GUILayout.Window(99030293, Rect[_wIdx], WindowFunction, "CruiseAssist - Config", CruiseAssistMainUI.WindowStyle, Array.Empty<GUILayoutOption>());
|
||||
Rect[_wIdx] = GUILayout.Window(99030293, Rect[_wIdx], WindowFunction, "CruiseAssist - Config", CruiseAssistMainUI.WindowStyle);
|
||||
var num = CruiseAssistMainUI.Scale / 100f;
|
||||
if (Screen.width / num < Rect[_wIdx].xMax)
|
||||
{
|
||||
@@ -40,35 +105,21 @@ public static class CruiseAssistConfigUI
|
||||
|
||||
private static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label("Main Window Style :", new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 120f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
}, Array.Empty<GUILayoutOption>());
|
||||
var guistyle = new GUIStyle(CruiseAssistMainUI.BaseToolbarButtonStyle)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12
|
||||
};
|
||||
var array = new[] { "FULL", "MINI" };
|
||||
var num = CruiseAssistMainUI.ViewMode == CruiseAssistMainUIViewMode.Full ? 0 : 1;
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Main Window Style :", _labelStyle);
|
||||
var viewMode = CruiseAssistMainUI.ViewMode == CruiseAssistMainUIViewMode.Full ? 0 : 1;
|
||||
GUI.changed = false;
|
||||
var num2 = GUILayout.Toolbar(num, array, guistyle, Array.Empty<GUILayoutOption>());
|
||||
var changed = GUI.changed;
|
||||
if (changed)
|
||||
var value = GUILayout.Toolbar(viewMode, ViewModeTexts, _toolbarButtonStyle);
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
}
|
||||
if (num2 != num)
|
||||
if (value != viewMode)
|
||||
{
|
||||
if (num2 != 0)
|
||||
if (value != 0)
|
||||
{
|
||||
if (num2 == 1)
|
||||
if (value == 1)
|
||||
{
|
||||
CruiseAssistMainUI.ViewMode = CruiseAssistMainUIViewMode.Mini;
|
||||
}
|
||||
@@ -80,128 +131,78 @@ public static class CruiseAssistConfigUI
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label("UI Scale :", new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 60f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
}, Array.Empty<GUILayoutOption>());
|
||||
var guistyle2 = new GUIStyle(CruiseAssistMainUI.BaseHorizontalSliderStyle)
|
||||
{
|
||||
fixedWidth = 180f,
|
||||
margin =
|
||||
{
|
||||
top = 10
|
||||
},
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
var guistyle3 = new GUIStyle(CruiseAssistMainUI.BaseHorizontalSliderThumbStyle)
|
||||
{
|
||||
border = new RectOffset(1, 1, 8, 8)
|
||||
};
|
||||
TempScale = GUILayout.HorizontalSlider(TempScale, 80f, 240f, guistyle2, guistyle3, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("UI Scale :", _uiScaleStyle);
|
||||
TempScale = GUILayout.HorizontalSlider(TempScale, 80f, 240f, _horizontalSliderStyle, _horizontalSliderThunbStyle);
|
||||
TempScale = (int)TempScale / 5 * 5;
|
||||
var guistyle4 = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 40f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
GUILayout.Label(TempScale.ToString("0") + "%", guistyle4, Array.Empty<GUILayoutOption>());
|
||||
var ok = GUILayout.Button("SET", new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 60f,
|
||||
fixedHeight = 18f,
|
||||
margin =
|
||||
{
|
||||
top = 6
|
||||
},
|
||||
fontSize = 12
|
||||
}, Array.Empty<GUILayoutOption>());
|
||||
if (ok)
|
||||
GUILayout.Label(TempScale.ToString("0") + "%", _percentStyle);
|
||||
if (GUILayout.Button("SET", _setButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.Scale = TempScale;
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
var guistyle5 = new GUIStyle(CruiseAssistMainUI.BaseToggleStyle)
|
||||
{
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.LowerLeft
|
||||
};
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.MarkVisitedFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.MarkVisitedFlag, "Mark the visited system and planet.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
CruiseAssistPlugin.Conf.MarkVisitedFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.MarkVisitedFlag, "Mark the visited system and planet.".Translate(), _toggleStyle);
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.SelectFocusFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.SelectFocusFlag, "Focus when select target.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
CruiseAssistPlugin.Conf.SelectFocusFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.SelectFocusFlag, "Focus when select target.".Translate(), _toggleStyle);
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag, "Hide duplicate history.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag, "Hide duplicate history.".Translate(), _toggleStyle);
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag, "Disable lock cursor when starting sail mode.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag, "Disable lock cursor when starting sail mode.".Translate(), _toggleStyle);
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag, "Show main window when target selected, even not sail mode.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag, "Show main window when target selected, even not sail mode.".Translate(), _toggleStyle);
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag, "Close StarList when set target planet.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag, "Close StarList when set target planet.".Translate(), _toggleStyle);
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag, "Hide bottom close button.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag, "Hide bottom close button.".Translate(), _toggleStyle);
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
var guistyle6 = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12
|
||||
};
|
||||
ok = !CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag && GUILayout.Button("Close", guistyle6, Array.Empty<GUILayoutOption>());
|
||||
if (ok)
|
||||
if (!CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag && GUILayout.Button("Close", _closeButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
Show[_wIdx] = false;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
ok = GUI.Button(new Rect(Rect[_wIdx].width - 16f, 1f, 16f, 16f), "", CruiseAssistMainUI.CloseButtonStyle);
|
||||
if (ok)
|
||||
if (GUI.Button(new Rect(Rect[_wIdx].width - 16f, 1f, 16f, 16f), "", CruiseAssistMainUI.CloseButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
Show[_wIdx] = false;
|
||||
@@ -210,21 +211,25 @@ public static class CruiseAssistConfigUI
|
||||
}
|
||||
|
||||
private static int _wIdx;
|
||||
|
||||
public const float WindowWidth = 400f;
|
||||
|
||||
public const float WindowHeight = 400f;
|
||||
|
||||
public static readonly bool[] Show = new bool[2];
|
||||
|
||||
public static readonly Rect[] Rect = {
|
||||
public static readonly Rect[] Rect =
|
||||
[
|
||||
new Rect(0f, 0f, 400f, 400f),
|
||||
new Rect(0f, 0f, 400f, 400f)
|
||||
};
|
||||
|
||||
private static readonly float[] LastCheckWindowLeft = { float.MinValue, float.MinValue };
|
||||
|
||||
private static readonly float[] LastCheckWindowTop = { float.MinValue, float.MinValue };
|
||||
|
||||
];
|
||||
private static readonly float[] LastCheckWindowLeft = [float.MinValue, float.MinValue];
|
||||
private static readonly float[] LastCheckWindowTop = [float.MinValue, float.MinValue];
|
||||
public static float TempScale;
|
||||
private static GUIStyle _labelStyle;
|
||||
private static GUIStyle _toolbarButtonStyle;
|
||||
private static GUIStyle _uiScaleStyle;
|
||||
private static GUIStyle _horizontalSliderStyle;
|
||||
private static GUIStyle _horizontalSliderThunbStyle;
|
||||
private static GUIStyle _percentStyle;
|
||||
private static GUIStyle _toggleStyle;
|
||||
private static GUIStyle _setButtonStyle;
|
||||
private static GUIStyle _closeButtonStyle;
|
||||
private static readonly string[] ViewModeTexts = ["FULL", "MINI"];
|
||||
}
|
||||
@@ -7,13 +7,20 @@ namespace CruiseAssist.UI;
|
||||
|
||||
public static class CruiseAssistDebugUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
public static void OnInit()
|
||||
{
|
||||
var guistyle = new GUIStyle(GUI.skin.window)
|
||||
_windowStyle = new GUIStyle(GUI.skin.window)
|
||||
{
|
||||
fontSize = 11
|
||||
};
|
||||
Rect = GUILayout.Window(99030294, Rect, WindowFunction, "CruiseAssist - Debug", guistyle, Array.Empty<GUILayoutOption>());
|
||||
_debugStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 12
|
||||
};
|
||||
}
|
||||
public static void OnGUI()
|
||||
{
|
||||
Rect = GUILayout.Window(99030294, Rect, WindowFunction, "CruiseAssist - Debug", _windowStyle, Array.Empty<GUILayoutOption>());
|
||||
if (Screen.width < Rect.xMax)
|
||||
{
|
||||
Rect.x = Screen.width - Rect.width;
|
||||
@@ -45,48 +52,42 @@ public static class CruiseAssistDebugUI
|
||||
private static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var guistyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 12
|
||||
};
|
||||
_scrollPos = GUILayout.BeginScrollView(_scrollPos, Array.Empty<GUILayoutOption>());
|
||||
var reticuleTargetStar = CruiseAssistPlugin.ReticuleTargetStar;
|
||||
GUILayout.Label($"CruiseAssistPlugin.ReticuleTargetStar.id={(reticuleTargetStar != null ? new int?(reticuleTargetStar.id) : null)}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"CruiseAssistPlugin.ReticuleTargetStar.id={(reticuleTargetStar != null ? new int?(reticuleTargetStar.id) : null)}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
var reticuleTargetPlanet = CruiseAssistPlugin.ReticuleTargetPlanet;
|
||||
GUILayout.Label($"CruiseAssistPlugin.ReticuleTargetPlanet.id={(reticuleTargetPlanet != null ? new int?(reticuleTargetPlanet.id) : null)}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"CruiseAssistPlugin.ReticuleTargetPlanet.id={(reticuleTargetPlanet != null ? new int?(reticuleTargetPlanet.id) : null)}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
var selectTargetStar = CruiseAssistPlugin.SelectTargetStar;
|
||||
GUILayout.Label($"CruiseAssistPlugin.SelectTargetStar.id={(selectTargetStar != null ? new int?(selectTargetStar.id) : null)}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"CruiseAssistPlugin.SelectTargetStar.id={(selectTargetStar != null ? new int?(selectTargetStar.id) : null)}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
var selectTargetPlanet = CruiseAssistPlugin.SelectTargetPlanet;
|
||||
GUILayout.Label($"CruiseAssistPlugin.SelectTargetPlanet.id={(selectTargetPlanet != null ? new int?(selectTargetPlanet.id) : null)}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.navigation.indicatorAstroId={GameMain.mainPlayer.navigation.indicatorAstroId}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input0.w={GameMain.mainPlayer.controller.input0.w}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input0.x={GameMain.mainPlayer.controller.input0.x}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input0.y={GameMain.mainPlayer.controller.input0.y}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input0.z={GameMain.mainPlayer.controller.input0.z}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input1.w={GameMain.mainPlayer.controller.input1.w}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input1.x={GameMain.mainPlayer.controller.input1.x}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input1.y={GameMain.mainPlayer.controller.input1.y}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input1.z={GameMain.mainPlayer.controller.input1.z}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"VFInput._sailSpeedUp={VFInput._sailSpeedUp}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"CruiseAssistPlugin.Enable={CruiseAssistPlugin.Enable}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"CruiseAssistPlugin.History={CruiseAssistPlugin.History.Count()}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label("CruiseAssistPlugin.History=" + ListUtils.ToString(CruiseAssistPlugin.History), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GUI.skin.window.margin.top={GUI.skin.window.margin.top}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GUI.skin.window.border.top={GUI.skin.window.border.top}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GUI.skin.window.padding.top={GUI.skin.window.padding.top}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GUI.skin.window.overflow.top={GUI.skin.window.overflow.top}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"CruiseAssistPlugin.SelectTargetPlanet.id={(selectTargetPlanet != null ? new int?(selectTargetPlanet.id) : null)}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.navigation.indicatorAstroId={GameMain.mainPlayer.navigation.indicatorAstroId}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input0.w={GameMain.mainPlayer.controller.input0.w}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input0.x={GameMain.mainPlayer.controller.input0.x}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input0.y={GameMain.mainPlayer.controller.input0.y}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input0.z={GameMain.mainPlayer.controller.input0.z}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input1.w={GameMain.mainPlayer.controller.input1.w}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input1.x={GameMain.mainPlayer.controller.input1.x}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input1.y={GameMain.mainPlayer.controller.input1.y}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input1.z={GameMain.mainPlayer.controller.input1.z}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"VFInput._sailSpeedUp={VFInput._sailSpeedUp}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"CruiseAssistPlugin.Enable={CruiseAssistPlugin.Enable}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"CruiseAssistPlugin.History={CruiseAssistPlugin.History.Count()}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label("CruiseAssistPlugin.History=" + ListUtils.ToString(CruiseAssistPlugin.History), _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GUI.skin.window.margin.top={GUI.skin.window.margin.top}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GUI.skin.window.border.top={GUI.skin.window.border.top}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GUI.skin.window.padding.top={GUI.skin.window.padding.top}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GUI.skin.window.overflow.top={GUI.skin.window.overflow.top}", _debugStyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndScrollView();
|
||||
GUILayout.EndVertical();
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
public static bool Show = false;
|
||||
|
||||
public static Rect Rect = new Rect(0f, 0f, 400f, 400f);
|
||||
|
||||
public static Rect Rect = new(0f, 0f, 400f, 400f);
|
||||
private static float _lastCheckWindowLeft = float.MinValue;
|
||||
|
||||
private static float _lastCheckWindowTop = float.MinValue;
|
||||
|
||||
private static Vector2 _scrollPos = Vector2.zero;
|
||||
private static GUIStyle _windowStyle;
|
||||
private static GUIStyle _debugStyle;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,62 +1,140 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CruiseAssist.UI;
|
||||
|
||||
public class CruiseAssistStarListUI
|
||||
public static class CruiseAssistStarListUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
private static GUIStyle _toolbarStyle;
|
||||
private static GUIStyle _nameLabelStyle;
|
||||
private static GUIStyle _nRangeLabelStyle;
|
||||
private static GUIStyle _hRangeLabelStyle;
|
||||
private static GUIStyle _nActionButtonStyle;
|
||||
private static GUIStyle _hActionButtonStyle;
|
||||
private static GUIStyle _nSortButtonStyle;
|
||||
private static GUIStyle _hSortButtonStyle;
|
||||
private static GUIStyle _verticalScrollbarStyle;
|
||||
private static GUIStyle _commonButtonStyle;
|
||||
private static readonly string[] Tabs = ["Normal", "History", "Bookmark"];
|
||||
private static readonly string[][] ButtonTexts =
|
||||
[
|
||||
["Target", "Bookmark"],
|
||||
["Target", "Bookmark", "Delete"],
|
||||
["Target", "Sort", "Delete"]
|
||||
];
|
||||
|
||||
public static void OnInit()
|
||||
{
|
||||
wIdx = CruiseAssistMainUI.WIdx;
|
||||
Rect[wIdx] = GUILayout.Window(99030292, Rect[wIdx], WindowFunction, "CruiseAssist - StarList", CruiseAssistMainUI.WindowStyle, Array.Empty<GUILayoutOption>());
|
||||
var scale = CruiseAssistMainUI.Scale / 100f;
|
||||
if (Screen.width / scale < Rect[wIdx].xMax)
|
||||
{
|
||||
Rect[wIdx].x = Screen.width / scale - Rect[wIdx].width;
|
||||
}
|
||||
|
||||
if (Rect[wIdx].x < 0f)
|
||||
{
|
||||
Rect[wIdx].x = 0f;
|
||||
}
|
||||
|
||||
if (Screen.height / scale < Rect[wIdx].yMax)
|
||||
{
|
||||
Rect[wIdx].y = Screen.height / scale - Rect[wIdx].height;
|
||||
}
|
||||
|
||||
if (Rect[wIdx].y < 0f)
|
||||
{
|
||||
Rect[wIdx].y = 0f;
|
||||
}
|
||||
|
||||
if (lastCheckWindowLeft[wIdx] != float.MinValue)
|
||||
{
|
||||
if (Rect[wIdx].x != lastCheckWindowLeft[wIdx] || Rect[wIdx].y != lastCheckWindowTop[wIdx])
|
||||
{
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
lastCheckWindowLeft[wIdx] = Rect[wIdx].x;
|
||||
lastCheckWindowTop[wIdx] = Rect[wIdx].y;
|
||||
}
|
||||
|
||||
public static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var guistyle = new GUIStyle(CruiseAssistMainUI.BaseToolbarButtonStyle)
|
||||
_toolbarStyle = new GUIStyle(CruiseAssistMainUI.BaseToolbarButtonStyle)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12
|
||||
};
|
||||
var array = new[] { "Normal", "History", "Bookmark" };
|
||||
_nameLabelStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 240f,
|
||||
stretchHeight = true,
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
_nRangeLabelStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 60f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleRight
|
||||
};
|
||||
_hRangeLabelStyle = new GUIStyle(_nRangeLabelStyle)
|
||||
{
|
||||
fixedHeight = 40f
|
||||
};
|
||||
_nActionButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 40f,
|
||||
fixedHeight = 18f,
|
||||
margin =
|
||||
{
|
||||
top = 6
|
||||
},
|
||||
fontSize = 12
|
||||
};
|
||||
_hActionButtonStyle = new GUIStyle(_nActionButtonStyle)
|
||||
{
|
||||
margin =
|
||||
{
|
||||
top = 16
|
||||
}
|
||||
};
|
||||
_nSortButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 20f,
|
||||
fixedHeight = 18f,
|
||||
margin =
|
||||
{
|
||||
top = 6
|
||||
},
|
||||
fontSize = 12
|
||||
};
|
||||
_hSortButtonStyle = new GUIStyle(_nSortButtonStyle)
|
||||
{
|
||||
margin =
|
||||
{
|
||||
top = 16
|
||||
}
|
||||
};
|
||||
_verticalScrollbarStyle = new GUIStyle(CruiseAssistMainUI.BaseVerticalScrollBarStyle);
|
||||
_commonButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12
|
||||
};
|
||||
}
|
||||
|
||||
public static void OnGUI()
|
||||
{
|
||||
_wIdx = CruiseAssistMainUI.WIdx;
|
||||
Rect[_wIdx] = GUILayout.Window(99030292, Rect[_wIdx], WindowFunction, "CruiseAssist - StarList", CruiseAssistMainUI.WindowStyle);
|
||||
var scale = CruiseAssistMainUI.Scale / 100f;
|
||||
if (Screen.width / scale < Rect[_wIdx].xMax)
|
||||
{
|
||||
Rect[_wIdx].x = Screen.width / scale - Rect[_wIdx].width;
|
||||
}
|
||||
|
||||
if (Rect[_wIdx].x < 0f)
|
||||
{
|
||||
Rect[_wIdx].x = 0f;
|
||||
}
|
||||
|
||||
if (Screen.height / scale < Rect[_wIdx].yMax)
|
||||
{
|
||||
Rect[_wIdx].y = Screen.height / scale - Rect[_wIdx].height;
|
||||
}
|
||||
|
||||
if (Rect[_wIdx].y < 0f)
|
||||
{
|
||||
Rect[_wIdx].y = 0f;
|
||||
}
|
||||
|
||||
if (LastCheckWindowLeft[_wIdx] != float.MinValue)
|
||||
{
|
||||
if (Rect[_wIdx].x != LastCheckWindowLeft[_wIdx] || Rect[_wIdx].y != LastCheckWindowTop[_wIdx])
|
||||
{
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
LastCheckWindowLeft[_wIdx] = Rect[_wIdx].x;
|
||||
LastCheckWindowTop[_wIdx] = Rect[_wIdx].y;
|
||||
}
|
||||
|
||||
private static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.BeginHorizontal();
|
||||
GUI.changed = false;
|
||||
var selectedIndex = GUILayout.Toolbar(ListSelected, array, guistyle, Array.Empty<GUILayoutOption>());
|
||||
var selectedIndex = GUILayout.Toolbar(ListSelected, Tabs, _toolbarStyle);
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
@@ -68,59 +146,7 @@ public class CruiseAssistStarListUI
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
scrollPos[ListSelected] = GUILayout.BeginScrollView(scrollPos[ListSelected], GUIStyle.none, new GUIStyle(CruiseAssistMainUI.BaseVerticalScrollBarStyle), Array.Empty<GUILayoutOption>());
|
||||
var nameLabelStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 240f,
|
||||
stretchHeight = true,
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
var nRangeLabelStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 60f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleRight
|
||||
};
|
||||
var hRangeLabelStyle = new GUIStyle(nRangeLabelStyle)
|
||||
{
|
||||
fixedHeight = 40f
|
||||
};
|
||||
var nActionButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 40f,
|
||||
fixedHeight = 18f,
|
||||
margin =
|
||||
{
|
||||
top = 6
|
||||
},
|
||||
fontSize = 12
|
||||
};
|
||||
var hActionButtonStyle = new GUIStyle(nActionButtonStyle)
|
||||
{
|
||||
margin =
|
||||
{
|
||||
top = 16
|
||||
}
|
||||
};
|
||||
var nSortButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 20f,
|
||||
fixedHeight = 18f,
|
||||
margin =
|
||||
{
|
||||
top = 6
|
||||
},
|
||||
fontSize = 12
|
||||
};
|
||||
var hSortButtonStyle = new GUIStyle(nSortButtonStyle)
|
||||
{
|
||||
margin =
|
||||
{
|
||||
top = 16
|
||||
}
|
||||
};
|
||||
ScrollPos[ListSelected] = GUILayout.BeginScrollView(ScrollPos[ListSelected], GUIStyle.none, _verticalScrollbarStyle);
|
||||
switch (ListSelected)
|
||||
{
|
||||
case 0:
|
||||
@@ -146,54 +172,54 @@ public class CruiseAssistStarListUI
|
||||
{
|
||||
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)
|
||||
{
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.BeginHorizontal();
|
||||
var planetData = tuple2.Item1;
|
||||
var distance = tuple2.Item2;
|
||||
nameLabelStyle.normal.textColor = Color.white;
|
||||
nRangeLabelStyle.normal.textColor = Color.white;
|
||||
_nameLabelStyle.normal.textColor = Color.white;
|
||||
_nRangeLabelStyle.normal.textColor = Color.white;
|
||||
float height;
|
||||
if (planetData == null)
|
||||
{
|
||||
if (CruiseAssistPlugin.SelectTargetPlanet == null && CruiseAssistPlugin.SelectTargetStar != null && star.id == CruiseAssistPlugin.SelectTargetStar.id)
|
||||
{
|
||||
nameLabelStyle.normal.textColor = Color.cyan;
|
||||
nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
_nameLabelStyle.normal.textColor = Color.cyan;
|
||||
_nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
}
|
||||
var name = starName;
|
||||
if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
|
||||
{
|
||||
name = (star.planets.Where(p => p.factory != null).Count() > 0 ? "● " : "") + name;
|
||||
name = (star.planets.Where(p => p.factory != null).Count() > 0 ? VisitedMark : NonVisitMark) + name;
|
||||
}
|
||||
GUILayout.Label(name, nameLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
height = nameLabelStyle.CalcHeight(new GUIContent(name), nameLabelStyle.fixedWidth);
|
||||
GUILayout.Label(name, _nameLabelStyle);
|
||||
height = _nameLabelStyle.CalcHeight(new GUIContent(name), _nameLabelStyle.fixedWidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.SelectTargetPlanet != null && planetData.id == CruiseAssistPlugin.SelectTargetPlanet.id)
|
||||
{
|
||||
nameLabelStyle.normal.textColor = Color.cyan;
|
||||
nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
_nameLabelStyle.normal.textColor = Color.cyan;
|
||||
_nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
}
|
||||
var name = starName + " - " + CruiseAssistPlugin.GetPlanetName(planetData);
|
||||
if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
|
||||
{
|
||||
name = (planetData.factory != null ? "● " : "") + name;
|
||||
name = (planetData.factory != null ? VisitedMark : NonVisitMark) + name;
|
||||
}
|
||||
GUILayout.Label(name, nameLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
height = nameLabelStyle.CalcHeight(new GUIContent(name), nameLabelStyle.fixedWidth);
|
||||
GUILayout.Label(name, _nameLabelStyle);
|
||||
height = _nameLabelStyle.CalcHeight(new GUIContent(name), _nameLabelStyle.fixedWidth);
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label(CruiseAssistMainUI.RangeToString(planetData == null ? range : distance), height < 30f ? nRangeLabelStyle : hRangeLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
if (GUILayout.Button(actionSelected[ListSelected] == 0 ? "SET" : planetData == null ? "-" : CruiseAssistPlugin.Bookmark.Contains(planetData.id) ? "DEL" : "ADD", height < 30f ? nActionButtonStyle : hActionButtonStyle, Array.Empty<GUILayoutOption>()))
|
||||
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))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
if (actionSelected[ListSelected] == 0)
|
||||
if (ActionSelected[ListSelected] == 0)
|
||||
{
|
||||
SelectStar(star, planetData);
|
||||
var closeStarListWhenSetTargetPlanetFlag = CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag;
|
||||
if (closeStarListWhenSetTargetPlanetFlag)
|
||||
{
|
||||
Show[wIdx] = false;
|
||||
Show[_wIdx] = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -220,27 +246,27 @@ public class CruiseAssistStarListUI
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
nameLabelStyle.normal.textColor = Color.white;
|
||||
nRangeLabelStyle.normal.textColor = Color.white;
|
||||
GUILayout.BeginHorizontal();
|
||||
_nameLabelStyle.normal.textColor = Color.white;
|
||||
_nRangeLabelStyle.normal.textColor = Color.white;
|
||||
if (CruiseAssistPlugin.SelectTargetStar != null && star.id == CruiseAssistPlugin.SelectTargetStar.id)
|
||||
{
|
||||
nameLabelStyle.normal.textColor = Color.cyan;
|
||||
nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
_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 ? "● " : "") + name;
|
||||
name = (star.planets.Count(p => p.factory != null) > 0 ? VisitedMark : NonVisitMark) + name;
|
||||
}
|
||||
GUILayout.Label(name, nameLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
var height = nameLabelStyle.CalcHeight(new GUIContent(name), nameLabelStyle.fixedWidth);
|
||||
GUILayout.Label(name, _nameLabelStyle);
|
||||
var height = _nameLabelStyle.CalcHeight(new GUIContent(name), _nameLabelStyle.fixedWidth);
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label(CruiseAssistMainUI.RangeToString(range), height < 30f ? nRangeLabelStyle : hRangeLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
if (GUILayout.Button(actionSelected[ListSelected] == 0 ? "SET" : "-", height < 30f ? nActionButtonStyle : hActionButtonStyle, Array.Empty<GUILayoutOption>()))
|
||||
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)
|
||||
if (ActionSelected[ListSelected] == 0)
|
||||
{
|
||||
SelectStar(star, null);
|
||||
}
|
||||
@@ -253,7 +279,7 @@ public class CruiseAssistStarListUI
|
||||
{
|
||||
var highlighted = false;
|
||||
var enumBookmark = ListSelected != 1 ? CruiseAssistPlugin.Bookmark.ToList() : Enumerable.Reverse(CruiseAssistPlugin.History);
|
||||
if (ListSelected == 1 && actionSelected[ListSelected] != 2 && CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag)
|
||||
if (ListSelected == 1 && ActionSelected[ListSelected] != 2 && CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag)
|
||||
{
|
||||
enumBookmark = enumBookmark.Distinct();
|
||||
}
|
||||
@@ -264,30 +290,30 @@ public class CruiseAssistStarListUI
|
||||
var planetData = GameMain.galaxy.PlanetById(id);
|
||||
if (planetData == null) return;
|
||||
var magnitude = (planetData.uPosition - GameMain.mainPlayer.uPosition).magnitude;
|
||||
nameLabelStyle.normal.textColor = Color.white;
|
||||
nRangeLabelStyle.normal.textColor = Color.white;
|
||||
_nameLabelStyle.normal.textColor = Color.white;
|
||||
_nRangeLabelStyle.normal.textColor = Color.white;
|
||||
if (!highlighted && CruiseAssistPlugin.SelectTargetPlanet != null && planetData.id == CruiseAssistPlugin.SelectTargetPlanet.id)
|
||||
{
|
||||
nameLabelStyle.normal.textColor = Color.cyan;
|
||||
nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
_nameLabelStyle.normal.textColor = Color.cyan;
|
||||
_nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
highlighted = true;
|
||||
}
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.BeginHorizontal();
|
||||
var name = CruiseAssistPlugin.GetStarName(planetData.star) + " - " + CruiseAssistPlugin.GetPlanetName(planetData);
|
||||
if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
|
||||
{
|
||||
name = (planetData.factory != null ? "● " : "") + name;
|
||||
name = (planetData.factory != null ? VisitedMark : NonVisitMark) + name;
|
||||
}
|
||||
GUILayout.Label(name, nameLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
var height = nameLabelStyle.CalcHeight(new GUIContent(name), nameLabelStyle.fixedWidth);
|
||||
GUILayout.Label(name, _nameLabelStyle);
|
||||
var height = _nameLabelStyle.CalcHeight(new GUIContent(name), _nameLabelStyle.fixedWidth);
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label(CruiseAssistMainUI.RangeToString(magnitude), height < 30f ? nRangeLabelStyle : hRangeLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
if (ListSelected == 2 && actionSelected[ListSelected] == 1)
|
||||
GUILayout.Label(CruiseAssistMainUI.RangeToString(magnitude), height < 30f ? _nRangeLabelStyle : _hRangeLabelStyle);
|
||||
if (ListSelected == 2 && ActionSelected[ListSelected] == 1)
|
||||
{
|
||||
var index = CruiseAssistPlugin.Bookmark.IndexOf(id);
|
||||
var first = index == 0;
|
||||
var last = index == CruiseAssistPlugin.Bookmark.Count - 1;
|
||||
if (GUILayout.Button(last ? "-" : "↓", height < 30f ? nSortButtonStyle : hSortButtonStyle, Array.Empty<GUILayoutOption>()))
|
||||
if (GUILayout.Button(last ? "-" : "↓", height < 30f ? _nSortButtonStyle : _hSortButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
if (!last)
|
||||
@@ -297,7 +323,7 @@ public class CruiseAssistStarListUI
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button(first ? "-" : "↑", height < 30f ? nSortButtonStyle : hSortButtonStyle, Array.Empty<GUILayoutOption>()))
|
||||
if (GUILayout.Button(first ? "-" : "↑", height < 30f ? _nSortButtonStyle : _hSortButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
if (!first)
|
||||
@@ -309,17 +335,17 @@ public 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, Array.Empty<GUILayoutOption>()))
|
||||
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])
|
||||
switch (ActionSelected[ListSelected])
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
SelectStar(planetData.star, planetData);
|
||||
if (CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag)
|
||||
{
|
||||
Show[wIdx] = false;
|
||||
Show[_wIdx] = false;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -343,7 +369,7 @@ public class CruiseAssistStarListUI
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (actionSelected[ListSelected] == 2)
|
||||
if (ActionSelected[ListSelected] == 2)
|
||||
{
|
||||
switch (ListSelected)
|
||||
{
|
||||
@@ -376,37 +402,25 @@ public class CruiseAssistStarListUI
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var buttonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12
|
||||
};
|
||||
var buttons = new[]
|
||||
{
|
||||
new[] { "Target", "Bookmark" },
|
||||
new[] { "Target", "Bookmark", "Delete" },
|
||||
new[] { "Target", "Sort", "Delete" }
|
||||
};
|
||||
if (GUILayout.Button(buttons[ListSelected][actionSelected[ListSelected]], buttonStyle, Array.Empty<GUILayoutOption>()))
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button(ButtonTexts[ListSelected][ActionSelected[ListSelected]], _commonButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
actionSelected[ListSelected]++;
|
||||
actionSelected[ListSelected] %= buttons[ListSelected].Length;
|
||||
ActionSelected[ListSelected]++;
|
||||
ActionSelected[ListSelected] %= ButtonTexts[ListSelected].Length;
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
if (!CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag && GUILayout.Button("Close", buttonStyle, Array.Empty<GUILayoutOption>()))
|
||||
if (!CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag && GUILayout.Button("Close", _commonButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
Show[wIdx] = false;
|
||||
Show[_wIdx] = false;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
if (GUI.Button(new Rect(Rect[wIdx].width - 16f, 1f, 16f, 16f), "", CruiseAssistMainUI.CloseButtonStyle))
|
||||
if (GUI.Button(new Rect(Rect[_wIdx].width - 16f, 1f, 16f, 16f), "", CruiseAssistMainUI.CloseButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
Show[wIdx] = false;
|
||||
Show[_wIdx] = false;
|
||||
}
|
||||
GUI.DragWindow();
|
||||
}
|
||||
@@ -493,34 +507,25 @@ public class CruiseAssistStarListUI
|
||||
traverse.Field("forceUpdateCursorView").SetValue(true);
|
||||
}
|
||||
|
||||
private static int wIdx;
|
||||
|
||||
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 = {
|
||||
public static readonly Rect[] Rect =
|
||||
[
|
||||
new Rect(0f, 0f, 400f, 480f),
|
||||
new Rect(0f, 0f, 400f, 480f)
|
||||
};
|
||||
|
||||
];
|
||||
public static int ListSelected;
|
||||
|
||||
public 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 = {
|
||||
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