1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:47:52 +08:00

Remove SizeForFlow magic number

This commit is contained in:
David Zhao 2019-03-28 15:40:58 +09:00
parent 9b047d9b90
commit bfe44eb33d
4 changed files with 11 additions and 4 deletions

View File

@ -145,7 +145,12 @@ namespace osu.Game.Tests.Visual
logoFacadeContainer.Add(logoFacade = logoFacadeContainer.LogoFacade); logoFacadeContainer.Add(logoFacade = logoFacadeContainer.LogoFacade);
} }
public bool IsLogoTracking => logo.Position == logo.Parent.ToLocalSpace(logoFacadeContainer.LogoFacade.ScreenSpaceDrawQuad.Centre); private Vector2 logoTrackingPosition => logo.Parent.ToLocalSpace(logoFacade.ScreenSpaceDrawQuad.Centre);
/// <summary>
/// Check that the logo is tracking the position of the facade, with an acceptable precision lenience.
/// </summary>
public bool IsLogoTracking => Math.Abs(logo.Position.X - logoTrackingPosition.X) < 0.001f && Math.Abs(logo.Position.Y - logoTrackingPosition.Y) < 0.001f;
public void RemoveFacade() public void RemoveFacade()
{ {

View File

@ -63,7 +63,8 @@ namespace osu.Game.Graphics.Containers
if (logo == null || !Tracking) if (logo == null || !Tracking)
return; return;
LogoFacade.Size = new Vector2(logo.SizeForFlow * facadeScale); // Account for the scale of the actual logo container, as SizeForFlow only accounts for the sprite scale.
LogoFacade.Size = new Vector2(logo.SizeForFlow * logo.Scale.X * facadeScale);
if (LogoFacade.Parent != null && logo.Position != logoTrackingPosition) if (LogoFacade.Parent != null && logo.Position != logoTrackingPosition)
{ {

View File

@ -54,7 +54,7 @@ namespace osu.Game.Screens.Menu
/// </summary> /// </summary>
public Func<bool> Action; public Func<bool> Action;
public float SizeForFlow => logo == null ? 0 : logo.DrawSize.X * logo.Scale.X * logoBounceContainer.Scale.X * logoHoverContainer.Scale.X * 0.74f; public float SizeForFlow => logo == null ? 0 : logo.DrawSize.X * logo.Scale.X * logoBounceContainer.Scale.X * logoHoverContainer.Scale.X;
private readonly Sprite ripple; private readonly Sprite ripple;

View File

@ -156,7 +156,7 @@ namespace osu.Game.Screens.Play
logo.MoveTo(new Vector2(0.5f), duration, Easing.In); logo.MoveTo(new Vector2(0.5f), duration, Easing.In);
logo.FadeIn(350); logo.FadeIn(350);
content.SetLogo(logo, 0.3f, 500, Easing.InOutExpo); content.SetLogo(logo, 1.0f, 500, Easing.InOutExpo);
Scheduler.AddDelayed(() => content.Tracking = true, resuming ? 0 : 500); Scheduler.AddDelayed(() => content.Tracking = true, resuming ? 0 : 500);
} }
@ -365,6 +365,7 @@ namespace osu.Game.Screens.Play
Font = OsuFont.GetFont(size: 36, italics: true), Font = OsuFont.GetFont(size: 36, italics: true),
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Margin = new MarginPadding { Top = 15 },
}, },
new OsuSpriteText new OsuSpriteText
{ {