mirror of https://github.com/ppy/osu
Avoid multiple enumeration by converting to array at construction time
This commit is contained in:
parent
b28a0d5cd5
commit
ad79c2bc62
|
@ -20,7 +20,7 @@ namespace osu.Game
|
|||
internal class PerformFromMenuRunner : Component
|
||||
{
|
||||
private readonly Action<IScreen> finalAction;
|
||||
private readonly IEnumerable<Type> validScreens;
|
||||
private readonly Type[] validScreens;
|
||||
private readonly Func<IScreen> getCurrentScreen;
|
||||
|
||||
[Resolved]
|
||||
|
@ -53,7 +53,7 @@ public PerformFromMenuRunner(Action<IScreen> finalAction, IEnumerable<Type> vali
|
|||
validScreens = validScreens.Append(typeof(MainMenu));
|
||||
|
||||
this.finalAction = finalAction;
|
||||
this.validScreens = validScreens;
|
||||
this.validScreens = validScreens.ToArray();
|
||||
this.getCurrentScreen = getCurrentScreen;
|
||||
|
||||
Scheduler.Add(task = new ScheduledDelegate(checkCanComplete, 0, 200));
|
||||
|
|
Loading…
Reference in New Issue