-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
56 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Utils; | ||
using osu.Game.Rulesets.Catch.Skinning.Default; | ||
using osu.Game.Skinning; | ||
using osuTK; | ||
|
||
namespace osu.Game.Rulesets.Catch.Objects.Drawables | ||
{ | ||
|
@@ -36,23 +38,43 @@ protected override void LoadComplete() | |
StartTimeBindable.BindValueChanged(_ => UpdateComboColour()); | ||
} | ||
|
||
private float startScale; | ||
private float endScale; | ||
|
||
private float startAngle; | ||
private float endAngle; | ||
|
||
protected override void UpdateInitialTransforms() | ||
{ | ||
base.UpdateInitialTransforms(); | ||
|
||
// Important to have this in UpdateInitialTransforms() to it is re-triggered by RefreshStateTransforms(). | ||
const float end_scale = 0.6f; | ||
const float random_scale_range = 1.6f; | ||
|
||
ScalingContainer.ScaleTo(HitObject.Scale * (end_scale + random_scale_range * RandomSingle(3))) | ||
.Then().ScaleTo(HitObject.Scale * end_scale, HitObject.TimePreempt); | ||
startScale = end_scale + random_scale_range * RandomSingle(3); | ||
endScale = end_scale; | ||
|
||
ScalingContainer.RotateTo(getRandomAngle(1)) | ||
.Then() | ||
.RotateTo(getRandomAngle(2), HitObject.TimePreempt); | ||
startAngle = getRandomAngle(1); | ||
endAngle = getRandomAngle(2); | ||
|
||
float getRandomAngle(int series) => 180 * (RandomSingle(series) * 2 - 1); | ||
} | ||
|
||
protected override void Update() | ||
{ | ||
base.Update(); | ||
|
||
double preemptProgress = (Time.Current - (HitObject.StartTime - InitialLifetimeOffset)) / HitObject.TimePreempt; | ||
|
||
// Clamp scale and rotation at the point of bananas being caught, else let them freely extrapolate. | ||
if (Result.IsHit) | ||
preemptProgress = Math.Min(1, preemptProgress); | ||
|
||
ScalingContainer.Scale = new Vector2(HitObject.Scale * (float)Interpolation.Lerp(startScale, endScale, preemptProgress)); | ||
ScalingContainer.Rotation = (float)Interpolation.Lerp(startAngle, endAngle, preemptProgress); | ||
} | ||
|
||
public override void PlaySamples() | ||
{ | ||
base.PlaySamples(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using NUnit.Framework; | ||
using osu.Framework.Utils; | ||
using osu.Game.Beatmaps; | ||
|
@@ -22,9 +20,9 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor | |
{ | ||
public partial class TestSceneSliderSelectionBlueprint : SelectionBlueprintTestScene | ||
{ | ||
private Slider slider; | ||
private DrawableSlider drawableObject; | ||
private TestSliderBlueprint blueprint; | ||
private Slider slider = null!; | ||
private DrawableSlider drawableObject = null!; | ||
private TestSliderBlueprint blueprint = null!; | ||
|
||
[SetUp] | ||
public void Setup() => Schedule(() => | ||
|
@@ -218,6 +216,9 @@ private void checkPositions() | |
|
||
AddAssert("tail positioned correctly", | ||
() => Precision.AlmostEquals(blueprint.TailOverlay.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.TailCircle.ScreenSpaceDrawQuad.Centre)); | ||
|
||
AddAssert("end drag marker positioned correctly", | ||
() => Precision.AlmostEquals(blueprint.TailOverlay.EndDragMarker!.ToScreenSpace(blueprint.TailOverlay.EndDragMarker.OriginPosition), drawableObject.TailCircle.ScreenSpaceDrawQuad.Centre, 2)); | ||
} | ||
|
||
private void moveMouseToControlPoint(int index) | ||
|
@@ -230,14 +231,14 @@ private void moveMouseToControlPoint(int index) | |
} | ||
|
||
private void checkControlPointSelected(int index, bool selected) | ||
=> AddAssert($"control point {index} {(selected ? "selected" : "not selected")}", () => blueprint.ControlPointVisualiser.Pieces[index].IsSelected.Value == selected); | ||
=> AddAssert($"control point {index} {(selected ? "selected" : "not selected")}", () => blueprint.ControlPointVisualiser!.Pieces[index].IsSelected.Value == selected); | ||
|
||
private partial class TestSliderBlueprint : SliderSelectionBlueprint | ||
{ | ||
public new SliderBodyPiece BodyPiece => base.BodyPiece; | ||
public new TestSliderCircleOverlay HeadOverlay => (TestSliderCircleOverlay)base.HeadOverlay; | ||
public new TestSliderCircleOverlay TailOverlay => (TestSliderCircleOverlay)base.TailOverlay; | ||
public new PathControlPointVisualiser<Slider> ControlPointVisualiser => base.ControlPointVisualiser; | ||
public new PathControlPointVisualiser<Slider>? ControlPointVisualiser => base.ControlPointVisualiser; | ||
|
||
public TestSliderBlueprint(Slider slider) | ||
: base(slider) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters