mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Simplify changes to RulesetContainer
This commit is contained in:
parent
9177a45587
commit
d3368df94d
@ -35,8 +35,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
public void ApplyToRulesetContainer(RulesetContainer<OsuHitObject> rulesetContainer)
|
||||
{
|
||||
bool hasEasy = rulesetContainer.ActiveMods.Any(m => m is ModEasy);
|
||||
bool hasHardrock = rulesetContainer.ActiveMods.Any(m => m is ModHardRock);
|
||||
bool hasEasy = rulesetContainer.Mods.Any(m => m is ModEasy);
|
||||
bool hasHardrock = rulesetContainer.Mods.Any(m => m is ModHardRock);
|
||||
|
||||
rulesetContainer.Overlays.Add(blinds = new DrawableOsuBlinds(rulesetContainer.Playfield.HitObjectContainer, hasEasy, hasHardrock, rulesetContainer.Beatmap));
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// Place to put drawables above hit objects but below UI.
|
||||
/// </summary>
|
||||
public readonly Container Overlays;
|
||||
public Container Overlays { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The cursor provided by this <see cref="RulesetContainer"/>. May be null if no cursor is provided.
|
||||
@ -92,12 +92,6 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
Ruleset = ruleset;
|
||||
playfield = new Lazy<Playfield>(CreatePlayfield);
|
||||
Overlays = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 1,
|
||||
Height = 1
|
||||
};
|
||||
|
||||
IsPaused.ValueChanged += paused =>
|
||||
{
|
||||
@ -215,7 +209,7 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// The mods which are to be applied.
|
||||
/// </summary>
|
||||
protected IEnumerable<Mod> Mods;
|
||||
public IEnumerable<Mod> Mods { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="WorkingBeatmap"/> this <see cref="RulesetContainer{TObject}"/> was created with.
|
||||
@ -226,7 +220,6 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
private Container content;
|
||||
private IEnumerable<Mod> mods;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to assume the beatmap passed into this <see cref="RulesetContainer{TObject}"/> is for the current ruleset.
|
||||
@ -256,17 +249,24 @@ namespace osu.Game.Rulesets.UI
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
KeyBindingInputManager.Add(content = new Container
|
||||
KeyBindingInputManager.Children = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
});
|
||||
|
||||
AddInternal(KeyBindingInputManager);
|
||||
KeyBindingInputManager.Add(Playfield);
|
||||
content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
Playfield
|
||||
};
|
||||
|
||||
if (Cursor != null)
|
||||
KeyBindingInputManager.Add(Cursor);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
KeyBindingInputManager,
|
||||
Overlays = new Container { RelativeSizeAxes = Axes.Both }
|
||||
};
|
||||
|
||||
// Apply mods
|
||||
applyRulesetMods(Mods, config);
|
||||
|
||||
@ -324,11 +324,6 @@ namespace osu.Game.Rulesets.UI
|
||||
mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the currently selected mods for this ruleset container.
|
||||
/// </summary>
|
||||
public IEnumerable<Mod> ActiveMods { get => Mods; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates and adds the visual representation of a <see cref="TObject"/> to this <see cref="RulesetContainer{TObject}"/>.
|
||||
/// </summary>
|
||||
|
@ -184,7 +184,6 @@ namespace osu.Game.Screens.Play
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = RulesetContainer
|
||||
},
|
||||
RulesetContainer.Overlays,
|
||||
new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
|
Loading…
Reference in New Issue
Block a user