Move catcher base size constant to Catcher.

This commit is contained in:
ekrctb 2021-07-21 16:43:24 +09:00
parent 30777795ce
commit d9f9ad35be
5 changed files with 16 additions and 13 deletions

View File

@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Catch.Replays
bool impossibleJump = speedRequired > movement_speed * 2; bool impossibleJump = speedRequired > movement_speed * 2;
// todo: get correct catcher size, based on difficulty CS. // todo: get correct catcher size, based on difficulty CS.
const float catcher_width_half = CatcherArea.CATCHER_SIZE * 0.3f * 0.5f; const float catcher_width_half = Catcher.BASE_SIZE * 0.3f * 0.5f;
if (lastPosition - catcher_width_half < h.EffectiveX && lastPosition + catcher_width_half > h.EffectiveX) if (lastPosition - catcher_width_half < h.EffectiveX && lastPosition + catcher_width_half > h.EffectiveX)
{ {

View File

@ -25,6 +25,16 @@ namespace osu.Game.Rulesets.Catch.UI
{ {
public class Catcher : SkinReloadableDrawable public class Catcher : SkinReloadableDrawable
{ {
/// <summary>
/// The size of the catcher at 1x scale.
/// </summary>
public const float BASE_SIZE = 106.75f;
/// <summary>
/// The width of the catcher which can receive fruit. Equivalent to "catchMargin" in osu-stable.
/// </summary>
public const float ALLOWED_CATCH_RANGE = 0.8f;
/// <summary> /// <summary>
/// The default colour used to tint hyper-dash fruit, along with the moving catcher, its trail /// The default colour used to tint hyper-dash fruit, along with the moving catcher, its trail
/// and end glow/after-image during a hyper-dash. /// and end glow/after-image during a hyper-dash.
@ -82,11 +92,6 @@ namespace osu.Game.Rulesets.Catch.UI
private set => Body.AnimationState.Value = value; private set => Body.AnimationState.Value = value;
} }
/// <summary>
/// The width of the catcher which can receive fruit. Equivalent to "catchMargin" in osu-stable.
/// </summary>
public const float ALLOWED_CATCH_RANGE = 0.8f;
private bool dashing; private bool dashing;
public bool Dashing public bool Dashing
@ -140,7 +145,7 @@ namespace osu.Game.Rulesets.Catch.UI
Origin = Anchor.TopCentre; Origin = Anchor.TopCentre;
Size = new Vector2(CatcherArea.CATCHER_SIZE); Size = new Vector2(BASE_SIZE);
if (difficulty != null) if (difficulty != null)
Scale = calculateScale(difficulty); Scale = calculateScale(difficulty);
@ -197,7 +202,7 @@ namespace osu.Game.Rulesets.Catch.UI
/// Calculates the width of the area used for attempting catches in gameplay. /// Calculates the width of the area used for attempting catches in gameplay.
/// </summary> /// </summary>
/// <param name="scale">The scale of the catcher.</param> /// <param name="scale">The scale of the catcher.</param>
public static float CalculateCatchWidth(Vector2 scale) => CatcherArea.CATCHER_SIZE * Math.Abs(scale.X) * ALLOWED_CATCH_RANGE; public static float CalculateCatchWidth(Vector2 scale) => BASE_SIZE * Math.Abs(scale.X) * ALLOWED_CATCH_RANGE;
/// <summary> /// <summary>
/// Calculates the width of the area used for attempting catches in gameplay. /// Calculates the width of the area used for attempting catches in gameplay.

View File

@ -22,8 +22,6 @@ namespace osu.Game.Rulesets.Catch.UI
/// </summary> /// </summary>
public class CatcherArea : Container, IKeyBindingHandler<CatchAction> public class CatcherArea : Container, IKeyBindingHandler<CatchAction>
{ {
public const float CATCHER_SIZE = 106.75f;
public Catcher Catcher public Catcher Catcher
{ {
get => catcher; get => catcher;
@ -52,7 +50,7 @@ namespace osu.Game.Rulesets.Catch.UI
/// </remarks> /// </remarks>
public CatcherArea() public CatcherArea()
{ {
Size = new Vector2(CatchPlayfield.WIDTH, CATCHER_SIZE); Size = new Vector2(CatchPlayfield.WIDTH, Catcher.BASE_SIZE);
Child = comboDisplay = new CatchComboDisplay Child = comboDisplay = new CatchComboDisplay
{ {
RelativeSizeAxes = Axes.None, RelativeSizeAxes = Axes.None,

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Catch.UI
public CatcherTrail() public CatcherTrail()
{ {
Size = new Vector2(CatcherArea.CATCHER_SIZE); Size = new Vector2(Catcher.BASE_SIZE);
Origin = Anchor.TopCentre; Origin = Anchor.TopCentre;
Blending = BlendingParameters.Additive; Blending = BlendingParameters.Additive;
InternalChild = body = new SkinnableCatcher InternalChild = body = new SkinnableCatcher

View File

@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Catch.UI
{ {
Anchor = Anchor.TopCentre; Anchor = Anchor.TopCentre;
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling. // Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.
OriginPosition = new Vector2(0.5f, 0.06f) * CatcherArea.CATCHER_SIZE; OriginPosition = new Vector2(0.5f, 0.06f) * Catcher.BASE_SIZE;
} }
} }
} }