1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 04:42:55 +08:00

Update with framework state transformation

Removes explicit initial state setting in DrawableOsuHitObjects.
This commit is contained in:
smoogipoo 2017-11-09 14:04:59 +09:00
parent c7426ebed8
commit 348083f589
7 changed files with 15 additions and 56 deletions

@ -1 +1 @@
Subproject commit c8222d1dc932aafe17ec42bfbe6cbec81851f55d
Subproject commit b70ca3de9ec1a8eb7fb73fcfd169ff38d00b07cd

View File

@ -58,6 +58,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
},
ApproachCircle = new ApproachCircle
{
Alpha = 0,
Scale = new Vector2(4),
Colour = AccentColour,
}
};
@ -82,25 +84,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
});
}
protected override void UpdateInitialState()
{
base.UpdateInitialState();
// Hide() cannot be used here, because when rewinding, we need these to be the final values
ring.Alpha = 1;
circle.Alpha = 1;
number.Alpha = 1;
glow.Alpha = 1;
ApproachCircle.Alpha = 0;
ApproachCircle.Scale = new Vector2(4);
explode.Alpha = 0;
flash.Alpha = 0;
Scale = new Vector2(HitObject.Scale);
}
protected override void UpdatePreemptState()
{
base.UpdatePreemptState();

View File

@ -23,12 +23,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected sealed override void UpdateState(ArmedState state)
{
ClearTransforms(true);
double transformTime = HitObject.StartTime - TIME_PREEMPT;
using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true))
TransformStateTo(transformTime, true);
ClearTransformsAfter(transformTime, true);
using (BeginAbsoluteSequence(transformTime, true))
{
UpdateInitialState();
UpdatePreemptState();
using (BeginDelayedSequence(TIME_PREEMPT + (Judgements.FirstOrDefault()?.TimeOffset ?? 0), true))
@ -36,12 +37,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
}
protected virtual void UpdateInitialState()
{
// Hide() cannot be used here, because when rewinding, we need these to be the final values
Alpha = 0;
}
protected virtual void UpdatePreemptState()
{
this.FadeIn(TIME_FADEIN);

View File

@ -24,13 +24,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
this.repeatPoint = repeatPoint;
this.drawableSlider = drawableSlider;
// The containing DrawableSlider is updated before us and clears our transforms, so we need to be
// present to get updated and have UpdateState correctly called when rewinding.
AlwaysPresent = true;
AutoSizeAxes = Axes.Both;
Blending = BlendingMode.Additive;
Origin = Anchor.Centre;
Scale = new Vector2(0.5f);
Children = new Drawable[]
{
@ -50,13 +47,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
AddJudgement(new OsuJudgement { Result = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss });
}
protected override void UpdateInitialState()
{
base.UpdateInitialState();
Scale = new Vector2(0.5f);
}
protected override void UpdatePreemptState()
{
var animIn = Math.Min(150, repeatPoint.StartTime - FadeInTime);

View File

@ -43,7 +43,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
ball = new SliderBall(s)
{
Scale = new Vector2(s.Scale),
AccentColour = AccentColour
AccentColour = AccentColour,
AlwaysPresent = true,
Alpha = 0
},
initialCircle = new DrawableHitCircle(new HitCircle
{
@ -148,16 +150,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
}
protected override void UpdateInitialState()
{
base.UpdateInitialState();
body.Alpha = 1;
//we need to be present to handle input events. note that we still don't get enough events (we don't get a position if the mouse hasn't moved since the slider appeared).
ball.AlwaysPresent = true;
ball.Alpha = 0;
}
protected override void UpdateCurrentState(ArmedState state)
{
ball.FadeIn();

View File

@ -28,10 +28,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Size = new Vector2(16) * sliderTick.Scale;
// The containing DrawableSlider is updated before us and clears our transforms, so we need to be
// present to get updated and have UpdateState correctly called when rewinding.
AlwaysPresent = true;
Masking = true;
CornerRadius = Size.X / 2;

View File

@ -215,6 +215,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
nestedHitObjects.Add(h);
}
protected override bool AllowStateTransformByParent => false;
protected override bool AllowTransformClearByParent => false;
protected abstract void UpdateState(ArmedState state);
}
}