mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Apply reviews, add safety for multiple facades
This commit is contained in:
@ -60,7 +60,7 @@ namespace osu.Game.Screens.Menu
|
||||
if (this.logo != null)
|
||||
{
|
||||
this.logo.Action = onOsuLogo;
|
||||
logoFacadeContainer.SetLogo(logo, 0.74f);
|
||||
logoTrackingContainer.SetLogo(logo, 0.74f);
|
||||
|
||||
// osuLogo.SizeForFlow relies on loading to be complete.
|
||||
buttonArea.Flow.Position = new Vector2(WEDGE_WIDTH * 2 - (BUTTON_WIDTH + this.logo.SizeForFlow / 4), 0);
|
||||
@ -70,7 +70,7 @@ namespace osu.Game.Screens.Menu
|
||||
else
|
||||
{
|
||||
// We should stop tracking as the facade is now out of scope.
|
||||
logoFacadeContainer.Tracking = false;
|
||||
logoTrackingContainer.Tracking = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,29 +83,29 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private SampleChannel sampleBack;
|
||||
|
||||
private readonly LogoFacadeContainer logoFacadeContainer;
|
||||
private readonly LogoTrackingContainer logoTrackingContainer;
|
||||
|
||||
public ButtonSystem()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
Child = logoFacadeContainer = new LogoFacadeContainer
|
||||
Child = logoTrackingContainer = new LogoTrackingContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = buttonArea = new ButtonArea()
|
||||
};
|
||||
|
||||
buttonArea.AddRange(new Container[]
|
||||
buttonArea.AddRange(new Drawable[]
|
||||
{
|
||||
new Button(@"settings", string.Empty, FontAwesome.Gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O),
|
||||
backButton = new Button(@"back", @"button-back-select", OsuIcon.LeftCircle, new Color4(51, 58, 94, 255), () => State = ButtonSystemState.TopLevel, -WEDGE_WIDTH)
|
||||
{
|
||||
VisibleState = ButtonSystemState.Play,
|
||||
},
|
||||
logoFacadeContainer.LogoFacade
|
||||
logoTrackingContainer.LogoFacade
|
||||
});
|
||||
|
||||
buttonArea.Flow.CentreTarget = logoFacadeContainer.LogoFacade;
|
||||
buttonArea.Flow.CentreTarget = logoTrackingContainer.LogoFacade;
|
||||
}
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
@ -271,7 +271,7 @@ namespace osu.Game.Screens.Menu
|
||||
logoDelayedAction?.Cancel();
|
||||
logoDelayedAction = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
logoFacadeContainer.Tracking = false;
|
||||
logoTrackingContainer.Tracking = false;
|
||||
|
||||
game?.Toolbar.Hide();
|
||||
|
||||
@ -294,8 +294,8 @@ namespace osu.Game.Screens.Menu
|
||||
if (lastState == ButtonSystemState.Initial)
|
||||
logo.ScaleTo(0.5f, 200, Easing.In);
|
||||
|
||||
logoFacadeContainer.SetLogo(logo, 0.74f, lastState == ButtonSystemState.EnteringMode ? 0 : 200, Easing.In);
|
||||
logoFacadeContainer.Tracking = true;
|
||||
logoTrackingContainer.SetLogo(logo, 0.74f, lastState == ButtonSystemState.EnteringMode ? 0 : 200, Easing.In);
|
||||
logoTrackingContainer.Tracking = true;
|
||||
|
||||
logoDelayedAction?.Cancel();
|
||||
logoDelayedAction = Scheduler.AddDelayed(() =>
|
||||
@ -308,14 +308,14 @@ namespace osu.Game.Screens.Menu
|
||||
break;
|
||||
default:
|
||||
logo.ClearTransforms(targetMember: nameof(Position));
|
||||
logoFacadeContainer.Tracking = true;
|
||||
logoTrackingContainer.Tracking = true;
|
||||
logo.ScaleTo(0.5f, 200, Easing.OutQuint);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case ButtonSystemState.EnteringMode:
|
||||
logoFacadeContainer.Tracking = true;
|
||||
logoTrackingContainer.Tracking = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -54,8 +54,14 @@ namespace osu.Game.Screens.Menu
|
||||
/// </summary>
|
||||
public Func<bool> Action;
|
||||
|
||||
/// <summary>
|
||||
/// The size of the logo Sprite with respect to the scale of its hover and bounce containers.
|
||||
/// </summary>
|
||||
/// <remarks>Does not account for the scale of this <see cref="OsuLogo"/></remarks>
|
||||
public float SizeForFlow => logo == null ? 0 : logo.DrawSize.X * logo.Scale.X * logoBounceContainer.Scale.X * logoHoverContainer.Scale.X;
|
||||
|
||||
public bool HasTrackingContainer { get; set; }
|
||||
|
||||
private readonly Sprite ripple;
|
||||
|
||||
private readonly Container rippleContainer;
|
||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private Player player;
|
||||
|
||||
private LogoFacadeContainer content;
|
||||
private LogoTrackingContainer content;
|
||||
|
||||
private BeatmapMetadataDisplay info;
|
||||
|
||||
@ -60,14 +60,12 @@ namespace osu.Game.Screens.Play
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = content = new LogoFacadeContainer
|
||||
InternalChild = (content = new LogoTrackingContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
};
|
||||
|
||||
content.Children = new Drawable[]
|
||||
}).WithChildren(new Drawable[]
|
||||
{
|
||||
info = new BeatmapMetadataDisplay(Beatmap.Value, content.LogoFacade)
|
||||
{
|
||||
@ -89,7 +87,7 @@ namespace osu.Game.Screens.Play
|
||||
new InputSettings()
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
loadNewPlayer();
|
||||
}
|
||||
@ -163,12 +161,9 @@ namespace osu.Game.Screens.Play
|
||||
logo.ScaleTo(new Vector2(0.15f), duration, Easing.In);
|
||||
logo.FadeIn(350);
|
||||
|
||||
content.SetLogo(logo, 1.0f, 500, Easing.InOutExpo);
|
||||
content.SetLogo(logo, 1.0f, resuming ? 0 : 500, Easing.InOutExpo);
|
||||
|
||||
Scheduler.AddDelayed(() =>
|
||||
{
|
||||
content.Tracking = true;
|
||||
}, resuming ? 0 : 500);
|
||||
Scheduler.AddDelayed(() => { content.Tracking = true; }, resuming ? 0 : 500);
|
||||
}
|
||||
|
||||
protected override void LogoExiting(OsuLogo logo)
|
||||
@ -321,7 +316,7 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
|
||||
private readonly WorkingBeatmap beatmap;
|
||||
private readonly Container facade;
|
||||
private readonly Drawable facade;
|
||||
private LoadingAnimation loading;
|
||||
private Sprite backgroundSprite;
|
||||
private ModDisplay modDisplay;
|
||||
@ -343,7 +338,7 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
|
||||
public BeatmapMetadataDisplay(WorkingBeatmap beatmap, Container facade)
|
||||
public BeatmapMetadataDisplay(WorkingBeatmap beatmap, Drawable facade)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
this.facade = facade;
|
||||
@ -366,7 +361,7 @@ namespace osu.Game.Screens.Play
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
Children = new[]
|
||||
{
|
||||
facade,
|
||||
new OsuSpriteText
|
||||
|
Reference in New Issue
Block a user