1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 18:42:56 +08:00

Merge branch 'master' into tooltips

This commit is contained in:
Bartłomiej Dach 2024-07-12 11:01:03 +02:00 committed by GitHub
commit 5e00995948
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 36 additions and 78 deletions

View File

@ -838,18 +838,25 @@ namespace osu.Game.Tests.Visual.Navigation
[Test] [Test]
public void TestExitWithOperationInProgress() public void TestExitWithOperationInProgress()
{ {
AddUntilStep("wait for dialog overlay", () => Game.ChildrenOfType<DialogOverlay>().SingleOrDefault() != null); int x = 0;
AddUntilStep("wait for dialog overlay", () =>
{
x = 0;
return Game.ChildrenOfType<DialogOverlay>().SingleOrDefault() != null;
});
AddRepeatStep("start ongoing operation", () => AddRepeatStep("start ongoing operation", () =>
{ {
Game.Notifications.Post(new ProgressNotification Game.Notifications.Post(new ProgressNotification
{ {
Text = "Something is still running", Text = $"Something is still running #{++x}",
Progress = 0.5f, Progress = 0.5f,
State = ProgressNotificationState.Active, State = ProgressNotificationState.Active,
}); });
}, 15); }, 15);
AddAssert("all notifications = 15", () => Game.Notifications.AllNotifications.Count(), () => Is.EqualTo(15));
AddStep("Hold escape", () => InputManager.PressKey(Key.Escape)); AddStep("Hold escape", () => InputManager.PressKey(Key.Escape));
AddUntilStep("confirmation dialog shown", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog is ConfirmExitDialog); AddUntilStep("confirmation dialog shown", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog is ConfirmExitDialog);
AddStep("Release escape", () => InputManager.ReleaseKey(Key.Escape)); AddStep("Release escape", () => InputManager.ReleaseKey(Key.Escape));

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays
/// <summary> /// <summary>
/// All notifications currently being displayed by the toast tray. /// All notifications currently being displayed by the toast tray.
/// </summary> /// </summary>
public IEnumerable<Notification> Notifications => toastFlow; public IEnumerable<Notification> Notifications => toastFlow.Concat(InternalChildren.OfType<Notification>());
public bool IsDisplayingToasts => toastFlow.Count > 0; public bool IsDisplayingToasts => toastFlow.Count > 0;
@ -43,12 +43,7 @@ namespace osu.Game.Overlays
public Action<Notification>? ForwardNotificationToPermanentStore { get; set; } public Action<Notification>? ForwardNotificationToPermanentStore { get; set; }
public int UnreadCount => allDisplayedNotifications.Count(n => !n.WasClosed && !n.Read); public int UnreadCount => Notifications.Count(n => !n.WasClosed && !n.Read);
/// <summary>
/// Notifications contained in the toast flow, or in a detached state while they animate during forwarding to the main overlay.
/// </summary>
private IEnumerable<Notification> allDisplayedNotifications => toastFlow.Concat(InternalChildren.OfType<Notification>());
private int runningDepth; private int runningDepth;
@ -91,11 +86,7 @@ namespace osu.Game.Overlays
}; };
} }
public void MarkAllRead() public void MarkAllRead() => Notifications.ForEach(n => n.Read = true);
{
toastFlow.Children.ForEach(n => n.Read = true);
InternalChildren.OfType<Notification>().ForEach(n => n.Read = true);
}
public void FlushAllToasts() public void FlushAllToasts()
{ {

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Bindables; using osu.Framework.Bindables;
@ -19,7 +17,6 @@ using osu.Game.Input.Bindings;
using osu.Game.Overlays.Volume; using osu.Game.Overlays.Volume;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
using osuTK.Input;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -27,17 +24,17 @@ namespace osu.Game.Overlays
{ {
private const float offset = 10; private const float offset = 10;
private VolumeMeter volumeMeterMaster; private VolumeMeter volumeMeterMaster = null!;
private VolumeMeter volumeMeterEffect; private VolumeMeter volumeMeterEffect = null!;
private VolumeMeter volumeMeterMusic; private VolumeMeter volumeMeterMusic = null!;
private MuteButton muteButton; private MuteButton muteButton = null!;
private SelectionCycleFillFlowContainer<VolumeMeter> volumeMeters = null!;
private readonly BindableDouble muteAdjustment = new BindableDouble(); private readonly BindableDouble muteAdjustment = new BindableDouble();
public Bindable<bool> IsMuted { get; } = new Bindable<bool>(); public Bindable<bool> IsMuted { get; } = new Bindable<bool>();
private SelectionCycleFillFlowContainer<VolumeMeter> volumeMeters;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colours) private void load(AudioManager audio, OsuColour colours)
{ {
@ -140,8 +137,6 @@ namespace osu.Game.Overlays
return false; return false;
} }
private ScheduledDelegate popOutDelegate;
public void FocusMasterVolume() public void FocusMasterVolume()
{ {
volumeMeters.Select(volumeMeterMaster); volumeMeters.Select(volumeMeterMaster);
@ -179,30 +174,6 @@ namespace osu.Game.Overlays
return base.OnMouseMove(e); return base.OnMouseMove(e);
} }
protected override bool OnKeyDown(KeyDownEvent e)
{
switch (e.Key)
{
case Key.Left:
Adjust(GlobalAction.PreviousVolumeMeter);
return true;
case Key.Right:
Adjust(GlobalAction.NextVolumeMeter);
return true;
case Key.Down:
Adjust(GlobalAction.DecreaseVolume);
return true;
case Key.Up:
Adjust(GlobalAction.IncreaseVolume);
return true;
}
return base.OnKeyDown(e);
}
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
schedulePopOut(); schedulePopOut();
@ -215,6 +186,8 @@ namespace osu.Game.Overlays
base.OnHoverLost(e); base.OnHoverLost(e);
} }
private ScheduledDelegate? popOutDelegate;
private void schedulePopOut() private void schedulePopOut()
{ {
popOutDelegate?.Cancel(); popOutDelegate?.Cancel();

View File

@ -132,7 +132,7 @@ namespace osu.Game.Rulesets.Edit
InternalChildren = new[] InternalChildren = new[]
{ {
PlayfieldContentContainer = new ContentContainer PlayfieldContentContainer = new Container
{ {
Name = "Playfield content", Name = "Playfield content",
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
@ -269,6 +269,7 @@ namespace osu.Game.Rulesets.Edit
composerFocusMode.BindValueChanged(_ => composerFocusMode.BindValueChanged(_ =>
{ {
// Transforms should be kept in sync with other usages of composer focus mode.
if (!composerFocusMode.Value) if (!composerFocusMode.Value)
{ {
leftToolboxBackground.FadeIn(750, Easing.OutQuint); leftToolboxBackground.FadeIn(750, Easing.OutQuint);
@ -303,6 +304,8 @@ namespace osu.Game.Rulesets.Edit
PlayfieldContentContainer.Width = Math.Max(1024, DrawWidth) - (TOOLBOX_CONTRACTED_SIZE_LEFT + TOOLBOX_CONTRACTED_SIZE_RIGHT); PlayfieldContentContainer.Width = Math.Max(1024, DrawWidth) - (TOOLBOX_CONTRACTED_SIZE_LEFT + TOOLBOX_CONTRACTED_SIZE_RIGHT);
PlayfieldContentContainer.X = TOOLBOX_CONTRACTED_SIZE_LEFT; PlayfieldContentContainer.X = TOOLBOX_CONTRACTED_SIZE_LEFT;
} }
composerFocusMode.Value = PlayfieldContentContainer.Contains(InputManager.CurrentState.Mouse.Position);
} }
public override Playfield Playfield => drawableRulesetWrapper.Playfield; public override Playfield Playfield => drawableRulesetWrapper.Playfield;
@ -529,31 +532,6 @@ namespace osu.Game.Rulesets.Edit
} }
#endregion #endregion
private partial class ContentContainer : Container
{
public override bool HandlePositionalInput => true;
private readonly Bindable<bool> composerFocusMode = new Bindable<bool>();
[BackgroundDependencyLoader(true)]
private void load([CanBeNull] Editor editor)
{
if (editor != null)
composerFocusMode.BindTo(editor.ComposerFocusMode);
}
protected override bool OnHover(HoverEvent e)
{
composerFocusMode.Value = true;
return false;
}
protected override void OnHoverLost(HoverLostEvent e)
{
composerFocusMode.Value = false;
}
}
} }
/// <summary> /// <summary>

View File

@ -82,6 +82,7 @@ namespace osu.Game.Screens.Edit
saveInProgress.BindValueChanged(_ => TestGameplayButton.Enabled.Value = !saveInProgress.Value, true); saveInProgress.BindValueChanged(_ => TestGameplayButton.Enabled.Value = !saveInProgress.Value, true);
composerFocusMode.BindValueChanged(_ => composerFocusMode.BindValueChanged(_ =>
{ {
// Transforms should be kept in sync with other usages of composer focus mode.
foreach (var c in this.ChildrenOfType<BottomBarContainer>()) foreach (var c in this.ChildrenOfType<BottomBarContainer>())
{ {
if (!composerFocusMode.Value) if (!composerFocusMode.Value)

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Overlays; using osu.Game.Overlays;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Compose.Components.Timeline namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{ {
@ -40,7 +39,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = bar_width, Width = bar_width,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
Colour = ColourInfo.GradientVertical(colours.Colour2, Color4.Black), Colour = ColourInfo.GradientVertical(colours.Colour2.Opacity(0.6f), colours.Colour2.Opacity(0)),
}, },
new Triangle new Triangle
{ {

View File

@ -33,6 +33,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public DifficultyPointPiece(HitObject hitObject) public DifficultyPointPiece(HitObject hitObject)
{ {
HitObject = hitObject; HitObject = hitObject;
Y = -2.5f;
speedMultiplier = (hitObject as IHasSliderVelocity)?.SliderVelocityMultiplierBindable.GetBoundCopy(); speedMultiplier = (hitObject as IHasSliderVelocity)?.SliderVelocityMultiplierBindable.GetBoundCopy();
} }

View File

@ -35,6 +35,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public SamplePointPiece(HitObject hitObject) public SamplePointPiece(HitObject hitObject)
{ {
HitObject = hitObject; HitObject = hitObject;
Y = 2.5f;
} }
public bool AlternativeColor { get; init; } public bool AlternativeColor { get; init; }

View File

@ -134,6 +134,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
composerFocusMode.BindValueChanged(_ => composerFocusMode.BindValueChanged(_ =>
{ {
// Transforms should be kept in sync with other usages of composer focus mode.
if (!composerFocusMode.Value) if (!composerFocusMode.Value)
timelineBackground.FadeIn(750, Easing.OutQuint); timelineBackground.FadeIn(750, Easing.OutQuint);
else else

View File

@ -519,7 +519,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{ {
Type = EdgeEffectType.Shadow, Type = EdgeEffectType.Shadow,
Radius = 5, Radius = 5,
Colour = Color4.Black.Opacity(0.4f) Colour = Color4.Black.Opacity(0.05f)
} }
}; };
} }

View File

@ -218,6 +218,9 @@ namespace osu.Game.Screens.Edit
/// This controls the opacity of components like the timelines, sidebars, etc. /// This controls the opacity of components like the timelines, sidebars, etc.
/// In "composer focus" mode the opacity of the aforementioned components is reduced so that the user can focus on the composer better. /// In "composer focus" mode the opacity of the aforementioned components is reduced so that the user can focus on the composer better.
/// </summary> /// </summary>
/// <remarks>
/// The state of this bindable is controlled by <see cref="HitObjectComposer"/> when in <see cref="EditorScreenMode.Compose"/> mode.
/// </remarks>
public Bindable<bool> ComposerFocusMode { get; } = new Bindable<bool>(); public Bindable<bool> ComposerFocusMode { get; } = new Bindable<bool>();
public Editor(EditorLoader loader = null) public Editor(EditorLoader loader = null)
@ -1015,6 +1018,9 @@ namespace osu.Game.Screens.Edit
} }
finally finally
{ {
if (Mode.Value != EditorScreenMode.Compose)
ComposerFocusMode.Value = false;
updateSampleDisabledState(); updateSampleDisabledState();
rebindClipboardBindables(); rebindClipboardBindables();
} }