Add chat tab to multiplayer/replays ingame menu

This commit is contained in:
rob-v
2017-05-30 22:43:27 +02:00
committed by Paul Chote
parent daee217431
commit c848b30e9e
12 changed files with 206 additions and 35 deletions

View File

@@ -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");