From 63a2a451c06459fc13234cbb3909a43d363f2fd8 Mon Sep 17 00:00:00 2001 From: Tom Hempel Date: Mon, 10 Nov 2025 09:38:28 +0000 Subject: [PATCH] revert e99159a3681cb50d8926b18a9c9233e1a7e67297 revert Add notes handling to TaskButtonManager for UDP commands --- Unity/Assets/Scripts/ARVRMenu.cs | 45 +++++----------------------- Unity/Assets/Scripts/NotesDisplay.cs | 23 -------------- 2 files changed, 7 insertions(+), 61 deletions(-) delete mode 100644 Unity/Assets/Scripts/NotesDisplay.cs diff --git a/Unity/Assets/Scripts/ARVRMenu.cs b/Unity/Assets/Scripts/ARVRMenu.cs index ca5abfb..931bdea 100644 --- a/Unity/Assets/Scripts/ARVRMenu.cs +++ b/Unity/Assets/Scripts/ARVRMenu.cs @@ -18,17 +18,12 @@ public class TaskButtonManager : MonoBehaviour private string pendingTimerCommand = null; private readonly object sceneLock = new object(); private readonly object timerLock = new object(); - private readonly object notesLock = new object(); private TaskTimer taskTimer; - private NotesDisplay notesDisplay; - private string pendingNotesText = null; private void Start() { // Find TaskTimer in the scene taskTimer = FindObjectOfType(); - // Find NotesDisplay in the scene - notesDisplay = FindObjectOfType(); if (enableUDPControl) { @@ -65,23 +60,6 @@ public class TaskButtonManager : MonoBehaviour } } - // Check for pending notes updates (must be done on main thread) - lock (notesLock) - { - if (!string.IsNullOrEmpty(pendingNotesText)) - { - if (notesDisplay != null) - { - notesDisplay.SetNotes(pendingNotesText); - } - else - { - Debug.LogWarning("NotesDisplay not found in scene. Cannot display notes text."); - } - pendingNotesText = null; - } - } - // VR Tasks (Keys 1-4) if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1)) LoadSceneByName("VR-Task1"); @@ -153,12 +131,12 @@ public class TaskButtonManager : MonoBehaviour if (string.IsNullOrEmpty(message)) return; - // Parse command format: COMMAND:Parameter (Parameter may contain additional colons) - int separatorIndex = message.IndexOf(':'); - if (separatorIndex > 0 && separatorIndex < message.Length - 1) + // Parse command format: COMMAND:Parameter + string[] parts = message.Split(':'); + if (parts.Length >= 2) { - string commandType = message.Substring(0, separatorIndex).Trim().ToUpper(); - string parameter = message.Substring(separatorIndex + 1); // keep raw to preserve spaces/colons + string commandType = parts[0].Trim().ToUpper(); + string parameter = parts[1].Trim(); if (commandType == "SWITCH") { @@ -178,23 +156,14 @@ public class TaskButtonManager : MonoBehaviour } Debug.Log($"Scheduled timer command: {parameter}"); } - else if (commandType == "NOTES") - { - // Notes display command - lock (notesLock) - { - pendingNotesText = parameter; - } - Debug.Log($"Scheduled notes update: {parameter}"); - } else { - Debug.LogWarning($"Unknown UDP command type: {commandType}. Expected: SWITCH, TIMER or NOTES"); + Debug.LogWarning($"Unknown UDP command type: {commandType}. Expected: SWITCH or TIMER"); } } else { - Debug.LogWarning($"Invalid UDP command format: {message}. Expected format: COMMAND:Parameter (e.g., SWITCH:SceneName, TIMER:START or NOTES:Your text)"); + Debug.LogWarning($"Invalid UDP command format: {message}. Expected format: COMMAND:Parameter (e.g., SWITCH:SceneName or TIMER:START)"); } } diff --git a/Unity/Assets/Scripts/NotesDisplay.cs b/Unity/Assets/Scripts/NotesDisplay.cs deleted file mode 100644 index 0482ce2..0000000 --- a/Unity/Assets/Scripts/NotesDisplay.cs +++ /dev/null @@ -1,23 +0,0 @@ -using UnityEngine; -using TMPro; - -public class NotesDisplay : MonoBehaviour -{ - [Header("Notes UI")] - [Tooltip("TextMeshProUGUI field where received notes will be displayed")] - public TextMeshProUGUI notesText; - - public void SetNotes(string text) - { - if (notesText != null) - { - notesText.text = text; - } - else - { - Debug.LogWarning("NotesDisplay: notesText is not assigned in the inspector."); - } - } -} - -