mirror of https://github.com/ppy/osu
Use Lazy for threadsafety on playfield
This commit is contained in:
parent
6a690908cf
commit
b28b86dea9
|
@ -55,11 +55,11 @@ public abstract class RulesetContainer : Container
|
|||
|
||||
public abstract IEnumerable<HitObject> Objects { get; }
|
||||
|
||||
private Playfield playfield;
|
||||
private readonly Lazy<Playfield> playfield;
|
||||
/// <summary>
|
||||
/// The playfield.
|
||||
/// </summary>
|
||||
public Playfield Playfield => playfield ?? (playfield = CreatePlayfield());
|
||||
public Playfield Playfield => playfield.Value;
|
||||
|
||||
protected readonly Ruleset Ruleset;
|
||||
|
||||
|
@ -70,6 +70,7 @@ public abstract class RulesetContainer : Container
|
|||
protected RulesetContainer(Ruleset ruleset)
|
||||
{
|
||||
Ruleset = ruleset;
|
||||
playfield = new Lazy<Playfield>(CreatePlayfield);
|
||||
}
|
||||
|
||||
public abstract ScoreProcessor CreateScoreProcessor();
|
||||
|
|
Loading…
Reference in New Issue