mirror of
https://github.com/soarqin/DSP_Mods_TO.git
synced 2025-12-16 03:23:32 +08:00
Added CruiseAssist and AutoPilot
This commit is contained in:
176
AutoPilot/UI/AutoPilotConfigUI.cs
Normal file
176
AutoPilot/UI/AutoPilotConfigUI.cs
Normal file
@@ -0,0 +1,176 @@
|
||||
using System;
|
||||
using CruiseAssist.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AutoPilot.UI;
|
||||
|
||||
internal static class AutoPilotConfigUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
{
|
||||
_wIdx = CruiseAssistMainUI.WIdx;
|
||||
Rect[_wIdx] = GUILayout.Window(99031292, Rect[_wIdx], WindowFunction, "AutoPilot - Config", 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])
|
||||
{
|
||||
AutoPilotMainUI.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>());
|
||||
var guistyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 12,
|
||||
fixedHeight = 20f,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
var guistyle2 = new GUIStyle(CruiseAssistMainUI.BaseTextFieldStyle)
|
||||
{
|
||||
fontSize = 12,
|
||||
fixedWidth = 60f
|
||||
};
|
||||
guistyle.fixedHeight = 20f;
|
||||
guistyle2.alignment = TextAnchor.MiddleRight;
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
guistyle.fixedWidth = 240f;
|
||||
GUILayout.Label("Min Energy Percent (0-100 default:20)".Translate(), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.FlexibleSpace();
|
||||
SetValue(ref TempMinEnergyPer, GUILayout.TextField(TempMinEnergyPer, guistyle2, Array.Empty<GUILayoutOption>()), 0, 100, ref AutoPilotPlugin.Conf.MinEnergyPer);
|
||||
guistyle.fixedWidth = 20f;
|
||||
GUILayout.Label("%", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
guistyle.fixedWidth = 240f;
|
||||
GUILayout.Label("Max Speed (0-2000 default:2000)".Translate(), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.FlexibleSpace();
|
||||
SetValue(ref TempMaxSpeed, GUILayout.TextField(TempMaxSpeed, guistyle2, Array.Empty<GUILayoutOption>()), 0, 2000, ref AutoPilotPlugin.Conf.MaxSpeed);
|
||||
guistyle.fixedWidth = 20f;
|
||||
GUILayout.Label("m/s", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
guistyle.fixedWidth = 240f;
|
||||
GUILayout.Label("Warp Min Range (1-60 default:2)".Translate(), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.FlexibleSpace();
|
||||
SetValue(ref TempWarpMinRangeAU, GUILayout.TextArea(TempWarpMinRangeAU, guistyle2, Array.Empty<GUILayoutOption>()), 1, 60, ref AutoPilotPlugin.Conf.WarpMinRangeAU);
|
||||
guistyle.fixedWidth = 20f;
|
||||
GUILayout.Label("AU", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
guistyle.fixedWidth = 240f;
|
||||
GUILayout.Label("Speed to warp (0-2000 default:1200)".Translate(), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.FlexibleSpace();
|
||||
SetValue(ref TempSpeedToWarp, GUILayout.TextArea(TempSpeedToWarp, guistyle2, Array.Empty<GUILayoutOption>()), 0, 2000, ref AutoPilotPlugin.Conf.SpeedToWarp);
|
||||
guistyle.fixedWidth = 20f;
|
||||
GUILayout.Label("m/s", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndHorizontal();
|
||||
var guistyle3 = new GUIStyle(CruiseAssistMainUI.BaseToggleStyle)
|
||||
{
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.LowerLeft
|
||||
};
|
||||
GUI.changed = false;
|
||||
AutoPilotPlugin.Conf.LocalWarpFlag = GUILayout.Toggle(AutoPilotPlugin.Conf.LocalWarpFlag, "Warp to planet in local system.".Translate(), guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
AutoPilotMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
AutoPilotPlugin.Conf.AutoStartFlag = GUILayout.Toggle(AutoPilotPlugin.Conf.AutoStartFlag, "Start AutoPilot when set target planet.".Translate(), guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
AutoPilotMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
AutoPilotPlugin.Conf.MainWindowJoinFlag = GUILayout.Toggle(AutoPilotPlugin.Conf.MainWindowJoinFlag, "Join AutoPilot window to CruiseAssist window.".Translate(), guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
AutoPilotMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
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;
|
||||
}
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
private static bool SetValue(ref string temp, string instr, int min, int max, ref int value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(instr))
|
||||
{
|
||||
temp = string.Empty;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!int.TryParse(instr, out var num)) return false;
|
||||
if (num < min)
|
||||
{
|
||||
num = min;
|
||||
}
|
||||
else if (max < num)
|
||||
{
|
||||
num = max;
|
||||
}
|
||||
value = num;
|
||||
temp = value.ToString();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
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 = {
|
||||
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 };
|
||||
|
||||
public static string TempMinEnergyPer;
|
||||
|
||||
public static string TempMaxSpeed;
|
||||
|
||||
public static string TempWarpMinRangeAU;
|
||||
|
||||
public static string TempSpeedToWarp;
|
||||
}
|
||||
139
AutoPilot/UI/AutoPilotDebugUI.cs
Normal file
139
AutoPilot/UI/AutoPilotDebugUI.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using AutoPilot.Commons;
|
||||
using CruiseAssist;
|
||||
using CruiseAssist.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AutoPilot.UI;
|
||||
|
||||
internal class AutoPilotDebugUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
{
|
||||
var guistyle = new GUIStyle(GUI.skin.window)
|
||||
{
|
||||
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)
|
||||
{
|
||||
Rect.x = Screen.width - Rect.width;
|
||||
}
|
||||
var flag2 = Rect.x < 0f;
|
||||
if (flag2)
|
||||
{
|
||||
Rect.x = 0f;
|
||||
}
|
||||
var flag3 = Screen.height < Rect.yMax;
|
||||
if (flag3)
|
||||
{
|
||||
Rect.y = Screen.height - Rect.height;
|
||||
}
|
||||
var flag4 = Rect.y < 0f;
|
||||
if (flag4)
|
||||
{
|
||||
Rect.y = 0f;
|
||||
}
|
||||
var flag5 = lastCheckWindowLeft != float.MinValue;
|
||||
if (flag5)
|
||||
{
|
||||
var flag6 = Rect.x != lastCheckWindowLeft || Rect.y != lastCheckWindowTop;
|
||||
if (flag6)
|
||||
{
|
||||
AutoPilotMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
lastCheckWindowLeft = Rect.x;
|
||||
lastCheckWindowTop = Rect.y;
|
||||
var flag7 = AutoPilotMainUI.NextCheckGameTick <= GameMain.gameTick;
|
||||
if (flag7)
|
||||
{
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.State);
|
||||
}
|
||||
}
|
||||
|
||||
public 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>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.uPosition={GameMain.mainPlayer.uPosition}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var flag = GameMain.localPlanet != null && CruiseAssistPlugin.TargetUPos != VectorLF3.zero;
|
||||
if (flag)
|
||||
{
|
||||
var mainPlayer = GameMain.mainPlayer;
|
||||
var targetUPos = CruiseAssistPlugin.TargetUPos;
|
||||
var magnitude = (targetUPos - mainPlayer.uPosition).magnitude;
|
||||
var magnitude2 = (targetUPos - GameMain.localPlanet.uPosition).magnitude;
|
||||
var vectorLF = mainPlayer.uPosition - GameMain.localPlanet.uPosition;
|
||||
var vectorLF2 = CruiseAssistPlugin.TargetUPos - GameMain.localPlanet.uPosition;
|
||||
GUILayout.Label("range1=" + RangeToString(magnitude), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label("range2=" + RangeToString(magnitude2), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"range1>range2={magnitude > magnitude2}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"angle={Vector3.Angle(vectorLF, vectorLF2)}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
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 movementStateInFrame = GameMain.mainPlayer.controller.movementStateInFrame;
|
||||
GUILayout.Label($"movementStateInFrame={movementStateInFrame}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var guistyle2 = new GUIStyle(GUI.skin.toggle)
|
||||
{
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.LowerLeft
|
||||
};
|
||||
GUI.changed = false;
|
||||
AutoPilotPlugin.Conf.IgnoreGravityFlag = GUILayout.Toggle(AutoPilotPlugin.Conf.IgnoreGravityFlag, "Ignore gravity.", guistyle2, Array.Empty<GUILayoutOption>());
|
||||
var changed = GUI.changed;
|
||||
if (changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
GUILayout.EndVertical();
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
public static string RangeToString(double range)
|
||||
{
|
||||
var flag = range < 10000.0;
|
||||
string text;
|
||||
if (flag)
|
||||
{
|
||||
text = ((int)(range + 0.5)) + "m ";
|
||||
}
|
||||
else
|
||||
{
|
||||
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 text;
|
||||
}
|
||||
|
||||
public static bool Show = false;
|
||||
|
||||
public static Rect Rect = new Rect(0f, 0f, 400f, 400f);
|
||||
|
||||
private static float lastCheckWindowLeft = float.MinValue;
|
||||
|
||||
private static float lastCheckWindowTop = float.MinValue;
|
||||
|
||||
private static Vector2 scrollPos = Vector2.zero;
|
||||
}
|
||||
195
AutoPilot/UI/AutoPilotMainUI.cs
Normal file
195
AutoPilot/UI/AutoPilotMainUI.cs
Normal file
@@ -0,0 +1,195 @@
|
||||
using System;
|
||||
using AutoPilot.Commons;
|
||||
using AutoPilot.Enums;
|
||||
using CruiseAssist;
|
||||
using CruiseAssist.Enums;
|
||||
using CruiseAssist.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AutoPilot.UI;
|
||||
|
||||
internal class AutoPilotMainUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
{
|
||||
wIdx = CruiseAssistMainUI.WIdx;
|
||||
var viewMode = CruiseAssistMainUI.ViewMode;
|
||||
var cruiseAssistMainUIViewMode = viewMode;
|
||||
if (cruiseAssistMainUIViewMode != CruiseAssistMainUIViewMode.Full)
|
||||
{
|
||||
if (cruiseAssistMainUIViewMode == CruiseAssistMainUIViewMode.Mini)
|
||||
{
|
||||
Rect[wIdx].width = CruiseAssistMainUI.Rect[wIdx].width;
|
||||
Rect[wIdx].height = 70f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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].x = CruiseAssistMainUI.Rect[CruiseAssistMainUI.WIdx].x;
|
||||
Rect[wIdx].y = CruiseAssistMainUI.Rect[CruiseAssistMainUI.WIdx].yMax;
|
||||
}
|
||||
var flag = Screen.width / num < Rect[wIdx].xMax;
|
||||
if (flag)
|
||||
{
|
||||
Rect[wIdx].x = Screen.width / num - Rect[wIdx].width;
|
||||
}
|
||||
var flag2 = Rect[wIdx].x < 0f;
|
||||
if (flag2)
|
||||
{
|
||||
Rect[wIdx].x = 0f;
|
||||
}
|
||||
var flag3 = Screen.height / num < Rect[wIdx].yMax;
|
||||
if (flag3)
|
||||
{
|
||||
Rect[wIdx].y = Screen.height / num - Rect[wIdx].height;
|
||||
}
|
||||
var flag4 = Rect[wIdx].y < 0f;
|
||||
if (flag4)
|
||||
{
|
||||
Rect[wIdx].y = 0f;
|
||||
}
|
||||
var flag5 = lastCheckWindowLeft[wIdx] != float.MinValue;
|
||||
if (flag5)
|
||||
{
|
||||
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)
|
||||
{
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.State);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var flag = CruiseAssistMainUI.ViewMode == CruiseAssistMainUIViewMode.Full;
|
||||
if (flag)
|
||||
{
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var guistyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 12
|
||||
};
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var text = ((AutoPilotPlugin.State == AutoPilotState.Inactive) ? "---" : ((AutoPilotPlugin.Conf.MinEnergyPer < AutoPilotPlugin.EnergyPer) ? "OK" : "NG"));
|
||||
guistyle.normal.textColor = ((text == "OK") ? Color.cyan : ((text == "NG") ? Color.red : Color.white));
|
||||
GUILayout.Label("Energy : " + text, guistyle, Array.Empty<GUILayoutOption>());
|
||||
var text2 = ((AutoPilotPlugin.State == AutoPilotState.Inactive) ? "---" : ((CruiseAssistPlugin.TargetStar == null) ? "---" : (GameMain.mainPlayer.warping ? "---" : ((!AutoPilotPlugin.Conf.LocalWarpFlag && GameMain.localStar != null && CruiseAssistPlugin.TargetStar.id == GameMain.localStar.id) ? "---" : ((CruiseAssistPlugin.TargetRange < (double)(AutoPilotPlugin.Conf.WarpMinRangeAU * 40000)) ? "---" : ((AutoPilotPlugin.WarperCount < 1) ? "NG" : "OK"))))));
|
||||
guistyle.normal.textColor = ((text2 == "OK") ? Color.cyan : ((text2 == "NG") ? Color.red : Color.white));
|
||||
GUILayout.Label("Warper : " + text2, guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var text3 = ((AutoPilotPlugin.State == AutoPilotState.Inactive) ? "---" : (AutoPilotPlugin.LeavePlanet ? "ON" : "OFF"));
|
||||
guistyle.normal.textColor = ((text3 == "ON") ? Color.cyan : Color.white);
|
||||
GUILayout.Label("Leave Planet : " + text3, guistyle, Array.Empty<GUILayoutOption>());
|
||||
var text4 = ((AutoPilotPlugin.State == AutoPilotState.Inactive) ? "---" : (AutoPilotPlugin.SpeedUp ? "ON" : "OFF"));
|
||||
guistyle.normal.textColor = ((text4 == "ON") ? Color.cyan : Color.white);
|
||||
GUILayout.Label("Spee UP : " + text4, guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
}
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var guistyle2 = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 160f,
|
||||
fixedHeight = 32f,
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
var flag2 = AutoPilotPlugin.State == AutoPilotState.Inactive;
|
||||
if (flag2)
|
||||
{
|
||||
GUILayout.Label("Auto Pilot Inactive.", guistyle2, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
else
|
||||
{
|
||||
guistyle2.normal.textColor = Color.cyan;
|
||||
GUILayout.Label("Auto Pilot Active.", guistyle2, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
var guistyle3 = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 50f,
|
||||
fixedHeight = 18f,
|
||||
fontSize = 11,
|
||||
alignment = TextAnchor.MiddleCenter
|
||||
};
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var flag3 = GUILayout.Button("Config", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (flag3)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
var show = AutoPilotConfigUI.Show;
|
||||
var num = wIdx;
|
||||
show[num] = !show[num];
|
||||
var flag4 = AutoPilotConfigUI.Show[wIdx];
|
||||
if (flag4)
|
||||
{
|
||||
AutoPilotConfigUI.TempMinEnergyPer = AutoPilotPlugin.Conf.MinEnergyPer.ToString();
|
||||
AutoPilotConfigUI.TempMaxSpeed = AutoPilotPlugin.Conf.MaxSpeed.ToString();
|
||||
AutoPilotConfigUI.TempWarpMinRangeAU = AutoPilotPlugin.Conf.WarpMinRangeAU.ToString();
|
||||
AutoPilotConfigUI.TempSpeedToWarp = AutoPilotPlugin.Conf.SpeedToWarp.ToString();
|
||||
}
|
||||
}
|
||||
var flag5 = GUILayout.Button("Start", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (flag5)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
AutoPilotPlugin.State = AutoPilotState.Active;
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Button("-", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
var flag6 = GUILayout.Button("Stop", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (flag6)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
AutoPilotPlugin.State = AutoPilotState.Inactive;
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
private static int wIdx;
|
||||
|
||||
public const float WindowWidthFull = 398f;
|
||||
|
||||
public const float WindowHeightFull = 150f;
|
||||
|
||||
public const float WindowWidthMini = 288f;
|
||||
|
||||
public const float WindowHeightMini = 70f;
|
||||
|
||||
public static Rect[] Rect = {
|
||||
new Rect(0f, 0f, 398f, 150f),
|
||||
new Rect(0f, 0f, 398f, 150f)
|
||||
};
|
||||
|
||||
private static float[] lastCheckWindowLeft = { float.MinValue, float.MinValue };
|
||||
|
||||
private static float[] lastCheckWindowTop = { float.MinValue, float.MinValue };
|
||||
|
||||
public static long NextCheckGameTick = long.MaxValue;
|
||||
}
|
||||
Reference in New Issue
Block a user