Integrate global chat with the server lobby.

This commit is contained in:
Paul Chote
2015-10-09 23:03:32 +01:00
parent 3d7d7ff2a5
commit fa2b10b269
11 changed files with 416 additions and 106 deletions

View File

@@ -37,6 +37,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
enum PanelType { Players, Options, Music, Kick, ForceStart }
PanelType panel = PanelType.Players;
enum ChatPanelType { Lobby, Global }
ChatPanelType chatPanel = ChatPanelType.Lobby;
readonly Widget lobby;
readonly Widget editablePlayerTemplate;
readonly Widget nonEditablePlayerTemplate;
@@ -45,7 +48,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly Widget nonEditableSpectatorTemplate;
readonly Widget newSpectatorTemplate;
readonly ScrollPanelWidget chatPanel;
readonly ScrollPanelWidget lobbyChatPanel;
readonly Widget chatTemplate;
readonly ScrollPanelWidget players;
@@ -567,6 +570,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (skirmishMode)
disconnectButton.Text = "Back";
var globalChat = Game.LoadWidget(null, "LOBBY_GLOBALCHAT_PANEL", lobby.Get("GLOBALCHAT_ROOT"), new WidgetArgs());
var globalChatInput = globalChat.Get<TextFieldWidget>("CHAT_TEXTFIELD");
globalChat.IsVisible = () => chatPanel == ChatPanelType.Global;
var globalChatTab = lobby.Get<ButtonWidget>("GLOBALCHAT_TAB");
globalChatTab.IsHighlighted = () => chatPanel == ChatPanelType.Global;
globalChatTab.OnClick = () =>
{
chatPanel = ChatPanelType.Global;
globalChatInput.TakeKeyboardFocus();
};
var lobbyChat = lobby.Get("LOBBYCHAT");
lobbyChat.IsVisible = () => chatPanel == ChatPanelType.Lobby;
chatLabel = lobby.Get<LabelWidget>("LABEL_CHATTYPE");
var chatTextField = lobby.Get<TextFieldWidget>("CHAT_TEXTFIELD");
chatTextField.TakeKeyboardFocus();
@@ -576,7 +595,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return true;
// Always scroll to bottom when we've typed something
chatPanel.ScrollToBottom();
lobbyChatPanel.ScrollToBottom();
orderManager.IssueOrder(Order.Chat(teamChat, chatTextField.Text));
chatTextField.Text = "";
@@ -597,9 +616,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
chatTextField.OnEscKey = () => { chatTextField.Text = ""; return true; };
chatPanel = lobby.Get<ScrollPanelWidget>("CHAT_DISPLAY");
chatTemplate = chatPanel.Get("CHAT_TEMPLATE");
chatPanel.RemoveChildren();
var lobbyChatTab = lobby.Get<ButtonWidget>("LOBBYCHAT_TAB");
lobbyChatTab.IsHighlighted = () => chatPanel == ChatPanelType.Lobby;
lobbyChatTab.OnClick = () =>
{
chatPanel = ChatPanelType.Lobby;
chatTextField.TakeKeyboardFocus();
};
lobbyChatPanel = lobby.Get<ScrollPanelWidget>("CHAT_DISPLAY");
chatTemplate = lobbyChatPanel.Get("CHAT_TEMPLATE");
lobbyChatPanel.RemoveChildren();
var settingsButton = lobby.GetOrNull<ButtonWidget>("SETTINGS_BUTTON");
if (settingsButton != null)
@@ -655,10 +682,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
template.Bounds.Height += dh;
}
var scrolledToBottom = chatPanel.ScrolledToBottom;
chatPanel.AddChild(template);
var scrolledToBottom = lobbyChatPanel.ScrolledToBottom;
lobbyChatPanel.AddChild(template);
if (scrolledToBottom)
chatPanel.ScrollToBottom(smooth: true);
lobbyChatPanel.ScrollToBottom(smooth: true);
Game.Sound.PlayNotification(modRules, null, "Sounds", "ChatLine", null);
}

View File

@@ -0,0 +1,119 @@
Container@LOBBY_GLOBALCHAT_PANEL:
Logic: GlobalChatLogic
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Children:
Container@GLOBALCHAT_MAIN_PANEL:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Children:
Background@TOPIC:
Width: 582
Height: 20
Background: panel-transparent
Children:
Label@CHANNEL_TOPIC:
X: 10
Y: 0-1
Width: PARENT_RIGHT - 20
Height: PARENT_BOTTOM
Font: TinyBold
Align: Center
ScrollPanel@HISTORY_PANEL:
Width: 582
Y: 19
Height: PARENT_BOTTOM - 19
ItemSpacing: 5
Children:
Label@HISTORY_TEMPLATE:
X: 5
Width: 530
Height: 25
WordWrap: True
TextField@CHAT_TEXTFIELD:
X: 200
Y: PARENT_BOTTOM + 5
Width: 382
Height: 25
LeftMargin: 60
Children:
Label@LABEL_CHATTYPE:
Y: 0-1
Width: 55
Height: 25
Align: Right
Text: Global:
ScrollPanel@NICKNAME_PANEL:
X: 596
Width: PARENT_RIGHT - 596
Height: PARENT_BOTTOM
Children:
Container@NICKNAME_TEMPLATE:
Height: 20
Width: PARENT_RIGHT-25
Children:
Image@INDICATOR:
ImageCollection: lobby-bits
ImageName: admin
X: 4
Y: 9
Label@NICK:
X: 15
Width: PARENT_RIGHT-15
Height: 20
Button@DISCONNECT_BUTTON:
X: 596
Y: PARENT_BOTTOM + 5
Width: PARENT_RIGHT - 596
Height: 25
Text: Leave Chat
Font: Bold
Background@GLOBALCHAT_CONNECT_PANEL:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Background: scrollpanel-bg
Children:
Label@GLOBAL_CHAT_LABEL:
Y: PARENT_BOTTOM / 4
Width: PARENT_RIGHT
Align: Center
Text: Global Chat
Font: Bold
Label@NICKNAME_LABEL:
X: 200
Y: PARENT_BOTTOM / 4 + 35
Text: Nickname:
TextField@NICKNAME_TEXTFIELD:
X: 270
Y: PARENT_BOTTOM / 4 + 25
Width: 150
Height: 25
Checkbox@CONNECT_AUTOMATICALLY_CHECKBOX:
X: 270
Y: PARENT_BOTTOM / 4 + 75
Height: 20
Width: 180
Font: Regular
Text: Connect Automatically
Button@CONNECT_BUTTON:
X: 430
Y: PARENT_BOTTOM / 4 + 25
Width: 100
Height: 25
Text: Connect
Font: Bold
TextField@FAKE_CHAT:
X: 200
Y: PARENT_BOTTOM + 5
Width: PARENT_RIGHT - 200
Height: 25
LeftMargin: 60
Disabled: true
Children:
Label@LABEL_CHATTYPE:
Y: 0-1
Width: 55
Height: 25
Align: Right
Text: Global:

View File

@@ -1,9 +1,9 @@
Container@SERVER_LOBBY:
Logic: LobbyLogic
X: (WINDOW_RIGHT - WIDTH)/2
Y: (WINDOW_BOTTOM - 500)/2
Y: (WINDOW_BOTTOM - 560)/2
Width: 800
Height: 535
Height: 575
Children:
ColorPreviewManager@COLOR_MANAGER:
Label@SERVER_NAME:
@@ -14,7 +14,7 @@ Container@SERVER_LOBBY:
Align: Center
Background@bg:
Width: 800
Height: 500
Height: 540
Background: panel-black
Children:
Container@MAP_PREVIEW_ROOT:
@@ -57,11 +57,27 @@ Container@SERVER_LOBBY:
Y: 30
Width: 582
Height: 219
ScrollPanel@CHAT_DISPLAY:
Button@LOBBYCHAT_TAB:
X: 15
Y: PARENT_BOTTOM - 46
Width: 95
Height: 31
Text: Lobby
Button@GLOBALCHAT_TAB:
X: 115
Y: PARENT_BOTTOM - 46
Width: 95
Height: 31
Text: Global
Container@LOBBYCHAT:
X: 15
Y: 285
Width: PARENT_RIGHT - 30
Height: PARENT_BOTTOM - 324
Height: PARENT_BOTTOM - 300
Children:
ScrollPanel@CHAT_DISPLAY:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM - 30
TopBottomSpacing: 2
ItemSpacing: 2
Children:
@@ -88,9 +104,9 @@ Container@SERVER_LOBBY:
WordWrap: true
VAlign: Top
TextField@CHAT_TEXTFIELD:
X: 15
Y: PARENT_BOTTOM - HEIGHT - 15
Width: PARENT_RIGHT - 30
X: 200
Y: PARENT_BOTTOM - HEIGHT
Width: PARENT_RIGHT - 200
Height: 25
LeftMargin: 50
Children:
@@ -100,20 +116,25 @@ Container@SERVER_LOBBY:
Height: 25
Align: Right
Text: Chat:
Container@GLOBALCHAT_ROOT:
X: 15
Y: 285
Width: PARENT_RIGHT - 30
Height: PARENT_BOTTOM - 330
Button@DISCONNECT_BUTTON:
Y: 499
Y: 539
Width: 140
Height: 35
Text: Leave Game
Button@SETTINGS_BUTTON:
X: 150
Y: 499
Y: 539
Width: 140
Height: 35
Text: Settings
Button@START_GAME_BUTTON:
X: PARENT_RIGHT - WIDTH
Y: 499
Y: 539
Width: 140
Height: 35
Text: Start Game

View File

@@ -1,9 +1,9 @@
Container@MAPCHOOSER_PANEL:
Logic: MapChooserLogic
X: (WINDOW_RIGHT - WIDTH)/2
Y: (WINDOW_BOTTOM - 500)/2
Y: (WINDOW_BOTTOM - 560)/2
Width: 800
Height: 535
Height: 575
Children:
Label@TITLE:
Width: PARENT_RIGHT
@@ -14,7 +14,7 @@ Container@MAPCHOOSER_PANEL:
Text: Select Map
Background@bg:
Width: PARENT_RIGHT
Height: 500
Height: 540
Background: panel-black
Children:
Label@FILTER_DESC:
@@ -114,34 +114,33 @@ Container@MAPCHOOSER_PANEL:
Font: Tiny
Button@BUTTON_CANCEL:
Key: escape
X: 0
Y: 499
Y: 539
Width: 140
Height: 35
Text: Cancel
Button@RANDOMMAP_BUTTON:
Key: space
X: PARENT_RIGHT - 150 - WIDTH
Y: 499
Y: 539
Width: 140
Height: 35
Text: Random
Button@DELETE_MAP_BUTTON:
X: PARENT_RIGHT - 300 - WIDTH
Y: 499
Y: 539
Width: 140
Height: 35
Text: Delete Map
Button@DELETE_ALL_MAPS_BUTTON:
X: PARENT_RIGHT - 450 - WIDTH
Y: 499
Y: 539
Width: 140
Height: 35
Text: Delete All Maps
Button@BUTTON_OK:
Key: return
X: PARENT_RIGHT - WIDTH
Y: 499
Y: 539
Width: 140
Height: 35
Text: Ok

View File

@@ -100,6 +100,7 @@ ChromeLayout:
./mods/cnc/chrome/lobby-options.yaml
./mods/cnc/chrome/lobby-music.yaml
./mods/cnc/chrome/lobby-kickdialogs.yaml
./mods/cnc/chrome/lobby-globalchat.yaml
./mods/cnc/chrome/connection.yaml
./mods/cnc/chrome/color-picker.yaml
./mods/cnc/chrome/mapchooser.yaml

View File

@@ -90,6 +90,7 @@ ChromeLayout:
./mods/d2k/chrome/lobby-options.yaml
./mods/ra/chrome/lobby-music.yaml
./mods/ra/chrome/lobby-kickdialogs.yaml
./mods/ra/chrome/lobby-globalchat.yaml
./mods/d2k/chrome/color-picker.yaml
./mods/ra/chrome/map-chooser.yaml
./mods/ra/chrome/create-server.yaml

View File

@@ -0,0 +1,118 @@
Container@LOBBY_GLOBALCHAT_PANEL:
Logic: GlobalChatLogic
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Children:
Container@GLOBALCHAT_MAIN_PANEL:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Children:
Background@TOPIC:
Width: 582
Height: 20
Background: dialog2
Children:
Label@CHANNEL_TOPIC:
X: 10
Y: 0-1
Width: PARENT_RIGHT - 20
Height: PARENT_BOTTOM
Font: TinyBold
Align: Center
ScrollPanel@HISTORY_PANEL:
Y: 20
Width: 582
Height: PARENT_BOTTOM - 50
ItemSpacing: 5
Children:
Label@HISTORY_TEMPLATE:
X: 5
Width: 530
Height: 25
WordWrap: True
TextField@CHAT_TEXTFIELD:
X: 205
Y: PARENT_BOTTOM - 25
Width: 582-205
Height: 25
LeftMargin: 60
Children:
Label@LABEL_CHATTYPE:
Y: 0-1
Width: 55
Height: 25
Align: Right
Text: Global:
ScrollPanel@NICKNAME_PANEL:
X: 596
Width: PARENT_RIGHT - 596
Height: PARENT_BOTTOM - 30
Children:
Container@NICKNAME_TEMPLATE:
Height: 20
Width: PARENT_RIGHT-25
Children:
Image@INDICATOR:
ImageCollection: lobby-bits
ImageName: admin
X: 4
Y: 9
Label@NICK:
X: 15
Width: PARENT_RIGHT-15
Height: 20
Button@DISCONNECT_BUTTON:
X: 596
Y: PARENT_BOTTOM - 25
Width: PARENT_RIGHT - 596
Height: 25
Text: Leave Chat
Font: Bold
Background@GLOBALCHAT_CONNECT_PANEL:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM-30
Background: scrollpanel-bg
Children:
Label@GLOBAL_CHAT_LABEL:
Y: PARENT_BOTTOM / 4
Width: PARENT_RIGHT
Align: Center
Text: Global Chat
Font: Bold
Label@NICKNAME_LABEL:
X: 200
Y: PARENT_BOTTOM / 4 + 35
Text: Nickname:
TextField@NICKNAME_TEXTFIELD:
X: 270
Y: PARENT_BOTTOM / 4 + 25
Width: 150
Height: 25
Checkbox@CONNECT_AUTOMATICALLY_CHECKBOX:
X: 270
Y: PARENT_BOTTOM / 4 + 75
Height: 20
Width: 180
Font: Regular
Text: Connect Automatically
Button@CONNECT_BUTTON:
X: 430
Y: PARENT_BOTTOM / 4 + 25
Width: 100
Height: 25
Text: Connect
Font: Bold
TextField@FAKE_CHAT:
X: 205
Y: PARENT_BOTTOM + 5
Width: PARENT_RIGHT - 205
Height: 25
LeftMargin: 60
Disabled: true
Children:
Label@LABEL_CHATTYPE:
Y: 0-1
Width: 55
Height: 25
Align: Right
Text: Global:

View File

@@ -21,28 +21,28 @@ Background@SERVER_LOBBY:
DropDownButton@SLOTS_DROPDOWNBUTTON:
X: 20
Y: 291
Width: 180
Width: 200
Height: 25
Font: Bold
Text: Slot Admin
Button@PLAYERS_TAB:
X: 243
X: 225
Y: 285
Width: 120
Width: 126
Height: 31
Font: Bold
Text: Players
Button@OPTIONS_TAB:
X: 363
X: 351
Y: 285
Width: 120
Width: 126
Height: 31
Font: Bold
Text: Options
Button@MUSIC_TAB:
X: 483
X: 477
Y: 285
Width: 120
Width: 126
Height: 31
Font: Bold
Text: Music
@@ -58,11 +58,29 @@ Background@SERVER_LOBBY:
Height: 25
Text: Change Map
Font: Bold
ScrollPanel@CHAT_DISPLAY:
Button@LOBBYCHAT_TAB:
X: 20
Y: PARENT_BOTTOM - HEIGHT - 52
Y: PARENT_BOTTOM - 81
Width: 100
Height: 31
Text: Lobby
Font: Bold
Button@GLOBALCHAT_TAB:
X: 120
Y: PARENT_BOTTOM - 81
Width: 100
Height: 31
Text: Global
Font: Bold
Container@LOBBYCHAT:
X: 20
Y: PARENT_BOTTOM - HEIGHT - 50
Width: PARENT_RIGHT - 40
Height: 227
Height: 229
Children:
ScrollPanel@CHAT_DISPLAY:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM - 30
TopBottomSpacing: 2
ItemSpacing: 2
Children:
@@ -70,7 +88,6 @@ Background@SERVER_LOBBY:
Width: PARENT_RIGHT-27
Height: 16
X: 2
Y: 0
Children:
Label@TIME:
X: 3
@@ -89,9 +106,9 @@ Background@SERVER_LOBBY:
WordWrap: true
VAlign: Top
TextField@CHAT_TEXTFIELD:
X: 20
Y: PARENT_BOTTOM - HEIGHT - 20
Width: PARENT_RIGHT - 300
X: 205
Y: PARENT_BOTTOM - HEIGHT
Width: PARENT_RIGHT - 205
Height: 25
LeftMargin: 50
Children:
@@ -101,6 +118,11 @@ Background@SERVER_LOBBY:
Height: 25
Align: Right
Text: Chat:
Container@GLOBALCHAT_ROOT:
X: 20
Y: PARENT_BOTTOM - HEIGHT - 50
Width: PARENT_RIGHT - 40
Height: 229
Button@START_GAME_BUTTON:
X: PARENT_RIGHT - WIDTH - 150
Y: PARENT_BOTTOM - HEIGHT - 20

View File

@@ -101,6 +101,7 @@ ChromeLayout:
./mods/ra/chrome/lobby-options.yaml
./mods/ra/chrome/lobby-music.yaml
./mods/ra/chrome/lobby-kickdialogs.yaml
./mods/ra/chrome/lobby-globalchat.yaml
./mods/ra/chrome/color-picker.yaml
./mods/ra/chrome/map-chooser.yaml
./mods/ra/chrome/create-server.yaml

View File

@@ -155,6 +155,7 @@ ChromeLayout:
./mods/ra/chrome/lobby-options.yaml
./mods/ra/chrome/lobby-music.yaml
./mods/ra/chrome/lobby-kickdialogs.yaml
./mods/ra/chrome/lobby-globalchat.yaml
./mods/ts/chrome/color-picker.yaml
./mods/ra/chrome/map-chooser.yaml
./mods/ra/chrome/create-server.yaml