Hide map preview when no replay is selected.

This prevents interaction with the widget than can cause crashes as no replay is selected yet.
This commit is contained in:
RoosterDragon
2018-03-10 16:41:05 +00:00
committed by reaperrr
parent 356f24b78c
commit f47595b780

View File

@@ -72,9 +72,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
watch.IsDisabled = () => selectedReplay == null || map.Status != MapStatus.Available; watch.IsDisabled = () => selectedReplay == null || map.Status != MapStatus.Available;
watch.OnClick = () => { WatchReplay(); }; watch.OnClick = () => { WatchReplay(); };
var mapPreviewRoot = panel.Get("MAP_PREVIEW_ROOT");
mapPreviewRoot.IsVisible = () => selectedReplay != null;
panel.Get("REPLAY_INFO").IsVisible = () => selectedReplay != null; panel.Get("REPLAY_INFO").IsVisible = () => selectedReplay != null;
Ui.LoadWidget("MAP_PREVIEW", panel.Get("MAP_PREVIEW_ROOT"), new WidgetArgs Ui.LoadWidget("MAP_PREVIEW", mapPreviewRoot, new WidgetArgs
{ {
{ "orderManager", null }, { "orderManager", null },
{ "getMap", (Func<MapPreview>)(() => map) }, { "getMap", (Func<MapPreview>)(() => map) },