Facilitated spawn choice at game setup screen.

This commit is contained in:
Matija H
2014-04-25 21:56:01 +01:00
committed by matija-hustic
parent a7c77d4155
commit a0f6038ea6
17 changed files with 175 additions and 54 deletions

View File

@@ -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<string>("SpawnFont")].DrawTextWithContrast(Convert.ToString(spawnPoints.IndexOf(p) + 1), new int2(pos.X + offset.X + 4, pos.Y + offset.Y - 15), ChromeMetrics.Get<Color>("SpawnColor"), ChromeMetrics.Get<Color>("SpawnContrastColor"), 2);
if ((pos - Viewport.LastMousePos).LengthSquared < 64)
TooltipSpawnIndex = spawnPoints.IndexOf(p) + 1;

View File

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

View File

@@ -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<int, ScrollItemWidget, ScrollItemWidget> setupItem = (ii, itemTemplate) =>
{
var item = ScrollItemWidget.Setup(itemTemplate,
() => client.SpawnPoint == ii,
() => orderManager.IssueOrder(Order.Command("spawn {0} {1}".F(client.Index, ii))));
item.Get<LabelWidget>("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<string, string> countryNames)
{
@@ -384,6 +400,19 @@ namespace OpenRA.Mods.RA.Widgets.Logic
parent.Get<LabelWidget>("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<DropDownButtonWidget>("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<LabelWidget>("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<CheckboxWidget>("STATUS_CHECKBOX");

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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:

View File

@@ -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
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

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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:

View File

@@ -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:

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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