[OriginShift] Moved debug to BTKUI instead of keybind

This commit is contained in:
NotAKidoS 2024-06-18 13:14:35 -05:00
parent a29075d2ad
commit 69e6298281
2 changed files with 20 additions and 16 deletions

View file

@ -32,6 +32,10 @@ namespace NAK.OriginShiftMod.Integrations
// listen for state changes // listen for state changes
OriginShiftManager.OnStateChanged += OnOriginShiftStateChanged; 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 #region Category Actions
@ -131,5 +135,14 @@ namespace NAK.OriginShiftMod.Integrations
} }
#endregion Toggle Actions #endregion Toggle Actions
#region Debug Toggle Actions
private static void OnDebugToggle(bool value)
{
OriginShiftManager.Instance.ToggleDebugOverlay(value);
}
#endregion Debug Toggle Actions
} }
} }

View file

@ -231,24 +231,15 @@ public class OriginShiftManager : MonoBehaviour
#endregion Utility Methods #endregion Utility Methods
#region Unity Events #region Debug Methods
#if !UNITY_EDITOR public void ToggleDebugOverlay(bool state)
private void Update()
{ {
if (Input.GetKeyDown(KeyCode.P)) // press p to print chunk if (TryGetComponent(out DebugTextDisplay debugTextDisplay))
OriginShiftMod.Logger.Msg($"Current Chunk: {ChunkOffset}"); Destroy(debugTextDisplay);
else
// press o to toggle debug gameObject.AddComponent<DebugTextDisplay>();
if (Input.GetKeyDown(KeyCode.O))
{
if (TryGetComponent(out DebugTextDisplay debugTextDisplay))
Destroy(debugTextDisplay);
else
gameObject.AddComponent<DebugTextDisplay>();
}
} }
#endif
#endregion Unity Events #endregion Debug Methods
} }