#10416 Added ready checkbox for spectating admins

This commit is contained in:
Matthew Uzzell
2016-07-01 23:40:17 +01:00
parent fc50127390
commit 6110357460
6 changed files with 80 additions and 5 deletions

View File

@@ -745,7 +745,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
LobbyUtils.SetupEditableFactionWidget(template, slot, client, orderManager, factions);
LobbyUtils.SetupEditableTeamWidget(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
{
@@ -791,6 +791,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
template = editableSpectatorTemplate.Clone();
LobbyUtils.SetupEditableNameWidget(template, null, c, orderManager);
if (client.IsAdmin)
LobbyUtils.SetupEditableReadyWidget(template, null, client, orderManager, Map);
}
else
{
@@ -800,7 +803,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
LobbyUtils.SetupNameWidget(template, null, client);
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);

View File

@@ -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();
}
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");
status.IsChecked = () => orderManager.LocalClient.IsReady || c.Bot != null;
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;
status.OnClick = () => orderManager.IssueOrder(Order.Command("state {0}".F(state)));