mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
feat(uxassist): show new navigation shortcut hint
This commit is contained in:
1 parent
5ae85eb031
commit
3f8e04f4a0
5 files changed
+48
-6
No files matched your search
@@ -165,6 +165,7 @@ public static class I18NKeys
|
||||
public const string DarkFogHiveFollowDistance = "Dark Fog Hive follow distance";
|
||||
public const string DarkFogCarrierFollowDistance = "Dark Fog Carrier follow distance";
|
||||
public const string AutoNavigationActive = "Auto-navigation active";
|
||||
public const string AutoNavigationEnableHint = "Press {0} to enable auto-navigation";
|
||||
public const string AutoNavigationStarted = "Auto-navigation started";
|
||||
public const string AutoNavigationStopped = "Auto-navigation stopped";
|
||||
public const string TreatStackItemsAsSingleInMonitorComponents = "Treat stack items as single in monitor components";
|
||||
@@ -432,6 +433,7 @@ You can set 2 shortcut keys in Settings panel:
|
||||
I18N.Add(DarkFogHiveFollowDistance, "Dark Fog Hive follow distance (AU)", "黑雾巢穴跟踪距离(AU)");
|
||||
I18N.Add(DarkFogCarrierFollowDistance, "Dark Fog Carrier follow distance (m)", "黑雾火种跟踪距离(m)");
|
||||
I18N.Add(AutoNavigationActive, "Auto-navigation active", "自动导航中");
|
||||
I18N.Add(AutoNavigationEnableHint, "Press {0} to enable auto-navigation", "按 {0} 启用自动导航");
|
||||
I18N.Add(AutoNavigationStarted, "Auto-navigation started", "自动导航启动");
|
||||
I18N.Add(AutoNavigationStopped, "Auto-navigation stopped", "自动导航关闭");
|
||||
I18N.Add(TreatStackItemsAsSingleInMonitorComponents, "Treat stack items as single in monitor components", "在流速计中将堆叠物品视为单个物品");
|
||||
|
||||
@@ -30,6 +30,19 @@ public static class KeyBindings
|
||||
return new CombineKey((int)shortcut.MainKey, mod, ECombineKeyAction.OnceClick, false);
|
||||
}
|
||||
|
||||
public static string GetKeyBindingText(PressKeyBind keyBind)
|
||||
{
|
||||
var defaultBind = keyBind.defaultBind;
|
||||
var key = defaultBind.key;
|
||||
if (VFInput.override_keys != null && (uint)defaultBind.id < (uint)VFInput.override_keys.Length)
|
||||
{
|
||||
var overrideKey = VFInput.override_keys[defaultBind.id];
|
||||
if (!overrideKey.IsNull()) key = overrideKey;
|
||||
}
|
||||
|
||||
return key.ToString();
|
||||
}
|
||||
|
||||
public static bool IsKeyPressing(this PressKeyBind keyBind)
|
||||
{
|
||||
var defBind = keyBind.defaultBind;
|
||||
|
||||
@@ -26,6 +26,8 @@ internal static class AutoCruiseUI
|
||||
|
||||
public static void OnUpdate()
|
||||
{
|
||||
if (Time.frameCount % 30 == 0)
|
||||
Patches.PlayerPatch.AutoNavigationG.UpdateUiTip();
|
||||
}
|
||||
|
||||
public static void InitToggleAutoCruiseCheckButton()
|
||||
|
||||
@@ -724,14 +724,19 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
|
||||
public static void StartG( )
|
||||
{
|
||||
if (UiTipText != null || UIRoot.instance?.uiGame?.generalTips?.modeText == null)
|
||||
if (UiTipText != null)
|
||||
{
|
||||
UpdateUiTip();
|
||||
return;
|
||||
}
|
||||
if (UIRoot.instance?.uiGame?.generalTips?.modeText == null)
|
||||
return;
|
||||
Text originText = UIRoot.instance.uiGame.generalTips.modeText;
|
||||
UiTipText = Object.Instantiate(originText, originText.transform.parent);
|
||||
UiTipText.gameObject.SetActive(false);
|
||||
UiTipText.rectTransform.anchoredPosition = new Vector2(0f, 160f);
|
||||
UiTipText.fontStyle = FontStyle.Normal;
|
||||
UiTipText.text = I18NKeys.AutoNavigationActive.Translate();
|
||||
UpdateUiTip();
|
||||
}
|
||||
|
||||
public static void Toggle()
|
||||
@@ -740,6 +745,7 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
StopAutoNavigation();
|
||||
else
|
||||
StartAutoNavigation( );
|
||||
UpdateUiTip();
|
||||
}
|
||||
|
||||
private static void StartAutoNavigation( )
|
||||
@@ -750,7 +756,7 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
EnableTag = true;
|
||||
Reset( );
|
||||
UIRealtimeTip.Popup(I18NKeys.AutoNavigationStarted.Translate(), sound: false);
|
||||
UiTipText?.gameObject.SetActive(true);
|
||||
UpdateUiTip();
|
||||
}
|
||||
|
||||
private static void StopAutoNavigation(bool showTip = true)
|
||||
@@ -760,7 +766,7 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
PauseTag = false;
|
||||
if (wasEnabled && showTip && !DSPGame.IsMenuDemo && GameMain.isRunning)
|
||||
UIRealtimeTip.Popup(I18NKeys.AutoNavigationStopped.Translate(), sound: false);
|
||||
UiTipText?.gameObject.SetActive(false);
|
||||
UpdateUiTip();
|
||||
}
|
||||
|
||||
private static void Reset( )
|
||||
@@ -785,7 +791,26 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
Reset();
|
||||
}
|
||||
|
||||
private static void NavigationModeChanged(object sender, EventArgs args) => NormalizeNavigationMode();
|
||||
private static void NavigationModeChanged(object sender, EventArgs args)
|
||||
{
|
||||
NormalizeNavigationMode();
|
||||
UpdateUiTip();
|
||||
}
|
||||
|
||||
public static void UpdateUiTip()
|
||||
{
|
||||
if (UiTipText == null)
|
||||
return;
|
||||
|
||||
bool showTip = GameMain.isRunning && !DSPGame.IsMenuDemo && UseNewNavigationAlgorithm.Value && !AutoNavigationEnabled.Value;
|
||||
UiTipText.gameObject.SetActive(showTip);
|
||||
if (!showTip)
|
||||
return;
|
||||
|
||||
UiTipText.text = EnableTag
|
||||
? I18NKeys.AutoNavigationActive.Translate()
|
||||
: string.Format(I18NKeys.AutoNavigationEnableHint.Translate(), KeyBindings.GetKeyBindingText(_autoDriveKey));
|
||||
}
|
||||
|
||||
private static void NormalizeNavigationMode()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user