Save and load skirmish spectator viewport.

This commit is contained in:
Paul Chote
2019-04-20 11:01:55 +00:00
committed by reaperrr
parent 410d0796c3
commit c8f2ee5270
2 changed files with 45 additions and 5 deletions

View File

@@ -29,6 +29,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly HotkeyReference combinedViewKey = new HotkeyReference();
readonly HotkeyReference worldViewKey = new HotkeyReference();
readonly World world;
CameraOption selected;
class CameraOption
@@ -64,6 +66,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
[ObjectCreator.UseCtor]
public ObserverShroudSelectorLogic(Widget widget, ModData modData, World world, Dictionary<string, MiniYaml> logicArgs)
{
this.world = world;
MiniYaml yaml;
if (logicArgs.TryGetValue("CombinedViewKey", out yaml))
combinedViewKey = modData.Hotkeys[yaml.Value];
@@ -182,5 +186,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return false;
}
public override void Tick()
{
// Fix the selector if something else has changed the render player
if (selected != null && world.RenderPlayer != selected.Player)
{
if (combined.Player == world.RenderPlayer)
combined.OnClick();
else if (disableShroud.Player == world.RenderPlayer)
disableShroud.OnClick();
else
foreach (var group in teams)
foreach (var option in group)
if (option.Player == world.RenderPlayer)
option.OnClick();
}
}
}
}