[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
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
}
}

View file

@ -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<DebugTextDisplay>();
}
if (TryGetComponent(out DebugTextDisplay debugTextDisplay))
Destroy(debugTextDisplay);
else
gameObject.AddComponent<DebugTextDisplay>();
}
#endif
#endregion Unity Events
#endregion Debug Methods
}