1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Merge branch 'master' into verify-check-incorrect-audio-formats

This commit is contained in:
Bartłomiej Dach 2024-04-22 10:34:14 +02:00
commit 78f97d0ec7
No known key found for this signature in database
50 changed files with 504 additions and 165 deletions

View File

@ -10,7 +10,7 @@
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.329.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.419.0" />
</ItemGroup>
<PropertyGroup>
<!-- Fody does not handle Android build well, and warns when unchanged.

View File

@ -6,7 +6,6 @@ using System.Text;
using DiscordRPC;
using DiscordRPC.Message;
using Newtonsoft.Json;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
@ -80,14 +79,20 @@ namespace osu.Desktop
client.OnReady += onReady;
client.OnError += (_, e) => Logger.Log($"An error occurred with Discord RPC Client: {e.Message} ({e.Code})", LoggingTarget.Network, LogLevel.Error);
// A URI scheme is required to support game invitations, as well as informing Discord of the game executable path to support launching the game when a user clicks on join/spectate.
// The library doesn't properly support URI registration when ran from an app bundle on macOS.
if (!RuntimeInfo.IsApple)
try
{
client.RegisterUriScheme();
client.Subscribe(EventType.Join);
client.OnJoin += onJoin;
}
catch (Exception ex)
{
// This is known to fail in at least the following sandboxed environments:
// - macOS (when packaged as an app bundle)
// - flatpak (see: https://github.com/flathub/sh.ppy.osu/issues/170)
// There is currently no better way to do this offered by Discord, so the best we can do is simply ignore it for now.
Logger.Log($"Failed to register Discord URI scheme: {ex}");
}
client.Initialize();
}

View File

@ -22,7 +22,7 @@ using osu.Game.IPC;
using osu.Game.Online.Multiplayer;
using osu.Game.Performance;
using osu.Game.Utils;
using SDL2;
using SDL;
namespace osu.Desktop
{
@ -161,7 +161,7 @@ namespace osu.Desktop
host.Window.Title = Name;
}
protected override BatteryInfo CreateBatteryInfo() => new SDL2BatteryInfo();
protected override BatteryInfo CreateBatteryInfo() => new SDL3BatteryInfo();
protected override void Dispose(bool isDisposing)
{
@ -170,13 +170,14 @@ namespace osu.Desktop
archiveImportIPCChannel?.Dispose();
}
private class SDL2BatteryInfo : BatteryInfo
private unsafe class SDL3BatteryInfo : BatteryInfo
{
public override double? ChargeLevel
{
get
{
SDL.SDL_GetPowerInfo(out _, out int percentage);
int percentage;
SDL3.SDL_GetPowerInfo(null, &percentage);
if (percentage == -1)
return null;
@ -185,7 +186,7 @@ namespace osu.Desktop
}
}
public override bool OnBattery => SDL.SDL_GetPowerInfo(out _, out _) == SDL.SDL_PowerState.SDL_POWERSTATE_ON_BATTERY;
public override bool OnBattery => SDL3.SDL_GetPowerInfo(null, null) == SDL_PowerState.SDL_POWERSTATE_ON_BATTERY;
}
}
}

View File

@ -3,6 +3,7 @@
using System;
using System.Runtime;
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Logging;
using osu.Game.Performance;
@ -11,16 +12,26 @@ namespace osu.Desktop.Performance
{
public class HighPerformanceSessionManager : IHighPerformanceSessionManager
{
public bool IsSessionActive => activeSessions > 0;
private int activeSessions;
private GCLatencyMode originalGCMode;
public IDisposable BeginSession()
{
enableHighPerformanceSession();
return new InvokeOnDisposal<HighPerformanceSessionManager>(this, static m => m.disableHighPerformanceSession());
enterSession();
return new InvokeOnDisposal<HighPerformanceSessionManager>(this, static m => m.exitSession());
}
private void enableHighPerformanceSession()
private void enterSession()
{
if (Interlocked.Increment(ref activeSessions) > 1)
{
Logger.Log($"High performance session requested ({activeSessions} running in total)");
return;
}
Logger.Log("Starting high performance session");
originalGCMode = GCSettings.LatencyMode;
@ -30,8 +41,14 @@ namespace osu.Desktop.Performance
GC.Collect(0);
}
private void disableHighPerformanceSession()
private void exitSession()
{
if (Interlocked.Decrement(ref activeSessions) > 0)
{
Logger.Log($"High performance session finished ({activeSessions} others remain)");
return;
}
Logger.Log("Ending high performance session");
if (GCSettings.LatencyMode == GCLatencyMode.LowLatency)

View File

@ -13,7 +13,7 @@ using osu.Framework.Platform;
using osu.Game;
using osu.Game.IPC;
using osu.Game.Tournament;
using SDL2;
using SDL;
using Squirrel;
namespace osu.Desktop
@ -52,16 +52,19 @@ namespace osu.Desktop
// See https://www.mongodb.com/docs/realm/sdk/dotnet/compatibility/
if (windowsVersion.Major < 6 || (windowsVersion.Major == 6 && windowsVersion.Minor <= 2))
{
// If users running in compatibility mode becomes more of a common thing, we may want to provide better guidance or even consider
// disabling it ourselves.
// We could also better detect compatibility mode if required:
// https://stackoverflow.com/questions/10744651/how-i-can-detect-if-my-application-is-running-under-compatibility-mode#comment58183249_10744730
SDL.SDL_ShowSimpleMessageBox(SDL.SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR,
"Your operating system is too old to run osu!",
"This version of osu! requires at least Windows 8.1 to run.\n"
+ "Please upgrade your operating system or consider using an older version of osu!.\n\n"
+ "If you are running a newer version of windows, please check you don't have \"Compatibility mode\" turned on for osu!", IntPtr.Zero);
return;
unsafe
{
// If users running in compatibility mode becomes more of a common thing, we may want to provide better guidance or even consider
// disabling it ourselves.
// We could also better detect compatibility mode if required:
// https://stackoverflow.com/questions/10744651/how-i-can-detect-if-my-application-is-running-under-compatibility-mode#comment58183249_10744730
SDL3.SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR,
"Your operating system is too old to run osu!"u8,
"This version of osu! requires at least Windows 8.1 to run.\n"u8
+ "Please upgrade your operating system or consider using an older version of osu!.\n\n"u8
+ "If you are running a newer version of windows, please check you don't have \"Compatibility mode\" turned on for osu!"u8, null);
return;
}
}
setupSquirrel();

View File

@ -11,9 +11,5 @@ namespace osu.Game.Rulesets.Catch
: base(component)
{
}
protected override string RulesetPrefix => "catch"; // todo: use CatchRuleset.SHORT_NAME;
protected override string ComponentName => Component.ToString().ToLowerInvariant();
}
}

View File

@ -1,9 +1,14 @@
// 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 System.Collections.Generic;
using System.Linq;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Filter;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring.Legacy;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
@ -30,5 +35,20 @@ namespace osu.Game.Rulesets.Mania
return false;
}
public bool FilterMayChangeFromMods(ValueChangedEvent<IReadOnlyList<Mod>> mods)
{
if (keys.HasFilter)
{
// Interpreting as the Mod type is required for equality comparison.
HashSet<Mod> oldSet = mods.OldValue.OfType<ManiaKeyMod>().AsEnumerable<Mod>().ToHashSet();
HashSet<Mod> newSet = mods.NewValue.OfType<ManiaKeyMod>().AsEnumerable<Mod>().ToHashSet();
if (!oldSet.SetEquals(newSet))
return true;
}
return false;
}
}
}

View File

@ -15,10 +15,6 @@ namespace osu.Game.Rulesets.Mania
: base(component)
{
}
protected override string RulesetPrefix => ManiaRuleset.SHORT_NAME;
protected override string ComponentName => Component.ToString().ToLowerInvariant();
}
public enum ManiaSkinComponents

View File

@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio.Sample;
@ -13,6 +14,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Rendering;
using osu.Framework.Graphics.Textures;
using osu.Framework.Testing;
using osu.Framework.Testing.Input;
using osu.Game.Audio;
using osu.Game.Rulesets.Osu.Skinning.Legacy;
@ -47,7 +49,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
createTest(() =>
{
var skinContainer = new LegacySkinContainer(renderer, false);
var skinContainer = new LegacySkinContainer(renderer, provideMiddle: false);
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
skinContainer.Child = legacyCursorTrail;
@ -61,7 +63,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
createTest(() =>
{
var skinContainer = new LegacySkinContainer(renderer, true);
var skinContainer = new LegacySkinContainer(renderer, provideMiddle: true);
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
skinContainer.Child = legacyCursorTrail;
@ -70,6 +72,22 @@ namespace osu.Game.Rulesets.Osu.Tests
});
}
[Test]
public void TestLegacyDisjointCursorTrailViaNoCursor()
{
createTest(() =>
{
var skinContainer = new LegacySkinContainer(renderer, provideMiddle: false, provideCursor: false);
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
skinContainer.Child = legacyCursorTrail;
return skinContainer;
});
AddAssert("trail is disjoint", () => this.ChildrenOfType<LegacyCursorTrail>().Single().DisjointTrail, () => Is.True);
}
private void createTest(Func<Drawable> createContent) => AddStep("create trail", () =>
{
Clear();
@ -86,12 +104,14 @@ namespace osu.Game.Rulesets.Osu.Tests
private partial class LegacySkinContainer : Container, ISkinSource
{
private readonly IRenderer renderer;
private readonly bool disjoint;
private readonly bool provideMiddle;
private readonly bool provideCursor;
public LegacySkinContainer(IRenderer renderer, bool disjoint)
public LegacySkinContainer(IRenderer renderer, bool provideMiddle, bool provideCursor = true)
{
this.renderer = renderer;
this.disjoint = disjoint;
this.provideMiddle = provideMiddle;
this.provideCursor = provideCursor;
RelativeSizeAxes = Axes.Both;
}
@ -102,15 +122,14 @@ namespace osu.Game.Rulesets.Osu.Tests
{
switch (componentName)
{
case "cursortrail":
var tex = new Texture(renderer.WhitePixel);
case "cursor":
return provideCursor ? new Texture(renderer.WhitePixel) : null;
if (disjoint)
tex.ScaleAdjust = 1 / 25f;
return tex;
case "cursortrail":
return new Texture(renderer.WhitePixel);
case "cursormiddle":
return disjoint ? null : renderer.WhitePixel;
return provideMiddle ? null : renderer.WhitePixel;
}
return null;

View File

@ -0,0 +1,69 @@
// 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 System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Screens.Play;
using osu.Game.Tests.Visual;
using osuTK;
using osuTK.Input;
namespace osu.Game.Rulesets.Osu.Tests
{
public partial class TestSceneResume : PlayerTestScene
{
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new TestPlayer(true, false, AllowBackwardsSeeks);
[Test]
public void TestPauseViaKeyboard()
{
AddStep("move mouse to center", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.Centre));
AddUntilStep("wait for gameplay start", () => Player.LocalUserPlaying.Value);
AddStep("press escape", () => InputManager.PressKey(Key.Escape));
AddUntilStep("wait for pause overlay", () => Player.ChildrenOfType<PauseOverlay>().Single().State.Value, () => Is.EqualTo(Visibility.Visible));
AddStep("release escape", () => InputManager.ReleaseKey(Key.Escape));
AddStep("resume", () =>
{
InputManager.Key(Key.Down);
InputManager.Key(Key.Space);
});
AddUntilStep("pause overlay present", () => Player.DrawableRuleset.ResumeOverlay.State.Value, () => Is.EqualTo(Visibility.Visible));
}
[Test]
public void TestPauseViaKeyboardWhenMouseOutsidePlayfield()
{
AddStep("move mouse outside playfield", () => InputManager.MoveMouseTo(Player.DrawableRuleset.Playfield.ScreenSpaceDrawQuad.BottomRight + new Vector2(1)));
AddUntilStep("wait for gameplay start", () => Player.LocalUserPlaying.Value);
AddStep("press escape", () => InputManager.PressKey(Key.Escape));
AddUntilStep("wait for pause overlay", () => Player.ChildrenOfType<PauseOverlay>().Single().State.Value, () => Is.EqualTo(Visibility.Visible));
AddStep("release escape", () => InputManager.ReleaseKey(Key.Escape));
AddStep("resume", () =>
{
InputManager.Key(Key.Down);
InputManager.Key(Key.Space);
});
AddUntilStep("pause overlay present", () => Player.DrawableRuleset.ResumeOverlay.State.Value, () => Is.EqualTo(Visibility.Visible));
}
[Test]
public void TestPauseViaKeyboardWhenMouseOutsideScreen()
{
AddStep("move mouse outside playfield", () => InputManager.MoveMouseTo(new Vector2(-20)));
AddUntilStep("wait for gameplay start", () => Player.LocalUserPlaying.Value);
AddStep("press escape", () => InputManager.PressKey(Key.Escape));
AddUntilStep("wait for pause overlay", () => Player.ChildrenOfType<PauseOverlay>().Single().State.Value, () => Is.EqualTo(Visibility.Visible));
AddStep("release escape", () => InputManager.ReleaseKey(Key.Escape));
AddStep("resume", () =>
{
InputManager.Key(Key.Down);
InputManager.Key(Key.Space);
});
AddUntilStep("pause overlay not present", () => Player.DrawableRuleset.ResumeOverlay.State.Value, () => Is.EqualTo(Visibility.Hidden));
}
}
}

View File

@ -111,7 +111,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
if (score.Mods.Any(m => m is OsuModBlinds))
aimValue *= 1.3 + (totalHits * (0.0016 / (1 + 2 * effectiveMissCount)) * Math.Pow(accuracy, 16)) * (1 - 0.003 * attributes.DrainRate * attributes.DrainRate);
else if (score.Mods.Any(h => h is OsuModHidden))
else if (score.Mods.Any(m => m is OsuModHidden || m is OsuModTraceable))
{
// We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
aimValue *= 1.0 + 0.04 * (12.0 - attributes.ApproachRate);
@ -162,7 +162,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
// Increasing the speed value by object count for Blinds isn't ideal, so the minimum buff is given.
speedValue *= 1.12;
}
else if (score.Mods.Any(m => m is OsuModHidden))
else if (score.Mods.Any(m => m is OsuModHidden || m is OsuModTraceable))
{
// We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
speedValue *= 1.0 + 0.04 * (12.0 - attributes.ApproachRate);
@ -212,7 +212,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
// Increasing the accuracy value by object count for Blinds isn't ideal, so the minimum buff is given.
if (score.Mods.Any(m => m is OsuModBlinds))
accuracyValue *= 1.14;
else if (score.Mods.Any(m => m is OsuModHidden))
else if (score.Mods.Any(m => m is OsuModHidden || m is OsuModTraceable))
accuracyValue *= 1.08;
if (score.Mods.Any(m => m is OsuModFlashlight))

View File

@ -11,9 +11,5 @@ namespace osu.Game.Rulesets.Osu
: base(component)
{
}
protected override string RulesetPrefix => OsuRuleset.SHORT_NAME;
protected override string ComponentName => Component.ToString().ToLowerInvariant();
}
}

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
private readonly ISkin skin;
private const double disjoint_trail_time_separation = 1000 / 60.0;
private bool disjointTrail;
public bool DisjointTrail { get; private set; }
private double lastTrailTime;
private IBindable<float> cursorSize = null!;
@ -31,14 +31,19 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
private void load(OsuConfigManager config, ISkinSource skinSource)
{
cursorSize = config.GetBindable<float>(OsuSetting.GameplayCursorSize).GetBoundCopy();
Texture = skin.GetTexture("cursortrail");
disjointTrail = skin.GetTexture("cursormiddle") == null;
if (disjointTrail)
// Cursor and cursor trail components are sourced from potentially different skin sources.
// Stable always chooses cursor trail disjoint behaviour based on the cursor texture lookup source, so we need to fetch where that occurred.
// See https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Graphics/Skinning/SkinManager.cs#L269
var cursorProvider = skinSource.FindProvider(s => s.GetTexture("cursor") != null);
DisjointTrail = cursorProvider?.GetTexture("cursormiddle") == null;
if (DisjointTrail)
{
bool centre = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorCentre)?.Value ?? true;
@ -57,19 +62,19 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
}
}
protected override double FadeDuration => disjointTrail ? 150 : 500;
protected override double FadeDuration => DisjointTrail ? 150 : 500;
protected override float FadeExponent => 1;
protected override bool InterpolateMovements => !disjointTrail;
protected override bool InterpolateMovements => !DisjointTrail;
protected override float IntervalMultiplier => 1 / Math.Max(cursorSize.Value, 1);
protected override bool AvoidDrawingNearCursor => !disjointTrail;
protected override bool AvoidDrawingNearCursor => !DisjointTrail;
protected override void Update()
{
base.Update();
if (!disjointTrail || !currentPosition.HasValue)
if (!DisjointTrail || !currentPosition.HasValue)
return;
if (Time.Current - lastTrailTime >= disjoint_trail_time_separation)
@ -81,7 +86,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
protected override bool OnMouseMove(MouseMoveEvent e)
{
if (!disjointTrail)
if (!DisjointTrail)
return base.OnMouseMove(e);
currentPosition = e.ScreenSpaceMousePosition;

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 System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@ -12,6 +10,7 @@ using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Osu.UI.Cursor;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play;
using osuTK.Graphics;
@ -19,15 +18,18 @@ namespace osu.Game.Rulesets.Osu.UI
{
public partial class OsuResumeOverlay : ResumeOverlay
{
private Container cursorScaleContainer;
private OsuClickToResumeCursor clickToResumeCursor;
private Container cursorScaleContainer = null!;
private OsuClickToResumeCursor clickToResumeCursor = null!;
private OsuCursorContainer localCursorContainer;
private OsuCursorContainer? localCursorContainer;
public override CursorContainer LocalCursor => State.Value == Visibility.Visible ? localCursorContainer : null;
public override CursorContainer? LocalCursor => State.Value == Visibility.Visible ? localCursorContainer : null;
protected override LocalisableString Message => "Click the orange cursor to resume";
[Resolved]
private DrawableRuleset? drawableRuleset { get; set; }
[BackgroundDependencyLoader]
private void load()
{
@ -40,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.UI
protected override void PopIn()
{
// Can't display if the cursor is outside the window.
if (GameplayCursor.LastFrameState == Visibility.Hidden || !Contains(GameplayCursor.ActiveCursor.ScreenSpaceDrawQuad.Centre))
if (GameplayCursor.LastFrameState == Visibility.Hidden || drawableRuleset?.Contains(GameplayCursor.ActiveCursor.ScreenSpaceDrawQuad.Centre) == false)
{
Resume();
return;
@ -71,8 +73,8 @@ namespace osu.Game.Rulesets.Osu.UI
{
public override bool HandlePositionalInput => true;
public Action ResumeRequested;
private Container scaleTransitionContainer;
public Action? ResumeRequested;
private Container scaleTransitionContainer = null!;
public OsuClickToResumeCursor()
{

View File

@ -11,9 +11,5 @@ namespace osu.Game.Rulesets.Taiko
: base(component)
{
}
protected override string RulesetPrefix => TaikoRuleset.SHORT_NAME;
protected override string ComponentName => Component.ToString().ToLowerInvariant();
}
}

View File

@ -1,10 +1,13 @@
// 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 System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Filter;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Carousel;
using osu.Game.Screens.Select.Filter;
@ -311,6 +314,8 @@ namespace osu.Game.Tests.NonVisual.Filtering
public bool Matches(BeatmapInfo beatmapInfo, FilterCriteria criteria) => match;
public bool TryParseCustomKeywordCriteria(string key, Operator op, string value) => false;
public bool FilterMayChangeFromMods(ValueChangedEvent<IReadOnlyList<Mod>> mods) => false;
}
}
}

View File

@ -2,10 +2,13 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Filter;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Carousel;
using osu.Game.Screens.Select.Filter;
@ -514,6 +517,8 @@ namespace osu.Game.Tests.NonVisual.Filtering
return false;
}
public bool FilterMayChangeFromMods(ValueChangedEvent<IReadOnlyList<Mod>> mods) => false;
}
private static readonly object[] correct_date_query_examples =

View File

@ -104,6 +104,21 @@ namespace osu.Game.Tests.Visual.Ranking
});
}
[Test]
public void TestPPNotShownAsProvisionalIfClassicModIsPresentDueToLegacyScore()
{
AddStep("show example score", () =>
{
var score = TestResources.CreateTestScoreInfo(createTestBeatmap(new RealmUser()));
score.PP = 400;
score.Mods = score.Mods.Append(new OsuModClassic()).ToArray();
score.IsLegacyScore = true;
showPanel(score);
});
AddAssert("pp display faded out", () => this.ChildrenOfType<PerformanceStatistic>().Single().Alpha == 1);
}
[Test]
public void TestWithDefaultDate()
{

View File

@ -29,6 +29,7 @@ using osu.Game.Overlays.Dialog;
using osu.Game.Overlays.Mods;
using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
@ -1147,6 +1148,62 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("filter text cleared", () => songSelect!.FilterControl.ChildrenOfType<FilterControl.FilterControlTextBox>().First().Text, () => Is.Empty);
}
[Test]
public void TestNonFilterableModChange()
{
addRulesetImportStep(0);
createSongSelect();
// Mod that is guaranteed to never re-filter.
AddStep("add non-filterable mod", () => SelectedMods.Value = new Mod[] { new OsuModCinema() });
AddAssert("filter count is 1", () => songSelect!.FilterCount, () => Is.EqualTo(1));
// Removing the mod should still not re-filter.
AddStep("remove non-filterable mod", () => SelectedMods.Value = Array.Empty<Mod>());
AddAssert("filter count is 1", () => songSelect!.FilterCount, () => Is.EqualTo(1));
}
[Test]
public void TestFilterableModChange()
{
addRulesetImportStep(3);
createSongSelect();
// Change to mania ruleset.
AddStep("filter to mania ruleset", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.OnlineID == 3));
AddAssert("filter count is 2", () => songSelect!.FilterCount, () => Is.EqualTo(2));
// Apply a mod, but this should NOT re-filter because there's no search text.
AddStep("add filterable mod", () => SelectedMods.Value = new Mod[] { new ManiaModKey3() });
AddAssert("filter count is 2", () => songSelect!.FilterCount, () => Is.EqualTo(2));
// Set search text. Should re-filter.
AddStep("set search text to match mods", () => songSelect!.FilterControl.CurrentTextSearch.Value = "keys=3");
AddAssert("filter count is 3", () => songSelect!.FilterCount, () => Is.EqualTo(3));
// Change filterable mod. Should re-filter.
AddStep("change new filterable mod", () => SelectedMods.Value = new Mod[] { new ManiaModKey5() });
AddAssert("filter count is 4", () => songSelect!.FilterCount, () => Is.EqualTo(4));
// Add non-filterable mod. Should NOT re-filter.
AddStep("apply non-filterable mod", () => SelectedMods.Value = new Mod[] { new ManiaModNoFail(), new ManiaModKey5() });
AddAssert("filter count is 4", () => songSelect!.FilterCount, () => Is.EqualTo(4));
// Remove filterable mod. Should re-filter.
AddStep("remove filterable mod", () => SelectedMods.Value = new Mod[] { new ManiaModNoFail() });
AddAssert("filter count is 5", () => songSelect!.FilterCount, () => Is.EqualTo(5));
// Remove non-filterable mod. Should NOT re-filter.
AddStep("remove filterable mod", () => SelectedMods.Value = Array.Empty<Mod>());
AddAssert("filter count is 5", () => songSelect!.FilterCount, () => Is.EqualTo(5));
// Add filterable mod. Should re-filter.
AddStep("add filterable mod", () => SelectedMods.Value = new Mod[] { new ManiaModKey3() });
AddAssert("filter count is 6", () => songSelect!.FilterCount, () => Is.EqualTo(6));
}
private void waitForInitialSelection()
{
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);

View File

@ -612,6 +612,23 @@ namespace osu.Game.Tests.Visual.UserInterface
AddAssert("search text box unfocused", () => !modSelectOverlay.SearchTextBox.HasFocus);
}
[Test]
public void TestSearchBoxFocusToggleRespondsToExternalChanges()
{
AddStep("text search does not start active", () => configManager.SetValue(OsuSetting.ModSelectTextSearchStartsActive, false));
createScreen();
AddUntilStep("search text box not focused", () => !modSelectOverlay.SearchTextBox.HasFocus);
AddStep("press tab", () => InputManager.Key(Key.Tab));
AddAssert("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
AddStep("unfocus search text box externally", () => InputManager.ChangeFocus(null));
AddStep("press tab", () => InputManager.Key(Key.Tab));
AddAssert("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
}
[Test]
public void TestTextSearchDoesNotBlockCustomisationPanelKeyboardInteractions()
{

View File

@ -16,6 +16,7 @@ using osu.Game.Extensions;
using osu.Game.Online.API;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Performance;
using osu.Game.Rulesets;
using osu.Game.Scoring;
using osu.Game.Scoring.Legacy;
@ -51,6 +52,9 @@ namespace osu.Game.Database
[Resolved]
private ILocalUserPlayInfo? localUserPlayInfo { get; set; }
[Resolved]
private IHighPerformanceSessionManager? highPerformanceSessionManager { get; set; }
[Resolved]
private INotificationOverlay? notificationOverlay { get; set; }
@ -493,7 +497,9 @@ namespace osu.Game.Database
private void sleepIfRequired()
{
while (localUserPlayInfo?.IsPlaying.Value == true)
// Importantly, also sleep if high performance session is active.
// If we don't do this, memory usage can become runaway due to GC running in a more lenient mode.
while (localUserPlayInfo?.IsPlaying.Value == true || highPerformanceSessionManager?.IsSessionActive == true)
{
Logger.Log("Background processing sleeping due to active gameplay...");
Thread.Sleep(TimeToSleepDuringGameplay);

View File

@ -8,6 +8,8 @@ using System.Linq;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Extensions.Color4Extensions;
@ -143,13 +145,6 @@ namespace osu.Game.Graphics.UserInterface
FadeUnhovered();
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
if (accentColour == default)
AccentColour = colours.Blue;
}
public OsuTabItem(T value)
: base(value)
{
@ -196,10 +191,21 @@ namespace osu.Game.Graphics.UserInterface
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
},
new HoverClickSounds(HoverSampleSet.TabSelect)
new HoverSounds(HoverSampleSet.TabSelect)
};
}
private Sample selectSample;
[BackgroundDependencyLoader]
private void load(OsuColour colours, AudioManager audio)
{
if (accentColour == default)
AccentColour = colours.Blue;
selectSample = audio.Samples.Get(@"UI/tabselect-select");
}
protected override void OnActivated()
{
Text.Font = Text.Font.With(weight: FontWeight.Bold);
@ -211,6 +217,8 @@ namespace osu.Game.Graphics.UserInterface
Text.Font = Text.Font.With(weight: FontWeight.Medium);
FadeUnhovered();
}
protected override void OnActivatedByUser() => selectSample.Play();
}
}
}

View File

@ -7,6 +7,8 @@ using System;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
@ -53,6 +55,8 @@ namespace osu.Game.Graphics.UserInterface
}
}
private Sample selectSample = null!;
public PageTabItem(T value)
: base(value)
{
@ -78,12 +82,18 @@ namespace osu.Game.Graphics.UserInterface
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
},
new HoverClickSounds(HoverSampleSet.TabSelect)
new HoverSounds(HoverSampleSet.TabSelect)
};
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Torus, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
selectSample = audio.Samples.Get(@"UI/tabselect-select");
}
protected virtual LocalisableString CreateText() => (Value as Enum)?.GetLocalisableDescription() ?? Value.ToString();
protected override bool OnHover(HoverEvent e)
@ -112,6 +122,8 @@ namespace osu.Game.Graphics.UserInterface
protected override void OnActivated() => slideActive();
protected override void OnDeactivated() => slideInactive();
protected override void OnActivatedByUser() => selectSample.Play();
}
}
}

View File

@ -5,6 +5,8 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -47,13 +49,15 @@ namespace osu.Game.Overlays.BeatmapListing
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
private Sample selectSample = null!;
public TabItem(BeatmapCardSize value)
: base(value)
{
}
[BackgroundDependencyLoader]
private void load()
private void load(AudioManager audio)
{
AutoSizeAxes = Axes.Both;
Masking = true;
@ -79,8 +83,10 @@ namespace osu.Game.Overlays.BeatmapListing
Icon = getIconForCardSize(Value)
}
},
new HoverClickSounds(HoverSampleSet.TabSelect)
new HoverSounds(HoverSampleSet.TabSelect)
};
selectSample = audio.Samples.Get(@"UI/tabselect-select");
}
private static IconUsage getIconForCardSize(BeatmapCardSize cardSize)
@ -111,6 +117,8 @@ namespace osu.Game.Overlays.BeatmapListing
updateState();
}
protected override void OnActivatedByUser() => selectSample.Play();
protected override void OnDeactivated()
{
if (IsLoaded)

View File

@ -128,7 +128,11 @@ namespace osu.Game.Overlays.BeatmapListing
protected override bool OnClick(ClickEvent e)
{
base.OnClick(e);
// this tab item implementation is not managed by a TabControl,
// therefore we have to manually update Active state and play select sound when this tab item is clicked.
Active.Toggle();
SelectSample.Play();
return true;
}
}

View File

@ -5,6 +5,8 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
@ -24,13 +26,15 @@ namespace osu.Game.Overlays.BeatmapListing
private OsuSpriteText text;
protected Sample SelectSample { get; private set; } = null!;
public FilterTabItem(T value)
: base(value)
{
}
[BackgroundDependencyLoader]
private void load()
private void load(AudioManager audio)
{
AutoSizeAxes = Axes.Both;
AddRangeInternal(new Drawable[]
@ -40,10 +44,12 @@ namespace osu.Game.Overlays.BeatmapListing
Font = OsuFont.GetFont(size: 13, weight: FontWeight.Regular),
Text = LabelFor(Value)
},
new HoverClickSounds(HoverSampleSet.TabSelect)
new HoverSounds(HoverSampleSet.TabSelect)
});
Enabled.Value = true;
SelectSample = audio.Samples.Get(@"UI/tabselect-select");
}
protected override void LoadComplete()
@ -71,6 +77,8 @@ namespace osu.Game.Overlays.BeatmapListing
protected override void OnDeactivated() => UpdateState();
protected override void OnActivatedByUser() => SelectSample.Play();
/// <summary>
/// Returns the label text to be used for the supplied <paramref name="value"/>.
/// </summary>

View File

@ -21,7 +21,7 @@ namespace osu.Game.Overlays.BeatmapSet
// propagate value to tab items first to enable only available rulesets.
beatmapSet.Value = value;
SelectTab(TabContainer.TabItems.FirstOrDefault(t => t.Enabled.Value));
Current.Value = TabContainer.TabItems.FirstOrDefault(t => t.Enabled.Value)?.Value;
}
}

View File

@ -143,8 +143,6 @@ namespace osu.Game.Overlays.Mods
protected ShearedToggleButton? CustomisationButton { get; private set; }
protected SelectAllModsButton? SelectAllModsButton { get; set; }
private bool textBoxShouldFocus;
private Sample? columnAppearSample;
private WorkingBeatmap? beatmap;
@ -542,7 +540,7 @@ namespace osu.Game.Overlays.Mods
if (customisationVisible.Value)
SearchTextBox.KillFocus();
else
setTextBoxFocus(textBoxShouldFocus);
setTextBoxFocus(textSearchStartsActive.Value);
}
/// <summary>
@ -798,15 +796,13 @@ namespace osu.Game.Overlays.Mods
return false;
// TODO: should probably eventually support typical platform search shortcuts (`Ctrl-F`, `/`)
setTextBoxFocus(!textBoxShouldFocus);
setTextBoxFocus(!SearchTextBox.HasFocus);
return true;
}
private void setTextBoxFocus(bool keepFocus)
private void setTextBoxFocus(bool focus)
{
textBoxShouldFocus = keepFocus;
if (textBoxShouldFocus)
if (focus)
SearchTextBox.TakeFocus();
else
SearchTextBox.KillFocus();

View File

@ -11,6 +11,8 @@ using osuTK;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osuTK.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
@ -65,6 +67,8 @@ namespace osu.Game.Overlays
private readonly SpriteIcon icon;
private Sample selectSample = null!;
public PanelDisplayTabItem(OverlayPanelDisplayStyle value)
: base(value)
{
@ -78,14 +82,22 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit
},
new HoverClickSounds()
new HoverSounds(HoverSampleSet.TabSelect)
});
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
selectSample = audio.Samples.Get(@"UI/tabselect-select");
}
protected override void OnActivated() => updateState();
protected override void OnDeactivated() => updateState();
protected override void OnActivatedByUser() => selectSample.Play();
protected override bool OnHover(HoverEvent e)
{
updateState();

View File

@ -10,6 +10,8 @@ using osu.Game.Rulesets;
using osuTK.Graphics;
using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
using osu.Game.Graphics.Containers;
@ -39,6 +41,8 @@ namespace osu.Game.Overlays
public LocalisableString TooltipText => Value.Name;
private Sample selectSample = null!;
public OverlayRulesetTabItem(RulesetInfo value)
: base(value)
{
@ -59,12 +63,18 @@ namespace osu.Game.Overlays
Icon = value.CreateInstance().CreateIcon(),
},
},
new HoverClickSounds()
new HoverSounds(HoverSampleSet.TabSelect)
});
Enabled.Value = true;
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
selectSample = audio.Samples.Get(@"UI/tabselect-select");
}
protected override void LoadComplete()
{
base.LoadComplete();
@ -90,6 +100,8 @@ namespace osu.Game.Overlays
protected override void OnDeactivated() => updateState();
protected override void OnActivatedByUser() => selectSample.Play();
private void updateState()
{
AccentColour = Enabled.Value ? getActiveColour() : colourProvider.Foreground1;

View File

@ -11,6 +11,8 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics;
using osuTK.Graphics;
@ -49,8 +51,10 @@ namespace osu.Game.Overlays
Margin = new MarginPadding(PADDING);
}
private Sample selectSample;
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, OsuColour colours)
private void load(OverlayColourProvider colourProvider, OsuColour colours, AudioManager audio)
{
AddRange(new Drawable[]
{
@ -87,9 +91,11 @@ namespace osu.Game.Overlays
CollapsedSize = 2,
Expanded = true
},
new HoverClickSounds()
new HoverSounds(HoverSampleSet.TabSelect)
});
selectSample = audio.Samples.Get(@"UI/tabselect-select");
SelectedItem.BindValueChanged(_ => updateState(), true);
}
@ -105,6 +111,8 @@ namespace osu.Game.Overlays
protected override void OnDeactivated() => updateState();
protected override void OnActivatedByUser() => selectSample.Play();
protected override bool OnHover(HoverEvent e)
{
updateState();

View File

@ -4,6 +4,8 @@
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
@ -80,6 +82,8 @@ namespace osu.Game.Overlays
}
}
private Sample selectSample = null!;
public OverlayTabItem(T value)
: base(value)
{
@ -101,10 +105,16 @@ namespace osu.Game.Overlays
ExpandedSize = 5f,
CollapsedSize = 0
},
new HoverClickSounds(HoverSampleSet.TabSelect)
new HoverSounds(HoverSampleSet.TabSelect)
};
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
selectSample = audio.Samples.Get(@"UI/tabselect-select");
}
protected override bool OnHover(HoverEvent e)
{
base.OnHover(e);
@ -136,6 +146,8 @@ namespace osu.Game.Overlays
Text.Font = Text.Font.With(weight: FontWeight.Medium);
}
protected override void OnActivatedByUser() => selectSample.Play();
private void updateState()
{
if (Active.Value)

View File

@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Toolbar
{
public partial class ToolbarMusicButton : ToolbarOverlayToggleButton
{
private Circle volumeBar;
private Box volumeBar;
protected override Anchor TooltipAnchor => Anchor.TopRight;
@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Toolbar
StateContainer = music;
Flow.Padding = new MarginPadding { Horizontal = Toolbar.HEIGHT / 4 };
Flow.Add(volumeDisplay = new Container
Flow.Add(volumeDisplay = new CircularContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
@ -47,12 +47,12 @@ namespace osu.Game.Overlays.Toolbar
Masking = true,
Children = new[]
{
new Circle
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White.Opacity(0.25f),
},
volumeBar = new Circle
volumeBar = new Box
{
RelativeSizeAxes = Axes.Both,
Height = 0f,

View File

@ -3,11 +3,8 @@
#nullable disable
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -24,8 +21,6 @@ namespace osu.Game.Overlays.Toolbar
{
protected Drawable ModeButtonLine { get; private set; }
private readonly Dictionary<string, Sample> selectionSamples = new Dictionary<string, Sample>();
public ToolbarRulesetSelector()
{
RelativeSizeAxes = Axes.Y;
@ -33,7 +28,7 @@ namespace osu.Game.Overlays.Toolbar
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
private void load()
{
AddRangeInternal(new[]
{
@ -59,9 +54,6 @@ namespace osu.Game.Overlays.Toolbar
}
},
});
foreach (var ruleset in Rulesets.AvailableRulesets)
selectionSamples[ruleset.ShortName] = audio.Samples.Get($"UI/ruleset-select-{ruleset.ShortName}");
}
protected override void LoadComplete()
@ -88,10 +80,6 @@ namespace osu.Game.Overlays.Toolbar
if (SelectedTab != null)
{
ModeButtonLine.MoveToX(SelectedTab.DrawPosition.X, !hasInitialPosition ? 0 : 500, Easing.OutElasticQuarter);
if (hasInitialPosition)
selectionSamples[SelectedTab.Value.ShortName]?.Play();
hasInitialPosition = true;
}
}
@ -121,7 +109,7 @@ namespace osu.Game.Overlays.Toolbar
RulesetInfo found = Rulesets.AvailableRulesets.ElementAtOrDefault(requested);
if (found != null)
Current.Value = found;
SelectItem(found);
return true;
}

View File

@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
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.UserInterface;
@ -17,6 +19,8 @@ namespace osu.Game.Overlays.Toolbar
{
private readonly RulesetButton ruleset;
private Sample? selectSample;
public ToolbarRulesetTabButton(RulesetInfo value)
: base(value)
{
@ -34,10 +38,18 @@ namespace osu.Game.Overlays.Toolbar
ruleset.SetIcon(rInstance.CreateIcon());
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
selectSample = audio.Samples.Get($@"UI/ruleset-select-{Value.ShortName}");
}
protected override void OnActivated() => ruleset.Active = true;
protected override void OnDeactivated() => ruleset.Active = false;
protected override void OnActivatedByUser() => selectSample?.Play();
private partial class RulesetButton : ToolbarButton
{
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds();

View File

@ -40,10 +40,12 @@ namespace osu.Game.Overlays
protected override void PopOut()
{
base.PopOut();
Waves.Hide();
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InQuint);
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InQuint)
// base call is responsible for stopping preview tracks.
// delay it until the fade has concluded to ensure that nothing inside the overlay has triggered
// another preview track playback in the meantime, leaving an "orphaned" preview playing.
.OnComplete(_ => base.PopOut());
}
}
}

View File

@ -14,6 +14,11 @@ namespace osu.Game.Performance
/// </summary>
public interface IHighPerformanceSessionManager
{
/// <summary>
/// Whether a high performance session is currently active.
/// </summary>
bool IsSessionActive { get; }
/// <summary>
/// Start a new high performance session.
/// </summary>

View File

@ -1,7 +1,10 @@
// 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 System.Collections.Generic;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
@ -52,5 +55,12 @@ namespace osu.Game.Rulesets.Filter
/// while ignored criteria are included in <see cref="FilterCriteria.SearchText"/>.
/// </returns>
bool TryParseCustomKeywordCriteria(string key, Operator op, string value);
/// <summary>
/// Whether to reapply the filter as a result of the given change in applied mods.
/// </summary>
/// <param name="mods">The change in mods.</param>
/// <returns>Whether the filter should be re-applied.</returns>
bool FilterMayChangeFromMods(ValueChangedEvent<IReadOnlyList<Mod>> mods);
}
}

View File

@ -372,7 +372,7 @@ namespace osu.Game.Screens.Edit
}
}
},
new EditorScreenSwitcherControl
screenSwitcher = new EditorScreenSwitcherControl
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
@ -662,23 +662,23 @@ namespace osu.Game.Screens.Edit
return true;
case GlobalAction.EditorComposeMode:
Mode.Value = EditorScreenMode.Compose;
screenSwitcher.SelectItem(EditorScreenMode.Compose);
return true;
case GlobalAction.EditorDesignMode:
Mode.Value = EditorScreenMode.Design;
screenSwitcher.SelectItem(EditorScreenMode.Design);
return true;
case GlobalAction.EditorTimingMode:
Mode.Value = EditorScreenMode.Timing;
screenSwitcher.SelectItem(EditorScreenMode.Timing);
return true;
case GlobalAction.EditorSetupMode:
Mode.Value = EditorScreenMode.SongSetup;
screenSwitcher.SelectItem(EditorScreenMode.SongSetup);
return true;
case GlobalAction.EditorVerifyMode:
Mode.Value = EditorScreenMode.Verify;
screenSwitcher.SelectItem(EditorScreenMode.Verify);
return true;
case GlobalAction.EditorTestGameplay:
@ -959,6 +959,8 @@ namespace osu.Game.Screens.Edit
[CanBeNull]
private ScheduledDelegate playbackDisabledDebounce;
private EditorScreenSwitcherControl screenSwitcher;
private void updateSampleDisabledState()
{
bool shouldDisableSamples = clock.SeekingOrStopped.Value

View File

@ -30,6 +30,10 @@ namespace osu.Game.Screens.Edit
protected readonly FillFlowContainer<RowBackground> BackgroundFlow;
// We can avoid potentially thousands of objects being added to the input sub-tree since item selection is being handled by the BackgroundFlow
// and no items in the underlying table are clickable.
protected override bool ShouldBeConsideredForInput(Drawable child) => child == BackgroundFlow && base.ShouldBeConsideredForInput(child);
protected EditorTable()
{
RelativeSizeAxes = Axes.X;

View File

@ -4,6 +4,8 @@
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -78,14 +80,17 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
},
},
},
new HoverClickSounds(),
new HoverSounds(HoverSampleSet.TabSelect),
};
}
private Sample selectSample;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OsuColour colours, AudioManager audio)
{
selection.Colour = colours.Yellow;
selectSample = audio.Samples.Get(@"UI/tabselect-select");
}
protected override bool OnHover(HoverEvent e)
@ -109,6 +114,8 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
{
selection.FadeOut(transition_duration, Easing.OutQuint);
}
protected override void OnActivatedByUser() => selectSample.Play();
}
}
}

View File

@ -4,6 +4,7 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@ -17,6 +18,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Scoring;
using osu.Game.Localisation;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Screens.Ranking.Expanded.Statistics
{
@ -74,7 +76,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
Alpha = 0.5f;
TooltipText = ResultsScreenStrings.NoPPForUnrankedBeatmaps;
}
else if (scoreInfo.Mods.Any(m => !m.Ranked))
else if (hasUnrankedMods(scoreInfo))
{
Alpha = 0.5f;
TooltipText = ResultsScreenStrings.NoPPForUnrankedMods;
@ -87,6 +89,16 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
}
}
private static bool hasUnrankedMods(ScoreInfo scoreInfo)
{
IEnumerable<Mod> modsToCheck = scoreInfo.Mods;
if (scoreInfo.IsLegacyScore)
modsToCheck = modsToCheck.Where(m => m is not ModClassic);
return modsToCheck.Any(m => !m.Ranked);
}
public override void Appear()
{
base.Appear();

View File

@ -390,6 +390,15 @@ namespace osu.Game.Screens.Ranking
switch (e.Action)
{
case GlobalAction.QuickExit:
if (this.IsCurrentScreen())
{
this.Exit();
return true;
}
break;
case GlobalAction.Select:
StatisticsPanel.ToggleVisibility();
return true;

View File

@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -49,15 +50,14 @@ namespace osu.Game.Screens.Select
}
private OsuTabControl<SortMode> sortTabs;
private Bindable<SortMode> sortMode;
private Bindable<GroupMode> groupMode;
private FilterControlTextBox searchTextBox;
private CollectionDropdown collectionDropdown;
[CanBeNull]
private FilterCriteria currentCriteria;
public FilterCriteria CreateCriteria()
{
string query = searchTextBox.Text;
@ -228,7 +228,8 @@ namespace osu.Game.Screens.Select
if (m.NewValue.SequenceEqual(m.OldValue))
return;
updateCriteria();
if (currentCriteria?.RulesetCriteria?.FilterMayChangeFromMods(m) == true)
updateCriteria();
});
groupMode.BindValueChanged(_ => updateCriteria());
@ -263,7 +264,7 @@ namespace osu.Game.Screens.Select
private readonly Bindable<double> minimumStars = new BindableDouble();
private readonly Bindable<double> maximumStars = new BindableDouble();
private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria());
private void updateCriteria() => FilterChanged?.Invoke(currentCriteria = CreateCriteria());
protected override bool OnClick(ClickEvent e) => true;

View File

@ -24,8 +24,5 @@ namespace osu.Game.Skinning
{
Component = component;
}
protected virtual string RulesetPrefix => string.Empty;
protected virtual string ComponentName => Component.ToString();
}
}

View File

@ -30,11 +30,6 @@ namespace osu.Game.Skinning
/// </summary>
void Reload();
/// <summary>
/// Reload this target from the provided skinnable information.
/// </summary>
void Reload(SerialisedDrawableInfo[] skinnableInfo);
/// <summary>
/// Add a new skinnable component to this target.
/// </summary>

View File

@ -34,15 +34,15 @@ namespace osu.Game.Skinning
public float Rotation { get; set; }
public Vector2 Scale { get; set; }
public Vector2 Scale { get; set; } = Vector2.One;
public float? Width { get; set; }
public float? Height { get; set; }
public Anchor Anchor { get; set; }
public Anchor Anchor { get; set; } = Anchor.TopLeft;
public Anchor Origin { get; set; }
public Anchor Origin { get; set; } = Anchor.TopLeft;
/// <inheritdoc cref="ISerialisableDrawable.UsesFixedAnchor"/>
public bool UsesFixedAnchor { get; set; }

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using osu.Framework.Bindables;
@ -44,20 +43,6 @@ namespace osu.Game.Skinning
Lookup = lookup;
}
public void Reload(SerialisedDrawableInfo[] skinnableInfo)
{
var drawables = new List<Drawable>();
foreach (var i in skinnableInfo)
drawables.Add(i.CreateInstance());
Reload(new Container
{
RelativeSizeAxes = Axes.Both,
Children = drawables,
});
}
public void Reload() => Reload(CurrentSkin.GetDrawableComponent(Lookup) as Container);
public void Reload(Container? componentsContainer)

View File

@ -35,7 +35,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Realm" Version="11.5.0" />
<PackageReference Include="ppy.osu.Framework" Version="2024.329.0" />
<PackageReference Include="ppy.osu.Framework" Version="2024.419.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.410.0" />
<PackageReference Include="Sentry" Version="4.3.0" />
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->

View File

@ -23,6 +23,6 @@
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.329.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.419.0" />
</ItemGroup>
</Project>