mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Merge remote-tracking branch 'origin/master' into fix-new-inspections
# Conflicts: # osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs # osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs # osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs # osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs # osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs # osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs # osu.Game/Graphics/OsuFont.cs # osu.Game/Online/API/Requests/Responses/APILegacyScoreInfo.cs # osu.Game/Overlays/Profile/Header/BadgeContainer.cs # osu.Game/Overlays/Profile/ProfileHeader.cs # osu.Game/Screens/Select/PlaySongSelect.cs # osu.Game/Skinning/LegacySkinDecoder.cs
This commit is contained in:
@ -9,6 +9,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -17,6 +18,7 @@ using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Input;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Online.API;
|
||||
@ -47,6 +49,10 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private OsuLogo logo;
|
||||
|
||||
/// <summary>
|
||||
/// Assign the <see cref="OsuLogo"/> that this ButtonSystem should manage the position of.
|
||||
/// </summary>
|
||||
/// <param name="logo">The instance of the logo to be assigned. If null, we are suspending from the screen that uses this ButtonSystem.</param>
|
||||
public void SetOsuLogo(OsuLogo logo)
|
||||
{
|
||||
this.logo = logo;
|
||||
@ -60,9 +66,13 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
updateLogoState();
|
||||
}
|
||||
else
|
||||
{
|
||||
// We should stop tracking as the facade is now out of scope.
|
||||
logoTrackingContainer.StopTracking();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Drawable iconFacade;
|
||||
private readonly ButtonArea buttonArea;
|
||||
|
||||
private readonly Button backButton;
|
||||
@ -72,26 +82,29 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private SampleChannel sampleBack;
|
||||
|
||||
private readonly LogoTrackingContainer logoTrackingContainer;
|
||||
|
||||
public ButtonSystem()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
Child = buttonArea = new ButtonArea();
|
||||
|
||||
buttonArea.AddRange(new[]
|
||||
Child = logoTrackingContainer = new LogoTrackingContainer
|
||||
{
|
||||
new Button(@"settings", string.Empty, FontAwesome.Gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = buttonArea = new ButtonArea()
|
||||
};
|
||||
|
||||
buttonArea.AddRange(new Drawable[]
|
||||
{
|
||||
new Button(@"settings", string.Empty, FontAwesome.Solid.Cog, 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,
|
||||
},
|
||||
iconFacade = new Container //need a container to make the osu! icon flow properly.
|
||||
{
|
||||
Size = new Vector2(0, ButtonArea.BUTTON_AREA_HEIGHT)
|
||||
}
|
||||
logoTrackingContainer.LogoFacade.With(d => d.Scale = new Vector2(0.74f))
|
||||
});
|
||||
|
||||
buttonArea.Flow.CentreTarget = iconFacade;
|
||||
buttonArea.Flow.CentreTarget = logoTrackingContainer.LogoFacade;
|
||||
}
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
@ -103,11 +116,14 @@ namespace osu.Game.Screens.Menu
|
||||
[Resolved(CanBeNull = true)]
|
||||
private NotificationOverlay notifications { get; set; }
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private LoginOverlay loginOverlay { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(AudioManager audio, IdleTracker idleTracker, GameHost host)
|
||||
{
|
||||
buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.User, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
|
||||
buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.Users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M));
|
||||
buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.Solid.User, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
|
||||
buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.Solid.Users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M));
|
||||
buttonsPlay.Add(new Button(@"chart", @"button-generic-select", OsuIcon.Charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke()));
|
||||
buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play);
|
||||
|
||||
@ -121,6 +137,15 @@ namespace osu.Game.Screens.Menu
|
||||
buttonArea.AddRange(buttonsPlay);
|
||||
buttonArea.AddRange(buttonsTopLevel);
|
||||
|
||||
buttonArea.ForEach(b =>
|
||||
{
|
||||
if (b is Button)
|
||||
{
|
||||
b.Origin = Anchor.CentreLeft;
|
||||
b.Anchor = Anchor.CentreLeft;
|
||||
}
|
||||
});
|
||||
|
||||
isIdle.ValueChanged += idle => updateIdleState(idle.NewValue);
|
||||
|
||||
if (idleTracker != null) isIdle.BindTo(idleTracker.IsIdle);
|
||||
@ -135,7 +160,12 @@ namespace osu.Game.Screens.Menu
|
||||
notifications?.Post(new SimpleNotification
|
||||
{
|
||||
Text = "You gotta be logged in to multi 'yo!",
|
||||
Icon = FontAwesome.Globe
|
||||
Icon = FontAwesome.Solid.Globe,
|
||||
Activated = () =>
|
||||
{
|
||||
loginOverlay?.Show();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
@ -255,13 +285,11 @@ namespace osu.Game.Screens.Menu
|
||||
logoDelayedAction?.Cancel();
|
||||
logoDelayedAction = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
logoTracking = false;
|
||||
logoTrackingContainer.StopTracking();
|
||||
|
||||
game?.Toolbar.Hide();
|
||||
|
||||
logo.ClearTransforms(targetMember: nameof(Position));
|
||||
logo.RelativePositionAxes = Axes.Both;
|
||||
|
||||
logo.MoveTo(new Vector2(0.5f), 800, Easing.OutExpo);
|
||||
logo.ScaleTo(1, 800, Easing.OutExpo);
|
||||
}, buttonArea.Alpha * 150);
|
||||
@ -276,20 +304,17 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
case ButtonSystemState.Initial:
|
||||
logo.ClearTransforms(targetMember: nameof(Position));
|
||||
logo.RelativePositionAxes = Axes.None;
|
||||
|
||||
bool impact = logo.Scale.X > 0.6f;
|
||||
|
||||
if (lastState == ButtonSystemState.Initial)
|
||||
logo.ScaleTo(0.5f, 200, Easing.In);
|
||||
|
||||
logo.MoveTo(logoTrackingPosition, lastState == ButtonSystemState.EnteringMode ? 0 : 200, Easing.In);
|
||||
logoTrackingContainer.StartTracking(logo, lastState == ButtonSystemState.EnteringMode ? 0 : 200, Easing.In);
|
||||
|
||||
logoDelayedAction?.Cancel();
|
||||
logoDelayedAction = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
logoTracking = true;
|
||||
|
||||
if (impact)
|
||||
logo.Impact();
|
||||
|
||||
@ -299,8 +324,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
default:
|
||||
logo.ClearTransforms(targetMember: nameof(Position));
|
||||
logo.RelativePositionAxes = Axes.None;
|
||||
logoTracking = true;
|
||||
logoTrackingContainer.StartTracking(logo, 0, Easing.In);
|
||||
logo.ScaleTo(0.5f, 200, Easing.OutQuint);
|
||||
break;
|
||||
}
|
||||
@ -308,27 +332,10 @@ namespace osu.Game.Screens.Menu
|
||||
break;
|
||||
|
||||
case ButtonSystemState.EnteringMode:
|
||||
logoTracking = true;
|
||||
logoTrackingContainer.StartTracking(logo, 0, Easing.In);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private Vector2 logoTrackingPosition => logo.Parent.ToLocalSpace(iconFacade.ScreenSpaceDrawQuad.Centre);
|
||||
|
||||
private bool logoTracking;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (logo != null)
|
||||
{
|
||||
if (logoTracking && logo.RelativePositionAxes == Axes.None && iconFacade.IsLoaded)
|
||||
logo.Position = logoTrackingPosition;
|
||||
|
||||
iconFacade.Width = logo.SizeForFlow * 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ButtonSystemState
|
||||
|
Reference in New Issue
Block a user