1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 11:03:21 +08:00

Merge branch 'master' into gh-actions-diffcalc

This commit is contained in:
Dean Herbert 2021-09-07 18:41:24 +09:00 committed by GitHub
commit cb30f4d320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 505 additions and 174 deletions

View File

@ -51,7 +51,7 @@
<Reference Include="Java.Interop" /> <Reference Include="Java.Interop" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.827.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2021.907.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.830.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2021.830.0" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Transitive Dependencies"> <ItemGroup Label="Transitive Dependencies">

View File

@ -0,0 +1,46 @@
// 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.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Screens.Edit.Setup;
namespace osu.Game.Rulesets.Mania.Edit.Setup
{
public class ManiaSetupSection : RulesetSetupSection
{
private LabelledSwitchButton specialStyle;
public ManiaSetupSection()
: base(new ManiaRuleset().RulesetInfo)
{
}
[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
specialStyle = new LabelledSwitchButton
{
Label = "Use special (N+1) style",
Description = "Changes one column to act as a classic \"scratch\" or \"special\" column, which can be moved around by the user's skin (to the left/right/centre). Generally used in 5k (4+1) or 8key (7+1) configurations.",
Current = { Value = Beatmap.BeatmapInfo.SpecialStyle }
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
specialStyle.Current.BindValueChanged(_ => updateBeatmap());
}
private void updateBeatmap()
{
Beatmap.BeatmapInfo.SpecialStyle = specialStyle.Current.Value;
}
}
}

View File

@ -27,11 +27,13 @@ using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Configuration; using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.Difficulty; using osu.Game.Rulesets.Mania.Difficulty;
using osu.Game.Rulesets.Mania.Edit; using osu.Game.Rulesets.Mania.Edit;
using osu.Game.Rulesets.Mania.Edit.Setup;
using osu.Game.Rulesets.Mania.Scoring; using osu.Game.Rulesets.Mania.Scoring;
using osu.Game.Rulesets.Mania.Skinning.Legacy; using osu.Game.Rulesets.Mania.Skinning.Legacy;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning; using osu.Game.Skinning;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Ranking.Statistics; using osu.Game.Screens.Ranking.Statistics;
namespace osu.Game.Rulesets.Mania namespace osu.Game.Rulesets.Mania
@ -390,6 +392,8 @@ namespace osu.Game.Rulesets.Mania
{ {
return new ManiaFilterCriteria(); return new ManiaFilterCriteria();
} }
public override RulesetSetupSection CreateEditorSetupSection() => new ManiaSetupSection();
} }
public enum PlayfieldType public enum PlayfieldType

View File

@ -0,0 +1,52 @@
// 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.Allocation;
using osu.Framework.Bindables;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Screens.Edit.Setup;
namespace osu.Game.Rulesets.Osu.Edit.Setup
{
public class OsuSetupSection : RulesetSetupSection
{
private LabelledSliderBar<float> stackLeniency;
public OsuSetupSection()
: base(new OsuRuleset().RulesetInfo)
{
}
[BackgroundDependencyLoader]
private void load()
{
Children = new[]
{
stackLeniency = new LabelledSliderBar<float>
{
Label = "Stack Leniency",
Description = "In play mode, osu! automatically stacks notes which occur at the same location. Increasing this value means it is more likely to snap notes of further time-distance.",
Current = new BindableFloat(Beatmap.BeatmapInfo.StackLeniency)
{
Default = 0.7f,
MinValue = 0,
MaxValue = 1,
Precision = 0.1f
}
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
stackLeniency.Current.BindValueChanged(_ => updateBeatmap());
}
private void updateBeatmap()
{
Beatmap.BeatmapInfo.StackLeniency = stackLeniency.Current.Value;
}
}
}

View File

@ -30,9 +30,11 @@ using osu.Game.Skinning;
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Extensions.EnumExtensions;
using osu.Game.Rulesets.Osu.Edit.Setup;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Skinning.Legacy; using osu.Game.Rulesets.Osu.Skinning.Legacy;
using osu.Game.Rulesets.Osu.Statistics; using osu.Game.Rulesets.Osu.Statistics;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Ranking.Statistics; using osu.Game.Screens.Ranking.Statistics;
namespace osu.Game.Rulesets.Osu namespace osu.Game.Rulesets.Osu
@ -305,5 +307,7 @@ namespace osu.Game.Rulesets.Osu
} }
}; };
} }
public override RulesetSetupSection CreateEditorSetupSection() => new OsuSetupSection();
} }
} }

View File

@ -11,6 +11,7 @@ using osu.Framework.Platform;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Input; using osu.Game.Input;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Rulesets;
using Realms; using Realms;
namespace osu.Game.Tests.Database namespace osu.Game.Tests.Database
@ -42,7 +43,7 @@ namespace osu.Game.Tests.Database
KeyBindingContainer testContainer = new TestKeyBindingContainer(); KeyBindingContainer testContainer = new TestKeyBindingContainer();
keyBindingStore.Register(testContainer); keyBindingStore.Register(testContainer, Enumerable.Empty<RulesetInfo>());
Assert.That(queryCount(), Is.EqualTo(3)); Assert.That(queryCount(), Is.EqualTo(3));
@ -66,7 +67,7 @@ namespace osu.Game.Tests.Database
{ {
KeyBindingContainer testContainer = new TestKeyBindingContainer(); KeyBindingContainer testContainer = new TestKeyBindingContainer();
keyBindingStore.Register(testContainer); keyBindingStore.Register(testContainer, Enumerable.Empty<RulesetInfo>());
using (var primaryUsage = realmContextFactory.GetForRead()) using (var primaryUsage = realmContextFactory.GetForRead())
{ {

View File

@ -4,8 +4,13 @@
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Rulesets.Taiko;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Setup; using osu.Game.Screens.Edit.Setup;
@ -23,15 +28,31 @@ namespace osu.Game.Tests.Visual.Editing
editorBeatmap = new EditorBeatmap(new OsuBeatmap()); editorBeatmap = new EditorBeatmap(new OsuBeatmap());
} }
[BackgroundDependencyLoader] [Test]
private void load() public void TestOsu() => runForRuleset(new OsuRuleset().RulesetInfo);
{
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
Child = new SetupScreen [Test]
public void TestTaiko() => runForRuleset(new TaikoRuleset().RulesetInfo);
[Test]
public void TestCatch() => runForRuleset(new CatchRuleset().RulesetInfo);
[Test]
public void TestMania() => runForRuleset(new ManiaRuleset().RulesetInfo);
private void runForRuleset(RulesetInfo rulesetInfo)
{
AddStep("create screen", () =>
{ {
State = { Value = Visibility.Visible }, editorBeatmap.BeatmapInfo.Ruleset = rulesetInfo;
};
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
Child = new SetupScreen
{
State = { Value = Visibility.Visible },
};
});
} }
} }
} }

View File

@ -104,6 +104,9 @@ namespace osu.Game.Tests.Visual.Online
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg" CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg"
}, api.IsLoggedIn)); }, api.IsLoggedIn));
AddStep("Show ppy from username", () => profile.ShowUser(@"peppy"));
AddStep("Show flyte from username", () => profile.ShowUser(@"flyte"));
AddStep("Hide", profile.Hide); AddStep("Hide", profile.Hide);
AddStep("Show without reload", profile.Show); AddStep("Show without reload", profile.Show);
} }

View File

@ -1,14 +1,15 @@
// 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.
using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Handlers.Tablet; using osu.Framework.Input.Handlers.Tablet;
using osu.Framework.Platform; using osu.Framework.Testing;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
using osu.Game.Overlays.Settings.Sections.Input; using osu.Game.Overlays.Settings.Sections.Input;
using osuTK; using osuTK;
@ -17,22 +18,34 @@ namespace osu.Game.Tests.Visual.Settings
[TestFixture] [TestFixture]
public class TestSceneTabletSettings : OsuTestScene public class TestSceneTabletSettings : OsuTestScene
{ {
[BackgroundDependencyLoader] private TestTabletHandler tabletHandler;
private void load(GameHost host) private TabletSettings settings;
{
var tabletHandler = new TestTabletHandler();
AddRange(new Drawable[] [SetUpSteps]
public void SetUpSteps()
{
AddStep("create settings", () =>
{ {
new TabletSettings(tabletHandler) tabletHandler = new TestTabletHandler();
Children = new Drawable[]
{ {
RelativeSizeAxes = Axes.None, settings = new TabletSettings(tabletHandler)
Width = SettingsPanel.PANEL_WIDTH, {
Anchor = Anchor.TopCentre, RelativeSizeAxes = Axes.None,
Origin = Anchor.TopCentre, Width = SettingsPanel.PANEL_WIDTH,
} Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
}
};
}); });
AddStep("set square size", () => tabletHandler.SetTabletSize(new Vector2(100, 100)));
}
[Test]
public void TestVariousTabletSizes()
{
AddStep("Test with wide tablet", () => tabletHandler.SetTabletSize(new Vector2(160, 100))); AddStep("Test with wide tablet", () => tabletHandler.SetTabletSize(new Vector2(160, 100)));
AddStep("Test with square tablet", () => tabletHandler.SetTabletSize(new Vector2(300, 300))); AddStep("Test with square tablet", () => tabletHandler.SetTabletSize(new Vector2(300, 300)));
AddStep("Test with tall tablet", () => tabletHandler.SetTabletSize(new Vector2(100, 300))); AddStep("Test with tall tablet", () => tabletHandler.SetTabletSize(new Vector2(100, 300)));
@ -40,6 +53,71 @@ namespace osu.Game.Tests.Visual.Settings
AddStep("Test no tablet present", () => tabletHandler.SetTabletSize(Vector2.Zero)); AddStep("Test no tablet present", () => tabletHandler.SetTabletSize(Vector2.Zero));
} }
[Test]
public void TestWideAspectRatioValidity()
{
AddStep("Test with wide tablet", () => tabletHandler.SetTabletSize(new Vector2(160, 100)));
AddStep("Reset to full area", () => settings.ChildrenOfType<DangerousSettingsButton>().First().TriggerClick());
ensureValid();
AddStep("rotate 10", () => tabletHandler.Rotation.Value = 10);
ensureInvalid();
AddStep("scale down", () => tabletHandler.AreaSize.Value *= 0.9f);
ensureInvalid();
AddStep("scale down", () => tabletHandler.AreaSize.Value *= 0.9f);
ensureInvalid();
AddStep("scale down", () => tabletHandler.AreaSize.Value *= 0.9f);
ensureValid();
}
[Test]
public void TestRotationValidity()
{
AddAssert("area valid", () => settings.AreaSelection.IsWithinBounds);
AddStep("rotate 90", () => tabletHandler.Rotation.Value = 90);
ensureValid();
AddStep("rotate 180", () => tabletHandler.Rotation.Value = 180);
ensureValid();
AddStep("rotate 270", () => tabletHandler.Rotation.Value = 270);
ensureValid();
AddStep("rotate 360", () => tabletHandler.Rotation.Value = 360);
ensureValid();
AddStep("rotate 0", () => tabletHandler.Rotation.Value = 0);
ensureValid();
AddStep("rotate 45", () => tabletHandler.Rotation.Value = 45);
ensureInvalid();
AddStep("rotate 0", () => tabletHandler.Rotation.Value = 0);
ensureValid();
}
[Test]
public void TestOffsetValidity()
{
ensureValid();
AddStep("move right", () => tabletHandler.AreaOffset.Value = Vector2.Zero);
ensureInvalid();
AddStep("move back", () => tabletHandler.AreaOffset.Value = tabletHandler.AreaSize.Value / 2);
ensureValid();
}
private void ensureValid() => AddAssert("area valid", () => settings.AreaSelection.IsWithinBounds);
private void ensureInvalid() => AddAssert("area invalid", () => !settings.AreaSelection.IsWithinBounds);
public class TestTabletHandler : ITabletHandler public class TestTabletHandler : ITabletHandler
{ {
public Bindable<Vector2> AreaOffset { get; } = new Bindable<Vector2>(); public Bindable<Vector2> AreaOffset { get; } = new Bindable<Vector2>();

View File

@ -15,11 +15,6 @@ namespace osu.Game.Graphics.UserInterface
/// </summary> /// </summary>
public abstract class HoverSampleDebounceComponent : CompositeDrawable public abstract class HoverSampleDebounceComponent : CompositeDrawable
{ {
/// <summary>
/// Length of debounce for hover sound playback, in milliseconds.
/// </summary>
public double HoverDebounceTime { get; } = 20;
private Bindable<double?> lastPlaybackTime; private Bindable<double?> lastPlaybackTime;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -34,7 +29,7 @@ namespace osu.Game.Graphics.UserInterface
if (e.HasAnyButtonPressed) if (e.HasAnyButtonPressed)
return false; return false;
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= HoverDebounceTime; bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= OsuGameBase.SAMPLE_DEBOUNCE_TIME;
if (enoughTimePassedSinceLastPlayback) if (enoughTimePassedSinceLastPlayback)
{ {

View File

@ -6,7 +6,6 @@ using osu.Framework.Audio;
using osu.Framework.Audio.Sample; using osu.Framework.Audio.Sample;
using osu.Framework.Extensions; using osu.Framework.Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Framework.Utils; using osu.Framework.Utils;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
@ -28,7 +27,7 @@ namespace osu.Game.Graphics.UserInterface
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, SessionStatics statics) private void load(AudioManager audio)
{ {
sampleHover = audio.Samples.Get($@"UI/{SampleSet.GetDescription()}-hover") sampleHover = audio.Samples.Get($@"UI/{SampleSet.GetDescription()}-hover")
?? audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-hover"); ?? audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-hover");

View File

@ -46,52 +46,53 @@ namespace osu.Game.Input
} }
/// <summary> /// <summary>
/// Register a new type of <see cref="KeyBindingContainer{T}"/>, adding default bindings from <see cref="KeyBindingContainer.DefaultKeyBindings"/>. /// Register all defaults for this store.
/// </summary> /// </summary>
/// <param name="container">The container to populate defaults from.</param> /// <param name="container">The container to populate defaults from.</param>
public void Register(KeyBindingContainer container) => insertDefaults(container.DefaultKeyBindings); /// <param name="rulesets">The rulesets to populate defaults from.</param>
public void Register(KeyBindingContainer container, IEnumerable<RulesetInfo> rulesets)
/// <summary>
/// Register a ruleset, adding default bindings for each of its variants.
/// </summary>
/// <param name="ruleset">The ruleset to populate defaults from.</param>
public void Register(RulesetInfo ruleset)
{
var instance = ruleset.CreateInstance();
foreach (var variant in instance.AvailableVariants)
insertDefaults(instance.GetDefaultKeyBindings(variant), ruleset.ID, variant);
}
private void insertDefaults(IEnumerable<IKeyBinding> defaults, int? rulesetId = null, int? variant = null)
{ {
using (var usage = realmFactory.GetForWrite()) using (var usage = realmFactory.GetForWrite())
{ {
// compare counts in database vs defaults // intentionally flattened to a list rather than querying against the IQueryable, as nullable fields being queried against aren't indexed.
foreach (var defaultsForAction in defaults.GroupBy(k => k.Action)) // this is much faster as a result.
var existingBindings = usage.Realm.All<RealmKeyBinding>().ToList();
insertDefaults(usage, existingBindings, container.DefaultKeyBindings);
foreach (var ruleset in rulesets)
{ {
int existingCount = usage.Realm.All<RealmKeyBinding>().Count(k => k.RulesetID == rulesetId && k.Variant == variant && k.ActionInt == (int)defaultsForAction.Key); var instance = ruleset.CreateInstance();
foreach (var variant in instance.AvailableVariants)
if (defaultsForAction.Count() <= existingCount) insertDefaults(usage, existingBindings, instance.GetDefaultKeyBindings(variant), ruleset.ID, variant);
continue;
foreach (var k in defaultsForAction.Skip(existingCount))
{
// insert any defaults which are missing.
usage.Realm.Add(new RealmKeyBinding
{
KeyCombinationString = k.KeyCombination.ToString(),
ActionInt = (int)k.Action,
RulesetID = rulesetId,
Variant = variant
});
}
} }
usage.Commit(); usage.Commit();
} }
} }
private void insertDefaults(RealmContextFactory.RealmUsage usage, List<RealmKeyBinding> existingBindings, IEnumerable<IKeyBinding> defaults, int? rulesetId = null, int? variant = null)
{
// compare counts in database vs defaults for each action type.
foreach (var defaultsForAction in defaults.GroupBy(k => k.Action))
{
// avoid performing redundant queries when the database is empty and needs to be re-filled.
int existingCount = existingBindings.Count(k => k.RulesetID == rulesetId && k.Variant == variant && k.ActionInt == (int)defaultsForAction.Key);
if (defaultsForAction.Count() <= existingCount)
continue;
// insert any defaults which are missing.
usage.Realm.Add(defaultsForAction.Skip(existingCount).Select(k => new RealmKeyBinding
{
KeyCombinationString = k.KeyCombination.ToString(),
ActionInt = (int)k.Action,
RulesetID = rulesetId,
Variant = variant
}));
}
}
/// <summary> /// <summary>
/// Keys which should not be allowed for gameplay input purposes. /// Keys which should not be allowed for gameplay input purposes.
/// </summary> /// </summary>

View File

@ -8,15 +8,47 @@ namespace osu.Game.Online.API.Requests
{ {
public class GetUserRequest : APIRequest<User> public class GetUserRequest : APIRequest<User>
{ {
private readonly long? userId; private readonly string lookup;
public readonly RulesetInfo Ruleset; public readonly RulesetInfo Ruleset;
private readonly LookupType lookupType;
/// <summary>
/// Gets the currently logged-in user.
/// </summary>
public GetUserRequest()
{
}
/// <summary>
/// Gets a user from their ID.
/// </summary>
/// <param name="userId">The user to get.</param>
/// <param name="ruleset">The ruleset to get the user's info for.</param>
public GetUserRequest(long? userId = null, RulesetInfo ruleset = null) public GetUserRequest(long? userId = null, RulesetInfo ruleset = null)
{ {
this.userId = userId; lookup = userId.ToString();
lookupType = LookupType.Id;
Ruleset = ruleset; Ruleset = ruleset;
} }
protected override string Target => userId.HasValue ? $@"users/{userId}/{Ruleset?.ShortName}" : $@"me/{Ruleset?.ShortName}"; /// <summary>
/// Gets a user from their username.
/// </summary>
/// <param name="username">The user to get.</param>
/// <param name="ruleset">The ruleset to get the user's info for.</param>
public GetUserRequest(string username = null, RulesetInfo ruleset = null)
{
lookup = username;
lookupType = LookupType.Username;
Ruleset = ruleset;
}
protected override string Target => lookup != null ? $@"users/{lookup}/{Ruleset?.ShortName}?k={lookupType.ToString().ToLower()}" : $@"me/{Ruleset?.ShortName}";
private enum LookupType
{
Id,
Username
}
} }
} }

View File

@ -333,6 +333,9 @@ namespace osu.Game
case LinkAction.OpenUserProfile: case LinkAction.OpenUserProfile:
if (int.TryParse(link.Argument, out int userId)) if (int.TryParse(link.Argument, out int userId))
ShowUser(userId); ShowUser(userId);
else
ShowUser(link.Argument);
break; break;
case LinkAction.OpenWiki: case LinkAction.OpenWiki:
@ -380,6 +383,12 @@ namespace osu.Game
/// <param name="userId">The user to display.</param> /// <param name="userId">The user to display.</param>
public void ShowUser(int userId) => waitForReady(() => userProfile, _ => userProfile.ShowUser(userId)); public void ShowUser(int userId) => waitForReady(() => userProfile, _ => userProfile.ShowUser(userId));
/// <summary>
/// Show a user's profile as an overlay.
/// </summary>
/// <param name="username">The user to display.</param>
public void ShowUser(string username) => waitForReady(() => userProfile, _ => userProfile.ShowUser(username));
/// <summary> /// <summary>
/// Show a beatmap's set as an overlay, displaying the given beatmap. /// Show a beatmap's set as an overlay, displaying the given beatmap.
/// </summary> /// </summary>

View File

@ -56,6 +56,11 @@ namespace osu.Game
public const int SAMPLE_CONCURRENCY = 6; public const int SAMPLE_CONCURRENCY = 6;
/// <summary>
/// Length of debounce (in milliseconds) for commonly occuring sample playbacks that could stack.
/// </summary>
public const int SAMPLE_DEBOUNCE_TIME = 20;
/// <summary> /// <summary>
/// The maximum volume at which audio tracks should playback. This can be set lower than 1 to create some head-room for sound effects. /// The maximum volume at which audio tracks should playback. This can be set lower than 1 to create some head-room for sound effects.
/// </summary> /// </summary>
@ -200,31 +205,7 @@ namespace osu.Game
dependencies.CacheAs(this); dependencies.CacheAs(this);
dependencies.CacheAs(LocalConfig); dependencies.CacheAs(LocalConfig);
AddFont(Resources, @"Fonts/osuFont"); InitialiseFonts();
AddFont(Resources, @"Fonts/Torus/Torus-Regular");
AddFont(Resources, @"Fonts/Torus/Torus-Light");
AddFont(Resources, @"Fonts/Torus/Torus-SemiBold");
AddFont(Resources, @"Fonts/Torus/Torus-Bold");
AddFont(Resources, @"Fonts/Inter/Inter-Regular");
AddFont(Resources, @"Fonts/Inter/Inter-RegularItalic");
AddFont(Resources, @"Fonts/Inter/Inter-Light");
AddFont(Resources, @"Fonts/Inter/Inter-LightItalic");
AddFont(Resources, @"Fonts/Inter/Inter-SemiBold");
AddFont(Resources, @"Fonts/Inter/Inter-SemiBoldItalic");
AddFont(Resources, @"Fonts/Inter/Inter-Bold");
AddFont(Resources, @"Fonts/Inter/Inter-BoldItalic");
AddFont(Resources, @"Fonts/Noto/Noto-Basic");
AddFont(Resources, @"Fonts/Noto/Noto-Hangul");
AddFont(Resources, @"Fonts/Noto/Noto-CJK-Basic");
AddFont(Resources, @"Fonts/Noto/Noto-CJK-Compatibility");
AddFont(Resources, @"Fonts/Noto/Noto-Thai");
AddFont(Resources, @"Fonts/Venera/Venera-Light");
AddFont(Resources, @"Fonts/Venera/Venera-Bold");
AddFont(Resources, @"Fonts/Venera/Venera-Black");
Audio.Samples.PlaybackConcurrency = SAMPLE_CONCURRENCY; Audio.Samples.PlaybackConcurrency = SAMPLE_CONCURRENCY;
@ -346,10 +327,7 @@ namespace osu.Game
base.Content.Add(CreateScalingContainer().WithChildren(mainContent)); base.Content.Add(CreateScalingContainer().WithChildren(mainContent));
KeyBindingStore = new RealmKeyBindingStore(realmFactory); KeyBindingStore = new RealmKeyBindingStore(realmFactory);
KeyBindingStore.Register(globalBindings); KeyBindingStore.Register(globalBindings, RulesetStore.AvailableRulesets);
foreach (var r in RulesetStore.AvailableRulesets)
KeyBindingStore.Register(r);
dependencies.Cache(globalBindings); dependencies.Cache(globalBindings);
@ -363,6 +341,35 @@ namespace osu.Game
Ruleset.BindValueChanged(onRulesetChanged); Ruleset.BindValueChanged(onRulesetChanged);
} }
protected virtual void InitialiseFonts()
{
AddFont(Resources, @"Fonts/osuFont");
AddFont(Resources, @"Fonts/Torus/Torus-Regular");
AddFont(Resources, @"Fonts/Torus/Torus-Light");
AddFont(Resources, @"Fonts/Torus/Torus-SemiBold");
AddFont(Resources, @"Fonts/Torus/Torus-Bold");
AddFont(Resources, @"Fonts/Inter/Inter-Regular");
AddFont(Resources, @"Fonts/Inter/Inter-RegularItalic");
AddFont(Resources, @"Fonts/Inter/Inter-Light");
AddFont(Resources, @"Fonts/Inter/Inter-LightItalic");
AddFont(Resources, @"Fonts/Inter/Inter-SemiBold");
AddFont(Resources, @"Fonts/Inter/Inter-SemiBoldItalic");
AddFont(Resources, @"Fonts/Inter/Inter-Bold");
AddFont(Resources, @"Fonts/Inter/Inter-BoldItalic");
AddFont(Resources, @"Fonts/Noto/Noto-Basic");
AddFont(Resources, @"Fonts/Noto/Noto-Hangul");
AddFont(Resources, @"Fonts/Noto/Noto-CJK-Basic");
AddFont(Resources, @"Fonts/Noto/Noto-CJK-Compatibility");
AddFont(Resources, @"Fonts/Noto/Noto-Thai");
AddFont(Resources, @"Fonts/Venera/Venera-Light");
AddFont(Resources, @"Fonts/Venera/Venera-Bold");
AddFont(Resources, @"Fonts/Venera/Venera-Black");
}
private IDisposable blocking; private IDisposable blocking;
private void updateThreadStateChanged(ValueChangedEvent<GameThreadState> state) private void updateThreadStateChanged(ValueChangedEvent<GameThreadState> state)

View File

@ -9,6 +9,7 @@ using osu.Game.Overlays.Notifications;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Framework.Threading; using osu.Framework.Threading;
@ -29,6 +30,9 @@ namespace osu.Game.Overlays
private FlowContainer<NotificationSection> sections; private FlowContainer<NotificationSection> sections;
[Resolved]
private AudioManager audio { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -98,14 +102,18 @@ namespace osu.Game.Overlays
private int runningDepth; private int runningDepth;
private void notificationClosed() => updateCounts();
private readonly Scheduler postScheduler = new Scheduler(); private readonly Scheduler postScheduler = new Scheduler();
public override bool IsPresent => base.IsPresent || postScheduler.HasPendingTasks; public override bool IsPresent => base.IsPresent || postScheduler.HasPendingTasks;
private bool processingPosts = true; private bool processingPosts = true;
private double? lastSamplePlayback;
/// <summary>
/// Post a new notification for display.
/// </summary>
/// <param name="notification">The notification to display.</param>
public void Post(Notification notification) => postScheduler.Add(() => public void Post(Notification notification) => postScheduler.Add(() =>
{ {
++runningDepth; ++runningDepth;
@ -124,11 +132,13 @@ namespace osu.Game.Overlays
Show(); Show();
updateCounts(); updateCounts();
playDebouncedSample(notification.PopInSampleName);
}); });
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
if (processingPosts) if (processingPosts)
postScheduler.Update(); postScheduler.Update();
} }
@ -151,6 +161,24 @@ namespace osu.Game.Overlays
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint); this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
} }
private void notificationClosed()
{
updateCounts();
// this debounce is currently shared between popin/popout sounds, which means one could potentially not play when the user is expecting it.
// popout is constant across all notification types, and should therefore be handled using playback concurrency instead, but seems broken at the moment.
playDebouncedSample("UI/overlay-pop-out");
}
private void playDebouncedSample(string sampleName)
{
if (lastSamplePlayback == null || Time.Current - lastSamplePlayback > OsuGameBase.SAMPLE_DEBOUNCE_TIME)
{
audio.Samples.Get(sampleName)?.Play();
lastSamplePlayback = Time.Current;
}
}
private void updateCounts() private void updateCounts()
{ {
UnreadCount.Value = sections.Select(c => c.UnreadCount).Sum(); UnreadCount.Value = sections.Select(c => c.UnreadCount).Sum();

View File

@ -3,20 +3,18 @@
using System; using System;
using osu.Framework.Allocation; 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.Colour; using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Effects;
using osu.Game.Graphics;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays.Notifications namespace osu.Game.Overlays.Notifications
{ {
@ -42,10 +40,7 @@ namespace osu.Game.Overlays.Notifications
/// </summary> /// </summary>
public virtual bool DisplayOnTop => true; public virtual bool DisplayOnTop => true;
private Sample samplePopIn; public virtual string PopInSampleName => "UI/notification-pop-in";
private Sample 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; protected NotificationLight Light;
private readonly CloseButton closeButton; private readonly CloseButton closeButton;
@ -114,7 +109,7 @@ namespace osu.Game.Overlays.Notifications
closeButton = new CloseButton closeButton = new CloseButton
{ {
Alpha = 0, Alpha = 0,
Action = () => Close(), Action = Close,
Anchor = Anchor.CentreRight, Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight, Origin = Anchor.CentreRight,
Margin = new MarginPadding Margin = new MarginPadding
@ -127,13 +122,6 @@ 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) protected override bool OnHover(HoverEvent e)
{ {
closeButton.FadeIn(75); closeButton.FadeIn(75);
@ -158,8 +146,6 @@ namespace osu.Game.Overlays.Notifications
{ {
base.LoadComplete(); base.LoadComplete();
samplePopIn?.Play();
this.FadeInFromZero(200); this.FadeInFromZero(200);
NotificationContent.MoveToX(DrawSize.X); NotificationContent.MoveToX(DrawSize.X);
NotificationContent.MoveToX(0, 500, Easing.OutQuint); NotificationContent.MoveToX(0, 500, Easing.OutQuint);
@ -167,15 +153,12 @@ namespace osu.Game.Overlays.Notifications
public bool WasClosed; public bool WasClosed;
public virtual void Close(bool playSound = true) public virtual void Close()
{ {
if (WasClosed) return; if (WasClosed) return;
WasClosed = true; WasClosed = true;
if (playSound)
samplePopOut?.Play();
Closed?.Invoke(); Closed?.Invoke();
this.FadeOut(100); this.FadeOut(100);
Expire(); Expire();

View File

@ -110,12 +110,7 @@ namespace osu.Game.Overlays.Notifications
private void clearAll() private void clearAll()
{ {
bool first = true; notifications.Children.ForEach(c => c.Close());
notifications.Children.ForEach(c =>
{
c.Close(first);
first = false;
});
} }
protected override void Update() protected override void Update()

View File

@ -150,12 +150,12 @@ namespace osu.Game.Overlays.Notifications
colourCancelled = colours.Red; colourCancelled = colours.Red;
} }
public override void Close(bool playSound = true) public override void Close()
{ {
switch (State) switch (State)
{ {
case ProgressNotificationState.Cancelled: case ProgressNotificationState.Cancelled:
base.Close(playSound); base.Close();
break; break;
case ProgressNotificationState.Active: case ProgressNotificationState.Active:

View File

@ -7,7 +7,7 @@ namespace osu.Game.Overlays.Notifications
{ {
public class SimpleErrorNotification : SimpleNotification public class SimpleErrorNotification : SimpleNotification
{ {
protected override string PopInSampleName => "UI/error-notification-pop-in"; public override string PopInSampleName => "UI/error-notification-pop-in";
public SimpleErrorNotification() public SimpleErrorNotification()
{ {

View File

@ -4,10 +4,13 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.MatrixExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Handlers.Tablet; using osu.Framework.Input.Handlers.Tablet;
using osu.Framework.Utils;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osuTK; using osuTK;
@ -17,6 +20,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{ {
public class TabletAreaSelection : CompositeDrawable public class TabletAreaSelection : CompositeDrawable
{ {
public bool IsWithinBounds { get; private set; }
private readonly ITabletHandler handler; private readonly ITabletHandler handler;
private Container tabletContainer; private Container tabletContainer;
@ -109,29 +114,30 @@ namespace osu.Game.Overlays.Settings.Sections.Input
areaOffset.BindTo(handler.AreaOffset); areaOffset.BindTo(handler.AreaOffset);
areaOffset.BindValueChanged(val => areaOffset.BindValueChanged(val =>
{ {
usableAreaContainer.MoveTo(val.NewValue, 100, Easing.OutQuint) usableAreaContainer.MoveTo(val.NewValue, 100, Easing.OutQuint);
.OnComplete(_ => checkBounds()); // required as we are using SSDQ. checkBounds();
}, true); }, true);
areaSize.BindTo(handler.AreaSize); areaSize.BindTo(handler.AreaSize);
areaSize.BindValueChanged(val => areaSize.BindValueChanged(val =>
{ {
usableAreaContainer.ResizeTo(val.NewValue, 100, Easing.OutQuint) usableAreaContainer.ResizeTo(val.NewValue, 100, Easing.OutQuint);
.OnComplete(_ => checkBounds()); // required as we are using SSDQ.
int x = (int)val.NewValue.X; int x = (int)val.NewValue.X;
int y = (int)val.NewValue.Y; int y = (int)val.NewValue.Y;
int commonDivider = greatestCommonDivider(x, y); int commonDivider = greatestCommonDivider(x, y);
usableAreaText.Text = $"{(float)x / commonDivider}:{(float)y / commonDivider}"; usableAreaText.Text = $"{(float)x / commonDivider}:{(float)y / commonDivider}";
checkBounds();
}, true); }, true);
rotation.BindTo(handler.Rotation); rotation.BindTo(handler.Rotation);
rotation.BindValueChanged(val => rotation.BindValueChanged(val =>
{ {
usableAreaContainer.RotateTo(val.NewValue, 100, Easing.OutQuint);
tabletContainer.RotateTo(-val.NewValue, 800, Easing.OutQuint); tabletContainer.RotateTo(-val.NewValue, 800, Easing.OutQuint);
usableAreaContainer.RotateTo(val.NewValue, 100, Easing.OutQuint)
.OnComplete(_ => checkBounds()); // required as we are using SSDQ. checkBounds();
}, true); }, true);
tablet.BindTo(handler.Tablet); tablet.BindTo(handler.Tablet);
@ -169,12 +175,35 @@ namespace osu.Game.Overlays.Settings.Sections.Input
if (tablet.Value == null) if (tablet.Value == null)
return; return;
var usableSsdq = usableAreaContainer.ScreenSpaceDrawQuad; // allow for some degree of floating point error, as we don't care about being perfect here.
const float lenience = 0.5f;
bool isWithinBounds = tabletContainer.ScreenSpaceDrawQuad.Contains(usableSsdq.TopLeft + new Vector2(1)) && var tabletArea = new Quad(-lenience, -lenience, tablet.Value.Size.X + lenience * 2, tablet.Value.Size.Y + lenience * 2);
tabletContainer.ScreenSpaceDrawQuad.Contains(usableSsdq.BottomRight - new Vector2(1));
usableFill.FadeColour(isWithinBounds ? colour.Blue : colour.RedLight, 100); var halfUsableArea = areaSize.Value / 2;
var offset = areaOffset.Value;
var usableAreaQuad = new Quad(
new Vector2(-halfUsableArea.X, -halfUsableArea.Y),
new Vector2(halfUsableArea.X, -halfUsableArea.Y),
new Vector2(-halfUsableArea.X, halfUsableArea.Y),
new Vector2(halfUsableArea.X, halfUsableArea.Y)
);
var matrix = Matrix3.Identity;
MatrixExtensions.TranslateFromLeft(ref matrix, offset);
MatrixExtensions.RotateFromLeft(ref matrix, MathUtils.DegreesToRadians(rotation.Value));
usableAreaQuad *= matrix;
IsWithinBounds =
tabletArea.Contains(usableAreaQuad.TopLeft) &&
tabletArea.Contains(usableAreaQuad.TopRight) &&
tabletArea.Contains(usableAreaQuad.BottomLeft) &&
tabletArea.Contains(usableAreaQuad.BottomRight);
usableFill.FadeColour(IsWithinBounds ? colour.Blue : colour.RedLight, 100);
} }
protected override void Update() protected override void Update()

View File

@ -20,6 +20,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{ {
public class TabletSettings : SettingsSubsection public class TabletSettings : SettingsSubsection
{ {
public TabletAreaSelection AreaSelection { get; private set; }
private readonly ITabletHandler tabletHandler; private readonly ITabletHandler tabletHandler;
private readonly Bindable<bool> enabled = new BindableBool(true); private readonly Bindable<bool> enabled = new BindableBool(true);
@ -121,7 +123,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
new TabletAreaSelection(tabletHandler) AreaSelection = new TabletAreaSelection(tabletHandler)
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 300, Height = 300,

View File

@ -40,6 +40,8 @@ namespace osu.Game.Overlays
public void ShowUser(int userId) => ShowUser(new User { Id = userId }); public void ShowUser(int userId) => ShowUser(new User { Id = userId });
public void ShowUser(string username) => ShowUser(new User { Username = username });
public void ShowUser(User user, bool fetchOnline = true) public void ShowUser(User user, bool fetchOnline = true)
{ {
if (user == User.SYSTEM_USER) if (user == User.SYSTEM_USER)
@ -116,7 +118,7 @@ namespace osu.Game.Overlays
if (fetchOnline) if (fetchOnline)
{ {
userReq = new GetUserRequest(user.Id); userReq = user.Id > 1 ? new GetUserRequest(user.Id) : new GetUserRequest(user.Username);
userReq.Success += userLoadComplete; userReq.Success += userLoadComplete;
API.Queue(userReq); API.Queue(userReq);
} }

View File

@ -28,6 +28,7 @@ using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Extensions; using osu.Game.Extensions;
using osu.Game.Rulesets.Filter; using osu.Game.Rulesets.Filter;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Ranking.Statistics; using osu.Game.Screens.Ranking.Statistics;
namespace osu.Game.Rulesets namespace osu.Game.Rulesets
@ -315,5 +316,11 @@ namespace osu.Game.Rulesets
/// </summary> /// </summary>
[CanBeNull] [CanBeNull]
public virtual IRulesetFilterCriteria CreateRulesetFilterCriteria() => null; public virtual IRulesetFilterCriteria CreateRulesetFilterCriteria() => null;
/// <summary>
/// Can be overridden to add a ruleset-specific section to the editor beatmap setup screen.
/// </summary>
[CanBeNull]
public virtual RulesetSetupSection CreateEditorSetupSection() => null;
} }
} }

View File

@ -17,15 +17,21 @@ namespace osu.Game.Screens
Origin = Anchor.Centre; Origin = Anchor.Centre;
} }
public void Push(BackgroundScreen screen) /// <summary>
/// Attempt to push a new background screen to this stack.
/// </summary>
/// <param name="screen">The screen to attempt to push.</param>
/// <returns>Whether the push succeeded. For example, if the existing screen was already of the correct type this will return <c>false</c>.</returns>
public bool Push(BackgroundScreen screen)
{ {
if (screen == null) if (screen == null)
return; return false;
if (EqualityComparer<BackgroundScreen>.Default.Equals((BackgroundScreen)CurrentScreen, screen)) if (EqualityComparer<BackgroundScreen>.Default.Equals((BackgroundScreen)CurrentScreen, screen))
return; return false;
base.Push(screen); base.Push(screen);
return true;
} }
} }
} }

View File

@ -0,0 +1,20 @@
// 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.Localisation;
using osu.Game.Rulesets;
namespace osu.Game.Screens.Edit.Setup
{
public abstract class RulesetSetupSection : SetupSection
{
public sealed override LocalisableString Title => $"Ruleset ({rulesetInfo.Name})";
private readonly RulesetInfo rulesetInfo;
protected RulesetSetupSection(RulesetInfo rulesetInfo)
{
this.rulesetInfo = rulesetInfo;
}
}
}

View File

@ -1,6 +1,7 @@
// 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.
using System.Collections.Generic;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
@ -10,7 +11,7 @@ namespace osu.Game.Screens.Edit.Setup
public class SetupScreen : EditorRoundedScreen public class SetupScreen : EditorRoundedScreen
{ {
[Cached] [Cached]
private SectionsContainer<SetupSection> sections = new SectionsContainer<SetupSection>(); private SectionsContainer<SetupSection> sections { get; } = new SetupScreenSectionsContainer();
[Cached] [Cached]
private SetupScreenHeader header = new SetupScreenHeader(); private SetupScreenHeader header = new SetupScreenHeader();
@ -21,24 +22,27 @@ namespace osu.Game.Screens.Edit.Setup
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(EditorBeatmap beatmap)
{ {
AddRange(new Drawable[] var sectionsEnumerable = new List<SetupSection>
{ {
sections = new SetupScreenSectionsContainer new ResourcesSection(),
{ new MetadataSection(),
FixedHeader = header, new DifficultySection(),
RelativeSizeAxes = Axes.Both, new ColoursSection(),
Children = new SetupSection[] new DesignSection(),
{ };
new ResourcesSection(),
new MetadataSection(), var rulesetSpecificSection = beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateEditorSetupSection();
new DifficultySection(), if (rulesetSpecificSection != null)
new ColoursSection(), sectionsEnumerable.Add(rulesetSpecificSection);
new DesignSection(),
} Add(sections.With(s =>
}, {
}); s.RelativeSizeAxes = Axes.Both;
s.ChildrenEnumerable = sectionsEnumerable;
s.FixedHeader = header;
}));
} }
private class SetupScreenSectionsContainer : SectionsContainer<SetupSection> private class SetupScreenSectionsContainer : SectionsContainer<SetupSection>

View File

@ -12,9 +12,9 @@ using osuTK;
namespace osu.Game.Screens.Edit.Setup namespace osu.Game.Screens.Edit.Setup
{ {
internal abstract class SetupSection : Container public abstract class SetupSection : Container
{ {
private readonly FillFlowContainer flow; private FillFlowContainer flow;
/// <summary> /// <summary>
/// Used to align some of the child <see cref="LabelledDrawable{T}"/>s together to achieve a grid-like look. /// Used to align some of the child <see cref="LabelledDrawable{T}"/>s together to achieve a grid-like look.
@ -31,7 +31,8 @@ namespace osu.Game.Screens.Edit.Setup
public abstract LocalisableString Title { get; } public abstract LocalisableString Title { get; }
protected SetupSection() [BackgroundDependencyLoader]
private void load()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;

View File

@ -186,17 +186,14 @@ namespace osu.Game.Screens
{ {
applyArrivingDefaults(false); applyArrivingDefaults(false);
backgroundStack?.Push(ownedBackground = CreateBackground()); if (backgroundStack?.Push(ownedBackground = CreateBackground()) != true)
background = backgroundStack?.CurrentScreen as BackgroundScreen;
if (background != ownedBackground)
{ {
// background may have not been replaced, at which point we don't want to track the background lifetime. // If the constructed instance was not actually pushed to the background stack, we don't want to track it unnecessarily.
ownedBackground?.Dispose(); ownedBackground?.Dispose();
ownedBackground = null; ownedBackground = null;
} }
background = backgroundStack?.CurrentScreen as BackgroundScreen;
base.OnEntering(last); base.OnEntering(last);
} }

View File

@ -367,6 +367,11 @@ namespace osu.Game.Tests.Visual
Add(runner = new TestSceneTestRunner.TestRunner()); Add(runner = new TestSceneTestRunner.TestRunner());
} }
protected override void InitialiseFonts()
{
// skip fonts load as it's not required for testing purposes.
}
public void RunTestBlocking(TestScene test) => runner.RunTestBlocking(test); public void RunTestBlocking(TestScene test) => runner.RunTestBlocking(test);
} }
} }

View File

@ -37,7 +37,7 @@
</PackageReference> </PackageReference>
<PackageReference Include="Realm" Version="10.3.0" /> <PackageReference Include="Realm" Version="10.3.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.830.0" /> <PackageReference Include="ppy.osu.Framework" Version="2021.830.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.827.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2021.907.0" />
<PackageReference Include="Sentry" Version="3.9.0" /> <PackageReference Include="Sentry" Version="3.9.0" />
<PackageReference Include="SharpCompress" Version="0.28.3" /> <PackageReference Include="SharpCompress" Version="0.28.3" />
<PackageReference Include="NUnit" Version="3.13.2" /> <PackageReference Include="NUnit" Version="3.13.2" />

View File

@ -71,7 +71,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.830.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2021.830.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.827.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2021.907.0" />
</ItemGroup> </ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) --> <!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
<PropertyGroup> <PropertyGroup>