Merge pull request #11559 from MUzzell/feature-10416
Added ready checkbox for spectating admins
This commit is contained in:
@@ -60,7 +60,8 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
|
|
||||||
static void CheckAutoStart(S server)
|
static void CheckAutoStart(S server)
|
||||||
{
|
{
|
||||||
var playerClients = server.LobbyInfo.Clients.Where(c => c.Bot == null && c.Slot != null);
|
// A spectating admin is included for checking these rules
|
||||||
|
var playerClients = server.LobbyInfo.Clients.Where(c => (c.Bot == null && c.Slot != null) || c.IsAdmin);
|
||||||
|
|
||||||
// Are all players ready?
|
// Are all players ready?
|
||||||
if (!playerClients.Any() || playerClients.Any(c => c.State != Session.ClientState.Ready))
|
if (!playerClients.Any() || playerClients.Any(c => c.State != Session.ClientState.Ready))
|
||||||
@@ -188,6 +189,7 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
client.SpawnPoint = 0;
|
client.SpawnPoint = 0;
|
||||||
client.Color = HSLColor.FromRGB(255, 255, 255);
|
client.Color = HSLColor.FromRGB(255, 255, 255);
|
||||||
server.SyncLobbyClients();
|
server.SyncLobbyClients();
|
||||||
|
CheckAutoStart(server);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -708,7 +708,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
LobbyUtils.SetupEditableFactionWidget(template, slot, client, orderManager, factions);
|
LobbyUtils.SetupEditableFactionWidget(template, slot, client, orderManager, factions);
|
||||||
LobbyUtils.SetupEditableTeamWidget(template, slot, client, orderManager, Map);
|
LobbyUtils.SetupEditableTeamWidget(template, slot, client, orderManager, Map);
|
||||||
LobbyUtils.SetupEditableSpawnWidget(template, slot, client, orderManager, Map);
|
LobbyUtils.SetupEditableSpawnWidget(template, slot, client, orderManager, Map);
|
||||||
LobbyUtils.SetupEditableReadyWidget(template, slot, client, orderManager, Map, !Map.RulesLoaded || Map.InvalidCustomRules);
|
LobbyUtils.SetupEditableReadyWidget(template, slot, client, orderManager, Map);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -754,6 +754,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
template = editableSpectatorTemplate.Clone();
|
template = editableSpectatorTemplate.Clone();
|
||||||
|
|
||||||
LobbyUtils.SetupEditableNameWidget(template, null, c, orderManager);
|
LobbyUtils.SetupEditableNameWidget(template, null, c, orderManager);
|
||||||
|
|
||||||
|
if (client.IsAdmin)
|
||||||
|
LobbyUtils.SetupEditableReadyWidget(template, null, client, orderManager, Map);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -763,7 +766,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
LobbyUtils.SetupNameWidget(template, null, client);
|
LobbyUtils.SetupNameWidget(template, null, client);
|
||||||
LobbyUtils.SetupKickWidget(template, null, client, orderManager, lobby,
|
LobbyUtils.SetupKickWidget(template, null, client, orderManager, lobby,
|
||||||
() => panel = PanelType.Kick, () => panel = PanelType.Players);
|
() => panel = PanelType.Kick, () => panel = PanelType.Players);
|
||||||
|
|
||||||
|
if (client.IsAdmin)
|
||||||
|
LobbyUtils.SetupReadyWidget(template, null, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
LobbyUtils.SetupClientWidget(template, c, orderManager, true);
|
LobbyUtils.SetupClientWidget(template, c, orderManager, true);
|
||||||
|
|||||||
@@ -457,12 +457,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
parent.Get<LabelWidget>("SPAWN").GetText = () => (c.SpawnPoint == 0) ? "-" : Convert.ToChar('A' - 1 + c.SpawnPoint).ToString();
|
parent.Get<LabelWidget>("SPAWN").GetText = () => (c.SpawnPoint == 0) ? "-" : Convert.ToChar('A' - 1 + c.SpawnPoint).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetupEditableReadyWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, MapPreview map, bool forceDisable)
|
public static void SetupEditableReadyWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, MapPreview map)
|
||||||
{
|
{
|
||||||
var status = parent.Get<CheckboxWidget>("STATUS_CHECKBOX");
|
var status = parent.Get<CheckboxWidget>("STATUS_CHECKBOX");
|
||||||
status.IsChecked = () => orderManager.LocalClient.IsReady || c.Bot != null;
|
status.IsChecked = () => orderManager.LocalClient.IsReady || c.Bot != null;
|
||||||
status.IsVisible = () => true;
|
status.IsVisible = () => true;
|
||||||
status.IsDisabled = () => c.Bot != null || map.Status != MapStatus.Available || forceDisable;
|
status.IsDisabled = () => c.Bot != null || map.Status != MapStatus.Available ||
|
||||||
|
!map.RulesLoaded || map.InvalidCustomRules;
|
||||||
|
|
||||||
var state = orderManager.LocalClient.IsReady ? Session.ClientState.NotReady : Session.ClientState.Ready;
|
var state = orderManager.LocalClient.IsReady ? Session.ClientState.NotReady : Session.ClientState.Ready;
|
||||||
status.OnClick = () => orderManager.IssueOrder(Order.Command("state {0}".F(state)));
|
status.OnClick = () => orderManager.IssueOrder(Order.Command("state {0}".F(state)));
|
||||||
|
|||||||
@@ -300,6 +300,20 @@ Container@LOBBY_PLAYER_BIN:
|
|||||||
Text: Spectator
|
Text: Spectator
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
|
Image@STATUS_IMAGE:
|
||||||
|
X: 521
|
||||||
|
Y: 4
|
||||||
|
Width: 20
|
||||||
|
Height: 20
|
||||||
|
ImageCollection: checkbox-bits
|
||||||
|
ImageName: checked
|
||||||
|
Visible: false
|
||||||
|
Checkbox@STATUS_CHECKBOX:
|
||||||
|
X: 527
|
||||||
|
Y: 2
|
||||||
|
Width: 20
|
||||||
|
Height: 20
|
||||||
|
Visible: false
|
||||||
Container@TEMPLATE_NONEDITABLE_SPECTATOR:
|
Container@TEMPLATE_NONEDITABLE_SPECTATOR:
|
||||||
X: 5
|
X: 5
|
||||||
Width: 530
|
Width: 530
|
||||||
@@ -350,6 +364,14 @@ Container@LOBBY_PLAYER_BIN:
|
|||||||
Text: Spectator
|
Text: Spectator
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
|
Image@STATUS_IMAGE:
|
||||||
|
X: 527
|
||||||
|
Y: 4
|
||||||
|
Width: 20
|
||||||
|
Height: 20
|
||||||
|
ImageCollection: checkbox-bits
|
||||||
|
ImageName: checked
|
||||||
|
Visible: false
|
||||||
Container@TEMPLATE_NEW_SPECTATOR:
|
Container@TEMPLATE_NEW_SPECTATOR:
|
||||||
X: 5
|
X: 5
|
||||||
Width: 529
|
Width: 529
|
||||||
|
|||||||
@@ -291,6 +291,20 @@ Container@LOBBY_PLAYER_BIN:
|
|||||||
Text: Spectator
|
Text: Spectator
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
|
Checkbox@STATUS_CHECKBOX:
|
||||||
|
X: 525
|
||||||
|
Y: 2
|
||||||
|
Width: 20
|
||||||
|
Height: 20
|
||||||
|
Visible: false
|
||||||
|
Image@STATUS_IMAGE:
|
||||||
|
X: 527
|
||||||
|
Y: 4
|
||||||
|
Width: 20
|
||||||
|
Height: 20
|
||||||
|
ImageCollection: checkbox-bits
|
||||||
|
ImageName: checked
|
||||||
|
Visible: false
|
||||||
Container@TEMPLATE_NONEDITABLE_SPECTATOR:
|
Container@TEMPLATE_NONEDITABLE_SPECTATOR:
|
||||||
X: 5
|
X: 5
|
||||||
Width: 475
|
Width: 475
|
||||||
@@ -338,6 +352,14 @@ Container@LOBBY_PLAYER_BIN:
|
|||||||
Text: Spectator
|
Text: Spectator
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
|
Image@STATUS_IMAGE:
|
||||||
|
X: 527
|
||||||
|
Y: 4
|
||||||
|
Width: 20
|
||||||
|
Height: 20
|
||||||
|
ImageCollection: checkbox-bits
|
||||||
|
ImageName: checked
|
||||||
|
Visible: false
|
||||||
Container@TEMPLATE_NEW_SPECTATOR:
|
Container@TEMPLATE_NEW_SPECTATOR:
|
||||||
X: 5
|
X: 5
|
||||||
Width: 475
|
Width: 475
|
||||||
|
|||||||
@@ -291,6 +291,20 @@ Container@LOBBY_PLAYER_BIN:
|
|||||||
Text: Spectator
|
Text: Spectator
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
|
Checkbox@STATUS_CHECKBOX:
|
||||||
|
X: 525
|
||||||
|
Y: 2
|
||||||
|
Width: 20
|
||||||
|
Height: 20
|
||||||
|
Visible: false
|
||||||
|
Image@STATUS_IMAGE:
|
||||||
|
X: 527
|
||||||
|
Y: 4
|
||||||
|
Width: 20
|
||||||
|
Height: 20
|
||||||
|
ImageCollection: checkbox-bits
|
||||||
|
ImageName: checked
|
||||||
|
Visible: false
|
||||||
Container@TEMPLATE_NONEDITABLE_SPECTATOR:
|
Container@TEMPLATE_NONEDITABLE_SPECTATOR:
|
||||||
X: 5
|
X: 5
|
||||||
Width: 475
|
Width: 475
|
||||||
@@ -338,6 +352,14 @@ Container@LOBBY_PLAYER_BIN:
|
|||||||
Text: Spectator
|
Text: Spectator
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
|
Image@STATUS_IMAGE:
|
||||||
|
X: 527
|
||||||
|
Y: 4
|
||||||
|
Width: 20
|
||||||
|
Height: 20
|
||||||
|
ImageCollection: checkbox-bits
|
||||||
|
ImageName: checked
|
||||||
|
Visible: false
|
||||||
Container@TEMPLATE_NEW_SPECTATOR:
|
Container@TEMPLATE_NEW_SPECTATOR:
|
||||||
X: 5
|
X: 5
|
||||||
Width: 475
|
Width: 475
|
||||||
|
|||||||
Reference in New Issue
Block a user