Merge pull request #8783 from obrakmann/reenable-mission-replays

Re-enable mission replays
This commit is contained in:
Matthias Mailänder
2015-07-26 09:44:19 +02:00
4 changed files with 16 additions and 10 deletions

View File

@@ -69,7 +69,7 @@ namespace OpenRA
Player renderPlayer;
public Player RenderPlayer
{
get { return renderPlayer == null || renderPlayer.WinState != WinState.Undefined ? null : renderPlayer; }
get { return renderPlayer == null || (renderPlayer.WinState != WinState.Undefined && !Map.Visibility.HasFlag(MapVisibility.MissionSelector)) ? null : renderPlayer; }
set { renderPlayer = value; }
}

View File

@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var stats = widget.GetOrNull<MenuButtonWidget>("OBSERVER_STATS_BUTTON");
if (stats != null)
{
stats.IsDisabled = () => disableSystemButtons;
stats.IsDisabled = () => disableSystemButtons || world.Map.Visibility.HasFlag(MapVisibility.MissionSelector);
stats.OnClick = () => OpenMenuPanel(stats);
}
}

View File

@@ -19,9 +19,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ObserverShroudSelectorLogic
{
readonly CameraOption combined, disableShroud;
readonly IOrderedEnumerable<IGrouping<int, CameraOption>> teams;
readonly bool limitViews;
CameraOption selected;
CameraOption combined, disableShroud;
IOrderedEnumerable<IGrouping<int, CameraOption>> teams;
class CameraOption
{
@@ -56,9 +58,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
[ObjectCreator.UseCtor]
public ObserverShroudSelectorLogic(Widget widget, World world)
{
limitViews = world.Map.Visibility.HasFlag(MapVisibility.MissionSelector);
var groups = new Dictionary<string, IEnumerable<CameraOption>>();
teams = world.Players.Where(p => !p.NonCombatant)
teams = world.Players.Where(p => !p.NonCombatant && p.Playable)
.Select(p => new CameraOption(this, p))
.GroupBy(p => (world.LobbyInfo.ClientWithIndex(p.Player.ClientIndex) ?? new Session.Client()).Team)
.OrderBy(g => g.Key);
@@ -72,6 +76,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
combined = new CameraOption(this, world, "All Players", world.Players.First(p => p.InternalName == "Everyone"));
disableShroud = new CameraOption(this, world, "Disable Shroud", null);
if (!limitViews)
groups.Add("Other", new List<CameraOption>() { combined, disableShroud });
var shroudSelector = widget.Get<DropDownButtonWidget>("SHROUD_SELECTOR");
@@ -121,7 +126,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var keyhandler = shroudSelector.Get<LogicKeyListenerWidget>("SHROUD_KEYHANDLER");
keyhandler.OnKeyPress = HandleKeyPress;
selected = disableShroud;
selected = limitViews ? groups.First().Value.First() : disableShroud;
selected.OnClick();
}
public bool HandleKeyPress(KeyInput e)
@@ -129,7 +135,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (e.Event == KeyInputEvent.Down)
{
var h = Hotkey.FromKeyInput(e);
if (h == Game.Settings.Keys.ObserverCombinedView)
if (h == Game.Settings.Keys.ObserverCombinedView && !limitViews)
{
selected = combined;
selected.OnClick();
@@ -137,7 +143,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return true;
}
if (h == Game.Settings.Keys.ObserverWorldView)
if (h == Game.Settings.Keys.ObserverWorldView && !limitViews)
{
selected = disableShroud;
selected.OnClick();

View File

@@ -287,7 +287,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
};
Game.LobbyInfoChanged += lobbyReady;
om = Game.JoinServer(IPAddress.Loopback.ToString(), Game.CreateLocalServer(selectedMapPreview.Uid), "", false);
om = Game.JoinServer(IPAddress.Loopback.ToString(), Game.CreateLocalServer(selectedMapPreview.Uid), "");
}
class DropDownOption