mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
refactor(uxassist): unify auto-cruise navigation
Remove the legacy cruise implementation and expose the advanced navigator through the existing auto-cruise setting and UI. Match the game's 1.6-degree steering cap and handle antiparallel target directions with a stable turn plane.
This commit is contained in:
1 parent
fa65236d5c
commit
2c601e3546
8 files changed
+158
-466
No files matched your search
@@ -27,13 +27,16 @@ internal static class AutoCruiseUI
|
||||
public static void OnUpdate()
|
||||
{
|
||||
if (Time.frameCount % 30 == 0)
|
||||
Patches.PlayerPatch.AutoNavigationG.UpdateUiTip();
|
||||
{
|
||||
Patches.PlayerPatch.AutoNavigation.UpdateUiTip();
|
||||
UpdateToggleAutoCruiseCheckButtonVisiblility();
|
||||
}
|
||||
}
|
||||
|
||||
public static void InitToggleAutoCruiseCheckButton()
|
||||
{
|
||||
var lowGroup = GameObject.Find("UI Root/Overlay Canvas/In Game/Low Group");
|
||||
ToggleAutoCruise = MyCheckButton.CreateCheckButton(0, 0, lowGroup.GetComponent<RectTransform>(), Patches.PlayerPatch.AutoCruiseEnabled).WithSize(160f, 40f);
|
||||
ToggleAutoCruise = MyCheckButton.CreateCheckButton(0, 0, lowGroup.GetComponent<RectTransform>(), Patches.PlayerPatch.AutoNavigation.IsActive).WithSize(160f, 40f);
|
||||
var rectTrans = ToggleAutoCruise.rectTrans;
|
||||
rectTrans.anchorMax = new Vector2(0.5f, 0f);
|
||||
rectTrans.anchorMin = new Vector2(0.5f, 0f);
|
||||
@@ -48,19 +51,22 @@ internal static class AutoCruiseUI
|
||||
{
|
||||
if (ToggleAutoCruise.Checked)
|
||||
{
|
||||
ToggleAutoCruise.SetLabelText("Disable auto-cruise");
|
||||
ToggleAutoCruise.SetLabelText(I18NKeys.DisableAutoCruise);
|
||||
}
|
||||
else
|
||||
{
|
||||
ToggleAutoCruise.SetLabelText("Enable auto-cruise");
|
||||
ToggleAutoCruise.SetLabelText(I18NKeys.EnableAutoCruise);
|
||||
}
|
||||
}
|
||||
ToggleAutoCruise.OnChecked += Patches.PlayerPatch.AutoNavigation.Toggle;
|
||||
}
|
||||
|
||||
public static void UpdateToggleAutoCruiseCheckButtonVisiblility()
|
||||
{
|
||||
if (ToggleAutoCruise == null) return;
|
||||
var active = Patches.PlayerPatch.AutoNavigationEnabled.Value && Patches.PlayerPatch.AutoNavigation.IndicatorAstroId > 0;
|
||||
var active = Patches.PlayerPatch.AutoCruiseEnabled.Value
|
||||
&& Patches.PlayerPatch.AutoNavigation.HasNavigationTarget();
|
||||
ToggleAutoCruise.Checked = Patches.PlayerPatch.AutoNavigation.IsActive;
|
||||
ToggleAutoCruise.gameObject.SetActive(active);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user