diff --git a/OpenRA.Mods.RA/Widgets/Logic/ReplayBrowserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ReplayBrowserLogic.cs index 9c43b610f3..4a7b1229af 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ReplayBrowserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ReplayBrowserLogic.cs @@ -45,15 +45,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic var watch = panel.Get("WATCH_BUTTON"); watch.IsDisabled = () => currentReplay == null || currentMap == null || currentReplay.Duration == 0; - watch.OnClick = () => - { - if (currentReplay != null) - { - Game.JoinReplay(currentReplay.Filename); - Ui.CloseWindow(); - onStart(); - } - }; + watch.OnClick = () => { WatchReplay(); onStart(); }; panel.Get("REPLAY_INFO").IsVisible = () => currentReplay != null; } @@ -89,11 +81,21 @@ namespace OpenRA.Mods.RA.Widgets.Logic } } + void WatchReplay() + { + if (currentReplay != null) + { + Game.JoinReplay(currentReplay.Filename); + Ui.CloseWindow(); + } + } + void AddReplay(ScrollPanelWidget list, string filename, ScrollItemWidget template) { var item = ScrollItemWidget.Setup(template, () => currentReplay != null && currentReplay.Filename == filename, - () => SelectReplay(filename)); + () => SelectReplay(filename), + () => WatchReplay()); var f = Path.GetFileName(filename); item.Get("TITLE").GetText = () => f; list.AddChild(item);