1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 09:32:55 +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]
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", () =>
{
Game.Notifications.Post(new ProgressNotification
{
Text = "Something is still running",
Text = $"Something is still running #{++x}",
Progress = 0.5f,
State = ProgressNotificationState.Active,
});
}, 15);
AddAssert("all notifications = 15", () => Game.Notifications.AllNotifications.Count(), () => Is.EqualTo(15));
AddStep("Hold escape", () => InputManager.PressKey(Key.Escape));
AddUntilStep("confirmation dialog shown", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog is ConfirmExitDialog);
AddStep("Release escape", () => InputManager.ReleaseKey(Key.Escape));

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays
/// <summary>
/// All notifications currently being displayed by the toast tray.
/// </summary>
public IEnumerable<Notification> Notifications => toastFlow;
public IEnumerable<Notification> Notifications => toastFlow.Concat(InternalChildren.OfType<Notification>());
public bool IsDisplayingToasts => toastFlow.Count > 0;
@ -43,12 +43,7 @@ namespace osu.Game.Overlays
public Action<Notification>? ForwardNotificationToPermanentStore { get; set; }
public int UnreadCount => allDisplayedNotifications.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>());
public int UnreadCount => Notifications.Count(n => !n.WasClosed && !n.Read);
private int runningDepth;
@ -91,11 +86,7 @@ namespace osu.Game.Overlays
};
}
public void MarkAllRead()
{
toastFlow.Children.ForEach(n => n.Read = true);
InternalChildren.OfType<Notification>().ForEach(n => n.Read = true);
}
public void MarkAllRead() => Notifications.ForEach(n => n.Read = true);
public void FlushAllToasts()
{

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Bindables;
@ -19,7 +17,6 @@ using osu.Game.Input.Bindings;
using osu.Game.Overlays.Volume;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
namespace osu.Game.Overlays
{
@ -27,17 +24,17 @@ namespace osu.Game.Overlays
{
private const float offset = 10;
private VolumeMeter volumeMeterMaster;
private VolumeMeter volumeMeterEffect;
private VolumeMeter volumeMeterMusic;
private MuteButton muteButton;
private VolumeMeter volumeMeterMaster = null!;
private VolumeMeter volumeMeterEffect = null!;
private VolumeMeter volumeMeterMusic = null!;
private MuteButton muteButton = null!;
private SelectionCycleFillFlowContainer<VolumeMeter> volumeMeters = null!;
private readonly BindableDouble muteAdjustment = new BindableDouble();
public Bindable<bool> IsMuted { get; } = new Bindable<bool>();
private SelectionCycleFillFlowContainer<VolumeMeter> volumeMeters;
[BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colours)
{
@ -140,8 +137,6 @@ namespace osu.Game.Overlays
return false;
}
private ScheduledDelegate popOutDelegate;
public void FocusMasterVolume()
{
volumeMeters.Select(volumeMeterMaster);
@ -179,30 +174,6 @@ namespace osu.Game.Overlays
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)
{
schedulePopOut();
@ -215,6 +186,8 @@ namespace osu.Game.Overlays
base.OnHoverLost(e);
}
private ScheduledDelegate? popOutDelegate;
private void schedulePopOut()
{
popOutDelegate?.Cancel();

View File

@ -132,7 +132,7 @@ namespace osu.Game.Rulesets.Edit
InternalChildren = new[]
{
PlayfieldContentContainer = new ContentContainer
PlayfieldContentContainer = new Container
{
Name = "Playfield content",
RelativeSizeAxes = Axes.Y,
@ -269,6 +269,7 @@ namespace osu.Game.Rulesets.Edit
composerFocusMode.BindValueChanged(_ =>
{
// Transforms should be kept in sync with other usages of composer focus mode.
if (!composerFocusMode.Value)
{
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.X = TOOLBOX_CONTRACTED_SIZE_LEFT;
}
composerFocusMode.Value = PlayfieldContentContainer.Contains(InputManager.CurrentState.Mouse.Position);
}
public override Playfield Playfield => drawableRulesetWrapper.Playfield;
@ -529,31 +532,6 @@ namespace osu.Game.Rulesets.Edit
}
#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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -519,7 +519,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
Type = EdgeEffectType.Shadow,
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.
/// In "composer focus" mode the opacity of the aforementioned components is reduced so that the user can focus on the composer better.
/// </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 Editor(EditorLoader loader = null)
@ -1015,6 +1018,9 @@ namespace osu.Game.Screens.Edit
}
finally
{
if (Mode.Value != EditorScreenMode.Compose)
ComposerFocusMode.Value = false;
updateSampleDisabledState();
rebindClipboardBindables();
}