diff --git a/NebulaModel/MultiplayerOptions.cs b/NebulaModel/MultiplayerOptions.cs index 65f620fb5..5a26ecb8b 100644 --- a/NebulaModel/MultiplayerOptions.cs +++ b/NebulaModel/MultiplayerOptions.cs @@ -61,6 +61,10 @@ public class MultiplayerOptions : ICloneable [Description("Configure which type of IP should be used by Discord RPC")] public IPUtils.IPConfiguration IPConfiguration { get; set; } + [DisplayName("Cleanup inactive sessions"), Category("Network")] + [Description("If disabled the underlying networking library will not cleanup inactive connections. This might solve issues with clients randomly disconnecting and hosts having a 'System.ObjectDisposedException'.")] + public bool CleanupInactiveSessions { get; set; } = false; + [DisplayName("Show Lobby Hints")] public bool ShowLobbyHints { get; set; } = true; @@ -111,11 +115,12 @@ public bool StreamerMode { public ChatSize DefaultChatSize { get; set; } = ChatSize.Medium; [DisplayName("Notification duration"), Category("Chat")] + [Description("How long should the active message stay on the screen in seconds")] public int NotificationDuration { get; set; } = 15; - [DisplayName("Cleanup inactive sessions"), Category("Network")] - [Description("If disabled the underlying networking library will not cleanup inactive connections. This might solve issues with clients randomly disconnecting and hosts having a 'System.ObjectDisposedException'.")] - public bool CleanupInactiveSessions { get; set; } = true; + [DisplayName("Chat Window Opacity"), Category("Chat")] + [UIRange(0f, 1.0f, true)] + public float ChatWindowOpacity { get; set; } = 0.8f; // Detail function group buttons public bool PowerGridEnabled { get; set; } = false; diff --git a/NebulaWorld/MonoBehaviours/Local/Chat/ChatManager.cs b/NebulaWorld/MonoBehaviours/Local/Chat/ChatManager.cs index 0f9b3c9f1..16def4746 100644 --- a/NebulaWorld/MonoBehaviours/Local/Chat/ChatManager.cs +++ b/NebulaWorld/MonoBehaviours/Local/Chat/ChatManager.cs @@ -5,12 +5,14 @@ using NebulaModel.Utils; using System; using UnityEngine; +using UnityEngine.UI; namespace NebulaWorld.MonoBehaviours.Local { public class ChatManager : MonoBehaviour { private ChatWindow chatWindow; + private Image backgroundImage; public static ChatManager Instance; private void Awake() @@ -33,6 +35,12 @@ private void Awake() trans.sizeDelta = defaultSize; trans.anchoredPosition = defaultPos; + + // TODO: Fix ChatV2.prefab to get rid of warnings + GameObject backgroundGo = chatGo.transform.Find("Main/background").gameObject; + DestroyImmediate(backgroundGo.GetComponent()); + backgroundImage = backgroundGo.AddComponent(); + backgroundImage.color = new Color(0f, 0f, 0f, options.ChatWindowOpacity); } chatWindow = chatGo.transform.GetComponentInChildren(); @@ -56,6 +64,7 @@ public static void UpdateChatPosition() RectTransform trans = (RectTransform)Instance.chatWindow.transform; trans.anchoredPosition = defaultPos; trans.sizeDelta = defaultSize; + Instance.backgroundImage.color = new Color(0f, 0f, 0f, options.ChatWindowOpacity); } void Update()