From 7ef6d153e1800211d3a0a3b165188a1a52e4b383 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Tue, 24 Jun 2025 00:51:14 -0700 Subject: [PATCH] Make it so the user has to be logged in to send a message --- Assets/Scripts/ChatroomMenu.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Assets/Scripts/ChatroomMenu.cs b/Assets/Scripts/ChatroomMenu.cs index 6a7f6a3..3469ceb 100644 --- a/Assets/Scripts/ChatroomMenu.cs +++ b/Assets/Scripts/ChatroomMenu.cs @@ -22,6 +22,12 @@ public class ChatroomMenu : MonoBehaviour void Start() { + if (!PlayerPrefs.HasKey("gameSession") || !PlayerPrefs.HasKey("userName") || !PlayerPrefs.HasKey("userId")) + { + sendButton.interactable = false; + messageInputField.interactable = false; + ShowStatus("Warning: You are not logged in. Please log in to send messages."); + } backButton.onClick.AddListener(async () => await SceneManager.LoadSceneAsync("MainMenu")); sendButton.onClick.AddListener(async () => await HandleMessageSubmit()); messageInputField.textComponent.textWrappingMode = TextWrappingModes.Normal; @@ -38,6 +44,7 @@ public class ChatroomMenu : MonoBehaviour async Task HandleMessageSubmit() { + if (!sendButton.interactable) return; var text = messageInputField.text.Clone() as string; messageInputField.text = string.Empty; if (string.IsNullOrEmpty(text))