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