diff --git a/OriginShift/Integrations/BTKUI/BtkUiAddon_CAT_OriginShiftMod.cs b/OriginShift/Integrations/BTKUI/BtkUiAddon_CAT_OriginShiftMod.cs index a7de5ab..75d1010 100644 --- a/OriginShift/Integrations/BTKUI/BtkUiAddon_CAT_OriginShiftMod.cs +++ b/OriginShift/Integrations/BTKUI/BtkUiAddon_CAT_OriginShiftMod.cs @@ -32,6 +32,10 @@ namespace NAK.OriginShiftMod.Integrations // listen for state changes OriginShiftManager.OnStateChanged += OnOriginShiftStateChanged; + + // debug toggle + ToggleButton debugToggle = _ourCategory.AddToggle("Debug Overlay", "Displays coordinate & chunk debug information on the Desktop view.", false); + debugToggle.OnValueUpdated += OnDebugToggle; } #region Category Actions @@ -131,5 +135,14 @@ namespace NAK.OriginShiftMod.Integrations } #endregion Toggle Actions + + #region Debug Toggle Actions + + private static void OnDebugToggle(bool value) + { + OriginShiftManager.Instance.ToggleDebugOverlay(value); + } + + #endregion Debug Toggle Actions } } \ No newline at end of file diff --git a/OriginShift/OriginShift/OriginShiftManager.cs b/OriginShift/OriginShift/OriginShiftManager.cs index d39bedf..7f7579c 100644 --- a/OriginShift/OriginShift/OriginShiftManager.cs +++ b/OriginShift/OriginShift/OriginShiftManager.cs @@ -231,24 +231,15 @@ public class OriginShiftManager : MonoBehaviour #endregion Utility Methods - #region Unity Events + #region Debug Methods -#if !UNITY_EDITOR - private void Update() + public void ToggleDebugOverlay(bool state) { - if (Input.GetKeyDown(KeyCode.P)) // press p to print chunk - OriginShiftMod.Logger.Msg($"Current Chunk: {ChunkOffset}"); - - // press o to toggle debug - if (Input.GetKeyDown(KeyCode.O)) - { - if (TryGetComponent(out DebugTextDisplay debugTextDisplay)) - Destroy(debugTextDisplay); - else - gameObject.AddComponent(); - } + if (TryGetComponent(out DebugTextDisplay debugTextDisplay)) + Destroy(debugTextDisplay); + else + gameObject.AddComponent(); } -#endif - #endregion Unity Events + #endregion Debug Methods } \ No newline at end of file