Merge pull request #8783 from obrakmann/reenable-mission-replays
Re-enable mission replays
This commit is contained in:
@@ -69,7 +69,7 @@ namespace OpenRA
|
|||||||
Player renderPlayer;
|
Player renderPlayer;
|
||||||
public 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; }
|
set { renderPlayer = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var stats = widget.GetOrNull<MenuButtonWidget>("OBSERVER_STATS_BUTTON");
|
var stats = widget.GetOrNull<MenuButtonWidget>("OBSERVER_STATS_BUTTON");
|
||||||
if (stats != null)
|
if (stats != null)
|
||||||
{
|
{
|
||||||
stats.IsDisabled = () => disableSystemButtons;
|
stats.IsDisabled = () => disableSystemButtons || world.Map.Visibility.HasFlag(MapVisibility.MissionSelector);
|
||||||
stats.OnClick = () => OpenMenuPanel(stats);
|
stats.OnClick = () => OpenMenuPanel(stats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class ObserverShroudSelectorLogic
|
public class ObserverShroudSelectorLogic
|
||||||
{
|
{
|
||||||
|
readonly CameraOption combined, disableShroud;
|
||||||
|
readonly IOrderedEnumerable<IGrouping<int, CameraOption>> teams;
|
||||||
|
readonly bool limitViews;
|
||||||
|
|
||||||
CameraOption selected;
|
CameraOption selected;
|
||||||
CameraOption combined, disableShroud;
|
|
||||||
IOrderedEnumerable<IGrouping<int, CameraOption>> teams;
|
|
||||||
|
|
||||||
class CameraOption
|
class CameraOption
|
||||||
{
|
{
|
||||||
@@ -56,9 +58,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ObserverShroudSelectorLogic(Widget widget, World world)
|
public ObserverShroudSelectorLogic(Widget widget, World world)
|
||||||
{
|
{
|
||||||
|
limitViews = world.Map.Visibility.HasFlag(MapVisibility.MissionSelector);
|
||||||
|
|
||||||
var groups = new Dictionary<string, IEnumerable<CameraOption>>();
|
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))
|
.Select(p => new CameraOption(this, p))
|
||||||
.GroupBy(p => (world.LobbyInfo.ClientWithIndex(p.Player.ClientIndex) ?? new Session.Client()).Team)
|
.GroupBy(p => (world.LobbyInfo.ClientWithIndex(p.Player.ClientIndex) ?? new Session.Client()).Team)
|
||||||
.OrderBy(g => g.Key);
|
.OrderBy(g => g.Key);
|
||||||
@@ -72,7 +76,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
combined = new CameraOption(this, world, "All Players", world.Players.First(p => p.InternalName == "Everyone"));
|
combined = new CameraOption(this, world, "All Players", world.Players.First(p => p.InternalName == "Everyone"));
|
||||||
disableShroud = new CameraOption(this, world, "Disable Shroud", null);
|
disableShroud = new CameraOption(this, world, "Disable Shroud", null);
|
||||||
groups.Add("Other", new List<CameraOption>() { combined, disableShroud });
|
if (!limitViews)
|
||||||
|
groups.Add("Other", new List<CameraOption>() { combined, disableShroud });
|
||||||
|
|
||||||
var shroudSelector = widget.Get<DropDownButtonWidget>("SHROUD_SELECTOR");
|
var shroudSelector = widget.Get<DropDownButtonWidget>("SHROUD_SELECTOR");
|
||||||
shroudSelector.OnMouseDown = _ =>
|
shroudSelector.OnMouseDown = _ =>
|
||||||
@@ -121,7 +126,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var keyhandler = shroudSelector.Get<LogicKeyListenerWidget>("SHROUD_KEYHANDLER");
|
var keyhandler = shroudSelector.Get<LogicKeyListenerWidget>("SHROUD_KEYHANDLER");
|
||||||
keyhandler.OnKeyPress = HandleKeyPress;
|
keyhandler.OnKeyPress = HandleKeyPress;
|
||||||
|
|
||||||
selected = disableShroud;
|
selected = limitViews ? groups.First().Value.First() : disableShroud;
|
||||||
|
selected.OnClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HandleKeyPress(KeyInput e)
|
public bool HandleKeyPress(KeyInput e)
|
||||||
@@ -129,7 +135,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (e.Event == KeyInputEvent.Down)
|
if (e.Event == KeyInputEvent.Down)
|
||||||
{
|
{
|
||||||
var h = Hotkey.FromKeyInput(e);
|
var h = Hotkey.FromKeyInput(e);
|
||||||
if (h == Game.Settings.Keys.ObserverCombinedView)
|
if (h == Game.Settings.Keys.ObserverCombinedView && !limitViews)
|
||||||
{
|
{
|
||||||
selected = combined;
|
selected = combined;
|
||||||
selected.OnClick();
|
selected.OnClick();
|
||||||
@@ -137,7 +143,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h == Game.Settings.Keys.ObserverWorldView)
|
if (h == Game.Settings.Keys.ObserverWorldView && !limitViews)
|
||||||
{
|
{
|
||||||
selected = disableShroud;
|
selected = disableShroud;
|
||||||
selected.OnClick();
|
selected.OnClick();
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
};
|
};
|
||||||
Game.LobbyInfoChanged += lobbyReady;
|
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
|
class DropDownOption
|
||||||
|
|||||||
Reference in New Issue
Block a user