diff --git a/OpenRA.Game/Widgets/MapPreviewWidget.cs b/OpenRA.Game/Widgets/MapPreviewWidget.cs index c1d6f69038..6725b35750 100644 --- a/OpenRA.Game/Widgets/MapPreviewWidget.cs +++ b/OpenRA.Game/Widgets/MapPreviewWidget.cs @@ -123,6 +123,7 @@ namespace OpenRA.Widgets WidgetUtils.FillRectWithColor(new Rectangle(pos.X + offset.X + 2, pos.Y + offset.Y + 2, 12, 12), colors[p]); Game.Renderer.RgbaSpriteRenderer.DrawSprite(sprite, pos + offset); + Game.Renderer.Fonts[ChromeMetrics.Get("SpawnFont")].DrawTextWithContrast(Convert.ToString(spawnPoints.IndexOf(p) + 1), new int2(pos.X + offset.X + 4, pos.Y + offset.Y - 15), ChromeMetrics.Get("SpawnColor"), ChromeMetrics.Get("SpawnContrastColor"), 2); if ((pos - Viewport.LastMousePos).LengthSquared < 64) TooltipSpawnIndex = spawnPoints.IndexOf(p) + 1; diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index 9f965d01ba..999973af7b 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -608,6 +608,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic LobbyUtils.SetupEditableColorWidget(template, slot, client, orderManager, colorPreview); LobbyUtils.SetupEditableFactionWidget(template, slot, client, orderManager, countryNames); LobbyUtils.SetupEditableTeamWidget(template, slot, client, orderManager, Map); + LobbyUtils.SetupEditableSpawnWidget(template, slot, client, orderManager, Map); LobbyUtils.SetupEditableReadyWidget(template, slot, client, orderManager, Map); } else @@ -623,6 +624,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic LobbyUtils.SetupColorWidget(template, slot, client); LobbyUtils.SetupFactionWidget(template, slot, client, countryNames); LobbyUtils.SetupTeamWidget(template, slot, client); + LobbyUtils.SetupSpawnWidget(template, slot, client); LobbyUtils.SetupReadyWidget(template, slot, client); } diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs index d16c28686e..10e23cb9e8 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs @@ -88,6 +88,22 @@ namespace OpenRA.Mods.RA.Widgets.Logic dropdown.ShowDropDown("TEAM_DROPDOWN_TEMPLATE", 150, options, setupItem); } + public static void ShowSpawnDropDown(DropDownButtonWidget dropdown, Session.Client client, + OrderManager orderManager, int teamCount) + { + Func setupItem = (ii, itemTemplate) => + { + var item = ScrollItemWidget.Setup(itemTemplate, + () => client.SpawnPoint == ii, + () => orderManager.IssueOrder(Order.Command("spawn {0} {1}".F(client.Index, ii)))); + item.Get("LABEL").GetText = () => ii == 0 ? "-" : ii.ToString(); + return item; + }; + + var options = Exts.MakeArray(teamCount + 1, i => i).ToList(); + dropdown.ShowDropDown("SPAWN_DROPDOWN_TEMPLATE", 150, options, setupItem); + } + public static void ShowRaceDropDown(DropDownButtonWidget dropdown, Session.Client client, OrderManager orderManager, Dictionary countryNames) { @@ -384,6 +400,19 @@ namespace OpenRA.Mods.RA.Widgets.Logic parent.Get("TEAM").GetText = () => (c.Team == 0) ? "-" : c.Team.ToString(); } + public static void SetupEditableSpawnWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, MapPreview map) + { + var dropdown = parent.Get("SPAWN"); + dropdown.IsDisabled = () => s.LockSpawn || orderManager.LocalClient.IsReady; + dropdown.OnMouseDown = _ => ShowSpawnDropDown(dropdown, c, orderManager, map.PlayerCount); + dropdown.GetText = () => (c.SpawnPoint == 0) ? "-" : c.SpawnPoint.ToString(); + } + + public static void SetupSpawnWidget(Widget parent, Session.Slot s, Session.Client c) + { + parent.Get("SPAWN").GetText = () => (c.SpawnPoint == 0) ? "-" : c.SpawnPoint.ToString(); + } + public static void SetupEditableReadyWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, MapPreview map) { var status = parent.Get("STATUS_CHECKBOX"); diff --git a/mods/cnc/chrome/dialogs.yaml b/mods/cnc/chrome/dialogs.yaml index 28ac34187d..a95831d6b4 100644 --- a/mods/cnc/chrome/dialogs.yaml +++ b/mods/cnc/chrome/dialogs.yaml @@ -64,6 +64,22 @@ ScrollPanel@TEAM_DROPDOWN_TEMPLATE: Height: 25 Align: Center +ScrollPanel@SPAWN_DROPDOWN_TEMPLATE: + Width: DROPDOWN_WIDTH + Children: + ScrollItem@TEMPLATE: + Width: PARENT_RIGHT-27 + Height: 25 + X: 2 + Y: 0 + Visible: false + Children: + Label@LABEL: + X: 0 + Width: PARENT_RIGHT + Height: 25 + Align: Center + ScrollPanel@SPECTATOR_DROPDOWN_TEMPLATE: Width: DROPDOWN_WIDTH Background: panel-black diff --git a/mods/cnc/chrome/lobby-dialogs.yaml b/mods/cnc/chrome/lobby-dialogs.yaml index b7c49102d4..776bed5db8 100644 --- a/mods/cnc/chrome/lobby-dialogs.yaml +++ b/mods/cnc/chrome/lobby-dialogs.yaml @@ -92,7 +92,7 @@ Background@KICK_SPECTATORS_DIALOG: Background@LOBBY_OPTIONS_BIN: X: 15 Y: 30 - Width: 501 + Width: 556 Height: 219 Background: scrollpanel-bg Children: diff --git a/mods/cnc/chrome/lobby-playerbin.yaml b/mods/cnc/chrome/lobby-playerbin.yaml index 7f8a6bf5b6..20d3fcd322 100644 --- a/mods/cnc/chrome/lobby-playerbin.yaml +++ b/mods/cnc/chrome/lobby-playerbin.yaml @@ -1,14 +1,14 @@ ScrollPanel@LOBBY_PLAYER_BIN: X: 15 Y: 30 - Width: 501 + Width: 556 Height: 219 ItemSpacing: 5 Children: Container@TEMPLATE_EDITABLE_PLAYER: X: 5 Y: 0 - Width: 475 + Width: 530 Height: 25 Visible: false Children: @@ -84,9 +84,14 @@ ScrollPanel@LOBBY_PLAYER_BIN: Height: 25 X: 390 Font: Regular + DropDownButton@SPAWN: + X: 445 + Width: 50 + Height: 25 + Text: Spawn Image@STATUS_IMAGE: Visible: false - X: 450 + X: 495 Y: 4 Width: 20 Height: 20 @@ -94,14 +99,14 @@ ScrollPanel@LOBBY_PLAYER_BIN: ImageName: checked Checkbox@STATUS_CHECKBOX: Visible: false - X: 446 + X: 501 Y: 2 Width: 20 Height: 20 Container@TEMPLATE_NONEDITABLE_PLAYER: X: 5 Y: 0 - Width: 475 + Width: 530 Height: 25 Visible: false Children: @@ -173,7 +178,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Y: 0 Image@STATUS_IMAGE: Visible: false - X: 448 + X: 501 Y: 4 Width: 20 Height: 20 @@ -182,7 +187,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Container@TEMPLATE_EMPTY: X: 5 Y: 0 - Width: 475 + Width: 530 Height: 25 Visible: false Children: @@ -202,14 +207,14 @@ ScrollPanel@LOBBY_PLAYER_BIN: Button@JOIN: Text: Play in this slot Font: Regular - Width: 257 + Width: 312 Height: 25 X: 210 Y: 0 Container@TEMPLATE_EDITABLE_SPECTATOR: X: 5 Y: 0 - Width: 475 + Width: 530 Height: 25 Visible: false Children: @@ -244,7 +249,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: MaxLength: 16 Label@SPECTATOR: Text: Spectator - Width: 315-55 + Width: 315-55+55 Height: 25 X: 210 Y: 0 @@ -253,7 +258,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Container@TEMPLATE_NONEDITABLE_SPECTATOR: X: 5 Y: 0 - Width: 475 + Width: 530 Height: 25 Visible: false Children: @@ -294,7 +299,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Font: Bold Label@SPECTATOR: Text: Spectator - Width: 315-55 + Width: 315-55+55 Height: 25 X: 210 Y: 0 @@ -303,7 +308,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Container@TEMPLATE_NEW_SPECTATOR: X: 5 Y: 0 - Width: 474 + Width: 529 Height: 25 Visible: false Children: @@ -317,7 +322,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Button@SPECTATE: Text: Spectate Font: Regular - Width: 257 + Width: 312 Height: 25 X: 210 Y: 0 diff --git a/mods/cnc/chrome/lobby.yaml b/mods/cnc/chrome/lobby.yaml index d86d8aa139..541dbb2a04 100644 --- a/mods/cnc/chrome/lobby.yaml +++ b/mods/cnc/chrome/lobby.yaml @@ -2,18 +2,18 @@ Container@SERVER_LOBBY: Logic: LobbyLogic X: (WINDOW_RIGHT - WIDTH)/2 Y: (WINDOW_BOTTOM - 500)/2 - Width: 740 + Width: 800 Height: 535 Children: ColorPreviewManager@COLOR_MANAGER: Label@SERVER_NAME: - Width: 740 + Width: 800 Y: 0-25 Font: BigBold Contrast: true Align: Center Background@bg: - Width: 740 + Width: 800 Height: 500 Background: panel-black Children: @@ -51,8 +51,15 @@ Container@SERVER_LOBBY: Text: Team Align: Center Font: Bold + Label@SPAWN: + X: 445 + Width: 50 + Height: 25 + Text: Spawn + Align: Left + Font: Bold Label@STATUS: - X: 446 + X: 501 Width: 20 Height: 25 Text: Ready @@ -62,24 +69,24 @@ Container@SERVER_LOBBY: DropDownButton@SLOTS_DROPDOWNBUTTON: X: 15 Y: 254 - Width: 150 + Width: 166 Height: 25 Text: Slot Admin Button@OPTIONS_BUTTON: - X: 170 + X: 186 Y: 254 - Width: 112 + Width: 125 Height: 25 Button@CHANGEMAP_BUTTON: - X: 287 + X: 316 Y: 254 - Width: 112 + Width: 125 Height: 25 Text: Change Map Button@START_GAME_BUTTON: - X: 404 + X: 446 Y: 254 - Width: 112 + Width: 125 Height: 25 Text: Start Game ScrollPanel@CHAT_DISPLAY: diff --git a/mods/cnc/metrics.yaml b/mods/cnc/metrics.yaml index dcbaf3bfa1..7bacc58e88 100644 --- a/mods/cnc/metrics.yaml +++ b/mods/cnc/metrics.yaml @@ -18,4 +18,7 @@ Metrics: TextColor: 255,255,255 TextContrast: false TextContrastColor: 0,0,0 - ColorPickerRemapIndices: 176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190 \ No newline at end of file + ColorPickerRemapIndices: 176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190 + SpawnFont: Bold + SpawnColor: 255,255,255 + SpawnContrastColor: 0,0,0 diff --git a/mods/d2k/chrome/dropdowns.yaml b/mods/d2k/chrome/dropdowns.yaml index 6de43b47ab..32308acc15 100644 --- a/mods/d2k/chrome/dropdowns.yaml +++ b/mods/d2k/chrome/dropdowns.yaml @@ -42,6 +42,22 @@ ScrollPanel@TEAM_DROPDOWN_TEMPLATE: Height: 25 Align: Center +ScrollPanel@SPAWN_DROPDOWN_TEMPLATE: + Width: DROPDOWN_WIDTH + Children: + ScrollItem@TEMPLATE: + Width: PARENT_RIGHT-27 + Height: 25 + X: 2 + Y: 0 + Visible: false + Children: + Label@LABEL: + X: 0 + Width: PARENT_RIGHT + Height: 25 + Align: Center + ScrollPanel@SPECTATOR_DROPDOWN_TEMPLATE: Width: DROPDOWN_WIDTH Children: diff --git a/mods/d2k/chrome/lobby-playerbin.yaml b/mods/d2k/chrome/lobby-playerbin.yaml index cd3fe38856..c297883e10 100644 --- a/mods/d2k/chrome/lobby-playerbin.yaml +++ b/mods/d2k/chrome/lobby-playerbin.yaml @@ -2,7 +2,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: X: 20 Y: 67 ItemSpacing: 5 - Width: 535 + Width: 593 Height: 235 Children: Container@TEMPLATE_EDITABLE_PLAYER: @@ -78,15 +78,20 @@ ScrollPanel@LOBBY_PLAYER_BIN: Width: 48 Height: 25 Text: Team + DropDownButton@SPAWN: + X: 478 + Width: 48 + Height: 25 + Text: Spawn Checkbox@STATUS_CHECKBOX: - X: 477 + X: 535 Y: 2 Width: 20 Height: 20 Visible: false Image@STATUS_IMAGE: Visible: false - X: 479 + X: 537 Y: 4 Width: 20 Height: 20 @@ -166,7 +171,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Y: 0 Image@STATUS_IMAGE: Visible: false - X: 479 + X: 537 Y: 4 Width: 20 Height: 20 @@ -194,7 +199,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Visible: false Button@JOIN: Text: Play in this slot - Width: 278 + Width: 336 Height: 25 X: 190 Y: 0 @@ -235,7 +240,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: MaxLength: 16 Label@SPECTATOR: Text: Spectator - Width: 278 + Width: 336 Height: 25 X: 190 Y: 0 @@ -285,7 +290,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Font: Bold Label@SPECTATOR: Text: Spectator - Width: 278 + Width: 336 Height: 25 X: 190 Y: 0 @@ -308,7 +313,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Button@SPECTATE: Text: Spectate Font: Regular - Width: 278 + Width: 336 Height: 25 X: 190 Y: 0 diff --git a/mods/d2k/metrics.yaml b/mods/d2k/metrics.yaml index 1f3a480376..33db9da11d 100644 --- a/mods/d2k/metrics.yaml +++ b/mods/d2k/metrics.yaml @@ -19,3 +19,6 @@ Metrics: TextContrast: false TextContrastColor: 0,0,0 ColorPickerRemapIndices: 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240 + SpawnFont: Bold + SpawnColor: 255,255,255 + SpawnContrastColor: 0,0,0 diff --git a/mods/ra/chrome/dropdowns.yaml b/mods/ra/chrome/dropdowns.yaml index f707cb05fc..749ab3d071 100644 --- a/mods/ra/chrome/dropdowns.yaml +++ b/mods/ra/chrome/dropdowns.yaml @@ -42,6 +42,22 @@ ScrollPanel@TEAM_DROPDOWN_TEMPLATE: Height: 25 Align: Center +ScrollPanel@SPAWN_DROPDOWN_TEMPLATE: + Width: DROPDOWN_WIDTH + Children: + ScrollItem@TEMPLATE: + Width: PARENT_RIGHT-27 + Height: 25 + X: 2 + Y: 0 + Visible: false + Children: + Label@LABEL: + X: 0 + Width: PARENT_RIGHT + Height: 25 + Align: Center + ScrollPanel@SPECTATOR_DROPDOWN_TEMPLATE: Width: DROPDOWN_WIDTH Children: diff --git a/mods/ra/chrome/lobby-dialogs.yaml b/mods/ra/chrome/lobby-dialogs.yaml index 0018649893..1c1f8a6c16 100644 --- a/mods/ra/chrome/lobby-dialogs.yaml +++ b/mods/ra/chrome/lobby-dialogs.yaml @@ -91,7 +91,7 @@ Background@KICK_SPECTATORS_DIALOG: Background@LOBBY_OPTIONS_BIN: X: 20 Y: 67 - Width: 535 + Width: 593 Height: 235 Background: dialog3 Children: diff --git a/mods/ra/chrome/lobby-playerbin.yaml b/mods/ra/chrome/lobby-playerbin.yaml index 7154083283..8ac2f5a7aa 100644 --- a/mods/ra/chrome/lobby-playerbin.yaml +++ b/mods/ra/chrome/lobby-playerbin.yaml @@ -2,7 +2,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: X: 20 Y: 67 ItemSpacing: 5 - Width: 535 + Width: 593 Height: 235 Children: Container@TEMPLATE_EDITABLE_PLAYER: @@ -78,15 +78,20 @@ ScrollPanel@LOBBY_PLAYER_BIN: Width: 48 Height: 25 Text: Team + DropDownButton@SPAWN: + X: 478 + Width: 48 + Height: 25 + Text: Spawn Checkbox@STATUS_CHECKBOX: - X: 477 + X: 535 Y: 2 Width: 20 Height: 20 Visible: false Image@STATUS_IMAGE: Visible: false - X: 479 + X: 537 Y: 4 Width: 20 Height: 20 @@ -166,7 +171,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Y: 0 Image@STATUS_IMAGE: Visible: false - X: 479 + X: 537 Y: 4 Width: 20 Height: 20 @@ -194,7 +199,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Visible: false Button@JOIN: Text: Play in this slot - Width: 278 + Width: 336 Height: 25 X: 190 Y: 0 @@ -235,7 +240,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: MaxLength: 16 Label@SPECTATOR: Text: Spectator - Width: 278 + Width: 336 Height: 25 X: 190 Y: 0 @@ -285,7 +290,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Font: Bold Label@SPECTATOR: Text: Spectator - Width: 278 + Width: 336 Height: 25 X: 190 Y: 0 @@ -308,7 +313,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Button@SPECTATE: Text: Spectate Font: Regular - Width: 278 + Width: 336 Height: 25 X: 190 Y: 0 diff --git a/mods/ra/chrome/lobby.yaml b/mods/ra/chrome/lobby.yaml index c12f73e400..b8e26c6f99 100644 --- a/mods/ra/chrome/lobby.yaml +++ b/mods/ra/chrome/lobby.yaml @@ -2,7 +2,7 @@ Background@SERVER_LOBBY: Logic: LobbyLogic X: (WINDOW_RIGHT - WIDTH)/2 Y: (WINDOW_BOTTOM - HEIGHT)/2 - Width: 800 + Width: 858 Height: 600 Children: ColorPreviewManager@COLOR_MANAGER: @@ -48,8 +48,15 @@ Background@SERVER_LOBBY: Text: Team Align: Center Font: Bold + Label@LABEL_LOBBY_TEAM: + X: 478 + Width: 48 + Height: 25 + Text: Spawn + Align: Center + Font: Bold Label@LABEL_LOBBY_STATUS: - X: 477 + X: 535 Width: 20 Height: 25 Text: Ready @@ -59,35 +66,35 @@ Background@SERVER_LOBBY: DropDownButton@SLOTS_DROPDOWNBUTTON: X: 20 Y: PARENT_BOTTOM - 291 - Width: 151 + Width: 167 Height: 25 Font: Bold Text: Slot Admin Button@OPTIONS_BUTTON: - X: 178 + X: 194 Y: PARENT_BOTTOM - 291 - Width: 121 + Width: 135 Height: 25 Font: Bold Text: Game Options Button@CHANGEMAP_BUTTON: - X: 306 + X: 336 Y: PARENT_BOTTOM - 291 - Width: 121 + Width: 135 Height: 25 Text: Change Map Font: Bold Button@START_GAME_BUTTON: - X: 434 + X: 478 Y: PARENT_BOTTOM - 291 - Width: 121 + Width: 135 Height: 25 Text: Start Game Font: Bold ScrollPanel@CHAT_DISPLAY: X: 20 Y: PARENT_BOTTOM - HEIGHT - 52 - Width: 760 + Width: 818 Height: 210 ItemSpacing: 1 Children: diff --git a/mods/ra/metrics.yaml b/mods/ra/metrics.yaml index 8917a2d756..c2b5bf71e3 100644 --- a/mods/ra/metrics.yaml +++ b/mods/ra/metrics.yaml @@ -19,3 +19,6 @@ Metrics: TextContrast: false TextContrastColor: 0,0,0 ColorPickerRemapIndices: 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 + SpawnFont: Bold + SpawnColor: 255,255,255 + SpawnContrastColor: 0,0,0 diff --git a/mods/ts/metrics.yaml b/mods/ts/metrics.yaml index f0e66e52a0..ca9c90156d 100644 --- a/mods/ts/metrics.yaml +++ b/mods/ts/metrics.yaml @@ -19,3 +19,6 @@ Metrics: TextContrast: false TextContrastColor: 0,0,0 ColorPickerRemapIndices: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 + SpawnFont: Bold + SpawnColor: 255,255,255 + SpawnContrastColor: 0,0,0