mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:13:21 +08:00
Merge pull request #11733 from peppy/update-resources
Update resources with new samples
This commit is contained in:
commit
be9f3c6a48
@ -51,7 +51,7 @@
|
||||
<Reference Include="Java.Interop" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1202.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.211.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.128.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -105,6 +105,15 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
checkDisplayedCount(3);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestError()
|
||||
{
|
||||
setState(Visibility.Visible);
|
||||
AddStep(@"error #1", sendErrorNotification);
|
||||
AddAssert("Is visible", () => notificationOverlay.State.Value == Visibility.Visible);
|
||||
checkDisplayedCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSpam()
|
||||
{
|
||||
@ -179,7 +188,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
private void sendBarrage()
|
||||
{
|
||||
switch (RNG.Next(0, 4))
|
||||
switch (RNG.Next(0, 5))
|
||||
{
|
||||
case 0:
|
||||
sendHelloNotification();
|
||||
@ -196,6 +205,10 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
case 3:
|
||||
sendDownloadProgress();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
sendErrorNotification();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,6 +227,11 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
notificationOverlay.Post(new BackgroundNotification { Text = @"Welcome to osu!. Enjoy your stay!" });
|
||||
}
|
||||
|
||||
private void sendErrorNotification()
|
||||
{
|
||||
notificationOverlay.Post(new SimpleErrorNotification { Text = @"Rut roh!. Something went wrong!" });
|
||||
}
|
||||
|
||||
private void sendManyNotifications()
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
|
@ -20,6 +20,8 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
private SampleChannel samplePopIn;
|
||||
private SampleChannel samplePopOut;
|
||||
protected virtual string PopInSampleName => "UI/overlay-pop-in";
|
||||
protected virtual string PopOutSampleName => "UI/overlay-pop-out";
|
||||
|
||||
protected override bool BlockNonPositionalInput => true;
|
||||
|
||||
@ -40,8 +42,8 @@ namespace osu.Game.Graphics.Containers
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
samplePopIn = audio.Samples.Get(@"UI/overlay-pop-in");
|
||||
samplePopOut = audio.Samples.Get(@"UI/overlay-pop-out");
|
||||
samplePopIn = audio.Samples.Get(PopInSampleName);
|
||||
samplePopOut = audio.Samples.Get(PopOutSampleName);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Framework.Utils;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
@ -47,15 +48,20 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
if (sampleHover == null)
|
||||
return false;
|
||||
|
||||
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= HoverDebounceTime;
|
||||
|
||||
if (enoughTimePassedSinceLastPlayback)
|
||||
{
|
||||
sampleHover?.Play();
|
||||
sampleHover.Frequency.Value = 0.96 + RNG.NextDouble(0.08);
|
||||
sampleHover.Play();
|
||||
|
||||
lastPlaybackTime.Value = Time.Current;
|
||||
}
|
||||
|
||||
return base.OnHover(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,6 +74,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Normal,
|
||||
|
||||
[Description("-softer")]
|
||||
Soft
|
||||
Soft,
|
||||
|
||||
[Description("-toolbar")]
|
||||
Toolbar
|
||||
}
|
||||
}
|
||||
|
@ -778,7 +778,7 @@ namespace osu.Game
|
||||
|
||||
if (recentLogCount < short_term_display_limit)
|
||||
{
|
||||
Schedule(() => notifications.Post(new SimpleNotification
|
||||
Schedule(() => notifications.Post(new SimpleErrorNotification
|
||||
{
|
||||
Icon = entry.Level == LogLevel.Important ? FontAwesome.Solid.ExclamationCircle : FontAwesome.Solid.Bomb,
|
||||
Text = entry.Message.Truncate(256) + (entry.Exception != null && IsDeployedBuild ? "\n\nThis error has been automatically reported to the devs." : string.Empty),
|
||||
|
@ -14,6 +14,9 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
private readonly Container dialogContainer;
|
||||
|
||||
protected override string PopInSampleName => "UI/dialog-pop-in";
|
||||
protected override string PopOutSampleName => "UI/dialog-pop-out";
|
||||
|
||||
public PopupDialog CurrentDialog { get; private set; }
|
||||
|
||||
public DialogOverlay()
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
@ -40,6 +42,11 @@ namespace osu.Game.Overlays.Notifications
|
||||
/// </summary>
|
||||
public virtual bool DisplayOnTop => true;
|
||||
|
||||
private SampleChannel samplePopIn;
|
||||
private SampleChannel samplePopOut;
|
||||
protected virtual string PopInSampleName => "UI/notification-pop-in";
|
||||
protected virtual string PopOutSampleName => "UI/overlay-pop-out"; // TODO: replace with a unique sample?
|
||||
|
||||
protected NotificationLight Light;
|
||||
private readonly CloseButton closeButton;
|
||||
protected Container IconContent;
|
||||
@ -107,7 +114,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
closeButton = new CloseButton
|
||||
{
|
||||
Alpha = 0,
|
||||
Action = Close,
|
||||
Action = () => Close(),
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Margin = new MarginPadding
|
||||
@ -120,6 +127,13 @@ namespace osu.Game.Overlays.Notifications
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
samplePopIn = audio.Samples.Get(PopInSampleName);
|
||||
samplePopOut = audio.Samples.Get(PopOutSampleName);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
closeButton.FadeIn(75);
|
||||
@ -143,6 +157,9 @@ namespace osu.Game.Overlays.Notifications
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
samplePopIn?.Play();
|
||||
|
||||
this.FadeInFromZero(200);
|
||||
NotificationContent.MoveToX(DrawSize.X);
|
||||
NotificationContent.MoveToX(0, 500, Easing.OutQuint);
|
||||
@ -150,12 +167,15 @@ namespace osu.Game.Overlays.Notifications
|
||||
|
||||
public bool WasClosed;
|
||||
|
||||
public virtual void Close()
|
||||
public virtual void Close(bool playSound = true)
|
||||
{
|
||||
if (WasClosed) return;
|
||||
|
||||
WasClosed = true;
|
||||
|
||||
if (playSound)
|
||||
samplePopOut?.Play();
|
||||
|
||||
Closed?.Invoke();
|
||||
this.FadeOut(100);
|
||||
Expire();
|
||||
|
@ -109,7 +109,12 @@ namespace osu.Game.Overlays.Notifications
|
||||
|
||||
private void clearAll()
|
||||
{
|
||||
notifications.Children.ForEach(c => c.Close());
|
||||
bool first = true;
|
||||
notifications.Children.ForEach(c =>
|
||||
{
|
||||
c.Close(first);
|
||||
first = false;
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -150,12 +150,12 @@ namespace osu.Game.Overlays.Notifications
|
||||
colourCancelled = colours.Red;
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
public override void Close(bool playSound = true)
|
||||
{
|
||||
switch (State)
|
||||
{
|
||||
case ProgressNotificationState.Cancelled:
|
||||
base.Close();
|
||||
base.Close(playSound);
|
||||
break;
|
||||
|
||||
case ProgressNotificationState.Active:
|
||||
|
17
osu.Game/Overlays/Notifications/SimpleErrorNotification.cs
Normal file
17
osu.Game/Overlays/Notifications/SimpleErrorNotification.cs
Normal file
@ -0,0 +1,17 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Notifications
|
||||
{
|
||||
public class SimpleErrorNotification : SimpleNotification
|
||||
{
|
||||
protected override string PopInSampleName => "UI/error-notification-pop-in";
|
||||
|
||||
public SimpleErrorNotification()
|
||||
{
|
||||
Icon = FontAwesome.Solid.Bomb;
|
||||
}
|
||||
}
|
||||
}
|
@ -51,6 +51,9 @@ namespace osu.Game.Overlays
|
||||
private Container dragContainer;
|
||||
private Container playerContainer;
|
||||
|
||||
protected override string PopInSampleName => "UI/now-playing-pop-in";
|
||||
protected override string PopOutSampleName => "UI/now-playing-pop-out";
|
||||
|
||||
/// <summary>
|
||||
/// Provide a source for the toolbar height.
|
||||
/// </summary>
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Configuration.Tracking;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -19,6 +21,13 @@ namespace osu.Game.Overlays.OSD
|
||||
{
|
||||
private const int lights_bottom_margin = 40;
|
||||
|
||||
private readonly int optionCount;
|
||||
private readonly int selectedOption = -1;
|
||||
|
||||
private SampleChannel sampleOn;
|
||||
private SampleChannel sampleOff;
|
||||
private SampleChannel sampleChange;
|
||||
|
||||
public TrackedSettingToast(SettingDescription description)
|
||||
: base(description.Name, description.Value, description.Shortcut)
|
||||
{
|
||||
@ -46,9 +55,6 @@ namespace osu.Game.Overlays.OSD
|
||||
}
|
||||
};
|
||||
|
||||
int optionCount = 0;
|
||||
int selectedOption = -1;
|
||||
|
||||
switch (description.RawValue)
|
||||
{
|
||||
case bool val:
|
||||
@ -69,6 +75,34 @@ namespace osu.Game.Overlays.OSD
|
||||
optionLights.Add(new OptionLight { Glowing = i == selectedOption });
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
if (optionCount == 1)
|
||||
{
|
||||
if (selectedOption == 0)
|
||||
sampleOn?.Play();
|
||||
else
|
||||
sampleOff?.Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sampleChange == null) return;
|
||||
|
||||
sampleChange.Frequency.Value = 1 + (double)selectedOption / (optionCount - 1) * 0.25f;
|
||||
sampleChange.Play();
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
sampleOn = audio.Samples.Get("UI/osd-on");
|
||||
sampleOff = audio.Samples.Get("UI/osd-off");
|
||||
sampleChange = audio.Samples.Get("UI/osd-change");
|
||||
}
|
||||
|
||||
private class OptionLight : Container
|
||||
{
|
||||
private Color4 glowingColour, idleColour;
|
||||
|
@ -40,6 +40,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
private SeekLimitedSearchTextBox searchTextBox;
|
||||
|
||||
protected override string PopInSampleName => "UI/settings-pop-in";
|
||||
|
||||
/// <summary>
|
||||
/// Provide a source for the toolbar height.
|
||||
/// </summary>
|
||||
|
@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
private KeyBindingStore keyBindings { get; set; }
|
||||
|
||||
protected ToolbarButton()
|
||||
: base(HoverSampleSet.Loud)
|
||||
: base(HoverSampleSet.Toolbar)
|
||||
{
|
||||
Width = Toolbar.HEIGHT;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
@ -18,6 +18,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override bool StartHidden => true;
|
||||
|
||||
protected override string PopInSampleName => "UI/wave-pop-in";
|
||||
|
||||
protected WaveOverlayContainer()
|
||||
{
|
||||
AddInternal(Waves = new WaveContainer
|
||||
|
@ -45,6 +45,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private SampleChannel sampleClick;
|
||||
private SampleChannel sampleBeat;
|
||||
private SampleChannel sampleDownbeat;
|
||||
|
||||
private readonly Container colourAndTriangles;
|
||||
private readonly Triangles triangles;
|
||||
@ -259,6 +260,7 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
sampleClick = audio.Samples.Get(@"Menu/osu-logo-select");
|
||||
sampleBeat = audio.Samples.Get(@"Menu/osu-logo-heartbeat");
|
||||
sampleDownbeat = audio.Samples.Get(@"Menu/osu-logo-downbeat");
|
||||
|
||||
logo.Texture = textures.Get(@"Menu/logo");
|
||||
ripple.Texture = textures.Get(@"Menu/logo");
|
||||
@ -281,7 +283,15 @@ namespace osu.Game.Screens.Menu
|
||||
if (beatIndex < 0) return;
|
||||
|
||||
if (IsHovered)
|
||||
this.Delay(early_activation).Schedule(() => sampleBeat.Play());
|
||||
{
|
||||
this.Delay(early_activation).Schedule(() =>
|
||||
{
|
||||
if (beatIndex % (int)timingPoint.TimeSignature == 0)
|
||||
sampleDownbeat.Play();
|
||||
else
|
||||
sampleBeat.Play();
|
||||
});
|
||||
}
|
||||
|
||||
logoBeatContainer
|
||||
.ScaleTo(1 - 0.02f * amplitudeAdjust, early_activation, Easing.Out).Then()
|
||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colours)
|
||||
{
|
||||
sampleHover = audio.Samples.Get($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}");
|
||||
sampleHover = audio.Samples.Get("SongSelect/song-ping");
|
||||
hoverLayer.Colour = colours.Blue.Opacity(0.1f);
|
||||
}
|
||||
|
||||
@ -99,7 +99,11 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
sampleHover?.Play();
|
||||
if (sampleHover != null)
|
||||
{
|
||||
sampleHover.Frequency.Value = 0.90 + RNG.NextDouble(0.2);
|
||||
sampleHover.Play();
|
||||
}
|
||||
|
||||
hoverLayer.FadeIn(100, Easing.OutQuint);
|
||||
return base.OnHover(e);
|
||||
|
@ -30,7 +30,7 @@
|
||||
<PackageReference Include="Microsoft.NETCore.Targets" Version="3.1.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.128.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1202.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.211.0" />
|
||||
<PackageReference Include="Sentry" Version="3.0.1" />
|
||||
<PackageReference Include="SharpCompress" Version="0.27.1" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
|
@ -71,7 +71,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.128.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1202.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.211.0" />
|
||||
</ItemGroup>
|
||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
||||
<PropertyGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user