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

Merge branch 'map_info_on_mod_settings' of https://github.com/Givikap120/osu into map_info_on_mod_settings

This commit is contained in:
Givikap120 2023-09-03 02:09:18 +03:00
commit 2e2d4d0d60
18 changed files with 91 additions and 15 deletions

View File

@ -50,7 +50,7 @@ Please make sure you have the following prerequisites:
- A desktop platform with the [.NET 6.0 SDK](https://dotnet.microsoft.com/download) installed. - A desktop platform with the [.NET 6.0 SDK](https://dotnet.microsoft.com/download) installed.
When working with the codebase, we recommend using an IDE with intelligent code completion and syntax highlighting, such as the latest version of [Visual Studio](https://visualstudio.microsoft.com/vs/), [JetBrains Rider](https://www.jetbrains.com/rider/) or [Visual Studio Code](https://code.visualstudio.com/). When working with the codebase, we recommend using an IDE with intelligent code completion and syntax highlighting, such as the latest version of [Visual Studio](https://visualstudio.microsoft.com/vs/), [JetBrains Rider](https://www.jetbrains.com/rider/), or [Visual Studio Code](https://code.visualstudio.com/) with the [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) and [C#](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) plugin installed.
### Downloading the source code ### Downloading the source code

View File

@ -23,6 +23,9 @@ namespace osu.Game.Collections
private AudioFilter lowPassFilter = null!; private AudioFilter lowPassFilter = null!;
protected override string PopInSampleName => @"UI/overlay-big-pop-in";
protected override string PopOutSampleName => @"UI/overlay-big-pop-out";
public ManageCollectionsDialog() public ManageCollectionsDialog()
{ {
Anchor = Anchor.Centre; Anchor = Anchor.Centre;

View File

@ -24,6 +24,7 @@ namespace osu.Game.Graphics.Containers
private Sample samplePopOut; private Sample samplePopOut;
protected virtual string PopInSampleName => "UI/overlay-pop-in"; protected virtual string PopInSampleName => "UI/overlay-pop-in";
protected virtual string PopOutSampleName => "UI/overlay-pop-out"; protected virtual string PopOutSampleName => "UI/overlay-pop-out";
protected virtual double PopInOutSampleBalance => 0;
protected override bool BlockNonPositionalInput => true; protected override bool BlockNonPositionalInput => true;
@ -133,15 +134,21 @@ namespace osu.Game.Graphics.Containers
return; return;
} }
if (didChange) if (didChange && samplePopIn != null)
samplePopIn?.Play(); {
samplePopIn.Balance.Value = PopInOutSampleBalance;
samplePopIn.Play();
}
if (BlockScreenWideMouse && DimMainContent) overlayManager?.ShowBlockingOverlay(this); if (BlockScreenWideMouse && DimMainContent) overlayManager?.ShowBlockingOverlay(this);
break; break;
case Visibility.Hidden: case Visibility.Hidden:
if (didChange) if (didChange && samplePopOut != null)
samplePopOut?.Play(); {
samplePopOut.Balance.Value = PopInOutSampleBalance;
samplePopOut.Play();
}
if (BlockScreenWideMouse) overlayManager?.HideBlockingOverlay(this); if (BlockScreenWideMouse) overlayManager?.HideBlockingOverlay(this);
break; break;

View File

@ -2,6 +2,9 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -32,6 +35,12 @@ namespace osu.Game.Graphics.Containers
protected override bool StartHidden => true; protected override bool StartHidden => true;
private Sample? samplePopIn;
private Sample? samplePopOut;
// required due to LoadAsyncComplete() in `VisibilityContainer` calling PopOut() during load - similar workaround to `OsuDropdownMenu`
private bool wasShown;
public Color4 FirstWaveColour public Color4 FirstWaveColour
{ {
get => firstWave.Colour; get => firstWave.Colour;
@ -56,6 +65,13 @@ namespace osu.Game.Graphics.Containers
set => fourthWave.Colour = value; set => fourthWave.Colour = value;
} }
[BackgroundDependencyLoader(true)]
private void load(AudioManager audio)
{
samplePopIn = audio.Samples.Get("UI/wave-pop-in");
samplePopOut = audio.Samples.Get("UI/overlay-big-pop-out");
}
public WaveContainer() public WaveContainer()
{ {
Masking = true; Masking = true;
@ -110,6 +126,8 @@ namespace osu.Game.Graphics.Containers
w.Show(); w.Show();
contentContainer.MoveToY(0, APPEAR_DURATION, Easing.OutQuint); contentContainer.MoveToY(0, APPEAR_DURATION, Easing.OutQuint);
samplePopIn?.Play();
wasShown = true;
} }
protected override void PopOut() protected override void PopOut()
@ -118,6 +136,9 @@ namespace osu.Game.Graphics.Containers
w.Hide(); w.Hide();
contentContainer.MoveToY(2, DISAPPEAR_DURATION, Easing.In); contentContainer.MoveToY(2, DISAPPEAR_DURATION, Easing.In);
if (wasShown)
samplePopOut?.Play();
} }
protected override void UpdateAfterChildren() protected override void UpdateAfterChildren()

View File

@ -46,8 +46,8 @@ namespace osu.Game.Graphics.UserInterface
private readonly Container content; private readonly Container content;
private readonly Box hover; private readonly Box hover;
public OsuAnimatedButton() public OsuAnimatedButton(HoverSampleSet sampleSet = HoverSampleSet.Button)
: base(HoverSampleSet.Button) : base(sampleSet)
{ {
base.Content.Add(content = new Container base.Content.Add(content = new Container
{ {

View File

@ -14,6 +14,12 @@ namespace osu.Game.Graphics.UserInterface
private Sample? sampleOff; private Sample? sampleOff;
private Sample? sampleOn; private Sample? sampleOn;
/// <summary>
/// Sheared toggle buttons by default play two samples when toggled: a click and a toggle (on/off).
/// Sometimes this might be too much. Setting this to <c>false</c> will silence the toggle sound.
/// </summary>
protected virtual bool PlayToggleSamples => true;
/// <summary> /// <summary>
/// Whether this button is currently toggled to an active state. /// Whether this button is currently toggled to an active state.
/// </summary> /// </summary>
@ -68,10 +74,13 @@ namespace osu.Game.Graphics.UserInterface
{ {
sampleClick?.Play(); sampleClick?.Play();
if (Active.Value) if (PlayToggleSamples)
sampleOn?.Play(); {
else if (Active.Value)
sampleOff?.Play(); sampleOn?.Play();
else
sampleOff?.Play();
}
} }
} }
} }

View File

@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions; using osu.Framework.Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -21,6 +23,14 @@ namespace osu.Game.Graphics.UserInterfaceV2
private const float fade_duration = 250; private const float fade_duration = 250;
private const double scale_duration = 500; private const double scale_duration = 500;
private Sample? samplePopIn;
private Sample? samplePopOut;
protected virtual string PopInSampleName => "UI/overlay-pop-in";
protected virtual string PopOutSampleName => "UI/overlay-pop-out";
// required due to LoadAsyncComplete() in `VisibilityContainer` calling PopOut() during load - similar workaround to `OsuDropdownMenu`
private bool wasOpened;
public OsuPopover(bool withPadding = true) public OsuPopover(bool withPadding = true)
{ {
Content.Padding = withPadding ? new MarginPadding(20) : new MarginPadding(); Content.Padding = withPadding ? new MarginPadding(20) : new MarginPadding();
@ -38,9 +48,11 @@ namespace osu.Game.Graphics.UserInterfaceV2
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(OverlayColourProvider? colourProvider, OsuColour colours) private void load(OverlayColourProvider? colourProvider, OsuColour colours, AudioManager audio)
{ {
Background.Colour = Arrow.Colour = colourProvider?.Background4 ?? colours.GreySeaFoamDarker; Background.Colour = Arrow.Colour = colourProvider?.Background4 ?? colours.GreySeaFoamDarker;
samplePopIn = audio.Samples.Get(PopInSampleName);
samplePopOut = audio.Samples.Get(PopOutSampleName);
} }
protected override Drawable CreateArrow() => Empty(); protected override Drawable CreateArrow() => Empty();
@ -49,12 +61,18 @@ namespace osu.Game.Graphics.UserInterfaceV2
{ {
this.ScaleTo(1, scale_duration, Easing.OutElasticHalf); this.ScaleTo(1, scale_duration, Easing.OutElasticHalf);
this.FadeIn(fade_duration, Easing.OutQuint); this.FadeIn(fade_duration, Easing.OutQuint);
samplePopIn?.Play();
wasOpened = true;
} }
protected override void PopOut() protected override void PopOut()
{ {
this.ScaleTo(0.7f, scale_duration, Easing.OutQuint); this.ScaleTo(0.7f, scale_duration, Easing.OutQuint);
this.FadeOut(fade_duration, Easing.OutQuint); this.FadeOut(fade_duration, Easing.OutQuint);
if (wasOpened)
samplePopOut?.Play();
} }
protected override bool OnKeyDown(KeyDownEvent e) protected override bool OnKeyDown(KeyDownEvent e)

View File

@ -55,6 +55,9 @@ namespace osu.Game.Overlays
private const float side_bar_width = 190; private const float side_bar_width = 190;
private const float chat_bar_height = 60; private const float chat_bar_height = 60;
protected override string PopInSampleName => @"UI/overlay-big-pop-in";
protected override string PopOutSampleName => @"UI/overlay-big-pop-out";
[Resolved] [Resolved]
private OsuConfigManager config { get; set; } = null!; private OsuConfigManager config { get; set; } = null!;

View File

@ -20,6 +20,8 @@ namespace osu.Game.Overlays
private const float transition_time = 400; private const float transition_time = 400;
protected override double PopInOutSampleBalance => OsuGameBase.SFX_STEREO_STRENGTH;
[Cached] [Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);

View File

@ -18,6 +18,8 @@ namespace osu.Game.Overlays.Mods
{ {
public partial class AddPresetButton : ShearedToggleButton, IHasPopover public partial class AddPresetButton : ShearedToggleButton, IHasPopover
{ {
protected override bool PlayToggleSamples => false;
[Resolved] [Resolved]
private OsuColour colours { get; set; } = null!; private OsuColour colours { get; set; } = null!;

View File

@ -31,6 +31,8 @@ namespace osu.Game.Overlays
public LocalisableString Title => NotificationsStrings.HeaderTitle; public LocalisableString Title => NotificationsStrings.HeaderTitle;
public LocalisableString Description => NotificationsStrings.HeaderDescription; public LocalisableString Description => NotificationsStrings.HeaderDescription;
protected override double PopInOutSampleBalance => OsuGameBase.SFX_STEREO_STRENGTH;
public const float WIDTH = 320; public const float WIDTH = 320;
public const float TRANSITION_LENGTH = 600; public const float TRANSITION_LENGTH = 600;

View File

@ -56,6 +56,7 @@ namespace osu.Game.Overlays
private SeekLimitedSearchTextBox searchTextBox; private SeekLimitedSearchTextBox searchTextBox;
protected override string PopInSampleName => "UI/settings-pop-in"; protected override string PopInSampleName => "UI/settings-pop-in";
protected override double PopInOutSampleBalance => -OsuGameBase.SFX_STEREO_STRENGTH;
private readonly bool showSidebar; private readonly bool showSidebar;

View File

@ -18,7 +18,9 @@ namespace osu.Game.Overlays
protected override bool StartHidden => true; protected override bool StartHidden => true;
protected override string PopInSampleName => "UI/wave-pop-in"; // `WaveContainer` plays PopIn/PopOut samples, so we disable the overlay-level one as to not double-up sample playback.
protected override string PopInSampleName => string.Empty;
protected override string PopOutSampleName => string.Empty;
public const float HORIZONTAL_PADDING = 50; public const float HORIZONTAL_PADDING = 50;

View File

@ -262,6 +262,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
private readonly OsuSpriteText divisorText; private readonly OsuSpriteText divisorText;
public DivisorDisplay() public DivisorDisplay()
: base(HoverSampleSet.Default)
{ {
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;

View File

@ -114,6 +114,9 @@ namespace osu.Game.Screens.Edit.Setup
private partial class FileChooserPopover : OsuPopover private partial class FileChooserPopover : OsuPopover
{ {
protected override string PopInSampleName => "UI/overlay-big-pop-in";
protected override string PopOutSampleName => "UI/overlay-big-pop-out";
public FileChooserPopover(string[] handledExtensions, Bindable<FileInfo?> currentFile, string? chooserPath) public FileChooserPopover(string[] handledExtensions, Bindable<FileInfo?> currentFile, string? chooserPath)
{ {
Child = new Container Child = new Container

View File

@ -170,7 +170,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
if (Room.HasPassword.Value) if (Room.HasPassword.Value)
{ {
sampleJoin?.Play();
this.ShowPopover(); this.ShowPopover();
return true; return true;
} }

View File

@ -32,6 +32,9 @@ namespace osu.Game.Screens.Select.Options
public override bool BlockScreenWideMouse => false; public override bool BlockScreenWideMouse => false;
protected override string PopInSampleName => "SongSelect/options-pop-in";
protected override string PopOutSampleName => "SongSelect/options-pop-out";
public BeatmapOptionsOverlay() public BeatmapOptionsOverlay()
{ {
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;

View File

@ -170,7 +170,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantUsingDirective/@EntryIndexedValue">ERROR</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantUsingDirective/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantStringInterpolation/@EntryIndexedValue">WARNING</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantStringInterpolation/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantVerbatimPrefix/@EntryIndexedValue">WARNING</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantVerbatimPrefix/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantVerbatimStringPrefix/@EntryIndexedValue">HINT</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantVerbatimStringPrefix/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RemoveRedundantOrStatement_002EFalse/@EntryIndexedValue">WARNING</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RemoveRedundantOrStatement_002EFalse/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RemoveRedundantOrStatement_002ETrue/@EntryIndexedValue">WARNING</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RemoveRedundantOrStatement_002ETrue/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RemoveToList_002E1/@EntryIndexedValue">WARNING</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RemoveToList_002E1/@EntryIndexedValue">WARNING</s:String>