Combine DisplayRadius and Scale to DisplaySize

This commit is contained in:
ekrctb
2020-12-10 20:43:01 +09:00
parent e097b6e61c
commit 2634c6b8d9
5 changed files with 24 additions and 22 deletions

View File

@ -21,7 +21,9 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
public Bindable<Color4> AccentColour { get; } = new Bindable<Color4>();
public Bindable<bool> HyperDash { get; } = new Bindable<bool>();
float IHasCatchObjectState.Scale => Scale.X;
public Vector2 DisplaySize => Size * Scale;
public float DisplayRotation => Rotation;
/// <summary>
/// Whether this hit object should stay on the catcher plate when the object is caught by the catcher.
@ -45,8 +47,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
public virtual void CopyStateFrom(IHasCatchObjectState objectState)
{
HitObject = objectState.HitObject;
Scale = new Vector2(objectState.Scale);
Rotation = objectState.Rotation;
Scale = Vector2.Divide(objectState.DisplaySize, Size);
Rotation = objectState.DisplayRotation;
AccentColour.Value = objectState.AccentColour.Value;
HyperDash.Value = objectState.HyperDash.Value;
}

View File

@ -29,16 +29,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
/// </summary>
protected virtual float ScaleFactor => 1;
public float DisplayRadius => CatchHitObject.OBJECT_RADIUS * HitObject.Scale * ScaleFactor;
/// <summary>
/// The container internal transforms (such as scaling based on the circle size) are applied to.
/// </summary>
protected readonly Container ScalingContainer;
float IHasCatchObjectState.Scale => HitObject.Scale * ScaleFactor;
public Vector2 DisplaySize => ScalingContainer.Size * ScalingContainer.Scale;
float IHasCatchObjectState.Rotation => ScalingContainer.Rotation;
public float DisplayRotation => ScalingContainer.Rotation;
protected DrawablePalpableCatchHitObject([CanBeNull] CatchHitObject h)
: base(h)
@ -65,7 +63,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
ScaleBindable.BindValueChanged(scale =>
{
ScalingContainer.Scale = new Vector2(scale.NewValue * ScaleFactor);
Size = ScalingContainer.Size * ScalingContainer.Scale;
Size = DisplaySize;
}, true);
IndexInBeatmap.BindValueChanged(_ => UpdateComboColour());

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Objects.Drawables
@ -15,7 +16,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
Bindable<Color4> AccentColour { get; }
Bindable<bool> HyperDash { get; }
float Rotation { get; }
float Scale { get; }
Vector2 DisplaySize { get; }
float DisplayRotation { get; }
}
}