Merge pull request #11559 from MUzzell/feature-10416

Added ready checkbox for spectating admins
This commit is contained in:
abcdefg30
2016-07-15 15:47:05 +02:00
committed by GitHub
6 changed files with 80 additions and 5 deletions

View File

@@ -708,7 +708,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
{
@@ -754,6 +754,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
{
@@ -763,7 +766,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)));