diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs index 3f3151a695..402a15d392 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs @@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic chatChrome.Visible = true; var chatMode = chatChrome.Get("CHAT_MODE"); - chatMode.GetText = () => teamChat ? "Team" : "All"; + chatMode.GetText = () => teamChat && !disableTeamChat ? "Team" : "All"; chatMode.OnClick = () => teamChat ^= true; // Team chat is disabled if we are the only spectator @@ -113,6 +113,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic else chatMode.IsDisabled = () => disableTeamChat; + // Disable team chat after the game ended + world.GameOver += () => disableTeamChat = true; + chatText = chatChrome.Get("CHAT_TEXTFIELD"); chatText.MaxLength = UnitOrders.ChatMessageMaxLength; chatText.OnEnterKey = () => @@ -144,10 +147,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic chatText.Text = tabCompletion.Complete(chatText.Text); chatText.CursorPosition = chatText.Text.Length; - if (chatText.Text == previousText) - return SwitchTeamChat(); - else - return true; + if (chatText.Text == previousText && !disableTeamChat) + teamChat ^= true; + + return true; }; chatText.OnEscKey = () => @@ -217,13 +220,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic chatLineSound = yaml.Value; } - bool SwitchTeamChat() - { - if (!disableTeamChat) - teamChat ^= true; - return true; - } - public void OpenChat() { chatText.Text = "";