1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 18:12:56 +08:00

Fix incorrect usage of InternalChildren

Could cause overwriting of components added by base DrawableHitObjcet class (such as samples)
This commit is contained in:
Dean Herbert 2019-03-25 13:47:28 +09:00
parent c97116c91a
commit 39df8cce19
10 changed files with 22 additions and 28 deletions

View File

@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
Origin = Anchor.BottomLeft; Origin = Anchor.BottomLeft;
X = 0; X = 0;
InternalChild = bananaContainer = new Container { RelativeSizeAxes = Axes.Both }; AddInternal(bananaContainer = new Container { RelativeSizeAxes = Axes.Both });
foreach (var b in s.NestedHitObjects.Cast<Banana>()) foreach (var b in s.NestedHitObjects.Cast<Banana>())
AddNested(getVisualRepresentation?.Invoke(b)); AddNested(getVisualRepresentation?.Invoke(b));

View File

@ -26,10 +26,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
InternalChild = pulp = new Pulp AddInternal(pulp = new Pulp { Size = Size });
{
Size = Size
};
} }
public override Color4 AccentColour public override Color4 AccentColour

View File

@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
// todo: this should come from the skin. // todo: this should come from the skin.
AccentColour = colourForRepresentation(HitObject.VisualRepresentation); AccentColour = colourForRepresentation(HitObject.VisualRepresentation);
InternalChildren = new[] AddRangeInternal(new[]
{ {
createPulp(HitObject.VisualRepresentation), createPulp(HitObject.VisualRepresentation),
border = new Circle border = new Circle
@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
} }
} }
}, },
}; });
if (HitObject.HyperDash) if (HitObject.HyperDash)
{ {

View File

@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
Origin = Anchor.BottomLeft; Origin = Anchor.BottomLeft;
X = 0; X = 0;
InternalChild = dropletContainer = new Container { RelativeSizeAxes = Axes.Both, }; AddInternal(dropletContainer = new Container { RelativeSizeAxes = Axes.Both, });
foreach (var o in s.NestedHitObjects.Cast<CatchHitObject>()) foreach (var o in s.NestedHitObjects.Cast<CatchHitObject>())
AddNested(getVisualRepresentation?.Invoke(o)); AddNested(getVisualRepresentation?.Invoke(o));

View File

@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
InternalChildren = new Drawable[] AddRangeInternal(new Drawable[]
{ {
bodyPiece = new BodyPiece bodyPiece = new BodyPiece
{ {
@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre Origin = Anchor.TopCentre
} }
}; });
foreach (var tick in tickContainer) foreach (var tick in tickContainer)
AddNested(tick); AddNested(tick);

View File

@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Size = new Vector2(1); Size = new Vector2(1);
InternalChildren = new[] AddRangeInternal(new[]
{ {
glowContainer = new CircularContainer glowContainer = new CircularContainer
{ {
@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
} }
} }
} }
}; });
} }
public override Color4 AccentColour public override Color4 AccentColour

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
CornerRadius = 5; CornerRadius = 5;
Masking = true; Masking = true;
InternalChild = headPiece = new NotePiece(); AddInternal(headPiece = new NotePiece());
} }
protected override void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e) protected override void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)

View File

@ -44,17 +44,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
Width = tracker_width; Width = tracker_width;
InternalChildren = new[] AddInternal(Tracker = new Box
{ {
Tracker = new Box Anchor = Anchor.Centre,
{ Origin = Anchor.Centre,
Anchor = Anchor.Centre, RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre, EdgeSmoothness = new Vector2(0.5f, 0),
RelativeSizeAxes = Axes.Both, Alpha = 0.75f
EdgeSmoothness = new Vector2(0.5f, 0), });
Alpha = 0.75f
}
};
} }
protected override void UpdateState(ArmedState state) protected override void UpdateState(ArmedState state)

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
protected DrawableTaikoHitObject(TaikoHitObject hitObject) protected DrawableTaikoHitObject(TaikoHitObject hitObject)
: base(hitObject) : base(hitObject)
{ {
InternalChildren = new[] AddRangeInternal(new[]
{ {
nonProxiedContent = new Container nonProxiedContent = new Container
{ {
@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
Child = Content = new Container { RelativeSizeAxes = Axes.Both } Child = Content = new Container { RelativeSizeAxes = Axes.Both }
}, },
proxiedContent = new ProxiedContentContainer { RelativeSizeAxes = Axes.Both } proxiedContent = new ProxiedContentContainer { RelativeSizeAxes = Axes.Both }
}; });
} }
/// <summary> /// <summary>

View File

@ -170,12 +170,12 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;
InternalChild = new Box AddInternal(new Box
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
}; });
switch (direction) switch (direction)
{ {
@ -205,7 +205,7 @@ namespace osu.Game.Tests.Visual.Gameplay
Origin = Anchor.Centre; Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
InternalChild = new Box { Size = new Vector2(75) }; AddInternal(new Box { Size = new Vector2(75) });
} }
protected override void UpdateState(ArmedState state) protected override void UpdateState(ArmedState state)