mirror of
https://github.com/soarqin/DSP_Mods_TO.git
synced 2025-12-12 01:23:31 +08:00
WIP
This commit is contained in:
@@ -6,7 +6,7 @@ using UnityEngine;
|
||||
|
||||
namespace AutoPilot.UI;
|
||||
|
||||
internal class AutoPilotDebugUI
|
||||
internal static class AutoPilotDebugUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
{
|
||||
@@ -15,56 +15,52 @@ internal class AutoPilotDebugUI
|
||||
fontSize = 11
|
||||
};
|
||||
Rect = GUILayout.Window(99031293, Rect, WindowFunction, "AutoPilot - Debug", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var num = CruiseAssistMainUI.Scale / 100f;
|
||||
var flag = Screen.width < Rect.xMax;
|
||||
if (flag)
|
||||
|
||||
if (Screen.width < Rect.xMax)
|
||||
{
|
||||
Rect.x = Screen.width - Rect.width;
|
||||
}
|
||||
var flag2 = Rect.x < 0f;
|
||||
if (flag2)
|
||||
|
||||
if (Rect.x < 0f)
|
||||
{
|
||||
Rect.x = 0f;
|
||||
}
|
||||
var flag3 = Screen.height < Rect.yMax;
|
||||
if (flag3)
|
||||
|
||||
if (Screen.height < Rect.yMax)
|
||||
{
|
||||
Rect.y = Screen.height - Rect.height;
|
||||
}
|
||||
var flag4 = Rect.y < 0f;
|
||||
if (flag4)
|
||||
|
||||
if (Rect.y < 0f)
|
||||
{
|
||||
Rect.y = 0f;
|
||||
}
|
||||
var flag5 = lastCheckWindowLeft != float.MinValue;
|
||||
if (flag5)
|
||||
|
||||
if (_lastCheckWindowLeft != float.MinValue)
|
||||
{
|
||||
var flag6 = Rect.x != lastCheckWindowLeft || Rect.y != lastCheckWindowTop;
|
||||
if (flag6)
|
||||
if (Rect.x != _lastCheckWindowLeft || Rect.y != _lastCheckWindowTop)
|
||||
{
|
||||
AutoPilotMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
lastCheckWindowLeft = Rect.x;
|
||||
lastCheckWindowTop = Rect.y;
|
||||
var flag7 = AutoPilotMainUI.NextCheckGameTick <= GameMain.gameTick;
|
||||
if (flag7)
|
||||
_lastCheckWindowLeft = Rect.x;
|
||||
_lastCheckWindowTop = Rect.y;
|
||||
if (AutoPilotMainUI.NextCheckGameTick <= GameMain.gameTick)
|
||||
{
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.State);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WindowFunction(int windowId)
|
||||
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>());
|
||||
_scrollPos = GUILayout.BeginScrollView(_scrollPos, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.uPosition={GameMain.mainPlayer.uPosition}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var flag = GameMain.localPlanet != null && CruiseAssistPlugin.TargetUPos != VectorLF3.zero;
|
||||
if (flag)
|
||||
if (GameMain.localPlanet != null && CruiseAssistPlugin.TargetUPos != VectorLF3.zero)
|
||||
{
|
||||
var mainPlayer = GameMain.mainPlayer;
|
||||
var targetUPos = CruiseAssistPlugin.TargetUPos;
|
||||
@@ -80,10 +76,10 @@ internal class AutoPilotDebugUI
|
||||
var mecha = GameMain.mainPlayer.mecha;
|
||||
GUILayout.Label($"mecha.coreEnergy={mecha.coreEnergy}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"mecha.coreEnergyCap={mecha.coreEnergyCap}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var num = mecha.coreEnergy / mecha.coreEnergyCap * 100.0;
|
||||
GUILayout.Label($"energyPer={num}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var magnitude3 = GameMain.mainPlayer.controller.actionSail.visual_uvel.magnitude;
|
||||
GUILayout.Label("spped=" + RangeToString(magnitude3), guistyle, Array.Empty<GUILayoutOption>());
|
||||
var energyPer = mecha.coreEnergy / mecha.coreEnergyCap * 100.0;
|
||||
GUILayout.Label($"energyPer={energyPer}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var speed = GameMain.mainPlayer.controller.actionSail.visual_uvel.magnitude;
|
||||
GUILayout.Label("spped=" + RangeToString(speed), guistyle, Array.Empty<GUILayoutOption>());
|
||||
var movementStateInFrame = GameMain.mainPlayer.controller.movementStateInFrame;
|
||||
GUILayout.Label($"movementStateInFrame={movementStateInFrame}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var guistyle2 = new GUIStyle(GUI.skin.toggle)
|
||||
@@ -94,8 +90,7 @@ internal class AutoPilotDebugUI
|
||||
};
|
||||
GUI.changed = false;
|
||||
AutoPilotPlugin.Conf.IgnoreGravityFlag = GUILayout.Toggle(AutoPilotPlugin.Conf.IgnoreGravityFlag, "Ignore gravity.", guistyle2, Array.Empty<GUILayoutOption>());
|
||||
var changed = GUI.changed;
|
||||
if (changed)
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
}
|
||||
@@ -104,36 +99,28 @@ internal class AutoPilotDebugUI
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
public static string RangeToString(double range)
|
||||
private static string RangeToString(double range)
|
||||
{
|
||||
var flag = range < 10000.0;
|
||||
string text;
|
||||
if (flag)
|
||||
if (range < 10000.0)
|
||||
{
|
||||
text = ((int)(range + 0.5)) + "m ";
|
||||
return (int)(range + 0.5) + "m ";
|
||||
}
|
||||
else
|
||||
|
||||
if (range < 600000.0)
|
||||
{
|
||||
var flag2 = range < 600000.0;
|
||||
if (flag2)
|
||||
{
|
||||
text = (range / 40000.0).ToString("0.00") + "AU";
|
||||
}
|
||||
else
|
||||
{
|
||||
text = (range / 2400000.0).ToString("0.00") + "Ly";
|
||||
}
|
||||
return (range / 40000.0).ToString("0.00") + "AU";
|
||||
}
|
||||
return text;
|
||||
|
||||
return (range / 2400000.0).ToString("0.00") + "Ly";
|
||||
}
|
||||
|
||||
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 _lastCheckWindowLeft = float.MinValue;
|
||||
|
||||
private static float lastCheckWindowTop = float.MinValue;
|
||||
private static float _lastCheckWindowTop = float.MinValue;
|
||||
|
||||
private static Vector2 scrollPos = Vector2.zero;
|
||||
private static Vector2 _scrollPos = Vector2.zero;
|
||||
}
|
||||
@@ -8,81 +8,77 @@ using UnityEngine;
|
||||
|
||||
namespace AutoPilot.UI;
|
||||
|
||||
internal class AutoPilotMainUI
|
||||
internal static class AutoPilotMainUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
{
|
||||
wIdx = CruiseAssistMainUI.WIdx;
|
||||
_wIdx = CruiseAssistMainUI.WIdx;
|
||||
var viewMode = CruiseAssistMainUI.ViewMode;
|
||||
var cruiseAssistMainUIViewMode = viewMode;
|
||||
if (cruiseAssistMainUIViewMode != CruiseAssistMainUIViewMode.Full)
|
||||
if (viewMode != CruiseAssistMainUIViewMode.Full)
|
||||
{
|
||||
if (cruiseAssistMainUIViewMode == CruiseAssistMainUIViewMode.Mini)
|
||||
if (viewMode == CruiseAssistMainUIViewMode.Mini)
|
||||
{
|
||||
Rect[wIdx].width = CruiseAssistMainUI.Rect[wIdx].width;
|
||||
Rect[wIdx].height = 70f;
|
||||
Rect[_wIdx].width = CruiseAssistMainUI.Rect[_wIdx].width;
|
||||
Rect[_wIdx].height = 70f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Rect[wIdx].width = CruiseAssistMainUI.Rect[wIdx].width;
|
||||
Rect[wIdx].height = 150f;
|
||||
Rect[_wIdx].width = CruiseAssistMainUI.Rect[_wIdx].width;
|
||||
Rect[_wIdx].height = 150f;
|
||||
}
|
||||
var guistyle = new GUIStyle(CruiseAssistMainUI.WindowStyle)
|
||||
{
|
||||
fontSize = 11
|
||||
};
|
||||
Rect[wIdx] = GUILayout.Window(99031291, Rect[wIdx], WindowFunction, "AutoPilot", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var num = CruiseAssistMainUI.Scale / 100f;
|
||||
var mainWindowJoinFlag = AutoPilotPlugin.Conf.MainWindowJoinFlag;
|
||||
if (mainWindowJoinFlag)
|
||||
Rect[_wIdx] = GUILayout.Window(99031291, Rect[_wIdx], WindowFunction, "AutoPilot", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var scale = CruiseAssistMainUI.Scale / 100f;
|
||||
if (AutoPilotPlugin.Conf.MainWindowJoinFlag)
|
||||
{
|
||||
Rect[wIdx].x = CruiseAssistMainUI.Rect[CruiseAssistMainUI.WIdx].x;
|
||||
Rect[wIdx].y = CruiseAssistMainUI.Rect[CruiseAssistMainUI.WIdx].yMax;
|
||||
Rect[_wIdx].x = CruiseAssistMainUI.Rect[CruiseAssistMainUI.WIdx].x;
|
||||
Rect[_wIdx].y = CruiseAssistMainUI.Rect[CruiseAssistMainUI.WIdx].yMax;
|
||||
}
|
||||
var flag = Screen.width / num < Rect[wIdx].xMax;
|
||||
if (flag)
|
||||
|
||||
if (Screen.width / scale < Rect[_wIdx].xMax)
|
||||
{
|
||||
Rect[wIdx].x = Screen.width / num - Rect[wIdx].width;
|
||||
Rect[_wIdx].x = Screen.width / scale - Rect[_wIdx].width;
|
||||
}
|
||||
var flag2 = Rect[wIdx].x < 0f;
|
||||
if (flag2)
|
||||
|
||||
if (Rect[_wIdx].x < 0f)
|
||||
{
|
||||
Rect[wIdx].x = 0f;
|
||||
Rect[_wIdx].x = 0f;
|
||||
}
|
||||
var flag3 = Screen.height / num < Rect[wIdx].yMax;
|
||||
if (flag3)
|
||||
|
||||
if (Screen.height / scale < Rect[_wIdx].yMax)
|
||||
{
|
||||
Rect[wIdx].y = Screen.height / num - Rect[wIdx].height;
|
||||
Rect[_wIdx].y = Screen.height / scale - Rect[_wIdx].height;
|
||||
}
|
||||
var flag4 = Rect[wIdx].y < 0f;
|
||||
if (flag4)
|
||||
|
||||
if (Rect[_wIdx].y < 0f)
|
||||
{
|
||||
Rect[wIdx].y = 0f;
|
||||
Rect[_wIdx].y = 0f;
|
||||
}
|
||||
var flag5 = lastCheckWindowLeft[wIdx] != float.MinValue;
|
||||
if (flag5)
|
||||
|
||||
if (LastCheckWindowLeft[_wIdx] != float.MinValue)
|
||||
{
|
||||
var flag6 = Rect[wIdx].x != lastCheckWindowLeft[wIdx] || Rect[wIdx].y != lastCheckWindowTop[wIdx];
|
||||
var flag6 = Rect[_wIdx].x != LastCheckWindowLeft[_wIdx] || Rect[_wIdx].y != LastCheckWindowTop[_wIdx];
|
||||
if (flag6)
|
||||
{
|
||||
NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
lastCheckWindowLeft[wIdx] = Rect[wIdx].x;
|
||||
lastCheckWindowTop[wIdx] = Rect[wIdx].y;
|
||||
var flag7 = NextCheckGameTick <= GameMain.gameTick;
|
||||
if (flag7)
|
||||
LastCheckWindowLeft[_wIdx] = Rect[_wIdx].x;
|
||||
LastCheckWindowTop[_wIdx] = Rect[_wIdx].y;
|
||||
if (NextCheckGameTick <= GameMain.gameTick)
|
||||
{
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.State);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WindowFunction(int windowId)
|
||||
private static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var flag = CruiseAssistMainUI.ViewMode == CruiseAssistMainUIViewMode.Full;
|
||||
if (flag)
|
||||
if (CruiseAssistMainUI.ViewMode == CruiseAssistMainUIViewMode.Full)
|
||||
{
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var guistyle = new GUIStyle(GUI.skin.label)
|
||||
@@ -116,8 +112,7 @@ internal class AutoPilotMainUI
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
var flag2 = AutoPilotPlugin.State == AutoPilotState.Inactive;
|
||||
if (flag2)
|
||||
if (AutoPilotPlugin.State == AutoPilotState.Inactive)
|
||||
{
|
||||
GUILayout.Label("Auto Pilot Inactive.", guistyle2, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
@@ -135,14 +130,13 @@ internal class AutoPilotMainUI
|
||||
alignment = TextAnchor.MiddleCenter
|
||||
};
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var flag3 = GUILayout.Button("Config", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (flag3)
|
||||
if (GUILayout.Button("Config", guistyle3, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
var show = AutoPilotConfigUI.Show;
|
||||
var num = wIdx;
|
||||
var num = _wIdx;
|
||||
show[num] = !show[num];
|
||||
var flag4 = AutoPilotConfigUI.Show[wIdx];
|
||||
var flag4 = AutoPilotConfigUI.Show[_wIdx];
|
||||
if (flag4)
|
||||
{
|
||||
AutoPilotConfigUI.TempMinEnergyPer = AutoPilotPlugin.Conf.MinEnergyPer.ToString();
|
||||
@@ -151,8 +145,8 @@ internal class AutoPilotMainUI
|
||||
AutoPilotConfigUI.TempSpeedToWarp = AutoPilotPlugin.Conf.SpeedToWarp.ToString();
|
||||
}
|
||||
}
|
||||
var flag5 = GUILayout.Button("Start", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (flag5)
|
||||
|
||||
if (GUILayout.Button("Start", guistyle3, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
AutoPilotPlugin.State = AutoPilotState.Active;
|
||||
@@ -160,8 +154,7 @@ internal class AutoPilotMainUI
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Button("-", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
var flag6 = GUILayout.Button("Stop", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (flag6)
|
||||
if (GUILayout.Button("Stop", guistyle3, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
AutoPilotPlugin.State = AutoPilotState.Inactive;
|
||||
@@ -172,7 +165,7 @@ internal class AutoPilotMainUI
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
private static int wIdx;
|
||||
private static int _wIdx;
|
||||
|
||||
public const float WindowWidthFull = 398f;
|
||||
|
||||
@@ -182,14 +175,14 @@ internal class AutoPilotMainUI
|
||||
|
||||
public const float WindowHeightMini = 70f;
|
||||
|
||||
public static Rect[] Rect = {
|
||||
public static readonly Rect[] Rect = {
|
||||
new Rect(0f, 0f, 398f, 150f),
|
||||
new Rect(0f, 0f, 398f, 150f)
|
||||
};
|
||||
|
||||
private static float[] lastCheckWindowLeft = { float.MinValue, float.MinValue };
|
||||
private static readonly float[] LastCheckWindowLeft = { float.MinValue, float.MinValue };
|
||||
|
||||
private static float[] lastCheckWindowTop = { float.MinValue, float.MinValue };
|
||||
private static readonly float[] LastCheckWindowTop = { float.MinValue, float.MinValue };
|
||||
|
||||
public static long NextCheckGameTick = long.MaxValue;
|
||||
}
|
||||
BIN
CompressSave/package/plugins/x64/lz4wrap.dll
Normal file
BIN
CompressSave/package/plugins/x64/lz4wrap.dll
Normal file
Binary file not shown.
BIN
CompressSave/package/plugins/x64/nonewrap.dll
Normal file
BIN
CompressSave/package/plugins/x64/nonewrap.dll
Normal file
Binary file not shown.
BIN
CompressSave/package/plugins/x64/zstdwrap.dll
Normal file
BIN
CompressSave/package/plugins/x64/zstdwrap.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user