change currentSummary -> currentReplay in CncReplayBrowserLogic
This commit is contained in:
@@ -45,21 +45,21 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
var watch = panel.GetWidget<ButtonWidget>("WATCH_BUTTON");
|
var watch = panel.GetWidget<ButtonWidget>("WATCH_BUTTON");
|
||||||
watch.IsDisabled = () => currentSummary == null || currentMap == null || currentSummary.Duration == 0;
|
watch.IsDisabled = () => currentReplay == null || currentMap == null || currentReplay.Duration == 0;
|
||||||
watch.OnClick = () =>
|
watch.OnClick = () =>
|
||||||
{
|
{
|
||||||
if (currentSummary != null)
|
if (currentReplay != null)
|
||||||
{
|
{
|
||||||
Game.JoinReplay(currentSummary.Filename);
|
Game.JoinReplay(currentReplay.Filename);
|
||||||
Widget.CloseWindow();
|
Widget.CloseWindow();
|
||||||
onStart();
|
onStart();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
panel.GetWidget("REPLAY_INFO").IsVisible = () => currentSummary != null;
|
panel.GetWidget("REPLAY_INFO").IsVisible = () => currentReplay != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Replay currentSummary;
|
Replay currentReplay;
|
||||||
Map currentMap;
|
Map currentMap;
|
||||||
|
|
||||||
void SelectReplay(string filename)
|
void SelectReplay(string filename)
|
||||||
@@ -69,23 +69,23 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
currentSummary = new Replay(filename);
|
currentReplay = new Replay(filename);
|
||||||
currentMap = currentSummary.Map();
|
currentMap = currentReplay.Map();
|
||||||
|
|
||||||
panel.GetWidget<LabelWidget>("DURATION").GetText =
|
panel.GetWidget<LabelWidget>("DURATION").GetText =
|
||||||
() => WidgetUtils.FormatTime(currentSummary.Duration * 3 /* todo: 3:1 ratio isnt always true. */);
|
() => WidgetUtils.FormatTime(currentReplay.Duration * 3 /* todo: 3:1 ratio isnt always true. */);
|
||||||
panel.GetWidget<MapPreviewWidget>("MAP_PREVIEW").Map = () => currentMap;
|
panel.GetWidget<MapPreviewWidget>("MAP_PREVIEW").Map = () => currentMap;
|
||||||
panel.GetWidget<LabelWidget>("MAP_TITLE").GetText =
|
panel.GetWidget<LabelWidget>("MAP_TITLE").GetText =
|
||||||
() => currentMap != null ? currentMap.Title : "(Unknown Map)";
|
() => currentMap != null ? currentMap.Title : "(Unknown Map)";
|
||||||
|
|
||||||
var players = currentSummary.LobbyInfo.Slots
|
var players = currentReplay.LobbyInfo.Slots
|
||||||
.Count(s => currentSummary.LobbyInfo.ClientInSlot(s.Key) != null);
|
.Count(s => currentReplay.LobbyInfo.ClientInSlot(s.Key) != null);
|
||||||
panel.GetWidget<LabelWidget>("PLAYERS").GetText = () => players.ToString();
|
panel.GetWidget<LabelWidget>("PLAYERS").GetText = () => players.ToString();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.Write("debug", "Exception while parsing replay: {0}", e);
|
Log.Write("debug", "Exception while parsing replay: {0}", e);
|
||||||
currentSummary = null;
|
currentReplay = null;
|
||||||
currentMap = null;
|
currentMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
void AddReplay(ScrollPanelWidget list, string filename, ScrollItemWidget template)
|
void AddReplay(ScrollPanelWidget list, string filename, ScrollItemWidget template)
|
||||||
{
|
{
|
||||||
var item = ScrollItemWidget.Setup(template,
|
var item = ScrollItemWidget.Setup(template,
|
||||||
() => currentSummary != null && currentSummary.Filename == filename,
|
() => currentReplay != null && currentReplay.Filename == filename,
|
||||||
() => SelectReplay(filename));
|
() => SelectReplay(filename));
|
||||||
var f = Path.GetFileName(filename);
|
var f = Path.GetFileName(filename);
|
||||||
item.GetWidget<LabelWidget>("TITLE").GetText = () => f;
|
item.GetWidget<LabelWidget>("TITLE").GetText = () => f;
|
||||||
|
|||||||
Reference in New Issue
Block a user