Add chat tab to multiplayer/replays ingame menu
This commit is contained in:
@@ -17,7 +17,7 @@ using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
public enum IngameInfoPanel { AutoSelect, Map, Objectives, Debug }
|
||||
public enum IngameInfoPanel { AutoSelect, Map, Objectives, Debug, Chat }
|
||||
|
||||
class GameInfoLogic : ChromeLogic
|
||||
{
|
||||
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
numTabs++;
|
||||
var debugTabButton = widget.Get<ButtonWidget>(string.Concat("BUTTON", numTabs.ToString()));
|
||||
debugTabButton.Text = "Debug";
|
||||
debugTabButton.IsVisible = () => lp != null && numTabs > 1 && !hasError;
|
||||
debugTabButton.IsVisible = () => numTabs > 1 && !hasError;
|
||||
debugTabButton.IsDisabled = () => world.IsGameOver;
|
||||
debugTabButton.OnClick = () => activePanel = IngameInfoPanel.Debug;
|
||||
debugTabButton.IsHighlighted = () => activePanel == IngameInfoPanel.Debug;
|
||||
@@ -99,6 +99,28 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
activePanel = IngameInfoPanel.Debug;
|
||||
}
|
||||
|
||||
if (world.LobbyInfo.NonBotClients.Count() > 1)
|
||||
{
|
||||
numTabs++;
|
||||
var chatPanelContainer = widget.Get<ContainerWidget>("CHAT_PANEL");
|
||||
var chatTabButton = widget.Get<ButtonWidget>(string.Concat("BUTTON", numTabs.ToString()));
|
||||
chatTabButton.Text = "Chat";
|
||||
chatTabButton.IsVisible = () => numTabs > 1 && !hasError;
|
||||
chatTabButton.IsHighlighted = () => activePanel == IngameInfoPanel.Chat;
|
||||
chatTabButton.OnClick = () =>
|
||||
{
|
||||
activePanel = IngameInfoPanel.Chat;
|
||||
chatPanelContainer.Get<TextFieldWidget>("CHAT_TEXTFIELD").TakeKeyboardFocus();
|
||||
};
|
||||
|
||||
chatPanelContainer.IsVisible = () => activePanel == IngameInfoPanel.Chat;
|
||||
|
||||
Game.LoadWidget(world, "CHAT_CONTAINER", chatPanelContainer, new WidgetArgs() { { "isMenuChat", true } });
|
||||
|
||||
if (activePanel == IngameInfoPanel.AutoSelect)
|
||||
chatTabButton.OnClick();
|
||||
}
|
||||
|
||||
// Handle empty space when tabs aren't displayed
|
||||
var titleText = widget.Get<LabelWidget>("TITLE");
|
||||
var titleTextNoTabs = widget.GetOrNull<LabelWidget>("TITLE_NO_TABS");
|
||||
|
||||
Reference in New Issue
Block a user