mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 10:03:05 +08:00
Fix potential blueprint nullrefs with the new structure
This commit is contained in:
parent
bc41eb176e
commit
510ce9345f
@ -20,30 +20,36 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
|
|
||||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||||
|
|
||||||
private readonly BodyPiece body;
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
public HoldNoteSelectionBlueprint(DrawableHoldNote hold)
|
public HoldNoteSelectionBlueprint(DrawableHoldNote hold)
|
||||||
: base(hold)
|
: base(hold)
|
||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
new HoldNoteNoteSelectionBlueprint(hold.Head),
|
|
||||||
new HoldNoteNoteSelectionBlueprint(hold.Tail),
|
|
||||||
body = new BodyPiece
|
|
||||||
{
|
|
||||||
AccentColour = Color4.Transparent
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, IScrollingInfo scrollingInfo)
|
private void load(IScrollingInfo scrollingInfo)
|
||||||
{
|
{
|
||||||
body.BorderColour = colours.Yellow;
|
|
||||||
|
|
||||||
direction.BindTo(scrollingInfo.Direction);
|
direction.BindTo(scrollingInfo.Direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new HoldNoteNoteSelectionBlueprint(HitObject.Head),
|
||||||
|
new HoldNoteNoteSelectionBlueprint(HitObject.Tail),
|
||||||
|
new BodyPiece
|
||||||
|
{
|
||||||
|
AccentColour = Color4.Transparent,
|
||||||
|
BorderColour = colours.Yellow
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
@ -123,12 +123,20 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
if (blueprint == null)
|
if (blueprint == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blueprint.Selected += onBlueprintSelected;
|
if (hitObject.IsLoaded)
|
||||||
blueprint.Deselected += onBlueprintDeselected;
|
addBlueprint();
|
||||||
blueprint.SelectionRequested += onSelectionRequested;
|
else
|
||||||
blueprint.DragRequested += onDragRequested;
|
hitObject.OnLoadComplete += _ => addBlueprint();
|
||||||
|
|
||||||
selectionBlueprints.Add(blueprint);
|
void addBlueprint()
|
||||||
|
{
|
||||||
|
blueprint.Selected += onBlueprintSelected;
|
||||||
|
blueprint.Deselected += onBlueprintDeselected;
|
||||||
|
blueprint.SelectionRequested += onSelectionRequested;
|
||||||
|
blueprint.DragRequested += onDragRequested;
|
||||||
|
|
||||||
|
selectionBlueprints.Add(blueprint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeBlueprintFor(DrawableHitObject hitObject) => removeBlueprintFor(hitObject.HitObject);
|
private void removeBlueprintFor(DrawableHitObject hitObject) => removeBlueprintFor(hitObject.HitObject);
|
||||||
|
Loading…
Reference in New Issue
Block a user