mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 00:53:10 +08:00
Make DrawableHitObject a CompositeDrawable
No reason for it to be a container.
This commit is contained in:
parent
edd053fcd2
commit
a42035f494
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
Origin = Anchor.BottomLeft;
|
Origin = Anchor.BottomLeft;
|
||||||
X = 0;
|
X = 0;
|
||||||
|
|
||||||
Child = bananaContainer = new Container { RelativeSizeAxes = Axes.Both };
|
InternalChild = bananaContainer = new Container { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
foreach (var b in s.NestedHitObjects.Cast<BananaShower.Banana>())
|
foreach (var b in s.NestedHitObjects.Cast<BananaShower.Banana>())
|
||||||
AddNested(getVisualRepresentation?.Invoke(b));
|
AddNested(getVisualRepresentation?.Invoke(b));
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Child = new Pulp
|
InternalChild = new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour,
|
||||||
Size = Size
|
Size = Size
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Children = new[]
|
InternalChildren = new[]
|
||||||
{
|
{
|
||||||
createPulp(HitObject.VisualRepresentation),
|
createPulp(HitObject.VisualRepresentation),
|
||||||
border = new Circle
|
border = new Circle
|
||||||
@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
|
|
||||||
if (HitObject.HyperDash)
|
if (HitObject.HyperDash)
|
||||||
{
|
{
|
||||||
Add(new Pulp
|
AddInternal(new Pulp
|
||||||
{
|
{
|
||||||
RelativePositionAxes = Axes.Both,
|
RelativePositionAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
Origin = Anchor.BottomLeft;
|
Origin = Anchor.BottomLeft;
|
||||||
X = 0;
|
X = 0;
|
||||||
|
|
||||||
Child = dropletContainer = new Container { RelativeSizeAxes = Axes.Both, };
|
InternalChild = 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));
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = 1;
|
Height = 1;
|
||||||
|
|
||||||
Add(new Box
|
AddInternal(new Box
|
||||||
{
|
{
|
||||||
Name = "Bar line",
|
Name = "Bar line",
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
|
|
||||||
if (isMajor)
|
if (isMajor)
|
||||||
{
|
{
|
||||||
Add(new EquilateralTriangle
|
AddInternal(new EquilateralTriangle
|
||||||
{
|
{
|
||||||
Name = "Left triangle",
|
Name = "Left triangle",
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
Rotation = 90
|
Rotation = 90
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(new EquilateralTriangle
|
AddInternal(new EquilateralTriangle
|
||||||
{
|
{
|
||||||
Name = "Right triangle",
|
Name = "Right triangle",
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
AddRange(new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
// The hit object itself cannot be used for various elements because the tail overshoots it
|
// The hit object itself cannot be used for various elements because the tail overshoots it
|
||||||
// So a specialized container that is updated to contain the tail height is used
|
// So a specialized container that is updated to contain the tail height is used
|
||||||
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre
|
Origin = Anchor.TopCentre
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
foreach (var tick in HitObject.NestedHitObjects.OfType<HoldNoteTick>())
|
foreach (var tick in HitObject.NestedHitObjects.OfType<HoldNoteTick>())
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Size = new Vector2(1);
|
Size = new Vector2(1);
|
||||||
|
|
||||||
Children = new[]
|
InternalChildren = new[]
|
||||||
{
|
{
|
||||||
glowContainer = new CircularContainer
|
glowContainer = new CircularContainer
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
laneGlowPiece = new LaneGlowPiece
|
laneGlowPiece = new LaneGlowPiece
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
Position = HitObject.StackedPosition;
|
Position = HitObject.StackedPosition;
|
||||||
Scale = new Vector2(h.Scale);
|
Scale = new Vector2(h.Scale);
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
glow = new GlowPiece
|
glow = new GlowPiece
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
Blending = BlendingMode.Additive;
|
Blending = BlendingMode.Additive;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new SpriteIcon
|
new SpriteIcon
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
Container<DrawableSliderTick> ticks;
|
Container<DrawableSliderTick> ticks;
|
||||||
Container<DrawableRepeatPoint> repeatPoints;
|
Container<DrawableRepeatPoint> repeatPoints;
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
Body = new SliderBody(s)
|
Body = new SliderBody(s)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
BorderThickness = 2;
|
BorderThickness = 2;
|
||||||
BorderColour = Color4.White;
|
BorderColour = Color4.White;
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
Spinner = s;
|
Spinner = s;
|
||||||
|
|
||||||
Children = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
circleContainer = new Container
|
circleContainer = new Container
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
Width = tracker_width;
|
Width = tracker_width;
|
||||||
|
|
||||||
Children = new[]
|
InternalChildren = new[]
|
||||||
{
|
{
|
||||||
Tracker = new Box
|
Tracker = new Box
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
public DrawableBarLineMajor(BarLine barLine)
|
public DrawableBarLineMajor(BarLine barLine)
|
||||||
: base(barLine)
|
: base(barLine)
|
||||||
{
|
{
|
||||||
Add(triangleContainer = new Container
|
InternalChild = triangleContainer = new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
EdgeSmoothness = new Vector2(1),
|
EdgeSmoothness = new Vector2(1),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
Tracker.Alpha = 1f;
|
Tracker.Alpha = 1f;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
Content.ScaleTo(0, 100, Easing.OutQuint).Expire();
|
this.ScaleTo(0, 100, Easing.OutQuint).Expire();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
const float gravity_time = 300;
|
const float gravity_time = 300;
|
||||||
const float gravity_travel_height = 200;
|
const float gravity_travel_height = 200;
|
||||||
|
|
||||||
Content.ScaleTo(0.8f, gravity_time * 2, Easing.OutQuad);
|
this.ScaleTo(0.8f, gravity_time * 2, Easing.OutQuad);
|
||||||
|
|
||||||
this.MoveToY(-gravity_travel_height, gravity_time, Easing.Out)
|
this.MoveToY(-gravity_travel_height, gravity_time, Easing.Out)
|
||||||
.Then()
|
.Then()
|
||||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
{
|
{
|
||||||
FillMode = FillMode.Fit;
|
FillMode = FillMode.Fit;
|
||||||
|
|
||||||
Add(bodyContainer = new Container
|
InternalChild = bodyContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Depth = 1,
|
Depth = 1,
|
||||||
@ -111,7 +111,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
MainPiece.Add(symbol = new SwellSymbolPiece());
|
MainPiece.Add(symbol = new SwellSymbolPiece());
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Size = BaseSize = new Vector2(HitObject.IsStrong ? TaikoHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE);
|
Size = BaseSize = new Vector2(HitObject.IsStrong ? TaikoHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE);
|
||||||
|
|
||||||
Add(MainPiece = CreateMainPiece());
|
InternalChild = MainPiece = CreateMainPiece();
|
||||||
MainPiece.KiaiMode = HitObject.Kiai;
|
MainPiece.KiaiMode = HitObject.Kiai;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,12 +140,12 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
Add(new Box
|
InternalChild = new Box
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
});
|
};
|
||||||
|
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
@ -175,7 +175,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Add(new Box { Size = new Vector2(75) });
|
InternalChild = new Box { Size = new Vector2(75) };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
protected override void UpdateState(ArmedState state)
|
||||||
|
@ -19,7 +19,7 @@ using OpenTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Drawables
|
namespace osu.Game.Rulesets.Objects.Drawables
|
||||||
{
|
{
|
||||||
public abstract class DrawableHitObject : Container, IHasAccentColour
|
public abstract class DrawableHitObject : CompositeDrawable, IHasAccentColour
|
||||||
{
|
{
|
||||||
public readonly HitObject HitObject;
|
public readonly HitObject HitObject;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user