1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-15 02:55:55 +08:00

Compare commits

...

439 Commits

300 changed files with 5665 additions and 2288 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
]
},
"ppy.localisationanalyser.tools": {
"version": "2023.1117.0",
"version": "2024.517.0",
"commands": [
"localisation"
]
+2 -1
View File
@@ -340,4 +340,5 @@ inspectcode
# Fody (pulled in by Realm) - schema file
FodyWeavers.xsd
.idea/.idea.osu.Desktop/.idea/misc.xml
.idea/.idea.osu.Desktop/.idea/misc.xml
.idea/.idea.osu.Android/.idea/deploymentTargetDropDown.xml
-1
View File
@@ -2,7 +2,6 @@
<Project>
<PropertyGroup Label="C#">
<LangVersion>12.0</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 17 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 KiB

After

Width:  |  Height:  |  Size: 438 KiB

+1 -1
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.509.0" />
</ItemGroup>
<PropertyGroup>
<!-- Fody does not handle Android build well, and warns when unchanged.
-76
View File
@@ -1,76 +0,0 @@
// 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.Android.Input;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Localisation;
using osu.Game.Overlays.Settings;
namespace osu.Android
{
public partial class AndroidJoystickSettings : SettingsSubsection
{
protected override LocalisableString Header => JoystickSettingsStrings.JoystickGamepad;
private readonly AndroidJoystickHandler joystickHandler;
private readonly Bindable<bool> enabled = new BindableBool(true);
private SettingsSlider<float> deadzoneSlider = null!;
private Bindable<float> handlerDeadzone = null!;
private Bindable<float> localDeadzone = null!;
public AndroidJoystickSettings(AndroidJoystickHandler joystickHandler)
{
this.joystickHandler = joystickHandler;
}
[BackgroundDependencyLoader]
private void load()
{
// use local bindable to avoid changing enabled state of game host's bindable.
handlerDeadzone = joystickHandler.DeadzoneThreshold.GetBoundCopy();
localDeadzone = handlerDeadzone.GetUnboundCopy();
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = CommonStrings.Enabled,
Current = enabled
},
deadzoneSlider = new SettingsSlider<float>
{
LabelText = JoystickSettingsStrings.DeadzoneThreshold,
KeyboardStep = 0.01f,
DisplayAsPercentage = true,
Current = localDeadzone,
},
};
}
protected override void LoadComplete()
{
base.LoadComplete();
enabled.BindTo(joystickHandler.Enabled);
enabled.BindValueChanged(e => deadzoneSlider.Current.Disabled = !e.NewValue, true);
handlerDeadzone.BindValueChanged(val =>
{
bool disabled = localDeadzone.Disabled;
localDeadzone.Disabled = false;
localDeadzone.Value = val.NewValue;
localDeadzone.Disabled = disabled;
}, true);
localDeadzone.BindValueChanged(val => handlerDeadzone.Value = val.NewValue);
}
}
}
-97
View File
@@ -1,97 +0,0 @@
// 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 Android.OS;
using osu.Framework.Allocation;
using osu.Framework.Android.Input;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Configuration;
using osu.Game.Localisation;
using osu.Game.Overlays.Settings;
using osu.Game.Overlays.Settings.Sections.Input;
namespace osu.Android
{
public partial class AndroidMouseSettings : SettingsSubsection
{
private readonly AndroidMouseHandler mouseHandler;
protected override LocalisableString Header => MouseSettingsStrings.Mouse;
private Bindable<double> handlerSensitivity = null!;
private Bindable<double> localSensitivity = null!;
private Bindable<bool> relativeMode = null!;
public AndroidMouseSettings(AndroidMouseHandler mouseHandler)
{
this.mouseHandler = mouseHandler;
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager osuConfig)
{
// use local bindable to avoid changing enabled state of game host's bindable.
handlerSensitivity = mouseHandler.Sensitivity.GetBoundCopy();
localSensitivity = handlerSensitivity.GetUnboundCopy();
relativeMode = mouseHandler.UseRelativeMode.GetBoundCopy();
// High precision/pointer capture is only available on Android 8.0 and up
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
{
AddRange(new Drawable[]
{
new SettingsCheckbox
{
LabelText = MouseSettingsStrings.HighPrecisionMouse,
TooltipText = MouseSettingsStrings.HighPrecisionMouseTooltip,
Current = relativeMode,
Keywords = new[] { @"raw", @"input", @"relative", @"cursor", @"captured", @"pointer" },
},
new MouseSettings.SensitivitySetting
{
LabelText = MouseSettingsStrings.CursorSensitivity,
Current = localSensitivity,
},
});
}
AddRange(new Drawable[]
{
new SettingsCheckbox
{
LabelText = MouseSettingsStrings.DisableMouseWheelVolumeAdjust,
TooltipText = MouseSettingsStrings.DisableMouseWheelVolumeAdjustTooltip,
Current = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableWheel),
},
new SettingsCheckbox
{
LabelText = MouseSettingsStrings.DisableClicksDuringGameplay,
Current = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableButtons),
},
});
}
protected override void LoadComplete()
{
base.LoadComplete();
relativeMode.BindValueChanged(relative => localSensitivity.Disabled = !relative.NewValue, true);
handlerSensitivity.BindValueChanged(val =>
{
bool disabled = localSensitivity.Disabled;
localSensitivity.Disabled = false;
localSensitivity.Value = val.NewValue;
localSensitivity.Disabled = disabled;
}, true);
localSensitivity.BindValueChanged(val => handlerSensitivity.Value = val.NewValue);
}
}
}
-22
View File
@@ -5,13 +5,9 @@ using System;
using Android.App;
using Microsoft.Maui.Devices;
using osu.Framework.Allocation;
using osu.Framework.Android.Input;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Input.Handlers;
using osu.Framework.Platform;
using osu.Game;
using osu.Game.Overlays.Settings;
using osu.Game.Overlays.Settings.Sections.Input;
using osu.Game.Updater;
using osu.Game.Utils;
@@ -88,24 +84,6 @@ namespace osu.Android
protected override BatteryInfo CreateBatteryInfo() => new AndroidBatteryInfo();
public override SettingsSubsection CreateSettingsSubsectionFor(InputHandler handler)
{
switch (handler)
{
case AndroidMouseHandler mh:
return new AndroidMouseSettings(mh);
case AndroidJoystickHandler jh:
return new AndroidJoystickSettings(jh);
case AndroidTouchHandler th:
return new TouchSettings(th);
default:
return base.CreateSettingsSubsectionFor(handler);
}
}
private class AndroidBatteryInfo : BatteryInfo
{
public override double? ChargeLevel => Battery.ChargeLevel;
+7 -23
View File
@@ -1,24 +1,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:pathData="M73.92,44.43C74.82,44.43 75.43,45.1 75.43,46.02V54.54C75.43,55.46 74.82,56.13 73.92,56.13C73,56.13 72.41,55.46 72.41,54.54V46.02C72.41,45.1 73,44.43 73.92,44.43ZM73.92,61.55C72.82,61.55 71.95,60.68 71.95,59.58C71.95,58.51 72.82,57.64 73.92,57.64C75.02,57.64 75.89,58.51 75.89,59.58C75.89,60.68 75.02,61.55 73.92,61.55Z"
android:fillColor="#000000"/>
<path
android:pathData="M68.41,48.55C69.33,48.55 69.92,49.22 69.92,50.11V55.77C69.92,59.94 67.35,61.55 64.22,61.55C61.08,61.55 58.5,59.94 58.5,55.77V50.11C58.5,49.22 59.09,48.55 60.01,48.55C60.91,48.55 61.52,49.22 61.52,50.11V55.56C61.52,57.84 62.48,58.74 64.22,58.74C65.94,58.74 66.9,57.84 66.9,55.56V50.11C66.9,49.22 67.51,48.55 68.41,48.55Z"
android:fillColor="#000000"/>
<path
android:pathData="M49.94,52.01C49.94,52.85 50.81,53.16 52.47,53.54C54.78,54.1 56.98,54.69 56.98,57.53C56.98,60.3 54.93,61.55 51.99,61.55C49.56,61.55 47.79,60.71 46.97,59.73C46.33,58.97 46.41,58.3 47.02,57.71C47.79,56.97 48.46,57.28 48.89,57.66C49.58,58.3 50.43,58.97 52.07,58.97C53.29,58.97 54.06,58.56 54.06,57.74C54.06,56.92 53.24,56.64 51.09,56.05C48.97,55.46 47.08,54.9 47.08,52.36C47.08,49.52 49.38,48.35 51.94,48.35C53.4,48.35 55.06,48.73 56.08,49.83C56.52,50.27 56.85,50.88 56.08,51.72C55.32,52.52 54.75,52.29 54.22,51.88C53.73,51.52 52.88,50.91 51.6,50.91C50.73,50.91 49.94,51.19 49.94,52.01Z"
android:fillColor="#000000"/>
<path
android:pathData="M38.79,61.55C34.9,61.55 32.11,58.74 32.11,54.95C32.11,51.14 34.9,48.35 38.79,48.35C42.68,48.35 45.47,51.14 45.47,54.95C45.47,58.74 42.68,61.55 38.79,61.55ZM38.79,58.74C41.04,58.74 42.45,57.1 42.45,54.95C42.45,52.8 41.04,51.14 38.79,51.14C36.54,51.14 35.13,52.8 35.13,54.95C35.13,57.1 36.54,58.74 38.79,58.74Z"
android:fillColor="#000000"/>
<path
android:pathData="M86,54C86,71.67 71.67,86 54,86C36.33,86 22,71.67 22,54C22,36.33 36.33,22 54,22C71.67,22 86,36.33 86,54ZM25.2,54C25.2,69.91 38.09,82.8 54,82.8C69.91,82.8 82.8,69.91 82.8,54C82.8,38.09 69.91,25.2 54,25.2C38.09,25.2 25.2,38.09 25.2,54Z"
android:fillColor="#000000"/>
<path
android:pathData="M36.78,54.99C36.78,56.09 37.65,56.96 38.75,56.96C39.85,56.96 40.72,56.09 40.72,54.99C40.72,53.91 39.85,53.04 38.75,53.04C37.65,53.04 36.78,53.91 36.78,54.99Z"
android:fillColor="#000000"/>
<vector android:height="108dp" android:viewportHeight="434"
android:viewportWidth="434" android:width="108dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#000000" android:pathData="M299.36,178.05C303.08,178.05 305.62,180.81 305.62,184.62V219.92C305.62,223.74 303.08,226.5 299.36,226.5C295.55,226.5 293.11,223.74 293.11,219.92V184.62C293.11,180.81 295.55,178.05 299.36,178.05ZM299.36,248.97C294.81,248.97 291.2,245.37 291.2,240.81C291.2,236.35 294.81,232.75 299.36,232.75C303.92,232.75 307.53,236.35 307.53,240.81C307.53,245.37 303.92,248.97 299.36,248.97Z"/>
<path android:fillColor="#000000" android:pathData="M276.52,195.12C280.34,195.12 282.77,197.87 282.77,201.58V225.01C282.77,242.29 272.12,248.97 259.19,248.97C246.15,248.97 235.49,242.29 235.49,225.01V201.58C235.49,197.87 237.93,195.12 241.75,195.12C245.46,195.12 248,197.87 248,201.58V224.16C248,233.6 251.98,237.31 259.19,237.31C266.29,237.31 270.27,233.6 270.27,224.16V201.58C270.27,197.87 272.81,195.12 276.52,195.12Z"/>
<path android:fillColor="#000000" android:pathData="M200.02,209.43C200.02,212.93 203.63,214.2 210.52,215.79C220.06,218.12 229.18,220.56 229.18,232.33C229.18,243.78 220.7,248.97 208.51,248.97C198.43,248.97 191.12,245.47 187.73,241.44C185.08,238.26 185.4,235.51 187.94,233.07C191.12,229.99 193.88,231.27 195.68,232.86C198.54,235.51 202.04,238.26 208.82,238.26C213.91,238.26 217.09,236.57 217.09,233.18C217.09,229.78 213.7,228.62 204.8,226.18C196,223.74 188.15,221.41 188.15,210.91C188.15,199.15 197.69,194.27 208.29,194.27C214.34,194.27 221.23,195.86 225.47,200.42C227.27,202.22 228.65,204.76 225.47,208.26C222.29,211.55 219.96,210.6 217.73,208.9C215.71,207.41 212.22,204.87 206.92,204.87C203.31,204.87 200.02,206.04 200.02,209.43Z"/>
<path android:fillColor="#000000" android:pathData="M153.74,248.97C138.46,248.97 127.5,237.27 127.5,221.53C127.5,205.68 138.46,194.09 153.74,194.09C169.03,194.09 179.99,205.68 179.99,221.53C179.99,237.27 169.03,248.97 153.74,248.97ZM153.74,237.27C162.59,237.27 168.12,230.46 168.12,221.53C168.12,212.6 162.59,205.68 153.74,205.68C144.89,205.68 139.36,212.6 139.36,221.53C139.36,230.46 144.89,237.27 153.74,237.27Z"/>
<path android:fillColor="#000000" android:pathData="M349,217.5C349,290.13 290.13,349 217.5,349C144.88,349 86,290.13 86,217.5C86,144.88 144.88,86 217.5,86C290.13,86 349,144.88 349,217.5ZM99.15,217.5C99.15,282.86 152.14,335.85 217.5,335.85C282.86,335.85 335.85,282.86 335.85,217.5C335.85,152.14 282.86,99.15 217.5,99.15C152.14,99.15 99.15,152.14 99.15,217.5Z"/>
</vector>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 49 KiB

+26 -8
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();
}
@@ -159,8 +164,8 @@ namespace osu.Desktop
// user activity
if (activity.Value != null)
{
presence.State = truncate(activity.Value.GetStatus(hideIdentifiableInformation));
presence.Details = truncate(activity.Value.GetDetails(hideIdentifiableInformation) ?? string.Empty);
presence.State = clampLength(activity.Value.GetStatus(hideIdentifiableInformation));
presence.Details = clampLength(activity.Value.GetDetails(hideIdentifiableInformation) ?? string.Empty);
if (getBeatmapID(activity.Value) is int beatmapId && beatmapId > 0)
{
@@ -205,7 +210,9 @@ namespace osu.Desktop
Password = room.Settings.Password,
};
presence.Secrets.JoinSecret = JsonConvert.SerializeObject(roomSecret);
if (client.HasRegisteredUriScheme)
presence.Secrets.JoinSecret = JsonConvert.SerializeObject(roomSecret);
// discord cannot handle both secrets and buttons at the same time, so we need to choose something.
// the multiplayer room seems more important.
presence.Buttons = null;
@@ -264,8 +271,19 @@ namespace osu.Desktop
private static readonly int ellipsis_length = Encoding.UTF8.GetByteCount(new[] { '…' });
private static string truncate(string str)
private static string clampLength(string str)
{
// Empty strings are fine to discord even though single-character strings are not. Make it make sense.
if (string.IsNullOrEmpty(str))
return str;
// As above, discord decides that *non-empty* strings shorter than 2 characters cannot possibly be valid input, because... reasons?
// And yes, that is two *characters*, or *codepoints*, not *bytes* as further down below (as determined by empirical testing).
// That seems very questionable, and isn't even documented anywhere. So to *make it* accept such valid input,
// just tack on enough of U+200B ZERO WIDTH SPACEs at the end.
if (str.Length < 2)
return str.PadRight(2, '\u200B');
if (Encoding.UTF8.GetByteCount(str) <= 128)
return str;
+6
View File
@@ -489,6 +489,7 @@ namespace osu.Desktop
public static uint Stride => (uint)Marshal.SizeOf(typeof(NvApplication)) | (2 << 16);
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
internal enum NvStatus
{
OK = 0, // Success. Request is completed.
@@ -611,6 +612,7 @@ namespace osu.Desktop
FIRMWARE_REVISION_NOT_SUPPORTED = -200, // The device's firmware is not supported.
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
internal enum NvSystemType
{
UNKNOWN = 0,
@@ -618,6 +620,7 @@ namespace osu.Desktop
DESKTOP = 2
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
internal enum NvGpuType
{
UNKNOWN = 0,
@@ -625,6 +628,7 @@ namespace osu.Desktop
DGPU = 2, // Discrete
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
internal enum NvSettingID : uint
{
OGL_AA_LINE_GAMMA_ID = 0x2089BF6C,
@@ -717,6 +721,7 @@ namespace osu.Desktop
INVALID_SETTING_ID = 0xFFFFFFFF
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
internal enum NvShimSetting : uint
{
SHIM_RENDERING_MODE_INTEGRATED = 0x00000000,
@@ -731,6 +736,7 @@ namespace osu.Desktop
SHIM_RENDERING_MODE_DEFAULT = SHIM_RENDERING_MODE_AUTO_SELECT
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
internal enum NvThreadControlSetting : uint
{
OGL_THREAD_CONTROL_ENABLE = 0x00000001,
+6 -5
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;
}
}
}
@@ -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)
+21 -12
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();
@@ -104,7 +107,13 @@ namespace osu.Desktop
}
}
using (DesktopGameHost host = Host.GetSuitableDesktopHost(gameName, new HostOptions { IPCPort = !tournamentClient ? OsuGame.IPC_PORT : null }))
var hostOptions = new HostOptions
{
IPCPort = !tournamentClient ? OsuGame.IPC_PORT : null,
FriendlyGameName = OsuGameBase.GAME_NAME,
};
using (DesktopGameHost host = Host.GetSuitableDesktopHost(gameName, hostOptions))
{
if (!host.IsPrimaryInstance)
{
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
@@ -163,6 +164,7 @@ namespace osu.Desktop.Windows
[DllImport("Shell32.dll")]
private static extern void SHChangeNotify(EventId wEventId, Flags uFlags, IntPtr dwItem1, IntPtr dwItem2);
[SuppressMessage("ReSharper", "InconsistentNaming")]
private enum EventId
{
/// <summary>
@@ -172,6 +174,7 @@ namespace osu.Desktop.Windows
SHCNE_ASSOCCHANGED = 0x08000000
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
private enum Flags : uint
{
SHCNF_IDLIST = 0x0000
Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

@@ -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();
}
}
@@ -0,0 +1,49 @@
// 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.Input;
using osu.Framework.Testing;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Mania.Tests
{
public partial class TestSceneManiaTouchInputArea : PlayerTestScene
{
protected override Ruleset CreatePlayerRuleset() => new ManiaRuleset();
[Test]
public void TestTouchAreaNotInitiallyVisible()
{
AddAssert("touch area not visible", () => getTouchOverlay()?.State.Value == Visibility.Hidden);
}
[Test]
public void TestPressReceptors()
{
AddAssert("touch area not visible", () => getTouchOverlay()?.State.Value == Visibility.Hidden);
for (int i = 0; i < 4; i++)
{
int index = i;
AddStep($"touch receptor {index}", () => InputManager.BeginTouch(new Touch(TouchSource.Touch1, getReceptor(index).ScreenSpaceDrawQuad.Centre)));
AddAssert("action sent",
() => this.ChildrenOfType<ManiaInputManager>().SelectMany(m => m.KeyBindingContainer.PressedActions),
() => Does.Contain(getReceptor(index).Action.Value));
AddStep($"release receptor {index}", () => InputManager.EndTouch(new Touch(TouchSource.Touch1, getReceptor(index).ScreenSpaceDrawQuad.Centre)));
AddAssert("touch area visible", () => getTouchOverlay()?.State.Value == Visibility.Visible);
}
}
private ManiaTouchInputArea? getTouchOverlay() => this.ChildrenOfType<ManiaTouchInputArea>().SingleOrDefault();
private ManiaTouchInputArea.ColumnInputReceptor getReceptor(int index) => this.ChildrenOfType<ManiaTouchInputArea.ColumnInputReceptor>().ElementAt(index);
}
}
@@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mania.Edit
{
}
public new ManiaPlayfield Playfield => ((ManiaPlayfield)drawableRuleset.Playfield);
public new ManiaPlayfield Playfield => drawableRuleset.Playfield;
public IScrollingInfo ScrollingInfo => drawableRuleset.ScrollingInfo;
@@ -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;
}
}
}
@@ -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
+1 -35
View File
@@ -93,8 +93,7 @@ namespace osu.Game.Rulesets.Mania.UI
// For input purposes, the background is added at the highest depth, but is then proxied back below all other elements externally
// (see `Stage.columnBackgrounds`).
BackgroundContainer,
TopLevelContainer,
new ColumnTouchInputArea(this)
TopLevelContainer
};
var background = new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.ColumnBackground), _ => new DefaultColumnBackground())
@@ -181,38 +180,5 @@ namespace osu.Game.Rulesets.Mania.UI
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
// This probably shouldn't exist as is, but the columns in the stage are separated by a 1px border
=> DrawRectangle.Inflate(new Vector2(Stage.COLUMN_SPACING / 2, 0)).Contains(ToLocalSpace(screenSpacePos));
public partial class ColumnTouchInputArea : Drawable
{
private readonly Column column;
[Resolved(canBeNull: true)]
private ManiaInputManager maniaInputManager { get; set; }
private KeyBindingContainer<ManiaAction> keyBindingContainer;
public ColumnTouchInputArea(Column column)
{
RelativeSizeAxes = Axes.Both;
this.column = column;
}
protected override void LoadComplete()
{
keyBindingContainer = maniaInputManager?.KeyBindingContainer;
}
protected override bool OnTouchDown(TouchDownEvent e)
{
keyBindingContainer?.TriggerPressed(column.Action.Value);
return true;
}
protected override void OnTouchUp(TouchUpEvent e)
{
keyBindingContainer?.TriggerReleased(column.Action.Value);
}
}
}
}
-36
View File
@@ -3,15 +3,12 @@
#nullable disable
using System;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Skinning;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Mania.UI
{
@@ -62,12 +59,6 @@ namespace osu.Game.Rulesets.Mania.UI
onSkinChanged();
}
protected override void LoadComplete()
{
base.LoadComplete();
updateMobileSizing();
}
private void onSkinChanged()
{
for (int i = 0; i < stageDefinition.Columns; i++)
@@ -92,8 +83,6 @@ namespace osu.Game.Rulesets.Mania.UI
columns[i].Width = width.Value;
}
updateMobileSizing();
}
/// <summary>
@@ -106,31 +95,6 @@ namespace osu.Game.Rulesets.Mania.UI
Content[column] = columns[column].Child = content;
}
private void updateMobileSizing()
{
if (!IsLoaded || !RuntimeInfo.IsMobile)
return;
// GridContainer+CellContainer containing this stage (gets split up for dual stages).
Vector2? containingCell = this.FindClosestParent<Stage>()?.Parent?.DrawSize;
// Will be null in tests.
if (containingCell == null)
return;
float aspectRatio = containingCell.Value.X / containingCell.Value.Y;
// 2.83 is a mostly arbitrary scale-up (170 / 60, based on original implementation for argon)
float mobileAdjust = 2.83f * Math.Min(1, 7f / stageDefinition.Columns);
// 1.92 is a "reference" mobile screen aspect ratio for phones.
// We should scale it back for cases like tablets which aren't so extreme.
mobileAdjust *= aspectRatio / 1.92f;
// Best effort until we have better mobile support.
for (int i = 0; i < stageDefinition.Columns; i++)
columns[i].Width *= mobileAdjust;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
@@ -31,6 +31,7 @@ using osu.Game.Skinning;
namespace osu.Game.Rulesets.Mania.UI
{
[Cached]
public partial class DrawableManiaRuleset : DrawableScrollingRuleset<ManiaHitObject>
{
/// <summary>
@@ -43,7 +44,7 @@ namespace osu.Game.Rulesets.Mania.UI
/// </summary>
public const double MAX_TIME_RANGE = 11485;
protected new ManiaPlayfield Playfield => (ManiaPlayfield)base.Playfield;
public new ManiaPlayfield Playfield => (ManiaPlayfield)base.Playfield;
public new ManiaBeatmap Beatmap => (ManiaBeatmap)base.Beatmap;
@@ -103,6 +104,8 @@ namespace osu.Game.Rulesets.Mania.UI
configScrollSpeed.BindValueChanged(speed => this.TransformTo(nameof(smoothTimeRange), ComputeScrollTime(speed.NewValue), 200, Easing.OutQuint));
TimeRange.Value = smoothTimeRange = ComputeScrollTime(configScrollSpeed.Value);
KeyBindingInputManager.Add(new ManiaTouchInputArea());
}
protected override void AdjustScrollSpeed(int amount) => configScrollSpeed.Value += amount;
@@ -0,0 +1,216 @@
// 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.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Configuration;
using osuTK;
namespace osu.Game.Rulesets.Mania.UI
{
/// <summary>
/// An overlay that captures and displays osu!mania mouse and touch input.
/// </summary>
public partial class ManiaTouchInputArea : VisibilityContainer
{
// visibility state affects our child. we always want to handle input.
public override bool PropagatePositionalInputSubTree => true;
public override bool PropagateNonPositionalInputSubTree => true;
[SettingSource("Spacing", "The spacing between receptors.")]
public BindableFloat Spacing { get; } = new BindableFloat(10)
{
Precision = 1,
MinValue = 0,
MaxValue = 100,
};
[SettingSource("Opacity", "The receptor opacity.")]
public BindableFloat Opacity { get; } = new BindableFloat(1)
{
Precision = 0.1f,
MinValue = 0,
MaxValue = 1
};
[Resolved]
private DrawableManiaRuleset drawableRuleset { get; set; } = null!;
private GridContainer gridContainer = null!;
public ManiaTouchInputArea()
{
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
RelativeSizeAxes = Axes.Both;
Height = 0.5f;
}
[BackgroundDependencyLoader]
private void load()
{
List<Drawable> receptorGridContent = new List<Drawable>();
List<Dimension> receptorGridDimensions = new List<Dimension>();
bool first = true;
foreach (var stage in drawableRuleset.Playfield.Stages)
{
foreach (var column in stage.Columns)
{
if (!first)
{
receptorGridContent.Add(new Gutter { Spacing = { BindTarget = Spacing } });
receptorGridDimensions.Add(new Dimension(GridSizeMode.AutoSize));
}
receptorGridContent.Add(new ColumnInputReceptor { Action = { BindTarget = column.Action } });
receptorGridDimensions.Add(new Dimension());
first = false;
}
}
InternalChild = gridContainer = new GridContainer
{
RelativeSizeAxes = Axes.Both,
AlwaysPresent = true,
Content = new[] { receptorGridContent.ToArray() },
ColumnDimensions = receptorGridDimensions.ToArray()
};
}
protected override void LoadComplete()
{
base.LoadComplete();
Opacity.BindValueChanged(o => Alpha = o.NewValue, true);
}
protected override bool OnKeyDown(KeyDownEvent e)
{
// Hide whenever the keyboard is used.
Hide();
return false;
}
protected override bool OnMouseDown(MouseDownEvent e)
{
Show();
return true;
}
protected override bool OnTouchDown(TouchDownEvent e)
{
Show();
return true;
}
protected override void PopIn()
{
gridContainer.FadeIn(500, Easing.OutQuint);
}
protected override void PopOut()
{
gridContainer.FadeOut(300);
}
public partial class ColumnInputReceptor : CompositeDrawable
{
public readonly IBindable<ManiaAction> Action = new Bindable<ManiaAction>();
private readonly Box highlightOverlay;
[Resolved]
private ManiaInputManager? inputManager { get; set; }
private bool isPressed;
public ColumnInputReceptor()
{
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 10,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.15f,
},
highlightOverlay = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
Blending = BlendingParameters.Additive,
}
}
}
};
}
protected override bool OnTouchDown(TouchDownEvent e)
{
updateButton(true);
return false; // handled by parent container to show overlay.
}
protected override void OnTouchUp(TouchUpEvent e)
{
updateButton(false);
}
protected override bool OnMouseDown(MouseDownEvent e)
{
updateButton(true);
return false; // handled by parent container to show overlay.
}
protected override void OnMouseUp(MouseUpEvent e)
{
updateButton(false);
}
private void updateButton(bool press)
{
if (press == isPressed)
return;
isPressed = press;
if (press)
{
inputManager?.KeyBindingContainer?.TriggerPressed(Action.Value);
highlightOverlay.FadeTo(0.1f, 80, Easing.OutQuint);
}
else
{
inputManager?.KeyBindingContainer?.TriggerReleased(Action.Value);
highlightOverlay.FadeTo(0, 400, Easing.OutQuint);
}
}
}
private partial class Gutter : Drawable
{
public readonly IBindable<float> Spacing = new Bindable<float>();
public Gutter()
{
Spacing.BindValueChanged(s => Size = new Vector2(s.NewValue));
}
}
}
}
@@ -5,6 +5,7 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
using osu.Game.Tests.Visual;
@@ -52,6 +53,65 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddUntilStep("distance snap grid visible", () => this.ChildrenOfType<OsuDistanceSnapGrid>().Any());
AddStep("release alt", () => InputManager.ReleaseKey(Key.AltLeft));
AddUntilStep("distance snap grid hidden", () => !this.ChildrenOfType<OsuDistanceSnapGrid>().Any());
AddStep("enable distance snap grid", () => InputManager.Key(Key.T));
AddUntilStep("distance snap grid visible", () => this.ChildrenOfType<OsuDistanceSnapGrid>().Any());
AddStep("hold alt", () => InputManager.PressKey(Key.AltLeft));
AddUntilStep("distance snap grid hidden", () => !this.ChildrenOfType<OsuDistanceSnapGrid>().Any());
AddStep("release alt", () => InputManager.ReleaseKey(Key.AltLeft));
AddUntilStep("distance snap grid visible", () => this.ChildrenOfType<OsuDistanceSnapGrid>().Any());
}
[Test]
public void TestDistanceSnapAdjustDoesNotHideTheGridIfStartingEnabled()
{
double distanceSnap = double.PositiveInfinity;
AddStep("enable distance snap grid", () => InputManager.Key(Key.T));
AddStep("select second object", () => EditorBeatmap.SelectedHitObjects.Add(EditorBeatmap.HitObjects.ElementAt(1)));
AddUntilStep("distance snap grid visible", () => this.ChildrenOfType<OsuDistanceSnapGrid>().Any());
AddStep("store distance snap", () => distanceSnap = this.ChildrenOfType<IDistanceSnapProvider>().First().DistanceSpacingMultiplier.Value);
AddStep("increase distance", () =>
{
InputManager.PressKey(Key.AltLeft);
InputManager.PressKey(Key.ControlLeft);
InputManager.ScrollVerticalBy(1);
InputManager.ReleaseKey(Key.ControlLeft);
InputManager.ReleaseKey(Key.AltLeft);
});
AddUntilStep("distance snap increased", () => this.ChildrenOfType<IDistanceSnapProvider>().First().DistanceSpacingMultiplier.Value, () => Is.GreaterThan(distanceSnap));
AddUntilStep("distance snap grid still visible", () => this.ChildrenOfType<OsuDistanceSnapGrid>().Any());
}
[Test]
public void TestDistanceSnapAdjustShowsGridMomentarilyIfStartingDisabled()
{
double distanceSnap = double.PositiveInfinity;
AddStep("select second object", () => EditorBeatmap.SelectedHitObjects.Add(EditorBeatmap.HitObjects.ElementAt(1)));
AddUntilStep("distance snap grid hidden", () => !this.ChildrenOfType<OsuDistanceSnapGrid>().Any());
AddStep("store distance snap", () => distanceSnap = this.ChildrenOfType<IDistanceSnapProvider>().First().DistanceSpacingMultiplier.Value);
AddStep("start increasing distance", () =>
{
InputManager.PressKey(Key.AltLeft);
InputManager.PressKey(Key.ControlLeft);
});
AddUntilStep("distance snap grid visible", () => this.ChildrenOfType<OsuDistanceSnapGrid>().Any());
AddStep("finish increasing distance", () =>
{
InputManager.ScrollVerticalBy(1);
InputManager.ReleaseKey(Key.ControlLeft);
InputManager.ReleaseKey(Key.AltLeft);
});
AddUntilStep("distance snap increased", () => this.ChildrenOfType<IDistanceSnapProvider>().First().DistanceSpacingMultiplier.Value, () => Is.GreaterThan(distanceSnap));
AddUntilStep("distance snap hidden in the end", () => !this.ChildrenOfType<OsuDistanceSnapGrid>().Any());
}
[Test]
@@ -30,23 +30,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
});
[Test]
public void TestAddOverlappingControlPoints()
{
createVisualiser(true);
addControlPointStep(new Vector2(200));
addControlPointStep(new Vector2(300));
addControlPointStep(new Vector2(300));
addControlPointStep(new Vector2(500, 300));
AddAssert("last connection displayed", () =>
{
var lastConnection = visualiser.Connections.Last(c => c.ControlPoint.Position == new Vector2(300));
return lastConnection.DrawWidth > 50;
});
}
[Test]
public void TestPerfectCurveTooManyPoints()
{
@@ -194,24 +177,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
addAssertPointPositionChanged(points, i);
}
[Test]
public void TestStackingUpdatesConnectionPosition()
{
createVisualiser(true);
Vector2 connectionPosition;
addControlPointStep(connectionPosition = new Vector2(300));
addControlPointStep(new Vector2(600));
// Apply a big number in stacking so the person running the test can clearly see if it fails
AddStep("apply stacking", () => slider.StackHeightBindable.Value += 10);
AddAssert($"Connection at {connectionPosition} changed",
() => visualiser.Connections[0].Position,
() => !Is.EqualTo(connectionPosition)
);
}
private void addAssertPointPositionChanged(Vector2[] points, int index)
{
AddAssert($"Point at {points.ElementAt(index)} changed",
@@ -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;
@@ -19,6 +19,7 @@ using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Configuration;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.Osu.UI.Cursor;
using osu.Game.Screens.Play.HUD;
using osu.Game.Tests.Visual;
@@ -578,6 +579,24 @@ namespace osu.Game.Rulesets.Osu.Tests
assertKeyCounter(1, 1);
}
[Test]
public void TestTouchJudgedCircle()
{
addHitCircleAt(TouchSource.Touch1);
addHitCircleAt(TouchSource.Touch2);
beginTouch(TouchSource.Touch1);
endTouch(TouchSource.Touch1);
// Hold the second touch (this becomes the primary touch).
beginTouch(TouchSource.Touch2);
// Touch again on the first circle.
// Because it's been judged, the cursor should not move here.
beginTouch(TouchSource.Touch1);
checkPosition(TouchSource.Touch2);
}
private void addHitCircleAt(TouchSource source)
{
AddStep($"Add circle at {source}", () =>
@@ -590,6 +609,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
Clock = new FramedClock(new ManualClock()),
Position = mainContent.ToLocalSpace(getSanePositionForSource(source)),
CheckHittable = (_, _, _) => ClickAction.Hit
});
});
}
@@ -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));
}
}
}
@@ -36,11 +36,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
while (rhythmStart < historicalNoteCount - 2 && current.StartTime - current.Previous(rhythmStart).StartTime < history_time_max)
rhythmStart++;
OsuDifficultyHitObject prevObj = (OsuDifficultyHitObject)current.Previous(rhythmStart);
OsuDifficultyHitObject lastObj = (OsuDifficultyHitObject)current.Previous(rhythmStart + 1);
for (int i = rhythmStart; i > 0; i--)
{
OsuDifficultyHitObject currObj = (OsuDifficultyHitObject)current.Previous(i - 1);
OsuDifficultyHitObject prevObj = (OsuDifficultyHitObject)current.Previous(i);
OsuDifficultyHitObject lastObj = (OsuDifficultyHitObject)current.Previous(i + 1);
double currHistoricalDecay = (history_time_max - (current.StartTime - currObj.StartTime)) / history_time_max; // scales note 0 to 1 from history to now
@@ -66,10 +67,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
}
else
{
if (current.Previous(i - 1).BaseObject is Slider) // bpm change is into slider, this is easy acc window
if (currObj.BaseObject is Slider) // bpm change is into slider, this is easy acc window
effectiveRatio *= 0.125;
if (current.Previous(i).BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle
if (prevObj.BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle
effectiveRatio *= 0.25;
if (previousIslandSize == islandSize) // repeated island size (ex: triplet -> triplet)
@@ -100,6 +101,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
startRatio = effectiveRatio;
islandSize = 1;
}
lastObj = prevObj;
prevObj = currObj;
}
return Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier) / 2; //produces multiplier that can be applied to strain. range [1, infinity) (not really though)
@@ -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))
@@ -4,10 +4,7 @@
#nullable disable
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Lines;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
using osuTK;
@@ -15,36 +12,21 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
/// <summary>
/// A visualisation of the line between two <see cref="PathControlPointPiece{T}"/>s.
/// A visualisation of the lines between <see cref="PathControlPointPiece{T}"/>s.
/// </summary>
/// <typeparam name="T">The type of <see cref="OsuHitObject"/> which this <see cref="PathControlPointConnectionPiece{T}"/> visualises.</typeparam>
public partial class PathControlPointConnectionPiece<T> : CompositeDrawable where T : OsuHitObject, IHasPath
/// <typeparam name="T">The type of <see cref="OsuHitObject"/> which this <see cref="PathControlPointConnection{T}"/> visualises.</typeparam>
public partial class PathControlPointConnection<T> : SmoothPath where T : OsuHitObject, IHasPath
{
public readonly PathControlPoint ControlPoint;
private readonly Path path;
private readonly T hitObject;
public int ControlPointIndex { get; set; }
private IBindable<Vector2> hitObjectPosition;
private IBindable<int> pathVersion;
private IBindable<int> stackHeight;
public PathControlPointConnectionPiece(T hitObject, int controlPointIndex)
public PathControlPointConnection(T hitObject)
{
this.hitObject = hitObject;
ControlPointIndex = controlPointIndex;
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
ControlPoint = hitObject.Path.ControlPoints[controlPointIndex];
InternalChild = path = new SmoothPath
{
Anchor = Anchor.Centre,
PathRadius = 1
};
PathRadius = 1;
}
protected override void LoadComplete()
@@ -68,18 +50,14 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
/// </summary>
private void updateConnectingPath()
{
Position = hitObject.StackedPosition + ControlPoint.Position;
Position = hitObject.StackedPosition;
path.ClearVertices();
ClearVertices();
int nextIndex = ControlPointIndex + 1;
if (nextIndex == 0 || nextIndex >= hitObject.Path.ControlPoints.Count)
return;
foreach (var controlPoint in hitObject.Path.ControlPoints)
AddVertex(controlPoint.Position);
path.AddVertex(Vector2.Zero);
path.AddVertex(hitObject.Path.ControlPoints[nextIndex].Position - ControlPoint.Position);
path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero);
OriginPosition = PositionInBoundingBox(Vector2.Zero);
}
}
}
@@ -8,9 +8,9 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics;
@@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
public readonly PathControlPoint ControlPoint;
private readonly T hitObject;
private readonly Container marker;
private readonly Circle circle;
private readonly Drawable markerRing;
[Resolved]
@@ -60,38 +60,22 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
InternalChildren = new[]
{
marker = new Container
circle = new Circle
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Children = new[]
{
new Circle
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(20),
},
markerRing = new CircularContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(28),
Masking = true,
BorderThickness = 2,
BorderColour = Color4.White,
Alpha = 0,
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
}
}
}
Size = new Vector2(20),
},
markerRing = new CircularProgress
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(28),
Alpha = 0,
InnerRadius = 0.1f,
Progress = 1
}
};
}
@@ -115,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
}
// The connecting path is excluded from positional input
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => marker.ReceivePositionalInputAt(screenSpacePos);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => circle.ReceivePositionalInputAt(screenSpacePos);
protected override bool OnHover(HoverEvent e)
{
@@ -209,8 +193,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
if (IsHovered || IsSelected.Value)
colour = colour.Lighten(1);
marker.Colour = colour;
marker.Scale = new Vector2(hitObject.Scale);
Colour = colour;
Scale = new Vector2(hitObject.Scale);
}
private Color4 getColourFromNodeType()
@@ -37,7 +37,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; // allow context menu to appear outside of the playfield.
internal readonly Container<PathControlPointPiece<T>> Pieces;
internal readonly Container<PathControlPointConnectionPiece<T>> Connections;
private readonly IBindableList<PathControlPoint> controlPoints = new BindableList<PathControlPoint>();
private readonly T hitObject;
@@ -63,7 +62,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
InternalChildren = new Drawable[]
{
Connections = new Container<PathControlPointConnectionPiece<T>> { RelativeSizeAxes = Axes.Both },
new PathControlPointConnection<T>(hitObject),
Pieces = new Container<PathControlPointPiece<T>> { RelativeSizeAxes = Axes.Both }
};
}
@@ -78,6 +77,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
controlPoints.BindTo(hitObject.Path.ControlPoints);
}
// Generally all the control points are within the visible area all the time.
public override bool UpdateSubTreeMasking() => true;
/// <summary>
/// Handles correction of invalid path types.
/// </summary>
@@ -185,17 +187,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
case NotifyCollectionChangedAction.Add:
Debug.Assert(e.NewItems != null);
// If inserting in the path (not appending),
// update indices of existing connections after insert location
if (e.NewStartingIndex < Pieces.Count)
{
foreach (var connection in Connections)
{
if (connection.ControlPointIndex >= e.NewStartingIndex)
connection.ControlPointIndex += e.NewItems.Count;
}
}
for (int i = 0; i < e.NewItems.Count; i++)
{
var point = (PathControlPoint)e.NewItems[i];
@@ -209,8 +200,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
d.DragInProgress = DragInProgress;
d.DragEnded = DragEnded;
}));
Connections.Add(new PathControlPointConnectionPiece<T>(hitObject, e.NewStartingIndex + i));
}
break;
@@ -222,19 +211,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
foreach (var piece in Pieces.Where(p => p.ControlPoint == point).ToArray())
piece.RemoveAndDisposeImmediately();
foreach (var connection in Connections.Where(c => c.ControlPoint == point).ToArray())
connection.RemoveAndDisposeImmediately();
}
// If removing before the end of the path,
// update indices of connections after remove location
if (e.OldStartingIndex < Pieces.Count)
{
foreach (var connection in Connections)
{
if (connection.ControlPointIndex >= e.OldStartingIndex)
connection.ControlPointIndex -= e.OldItems.Count;
}
}
break;
@@ -403,7 +403,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
public override MenuItem[] ContextMenuItems => new MenuItem[]
{
new OsuMenuItem("Add control point", MenuItemType.Standard, () => addControlPoint(rightClickPosition)),
new OsuMenuItem("Add control point", MenuItemType.Standard, () =>
{
changeHandler?.BeginChange();
addControlPoint(rightClickPosition);
changeHandler?.EndChange();
}),
new OsuMenuItem("Convert to stream", MenuItemType.Destructive, convertToStream),
};
+1 -1
View File
@@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Osu
//
// Based on user feedback of more nuanced scenarios (where touch doesn't behave as expected),
// this can be expanded to a more complex implementation, but I'd still want to keep it as simple as we can.
NonPositionalInputQueue.OfType<DrawableHitCircle.HitReceptor>().Any(c => c.ReceivePositionalInputAt(screenSpacePosition));
NonPositionalInputQueue.OfType<DrawableHitCircle.HitReceptor>().Any(c => c.CanBeHit() && c.ReceivePositionalInputAt(screenSpacePosition));
public OsuInputManager(RulesetInfo ruleset)
: base(ruleset, 0, SimultaneousBindingMode.Unique)
@@ -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();
}
}
@@ -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;
+1 -2
View File
@@ -8,7 +8,6 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
@@ -37,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.UI
// For osu! gameplay, everything is always on screen.
// Skipping masking calculations improves performance in intense beatmaps (ie. https://osu.ppy.sh/beatmapsets/150945#osu/372245)
public override bool UpdateSubTreeMasking(Drawable source, RectangleF maskingBounds) => false;
public override bool UpdateSubTreeMasking() => false;
public SmokeContainer Smoke { get; }
public FollowPointRenderer FollowPoints { get; }
+11 -9
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()
{
@@ -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();
}
}
+1 -2
View File
@@ -7,7 +7,6 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Judgements;
@@ -345,7 +344,7 @@ namespace osu.Game.Rulesets.Taiko.UI
{
public void Add(Drawable proxy) => AddInternal(proxy);
public override bool UpdateSubTreeMasking(Drawable source, RectangleF maskingBounds)
public override bool UpdateSubTreeMasking()
{
// DrawableHitObject disables masking.
// Hitobject content is proxied and unproxied based on hit status and the IsMaskedAway value could get stuck because of this.
@@ -25,6 +25,7 @@ using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Taiko;
using osu.Game.Skinning;
using osu.Game.Storyboards;
using osu.Game.Tests.Resources;
using osuTK;
@@ -37,6 +38,22 @@ namespace osu.Game.Tests.Beatmaps.Formats
private static IEnumerable<string> allBeatmaps = beatmaps_resource_store.GetAvailableResources().Where(res => res.EndsWith(".osu", StringComparison.Ordinal));
[Test]
public void TestUnsupportedStoryboardEvents()
{
const string name = "Resources/storyboard_only_video.osu";
var decoded = decodeFromLegacy(beatmaps_resource_store.GetStream(name), name);
Assert.That(decoded.beatmap.UnhandledEventLines.Count, Is.EqualTo(1));
Assert.That(decoded.beatmap.UnhandledEventLines.Single(), Is.EqualTo("Video,0,\"video.avi\""));
var memoryStream = encodeToLegacy(decoded);
var storyboard = new LegacyStoryboardDecoder().Decode(new LineBufferedReader(memoryStream));
StoryboardLayer video = storyboard.Layers.Single(l => l.Name == "Video");
Assert.That(video.Elements.Count, Is.EqualTo(1));
}
[TestCaseSource(nameof(allBeatmaps))]
public void TestEncodeDecodeStability(string name)
{
@@ -14,6 +14,7 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Formats;
using osu.Game.Beatmaps.Legacy;
using osu.Game.IO.Legacy;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Replays;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch;
@@ -31,6 +32,7 @@ using osu.Game.Rulesets.Taiko;
using osu.Game.Scoring;
using osu.Game.Scoring.Legacy;
using osu.Game.Tests.Resources;
using osu.Game.Users;
namespace osu.Game.Tests.Beatmaps.Formats
{
@@ -224,6 +226,12 @@ namespace osu.Game.Tests.Beatmaps.Formats
new OsuModDoubleTime { SpeedChange = { Value = 1.1 } }
};
scoreInfo.OnlineID = 123123;
scoreInfo.User = new APIUser
{
Username = "spaceman_atlas",
Id = 3035836,
CountryCode = CountryCode.PL
};
scoreInfo.ClientVersion = "2023.1221.0";
var beatmap = new TestBeatmap(ruleset);
@@ -248,6 +256,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.That(decodedAfterEncode.ScoreInfo.MaximumStatistics, Is.EqualTo(scoreInfo.MaximumStatistics));
Assert.That(decodedAfterEncode.ScoreInfo.Mods, Is.EqualTo(scoreInfo.Mods));
Assert.That(decodedAfterEncode.ScoreInfo.ClientVersion, Is.EqualTo("2023.1221.0"));
Assert.That(decodedAfterEncode.ScoreInfo.RealmUser.OnlineID, Is.EqualTo(3035836));
});
}
@@ -352,6 +361,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
[HitResult.Great] = 200,
[HitResult.LargeTickHit] = 1,
};
scoreInfo.Rank = ScoreRank.A;
var beatmap = new TestBeatmap(ruleset);
var score = new Score
@@ -412,6 +422,80 @@ namespace osu.Game.Tests.Beatmaps.Formats
});
}
[Test]
public void TestTotalScoreWithoutModsReadIfPresent()
{
var ruleset = new OsuRuleset().RulesetInfo;
var scoreInfo = TestResources.CreateTestScoreInfo(ruleset);
scoreInfo.Mods = new Mod[]
{
new OsuModDoubleTime { SpeedChange = { Value = 1.1 } }
};
scoreInfo.OnlineID = 123123;
scoreInfo.ClientVersion = "2023.1221.0";
scoreInfo.TotalScoreWithoutMods = 1_000_000;
scoreInfo.TotalScore = 1_020_000;
var beatmap = new TestBeatmap(ruleset);
var score = new Score
{
ScoreInfo = scoreInfo,
Replay = new Replay
{
Frames = new List<ReplayFrame>
{
new OsuReplayFrame(2000, OsuPlayfield.BASE_SIZE / 2, OsuAction.LeftButton)
}
}
};
var decodedAfterEncode = encodeThenDecode(LegacyBeatmapDecoder.LATEST_VERSION, score, beatmap);
Assert.Multiple(() =>
{
Assert.That(decodedAfterEncode.ScoreInfo.TotalScoreWithoutMods, Is.EqualTo(1_000_000));
Assert.That(decodedAfterEncode.ScoreInfo.TotalScore, Is.EqualTo(1_020_000));
});
}
[Test]
public void TestTotalScoreWithoutModsBackwardsPopulatedIfMissing()
{
var ruleset = new OsuRuleset().RulesetInfo;
var scoreInfo = TestResources.CreateTestScoreInfo(ruleset);
scoreInfo.Mods = new Mod[]
{
new OsuModDoubleTime { SpeedChange = { Value = 1.1 } }
};
scoreInfo.OnlineID = 123123;
scoreInfo.ClientVersion = "2023.1221.0";
scoreInfo.TotalScoreWithoutMods = 0;
scoreInfo.TotalScore = 1_020_000;
var beatmap = new TestBeatmap(ruleset);
var score = new Score
{
ScoreInfo = scoreInfo,
Replay = new Replay
{
Frames = new List<ReplayFrame>
{
new OsuReplayFrame(2000, OsuPlayfield.BASE_SIZE / 2, OsuAction.LeftButton)
}
}
};
var decodedAfterEncode = encodeThenDecode(LegacyBeatmapDecoder.LATEST_VERSION, score, beatmap);
Assert.Multiple(() =>
{
Assert.That(decodedAfterEncode.ScoreInfo.TotalScoreWithoutMods, Is.EqualTo(1_000_000));
Assert.That(decodedAfterEncode.ScoreInfo.TotalScore, Is.EqualTo(1_020_000));
});
}
private static Score encodeThenDecode(int beatmapVersion, Score score, TestBeatmap beatmap)
{
var encodeStream = new MemoryStream();
@@ -20,7 +20,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
[TestCase(1, 3)]
[TestCase(1, 0)]
[TestCase(0, 3)]
public void CatchMergesFruitAndDropletMisses(int missCount, int largeTickMissCount)
public void TestCatchMergesFruitAndDropletMisses(int missCount, int largeTickMissCount)
{
var ruleset = new CatchRuleset().RulesetInfo;
var scoreInfo = TestResources.CreateTestScoreInfo(ruleset);
@@ -41,7 +41,22 @@ namespace osu.Game.Tests.Beatmaps.Formats
}
[Test]
public void ScoreWithMissIsNotPerfect()
public void TestFailPreserved()
{
var ruleset = new OsuRuleset().RulesetInfo;
var scoreInfo = TestResources.CreateTestScoreInfo();
var beatmap = new TestBeatmap(ruleset);
scoreInfo.Rank = ScoreRank.F;
var score = new Score { ScoreInfo = scoreInfo };
var decodedAfterEncode = encodeThenDecode(LegacyBeatmapDecoder.LATEST_VERSION, score, beatmap);
Assert.That(decodedAfterEncode.ScoreInfo.Rank, Is.EqualTo(ScoreRank.F));
}
[Test]
public void TestScoreWithMissIsNotPerfect()
{
var ruleset = new OsuRuleset().RulesetInfo;
var scoreInfo = TestResources.CreateTestScoreInfo(ruleset);
@@ -0,0 +1,128 @@
// 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.IO;
using System.Linq;
using ManagedBass;
using Moq;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks;
using osu.Game.Rulesets.Objects;
using osu.Game.Tests.Beatmaps;
using osu.Game.Tests.Resources;
using osuTK.Audio;
namespace osu.Game.Tests.Editing.Checks
{
[TestFixture]
public class CheckHitsoundsFormatTest
{
private CheckHitsoundsFormat check = null!;
private IBeatmap beatmap = null!;
[SetUp]
public void Setup()
{
check = new CheckHitsoundsFormat();
beatmap = new Beatmap<HitObject>
{
BeatmapInfo = new BeatmapInfo
{
BeatmapSet = new BeatmapSetInfo
{
Files = { CheckTestHelpers.CreateMockFile("wav") }
}
}
};
// 0 = No output device. This still allows decoding.
if (!Bass.Init(0) && Bass.LastError != Errors.Already)
throw new AudioException("Could not initialize Bass.");
}
[Test]
public void TestMp3Audio()
{
using (var resourceStream = TestResources.OpenResource("Samples/test-sample-cut.mp3"))
{
var issues = check.Run(getContext(resourceStream)).ToList();
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckHitsoundsFormat.IssueTemplateIncorrectFormat);
}
}
[Test]
public void TestOggAudio()
{
using (var resourceStream = TestResources.OpenResource("Samples/test-sample.ogg"))
{
var issues = check.Run(getContext(resourceStream)).ToList();
Assert.That(issues, Has.Count.EqualTo(0));
}
}
[Test]
public void TestWavAudio()
{
using (var resourceStream = TestResources.OpenResource("Samples/hitsound-delay.wav"))
{
var issues = check.Run(getContext(resourceStream)).ToList();
Assert.That(issues, Has.Count.EqualTo(0));
}
}
[Test]
public void TestWebmAudio()
{
using (var resourceStream = TestResources.OpenResource("Samples/test-sample.webm"))
{
var issues = check.Run(getContext(resourceStream)).ToList();
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckHitsoundsFormat.IssueTemplateFormatUnsupported);
}
}
[Test]
public void TestNotAnAudioFile()
{
beatmap = new Beatmap<HitObject>
{
BeatmapInfo = new BeatmapInfo
{
BeatmapSet = new BeatmapSetInfo
{
Files = { CheckTestHelpers.CreateMockFile("png") }
}
}
};
using (var resourceStream = TestResources.OpenResource("Textures/test-image.png"))
{
var issues = check.Run(getContext(resourceStream)).ToList();
Assert.That(issues, Has.Count.EqualTo(0));
}
}
[Test]
public void TestCorruptAudio()
{
using (var resourceStream = TestResources.OpenResource("Samples/corrupt.wav"))
{
var issues = check.Run(getContext(resourceStream)).ToList();
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckHitsoundsFormat.IssueTemplateFormatUnsupported);
}
}
private BeatmapVerifierContext getContext(Stream? resourceStream)
{
var mockWorkingBeatmap = new Mock<TestWorkingBeatmap>(beatmap, null, null);
mockWorkingBeatmap.Setup(w => w.GetStream(It.IsAny<string>())).Returns(resourceStream);
return new BeatmapVerifierContext(beatmap, mockWorkingBeatmap.Object);
}
}
}
@@ -0,0 +1,112 @@
// 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.IO;
using System.Linq;
using ManagedBass;
using Moq;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks;
using osu.Game.Rulesets.Objects;
using osu.Game.Tests.Beatmaps;
using osu.Game.Tests.Resources;
using osuTK.Audio;
namespace osu.Game.Tests.Editing.Checks
{
[TestFixture]
public partial class CheckSongFormatTest
{
private CheckSongFormat check = null!;
private IBeatmap beatmap = null!;
[SetUp]
public void Setup()
{
check = new CheckSongFormat();
beatmap = new Beatmap<HitObject>
{
BeatmapInfo = new BeatmapInfo
{
BeatmapSet = new BeatmapSetInfo
{
Files = { CheckTestHelpers.CreateMockFile("mp3") }
}
}
};
// 0 = No output device. This still allows decoding.
if (!Bass.Init(0) && Bass.LastError != Errors.Already)
throw new AudioException("Could not initialize Bass.");
}
[Test]
public void TestMp3Audio()
{
using (var resourceStream = TestResources.OpenResource("Samples/test-sample-cut.mp3"))
{
beatmap.Metadata.AudioFile = "abc123.mp3";
var issues = check.Run(getContext(resourceStream)).ToList();
Assert.That(issues, Has.Count.EqualTo(0));
}
}
[Test]
public void TestOggAudio()
{
using (var resourceStream = TestResources.OpenResource("Samples/test-sample.ogg"))
{
beatmap.Metadata.AudioFile = "abc123.mp3";
var issues = check.Run(getContext(resourceStream)).ToList();
Assert.That(issues, Has.Count.EqualTo(0));
}
}
[Test]
public void TestWavAudio()
{
using (var resourceStream = TestResources.OpenResource("Samples/hitsound-delay.wav"))
{
beatmap.Metadata.AudioFile = "abc123.mp3";
var issues = check.Run(getContext(resourceStream)).ToList();
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckSongFormat.IssueTemplateIncorrectFormat);
}
}
[Test]
public void TestWebmAudio()
{
using (var resourceStream = TestResources.OpenResource("Samples/test-sample.webm"))
{
beatmap.Metadata.AudioFile = "abc123.mp3";
var issues = check.Run(getContext(resourceStream)).ToList();
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckSongFormat.IssueTemplateFormatUnsupported);
}
}
[Test]
public void TestCorruptAudio()
{
using (var resourceStream = TestResources.OpenResource("Samples/corrupt.wav"))
{
beatmap.Metadata.AudioFile = "abc123.mp3";
var issues = check.Run(getContext(resourceStream)).ToList();
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckSongFormat.IssueTemplateFormatUnsupported);
}
}
private BeatmapVerifierContext getContext(Stream? resourceStream)
{
var mockWorkingBeatmap = new Mock<TestWorkingBeatmap>(beatmap, null, null);
mockWorkingBeatmap.Setup(w => w.GetStream(It.IsAny<string>())).Returns(resourceStream);
return new BeatmapVerifierContext(beatmap, mockWorkingBeatmap.Object);
}
}
}
@@ -95,18 +95,6 @@ namespace osu.Game.Tests.Editing.Checks
}
}
[Test]
public void TestCorruptAudioFile()
{
using (var resourceStream = TestResources.OpenResource("Samples/corrupt.wav"))
{
var issues = check.Run(getContext(resourceStream)).ToList();
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckTooShortAudioFiles.IssueTemplateBadFormat);
}
}
private BeatmapVerifierContext getContext(Stream? resourceStream)
{
var mockWorkingBeatmap = new Mock<TestWorkingBeatmap>(beatmap, null, null);
@@ -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;
}
}
}
@@ -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 =
@@ -0,0 +1,235 @@
// 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;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Difficulty.Skills;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Tests.NonVisual
{
[TestFixture]
public class TestSceneTimedDifficultyCalculation
{
[Test]
public void TestAttributesGeneratedForAllNonSkippedObjects()
{
var beatmap = new Beatmap<TestHitObject>
{
HitObjects =
{
new TestHitObject { StartTime = 1 },
new TestHitObject
{
StartTime = 2,
Nested = 1
},
new TestHitObject { StartTime = 3 },
}
};
List<TimedDifficultyAttributes> attribs = new TestDifficultyCalculator(new TestWorkingBeatmap(beatmap)).CalculateTimed();
Assert.That(attribs.Count, Is.EqualTo(4));
assertEquals(attribs[0], beatmap.HitObjects[0]);
assertEquals(attribs[1], beatmap.HitObjects[0], beatmap.HitObjects[1]);
assertEquals(attribs[2], beatmap.HitObjects[0], beatmap.HitObjects[1]); // From the nested object.
assertEquals(attribs[3], beatmap.HitObjects[0], beatmap.HitObjects[1], beatmap.HitObjects[2]);
}
[Test]
public void TestAttributesNotGeneratedForSkippedObjects()
{
var beatmap = new Beatmap<TestHitObject>
{
HitObjects =
{
// The first object is usually skipped in all implementations
new TestHitObject
{
StartTime = 1,
Skip = true
},
// An intermediate skipped object.
new TestHitObject
{
StartTime = 2,
Skip = true
},
new TestHitObject { StartTime = 3 },
}
};
List<TimedDifficultyAttributes> attribs = new TestDifficultyCalculator(new TestWorkingBeatmap(beatmap)).CalculateTimed();
Assert.That(attribs.Count, Is.EqualTo(1));
assertEquals(attribs[0], beatmap.HitObjects[0], beatmap.HitObjects[1], beatmap.HitObjects[2]);
}
[Test]
public void TestNestedObjectOnlyAddsParentOnce()
{
var beatmap = new Beatmap<TestHitObject>
{
HitObjects =
{
new TestHitObject
{
StartTime = 1,
Skip = true,
Nested = 2
},
}
};
List<TimedDifficultyAttributes> attribs = new TestDifficultyCalculator(new TestWorkingBeatmap(beatmap)).CalculateTimed();
Assert.That(attribs.Count, Is.EqualTo(2));
assertEquals(attribs[0], beatmap.HitObjects[0]);
assertEquals(attribs[1], beatmap.HitObjects[0]);
}
[Test]
public void TestSkippedLastObjectAddedInLastIteration()
{
var beatmap = new Beatmap<TestHitObject>
{
HitObjects =
{
new TestHitObject { StartTime = 1 },
new TestHitObject
{
StartTime = 2,
Skip = true
},
new TestHitObject
{
StartTime = 3,
Skip = true
},
}
};
List<TimedDifficultyAttributes> attribs = new TestDifficultyCalculator(new TestWorkingBeatmap(beatmap)).CalculateTimed();
Assert.That(attribs.Count, Is.EqualTo(1));
assertEquals(attribs[0], beatmap.HitObjects[0], beatmap.HitObjects[1], beatmap.HitObjects[2]);
}
private void assertEquals(TimedDifficultyAttributes attribs, params HitObject[] expected)
{
Assert.That(((TestDifficultyAttributes)attribs.Attributes).Objects, Is.EquivalentTo(expected));
}
private class TestHitObject : HitObject
{
/// <summary>
/// Whether to skip generating a difficulty representation for this object.
/// </summary>
public bool Skip { get; set; }
/// <summary>
/// Whether to generate nested difficulty representations for this object, and if so, how many.
/// </summary>
public int Nested { get; set; }
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
{
for (int i = 0; i < Nested; i++)
AddNested(new TestHitObject { StartTime = StartTime + 0.1 * i });
}
}
private class TestRuleset : Ruleset
{
public override IEnumerable<Mod> GetModsFor(ModType type) => Enumerable.Empty<Mod>();
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod>? mods = null) => throw new NotImplementedException();
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new PassThroughBeatmapConverter(beatmap);
public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new TestDifficultyCalculator(beatmap);
public override string Description => string.Empty;
public override string ShortName => string.Empty;
private class PassThroughBeatmapConverter : IBeatmapConverter
{
public event Action<HitObject, IEnumerable<HitObject>>? ObjectConverted
{
add { }
remove { }
}
public IBeatmap Beatmap { get; }
public PassThroughBeatmapConverter(IBeatmap beatmap)
{
Beatmap = beatmap;
}
public bool CanConvert() => true;
public IBeatmap Convert(CancellationToken cancellationToken = default) => Beatmap;
}
}
private class TestDifficultyCalculator : DifficultyCalculator
{
public TestDifficultyCalculator(IWorkingBeatmap beatmap)
: base(new TestRuleset().RulesetInfo, beatmap)
{
}
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
=> new TestDifficultyAttributes { Objects = beatmap.HitObjects.ToArray() };
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
{
List<DifficultyHitObject> objects = new List<DifficultyHitObject>();
foreach (var obj in beatmap.HitObjects.OfType<TestHitObject>())
{
if (!obj.Skip)
objects.Add(new DifficultyHitObject(obj, obj, clockRate, objects, objects.Count));
foreach (var nested in obj.NestedHitObjects)
objects.Add(new DifficultyHitObject(nested, nested, clockRate, objects, objects.Count));
}
return objects;
}
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => new Skill[] { new PassThroughSkill(mods) };
private class PassThroughSkill : Skill
{
public PassThroughSkill(Mod[] mods)
: base(mods)
{
}
public override void Process(DifficultyHitObject current)
{
}
public override double DifficultyValue() => 1;
}
}
private class TestDifficultyAttributes : DifficultyAttributes
{
public HitObject[] Objects = Array.Empty<HitObject>();
}
}
}
Binary file not shown.
Binary file not shown.
+268
View File
@@ -15,6 +15,7 @@ using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.IO.Archives;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
@@ -23,6 +24,7 @@ using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Tests.Beatmaps.IO;
using osu.Game.Tests.Resources;
using osu.Game.Users;
namespace osu.Game.Tests.Scores.IO
{
@@ -284,6 +286,272 @@ namespace osu.Game.Tests.Scores.IO
}
}
[Test]
public void TestUserLookedUpByUsernameForOnlineScoreIfUserIDMissing()
{
using (HeadlessGameHost host = new CleanRunHeadlessGameHost())
{
try
{
var osu = LoadOsuIntoHost(host, true);
var api = (DummyAPIAccess)osu.API;
api.HandleRequest = req =>
{
switch (req)
{
case GetUserRequest userRequest:
if (userRequest.Lookup != "Test user")
return false;
userRequest.TriggerSuccess(new APIUser
{
Username = "Test user",
CountryCode = CountryCode.JP,
Id = 1234
});
return true;
default:
return false;
}
};
var beatmap = BeatmapImportHelper.LoadOszIntoOsu(osu, TestResources.GetQuickTestBeatmapForImport()).GetResultSafely();
var toImport = new ScoreInfo
{
Rank = ScoreRank.B,
TotalScore = 987654,
Accuracy = 0.8,
MaxCombo = 500,
Combo = 250,
User = new APIUser { Username = "Test user" },
Date = DateTimeOffset.Now,
OnlineID = 12345,
Ruleset = new OsuRuleset().RulesetInfo,
BeatmapInfo = beatmap.Beatmaps.First()
};
var imported = LoadScoreIntoOsu(osu, toImport);
Assert.AreEqual(toImport.Rank, imported.Rank);
Assert.AreEqual(toImport.TotalScore, imported.TotalScore);
Assert.AreEqual(toImport.Accuracy, imported.Accuracy);
Assert.AreEqual(toImport.MaxCombo, imported.MaxCombo);
Assert.AreEqual(toImport.User.Username, imported.User.Username);
Assert.AreEqual(toImport.Date, imported.Date);
Assert.AreEqual(toImport.OnlineID, imported.OnlineID);
Assert.AreEqual(toImport.User.Username, imported.RealmUser.Username);
Assert.AreEqual(1234, imported.RealmUser.OnlineID);
}
finally
{
host.Exit();
}
}
}
[Test]
public void TestUserLookedUpByUsernameForLegacyOnlineScore()
{
using (HeadlessGameHost host = new CleanRunHeadlessGameHost())
{
try
{
var osu = LoadOsuIntoHost(host, true);
var api = (DummyAPIAccess)osu.API;
api.HandleRequest = req =>
{
switch (req)
{
case GetUserRequest userRequest:
if (userRequest.Lookup != "Test user")
return false;
userRequest.TriggerSuccess(new APIUser
{
Username = "Test user",
CountryCode = CountryCode.JP,
Id = 1234
});
return true;
default:
return false;
}
};
var beatmap = BeatmapImportHelper.LoadOszIntoOsu(osu, TestResources.GetQuickTestBeatmapForImport()).GetResultSafely();
var toImport = new ScoreInfo
{
Rank = ScoreRank.B,
TotalScore = 987654,
Accuracy = 0.8,
MaxCombo = 500,
Combo = 250,
User = new APIUser { Username = "Test user" },
Date = DateTimeOffset.Now,
LegacyOnlineID = 12345,
Ruleset = new OsuRuleset().RulesetInfo,
BeatmapInfo = beatmap.Beatmaps.First()
};
var imported = LoadScoreIntoOsu(osu, toImport);
Assert.AreEqual(toImport.Rank, imported.Rank);
Assert.AreEqual(toImport.TotalScore, imported.TotalScore);
Assert.AreEqual(toImport.Accuracy, imported.Accuracy);
Assert.AreEqual(toImport.MaxCombo, imported.MaxCombo);
Assert.AreEqual(toImport.User.Username, imported.User.Username);
Assert.AreEqual(toImport.Date, imported.Date);
Assert.AreEqual(toImport.OnlineID, imported.OnlineID);
Assert.AreEqual(toImport.User.Username, imported.RealmUser.Username);
Assert.AreEqual(1234, imported.RealmUser.OnlineID);
}
finally
{
host.Exit();
}
}
}
[Test]
public void TestUserNotLookedUpForOfflineScoreIfUserIDMissing()
{
using (HeadlessGameHost host = new CleanRunHeadlessGameHost())
{
try
{
var osu = LoadOsuIntoHost(host, true);
var api = (DummyAPIAccess)osu.API;
api.HandleRequest = req =>
{
switch (req)
{
case GetUserRequest userRequest:
if (userRequest.Lookup != "Test user")
return false;
userRequest.TriggerSuccess(new APIUser
{
Username = "Test user",
CountryCode = CountryCode.JP,
Id = 1234
});
return true;
default:
return false;
}
};
var beatmap = BeatmapImportHelper.LoadOszIntoOsu(osu, TestResources.GetQuickTestBeatmapForImport()).GetResultSafely();
var toImport = new ScoreInfo
{
Rank = ScoreRank.B,
TotalScore = 987654,
Accuracy = 0.8,
MaxCombo = 500,
Combo = 250,
User = new APIUser { Username = "Test user" },
Date = DateTimeOffset.Now,
OnlineID = -1,
LegacyOnlineID = -1,
Ruleset = new OsuRuleset().RulesetInfo,
BeatmapInfo = beatmap.Beatmaps.First()
};
var imported = LoadScoreIntoOsu(osu, toImport);
Assert.AreEqual(toImport.Rank, imported.Rank);
Assert.AreEqual(toImport.TotalScore, imported.TotalScore);
Assert.AreEqual(toImport.Accuracy, imported.Accuracy);
Assert.AreEqual(toImport.MaxCombo, imported.MaxCombo);
Assert.AreEqual(toImport.User.Username, imported.User.Username);
Assert.AreEqual(toImport.Date, imported.Date);
Assert.AreEqual(toImport.OnlineID, imported.OnlineID);
Assert.AreEqual(toImport.User.Username, imported.RealmUser.Username);
Assert.That(imported.RealmUser.OnlineID, Is.LessThanOrEqualTo(1));
}
finally
{
host.Exit();
}
}
}
[Test]
public void TestUserLookedUpByOnlineIDIfPresent([Values] bool isOnlineScore)
{
using (HeadlessGameHost host = new CleanRunHeadlessGameHost())
{
try
{
var osu = LoadOsuIntoHost(host, true);
var api = (DummyAPIAccess)osu.API;
api.HandleRequest = req =>
{
switch (req)
{
case GetUserRequest userRequest:
if (userRequest.Lookup != "5555")
return false;
userRequest.TriggerSuccess(new APIUser
{
Username = "Some other guy",
CountryCode = CountryCode.DE,
Id = 5555
});
return true;
default:
return false;
}
};
var beatmap = BeatmapImportHelper.LoadOszIntoOsu(osu, TestResources.GetQuickTestBeatmapForImport()).GetResultSafely();
var toImport = new ScoreInfo
{
Rank = ScoreRank.B,
TotalScore = 987654,
Accuracy = 0.8,
MaxCombo = 500,
Combo = 250,
User = new APIUser { Id = 5555 },
Date = DateTimeOffset.Now,
Ruleset = new OsuRuleset().RulesetInfo,
BeatmapInfo = beatmap.Beatmaps.First()
};
if (isOnlineScore)
toImport.OnlineID = 12345;
var imported = LoadScoreIntoOsu(osu, toImport);
Assert.AreEqual(toImport.Rank, imported.Rank);
Assert.AreEqual(toImport.TotalScore, imported.TotalScore);
Assert.AreEqual(toImport.Accuracy, imported.Accuracy);
Assert.AreEqual(toImport.MaxCombo, imported.MaxCombo);
Assert.AreEqual(toImport.Date, imported.Date);
Assert.AreEqual(toImport.OnlineID, imported.OnlineID);
Assert.AreEqual("Some other guy", imported.RealmUser.Username);
Assert.AreEqual(5555, imported.RealmUser.OnlineID);
Assert.AreEqual(CountryCode.DE, imported.RealmUser.CountryCode);
}
finally
{
host.Exit();
}
}
}
public static ScoreInfo LoadScoreIntoOsu(OsuGameBase osu, ScoreInfo score, ArchiveReader archive = null)
{
// clone to avoid attaching the input score to realm.
@@ -1,6 +1,7 @@
// 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.IO;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
@@ -12,6 +13,7 @@ using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Tests.Resources;
using osu.Game.Tests.Visual;
using MemoryStream = System.IO.MemoryStream;
namespace osu.Game.Tests.Skins
{
@@ -21,6 +23,52 @@ namespace osu.Game.Tests.Skins
[Resolved]
private BeatmapManager beatmaps { get; set; } = null!;
[Test]
public void TestRetrieveAndLegacyExportJapaneseFilename()
{
IWorkingBeatmap beatmap = null!;
MemoryStream outStream = null!;
// Ensure importer encoding is correct
AddStep("import beatmap", () => beatmap = importBeatmapFromArchives(@"japanese-filename.osz"));
AddAssert("sample is non-null", () => beatmap.Skin.GetSample(new SampleInfo(@"見本")) != null);
// Ensure exporter encoding is correct (round trip)
AddStep("export", () =>
{
outStream = new MemoryStream();
new LegacyBeatmapExporter(LocalStorage)
.ExportToStream((BeatmapSetInfo)beatmap.BeatmapInfo.BeatmapSet!, outStream, null);
});
AddStep("import beatmap again", () => beatmap = importBeatmapFromStream(outStream));
AddAssert("sample is non-null", () => beatmap.Skin.GetSample(new SampleInfo(@"見本")) != null);
}
[Test]
public void TestRetrieveAndNonLegacyExportJapaneseFilename()
{
IWorkingBeatmap beatmap = null!;
MemoryStream outStream = null!;
// Ensure importer encoding is correct
AddStep("import beatmap", () => beatmap = importBeatmapFromArchives(@"japanese-filename.osz"));
AddAssert("sample is non-null", () => beatmap.Skin.GetSample(new SampleInfo(@"見本")) != null);
// Ensure exporter encoding is correct (round trip)
AddStep("export", () =>
{
outStream = new MemoryStream();
new BeatmapExporter(LocalStorage)
.ExportToStream((BeatmapSetInfo)beatmap.BeatmapInfo.BeatmapSet!, outStream, null);
});
AddStep("import beatmap again", () => beatmap = importBeatmapFromStream(outStream));
AddAssert("sample is non-null", () => beatmap.Skin.GetSample(new SampleInfo(@"見本")) != null);
}
[Test]
public void TestRetrieveOggAudio()
{
@@ -45,6 +93,12 @@ namespace osu.Game.Tests.Skins
AddAssert("sample is non-null", () => beatmap.Skin.GetSample(new SampleInfo(@"spinner-osu")) != null);
}
private IWorkingBeatmap importBeatmapFromStream(Stream stream)
{
var imported = beatmaps.Import(new ImportTask(stream, "filename.osz")).GetResultSafely();
return imported.AsNonNull().PerformRead(s => beatmaps.GetWorkingBeatmap(s.Beatmaps[0]));
}
private IWorkingBeatmap importBeatmapFromArchives(string filename)
{
var imported = beatmaps.Import(new ImportTask(TestResources.OpenResource($@"Archives/{filename}"), filename)).GetResultSafely();
@@ -12,6 +12,7 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit;
using osu.Game.Storyboards;
using osu.Game.Tests.Beatmaps.IO;
using osuTK.Input;
@@ -83,6 +84,49 @@ namespace osu.Game.Tests.Visual.Editing
}
}
[Test]
public void TestDeleteDifficultyWithPendingChanges()
{
Guid deletedDifficultyID = Guid.Empty;
int countBeforeDeletion = 0;
string beatmapSetHashBefore = string.Empty;
AddUntilStep("wait for editor to load", () => Editor?.ReadyForUse == true);
AddStep("store selected difficulty", () =>
{
deletedDifficultyID = EditorBeatmap.BeatmapInfo.ID;
countBeforeDeletion = Beatmap.Value.BeatmapSetInfo.Beatmaps.Count;
beatmapSetHashBefore = Beatmap.Value.BeatmapSetInfo.Hash;
});
AddStep("make change to difficulty", () =>
{
EditorBeatmap.BeginChange();
EditorBeatmap.BeatmapInfo.DifficultyName = "changin' things";
EditorBeatmap.EndChange();
});
AddStep("click File", () => this.ChildrenOfType<DrawableOsuMenuItem>().First().TriggerClick());
AddStep("click delete", () => getDeleteMenuItem().TriggerClick());
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog != null);
AddAssert("dialog is deletion confirmation dialog", () => DialogOverlay.CurrentDialog, Is.InstanceOf<DeleteDifficultyConfirmationDialog>);
AddStep("confirm", () => InputManager.Key(Key.Number1));
AddUntilStep("no next dialog", () => DialogOverlay.CurrentDialog == null);
AddUntilStep("switched to different difficulty",
() => this.ChildrenOfType<EditorBeatmap>().SingleOrDefault() != null && EditorBeatmap.BeatmapInfo.ID != deletedDifficultyID);
AddAssert("difficulty is unattached from set",
() => Beatmap.Value.BeatmapSetInfo.Beatmaps.Select(b => b.ID), () => Does.Not.Contain(deletedDifficultyID));
AddAssert("beatmap set difficulty count decreased by one",
() => Beatmap.Value.BeatmapSetInfo.Beatmaps.Count, () => Is.EqualTo(countBeforeDeletion - 1));
AddAssert("set hash changed", () => Beatmap.Value.BeatmapSetInfo.Hash, () => Is.Not.EqualTo(beatmapSetHashBefore));
AddAssert("difficulty is deleted from realm",
() => Realm.Run(r => r.Find<BeatmapInfo>(deletedDifficultyID)), () => Is.Null);
}
private DrawableOsuMenuItem getDeleteMenuItem() => this.ChildrenOfType<DrawableOsuMenuItem>()
.Single(item => item.ChildrenOfType<SpriteText>().Any(text => text.Text.ToString().StartsWith("Delete", StringComparison.Ordinal)));
}
@@ -10,6 +10,7 @@ using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.IO.Stores;
using osu.Framework.Testing;
@@ -40,7 +41,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("disallow all lookups", () =>
{
storyboard.UseSkinSprites = false;
storyboard.AlwaysProvideTexture = false;
storyboard.ProvideResources = false;
});
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
@@ -55,7 +56,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("allow storyboard lookup", () =>
{
storyboard.UseSkinSprites = false;
storyboard.AlwaysProvideTexture = true;
storyboard.ProvideResources = true;
});
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
@@ -67,13 +68,48 @@ namespace osu.Game.Tests.Visual.Gameplay
assertStoryboardSourced();
}
[TestCase(false)]
[TestCase(true)]
public void TestVideo(bool scaleTransformProvided)
{
AddStep("allow storyboard lookup", () =>
{
storyboard.ProvideResources = true;
});
AddStep("create video", () => SetContents(_ =>
{
var layer = storyboard.GetLayer("Video");
var sprite = new StoryboardVideo("Videos/test-video.mp4", Time.Current);
if (scaleTransformProvided)
{
sprite.Commands.AddScale(Easing.None, Time.Current, Time.Current + 1000, 1, 2);
sprite.Commands.AddScale(Easing.None, Time.Current + 1000, Time.Current + 2000, 2, 1);
}
layer.Elements.Clear();
layer.Add(sprite);
return new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
storyboard.CreateDrawable()
}
};
}));
}
[Test]
public void TestSkinLookupPreferredOverStoryboard()
{
AddStep("allow all lookups", () =>
{
storyboard.UseSkinSprites = true;
storyboard.AlwaysProvideTexture = true;
storyboard.ProvideResources = true;
});
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
@@ -91,7 +127,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("allow skin lookup", () =>
{
storyboard.UseSkinSprites = true;
storyboard.AlwaysProvideTexture = false;
storyboard.ProvideResources = false;
});
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
@@ -109,7 +145,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("allow all lookups", () =>
{
storyboard.UseSkinSprites = true;
storyboard.AlwaysProvideTexture = true;
storyboard.ProvideResources = true;
});
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
@@ -127,7 +163,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("allow all lookups", () =>
{
storyboard.UseSkinSprites = true;
storyboard.AlwaysProvideTexture = true;
storyboard.ProvideResources = true;
});
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
@@ -142,7 +178,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("allow all lookups", () =>
{
storyboard.UseSkinSprites = true;
storyboard.AlwaysProvideTexture = true;
storyboard.ProvideResources = true;
});
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
@@ -156,7 +192,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("allow all lookups", () =>
{
storyboard.UseSkinSprites = true;
storyboard.AlwaysProvideTexture = true;
storyboard.ProvideResources = true;
});
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
@@ -170,17 +206,25 @@ namespace osu.Game.Tests.Visual.Gameplay
AddAssert("origin back", () => sprites.All(s => s.Origin == Anchor.TopLeft));
}
private DrawableStoryboard createSprite(string lookupName, Anchor origin, Vector2 initialPosition)
private Drawable createSprite(string lookupName, Anchor origin, Vector2 initialPosition)
{
var layer = storyboard.GetLayer("Background");
var sprite = new StoryboardSprite(lookupName, origin, initialPosition);
sprite.AddLoop(Time.Current, 100).Alpha.Add(Easing.None, 0, 10000, 1, 1);
var loop = sprite.AddLoopingGroup(Time.Current, 100);
loop.AddAlpha(Easing.None, 0, 10000, 1, 1);
layer.Elements.Clear();
layer.Add(sprite);
return storyboard.CreateDrawable().With(s => s.RelativeSizeAxes = Axes.Both);
return new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
storyboard.CreateDrawable()
}
};
}
private void assertStoryboardSourced()
@@ -202,42 +246,52 @@ namespace osu.Game.Tests.Visual.Gameplay
return new TestDrawableStoryboard(this, mods);
}
public bool AlwaysProvideTexture { get; set; }
public bool ProvideResources { get; set; }
public override string GetStoragePathFromStoryboardPath(string path) => AlwaysProvideTexture ? path : string.Empty;
public override string GetStoragePathFromStoryboardPath(string path) => ProvideResources ? path : string.Empty;
private partial class TestDrawableStoryboard : DrawableStoryboard
{
private readonly bool alwaysProvideTexture;
private readonly bool provideResources;
public TestDrawableStoryboard(TestStoryboard storyboard, IReadOnlyList<Mod>? mods)
: base(storyboard, mods)
{
alwaysProvideTexture = storyboard.AlwaysProvideTexture;
provideResources = storyboard.ProvideResources;
}
protected override IResourceStore<byte[]> CreateResourceLookupStore() => alwaysProvideTexture
? new AlwaysReturnsTextureStore()
protected override IResourceStore<byte[]> CreateResourceLookupStore() => provideResources
? new ResourcesTextureStore()
: new ResourceStore<byte[]>();
internal class AlwaysReturnsTextureStore : IResourceStore<byte[]>
internal class ResourcesTextureStore : IResourceStore<byte[]>
{
private const string test_image = "Resources/Textures/test-image.png";
private readonly DllResourceStore store;
public AlwaysReturnsTextureStore()
public ResourcesTextureStore()
{
store = TestResources.GetStore();
}
public void Dispose() => store.Dispose();
public byte[] Get(string name) => store.Get(test_image);
public byte[] Get(string name) => store.Get(map(name));
public Task<byte[]> GetAsync(string name, CancellationToken cancellationToken = new CancellationToken()) => store.GetAsync(test_image, cancellationToken);
public Task<byte[]> GetAsync(string name, CancellationToken cancellationToken = new CancellationToken()) => store.GetAsync(map(name), cancellationToken);
public Stream GetStream(string name) => store.GetStream(test_image);
public Stream GetStream(string name) => store.GetStream(map(name));
private string map(string name)
{
switch (name)
{
case lookup_name:
return "Resources/Textures/test-image.png";
default:
return $"Resources/{name}";
}
}
public IEnumerable<string> GetAvailableResources() => store.GetAvailableResources();
}
@@ -47,7 +47,7 @@ namespace osu.Game.Tests.Visual.Gameplay
var sprite = new StoryboardSprite("unknown", Anchor.TopLeft, Vector2.Zero);
sprite.TimelineGroup.Alpha.Add(Easing.None, firstStoryboardEvent, firstStoryboardEvent + 500, 0, 1);
sprite.Commands.AddAlpha(Easing.None, firstStoryboardEvent, firstStoryboardEvent + 500, 0, 1);
storyboard.GetLayer("Background").Add(sprite);
@@ -73,17 +73,17 @@ namespace osu.Game.Tests.Visual.Gameplay
var sprite = new StoryboardSprite("unknown", Anchor.TopLeft, Vector2.Zero);
// these should be ignored as we have an alpha visibility blocker proceeding this command.
sprite.TimelineGroup.Scale.Add(Easing.None, loop_start_time, -18000, 0, 1);
var loopGroup = sprite.AddLoop(loop_start_time, 50);
loopGroup.Scale.Add(Easing.None, loop_start_time, -18000, 0, 1);
sprite.Commands.AddScale(Easing.None, loop_start_time, -18000, 0, 1);
var loopGroup = sprite.AddLoopingGroup(loop_start_time, 50);
loopGroup.AddScale(Easing.None, loop_start_time, -18000, 0, 1);
var target = addEventToLoop ? loopGroup : sprite.TimelineGroup;
var target = addEventToLoop ? loopGroup : sprite.Commands;
double loopRelativeOffset = addEventToLoop ? -loop_start_time : 0;
target.Alpha.Add(Easing.None, loopRelativeOffset + firstStoryboardEvent, loopRelativeOffset + firstStoryboardEvent + 500, 0, 1);
target.AddAlpha(Easing.None, loopRelativeOffset + firstStoryboardEvent, loopRelativeOffset + firstStoryboardEvent + 500, 0, 1);
// these should be ignored due to being in the future.
sprite.TimelineGroup.Alpha.Add(Easing.None, 18000, 20000, 0, 1);
loopGroup.Alpha.Add(Easing.None, 38000, 40000, 0, 1);
sprite.Commands.AddAlpha(Easing.None, 18000, 20000, 0, 1);
loopGroup.AddAlpha(Easing.None, 38000, 40000, 0, 1);
storyboard.GetLayer("Background").Add(sprite);
@@ -0,0 +1,264 @@
// 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;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.IO.Stores;
using osu.Framework.Testing;
using osu.Framework.Timing;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Mods;
using osu.Game.Storyboards;
using osu.Game.Storyboards.Drawables;
using osu.Game.Tests.Resources;
using osuTK;
namespace osu.Game.Tests.Visual.Gameplay
{
public partial class TestSceneStoryboardCommands : OsuTestScene
{
[Cached(typeof(Storyboard))]
private TestStoryboard storyboard { get; set; } = new TestStoryboard
{
UseSkinSprites = false,
AlwaysProvideTexture = true,
};
private readonly ManualClock manualClock = new ManualClock { Rate = 1, IsRunning = true };
private int clockDirection;
private const string lookup_name = "hitcircleoverlay";
private const double clock_limit = 2500;
protected override Container<Drawable> Content => content;
private Container content = null!;
private SpriteText timelineText = null!;
private Box timelineMarker = null!;
[BackgroundDependencyLoader]
private void load()
{
base.Content.Children = new Drawable[]
{
content = new Container
{
RelativeSizeAxes = Axes.Both,
},
timelineText = new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Margin = new MarginPadding { Bottom = 60 },
},
timelineMarker = new Box
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomCentre,
RelativePositionAxes = Axes.X,
Size = new Vector2(2, 50),
},
};
}
[SetUpSteps]
public void SetUpSteps()
{
AddStep("start clock", () => clockDirection = 1);
AddStep("pause clock", () => clockDirection = 0);
AddStep("set clock = 0", () => manualClock.CurrentTime = 0);
}
[Test]
public void TestNormalCommandPlayback()
{
AddStep("create storyboard", () => Child = createStoryboard(s =>
{
s.Commands.AddY(Easing.OutBounce, 500, 900, 100, 240);
s.Commands.AddY(Easing.OutQuint, 1100, 1500, 240, 100);
}));
assert(0, 100);
assert(500, 100);
assert(1000, 240);
assert(1500, 100);
assert(clock_limit, 100);
assert(1500, 100);
assert(1000, 240);
assert(500, 100);
assert(0, 100);
void assert(double time, double y)
{
AddStep($"set clock = {time}", () => manualClock.CurrentTime = time);
AddAssert($"sprite y = {y} at t = {time}", () => this.ChildrenOfType<DrawableStoryboardSprite>().Single().Y == y);
}
}
[Test]
public void TestLoopingCommandsPlayback()
{
AddStep("create storyboard", () => Child = createStoryboard(s =>
{
var loop = s.AddLoopingGroup(250, 1);
loop.AddY(Easing.OutBounce, 0, 400, 100, 240);
loop.AddY(Easing.OutQuint, 600, 1000, 240, 100);
}));
assert(0, 100);
assert(250, 100);
assert(850, 240);
assert(1250, 100);
assert(1850, 240);
assert(2250, 100);
assert(clock_limit, 100);
assert(2250, 100);
assert(1850, 240);
assert(1250, 100);
assert(850, 240);
assert(250, 100);
assert(0, 100);
void assert(double time, double y)
{
AddStep($"set clock = {time}", () => manualClock.CurrentTime = time);
AddAssert($"sprite y = {y} at t = {time}", () => this.ChildrenOfType<DrawableStoryboardSprite>().Single().Y == y);
}
}
[Test]
public void TestLoopManyTimes()
{
AddStep("create storyboard", () => Child = createStoryboard(s =>
{
var loop = s.AddLoopingGroup(500, 10000);
loop.AddY(Easing.OutBounce, 0, 60, 100, 240);
loop.AddY(Easing.OutQuint, 80, 120, 240, 100);
}));
}
[Test]
public void TestParameterTemporaryEffect()
{
AddStep("create storyboard", () => Child = createStoryboard(s =>
{
s.Commands.AddFlipV(Easing.None, 1000, 1500, true, false);
}));
AddAssert("sprite not flipped at t = 0", () => !this.ChildrenOfType<DrawableStoryboardSprite>().Single().FlipV);
AddStep("set clock = 1250", () => manualClock.CurrentTime = 1250);
AddAssert("sprite flipped at t = 1250", () => this.ChildrenOfType<DrawableStoryboardSprite>().Single().FlipV);
AddStep("set clock = 2000", () => manualClock.CurrentTime = 2000);
AddAssert("sprite not flipped at t = 2000", () => !this.ChildrenOfType<DrawableStoryboardSprite>().Single().FlipV);
AddStep("resume clock", () => clockDirection = 1);
}
[Test]
public void TestParameterPermanentEffect()
{
AddStep("create storyboard", () => Child = createStoryboard(s =>
{
s.Commands.AddFlipV(Easing.None, 1000, 1000, true, true);
}));
AddAssert("sprite flipped at t = 0", () => this.ChildrenOfType<DrawableStoryboardSprite>().Single().FlipV);
AddStep("set clock = 1250", () => manualClock.CurrentTime = 1250);
AddAssert("sprite flipped at t = 1250", () => this.ChildrenOfType<DrawableStoryboardSprite>().Single().FlipV);
AddStep("set clock = 2000", () => manualClock.CurrentTime = 2000);
AddAssert("sprite flipped at t = 2000", () => this.ChildrenOfType<DrawableStoryboardSprite>().Single().FlipV);
AddStep("resume clock", () => clockDirection = 1);
}
protected override void Update()
{
base.Update();
if (manualClock.CurrentTime > clock_limit || manualClock.CurrentTime < 0)
clockDirection = -clockDirection;
manualClock.CurrentTime += Time.Elapsed * clockDirection;
timelineText.Text = $"Time: {manualClock.CurrentTime:0}ms";
timelineMarker.X = (float)(manualClock.CurrentTime / clock_limit);
}
private DrawableStoryboard createStoryboard(Action<StoryboardSprite>? addCommands = null)
{
var layer = storyboard.GetLayer("Background");
var sprite = new StoryboardSprite(lookup_name, Anchor.Centre, new Vector2(320, 240));
sprite.Commands.AddScale(Easing.None, 0, clock_limit, 0.5f, 0.5f);
sprite.Commands.AddAlpha(Easing.None, 0, clock_limit, 1, 1);
addCommands?.Invoke(sprite);
layer.Elements.Clear();
layer.Add(sprite);
return storyboard.CreateDrawable().With(c => c.Clock = new FramedClock(manualClock));
}
private partial class TestStoryboard : Storyboard
{
public override DrawableStoryboard CreateDrawable(IReadOnlyList<Mod>? mods = null)
{
return new TestDrawableStoryboard(this, mods);
}
public bool AlwaysProvideTexture { get; set; }
public override string GetStoragePathFromStoryboardPath(string path) => AlwaysProvideTexture ? path : string.Empty;
private partial class TestDrawableStoryboard : DrawableStoryboard
{
private readonly bool alwaysProvideTexture;
public TestDrawableStoryboard(TestStoryboard storyboard, IReadOnlyList<Mod>? mods)
: base(storyboard, mods)
{
alwaysProvideTexture = storyboard.AlwaysProvideTexture;
}
protected override IResourceStore<byte[]> CreateResourceLookupStore() => alwaysProvideTexture
? new AlwaysReturnsTextureStore()
: new ResourceStore<byte[]>();
internal class AlwaysReturnsTextureStore : IResourceStore<byte[]>
{
private const string test_image = "Resources/Textures/test-image.png";
private readonly DllResourceStore store;
public AlwaysReturnsTextureStore()
{
store = TestResources.GetStore();
}
public void Dispose() => store.Dispose();
public byte[] Get(string name) => store.Get(test_image);
public Task<byte[]> GetAsync(string name, CancellationToken cancellationToken = new CancellationToken()) => store.GetAsync(test_image, cancellationToken);
public Stream GetStream(string name) => store.GetStream(test_image);
public IEnumerable<string> GetAvailableResources() => store.GetAvailableResources();
}
}
}
}
}
@@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
var storyboard = new Storyboard();
var sprite = new StoryboardSprite("unknown", Anchor.TopLeft, Vector2.Zero);
sprite.TimelineGroup.Alpha.Add(Easing.None, startTime, 0, 0, 1);
sprite.Commands.AddAlpha(Easing.None, startTime, 0, 0, 1);
storyboard.GetLayer("Background").Add(sprite);
return storyboard;
}
@@ -216,7 +216,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
var storyboard = new Storyboard();
var sprite = new StoryboardSprite("unknown", Anchor.TopLeft, Vector2.Zero);
sprite.TimelineGroup.Alpha.Add(Easing.None, 0, duration, 1, 0);
sprite.Commands.AddAlpha(Easing.None, 0, duration, 1, 0);
storyboard.GetLayer("Background").Add(sprite);
return storyboard;
}
@@ -69,8 +69,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
}),
createLoungeRoom(new Room
{
Name = { Value = "Multiplayer room" },
Status = { Value = new RoomStatusOpen() },
Name = { Value = "Private room" },
Status = { Value = new RoomStatusOpenPrivate() },
HasPassword = { Value = true },
EndDate = { Value = DateTimeOffset.Now.AddDays(1) },
Type = { Value = MatchType.HeadToHead },
Playlist =
@@ -424,7 +424,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
public void TestIntroStoryboardElement() => testLeadIn(b =>
{
var sprite = new StoryboardSprite("unknown", Anchor.TopLeft, Vector2.Zero);
sprite.TimelineGroup.Alpha.Add(Easing.None, -2000, 0, 0, 1);
sprite.Commands.AddAlpha(Easing.None, -2000, 0, 0, 1);
b.Storyboard.GetLayer("Background").Add(sprite);
});
@@ -145,6 +145,19 @@ namespace osu.Game.Tests.Visual.Navigation
presentAndConfirm(secondImport, type);
}
[Test]
public void TestPresentTwoImportsWithSameOnlineIDButDifferentHashes([Values] ScorePresentType type)
{
AddStep("enter song select", () => Game.ChildrenOfType<ButtonSystem>().Single().OnSolo?.Invoke());
AddUntilStep("song select is current", () => Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect && songSelect.BeatmapSetsLoaded);
var firstImport = importScore(1);
presentAndConfirm(firstImport, type);
var secondImport = importScore(1);
presentAndConfirm(secondImport, type);
}
private void returnToMenu()
{
// if we don't pause, there's a chance the track may change at the main menu out of our control (due to reaching the end of the track).
@@ -170,7 +183,7 @@ namespace osu.Game.Tests.Visual.Navigation
BeatmapInfo = beatmap.Beatmaps.First(),
Ruleset = ruleset ?? new OsuRuleset().RulesetInfo,
User = new GuestUser(),
}).Value;
})!.Value;
});
AddAssert($"import {i} succeeded", () => imported != null);
@@ -3,6 +3,7 @@
#nullable disable
using System;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
@@ -321,6 +322,30 @@ namespace osu.Game.Tests.Visual.Navigation
AddUntilStep("nested input disabled", () => ((Player)Game.ScreenStack.CurrentScreen).ChildrenOfType<PassThroughInputManager>().All(manager => !manager.UseParentInput));
}
[Test]
public void TestSkinSavesOnChange()
{
advanceToSongSelect();
openSkinEditor();
Guid editedSkinId = Guid.Empty;
AddStep("save skin id", () => editedSkinId = Game.Dependencies.Get<SkinManager>().CurrentSkinInfo.Value.ID);
AddStep("add skinnable component", () =>
{
skinEditor.ChildrenOfType<SkinComponentToolbox.ToolboxComponentButton>().First().TriggerClick();
});
AddStep("change to triangles skin", () => Game.Dependencies.Get<SkinManager>().SetSkinFromConfiguration(SkinInfo.TRIANGLES_SKIN.ToString()));
AddUntilStep("components loaded", () => Game.ChildrenOfType<SkinComponentsContainer>().All(c => c.ComponentsLoaded));
// sort of implicitly relies on song select not being skinnable.
// TODO: revisit if the above ever changes
AddUntilStep("skin changed", () => !skinEditor.ChildrenOfType<SkinBlueprint>().Any());
AddStep("change back to modified skin", () => Game.Dependencies.Get<SkinManager>().SetSkinFromConfiguration(editedSkinId.ToString()));
AddUntilStep("components loaded", () => Game.ChildrenOfType<SkinComponentsContainer>().All(c => c.ComponentsLoaded));
AddUntilStep("changes saved", () => skinEditor.ChildrenOfType<SkinBlueprint>().Any());
}
private void advanceToSongSelect()
{
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
@@ -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()
{
@@ -82,6 +82,14 @@ namespace osu.Game.Tests.Visual.Ranking
}).ToList());
}
[Test]
public void TestNonBasicHitResultsAreIgnored()
{
createTest(CreateDistributedHitEvents(0, 50)
.Select(h => new HitEvent(h.TimeOffset, 1.0, h.TimeOffset > 0 ? HitResult.Ok : HitResult.LargeTickHit, placeholder_object, placeholder_object, null))
.ToList());
}
[Test]
public void TestMultipleWindowsOfHitResult()
{
@@ -424,7 +424,7 @@ namespace osu.Game.Tests.Visual.Ranking
scores.Add(score);
}
scoresCallback?.Invoke(scores);
scoresCallback.Invoke(scores);
return null;
}
@@ -296,7 +296,7 @@ namespace osu.Game.Tests.Visual.Settings
}
[Test]
public void TestBindingConflictResolvedByRollback()
public void TestBindingConflictResolvedByRollbackViaMouse()
{
AddStep("reset taiko section to default", () =>
{
@@ -315,7 +315,7 @@ namespace osu.Game.Tests.Visual.Settings
}
[Test]
public void TestBindingConflictResolvedByOverwrite()
public void TestBindingConflictResolvedByOverwriteViaMouse()
{
AddStep("reset taiko section to default", () =>
{
@@ -333,6 +333,46 @@ namespace osu.Game.Tests.Visual.Settings
checkBinding("Left (rim)", "M1");
}
[Test]
public void TestBindingConflictResolvedByRollbackViaKeyboard()
{
AddStep("reset taiko & global sections to default", () =>
{
panel.ChildrenOfType<VariantBindingsSubsection>().First(section => new TaikoRuleset().RulesetInfo.Equals(section.Ruleset))
.ChildrenOfType<ResetButton>().Single().TriggerClick();
panel.ChildrenOfType<ResetButton>().First().TriggerClick();
});
AddStep("move mouse to centre", () => InputManager.MoveMouseTo(panel.ScreenSpaceDrawQuad.Centre));
scrollToAndStartBinding("Left (rim)");
AddStep("attempt to bind M1 to two keys", () => InputManager.Click(MouseButton.Left));
AddUntilStep("wait for popover", () => panel.ChildrenOfType<KeyBindingConflictPopover>().SingleOrDefault(), () => Is.Not.Null);
AddStep("press Esc", () => InputManager.Key(Key.Escape));
checkBinding("Left (centre)", "M1");
checkBinding("Left (rim)", "M2");
}
[Test]
public void TestBindingConflictResolvedByOverwriteViaKeyboard()
{
AddStep("reset taiko & global sections to default", () =>
{
panel.ChildrenOfType<VariantBindingsSubsection>().First(section => new TaikoRuleset().RulesetInfo.Equals(section.Ruleset))
.ChildrenOfType<ResetButton>().Single().TriggerClick();
panel.ChildrenOfType<ResetButton>().First().TriggerClick();
});
AddStep("move mouse to centre", () => InputManager.MoveMouseTo(panel.ScreenSpaceDrawQuad.Centre));
scrollToAndStartBinding("Left (rim)");
AddStep("attempt to bind M1 to two keys", () => InputManager.Click(MouseButton.Left));
AddUntilStep("wait for popover", () => panel.ChildrenOfType<KeyBindingConflictPopover>().SingleOrDefault(), () => Is.Not.Null);
AddStep("press Enter", () => InputManager.Key(Key.Enter));
checkBinding("Left (centre)", InputSettingsStrings.ActionHasNoKeyBinding.ToString());
checkBinding("Left (rim)", "M1");
}
[Test]
public void TestBindingConflictCausedByResetToDefaultOfSingleRow()
{
@@ -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);
@@ -77,21 +77,21 @@ namespace osu.Game.Tests.Visual.UserInterface
new OsuMenuItem(@"Some option"),
new OsuMenuItem(@"Highlighted option", MenuItemType.Highlighted),
new OsuMenuItem(@"Another option"),
new OsuMenuItem(@"Nested option >")
new OsuMenuItem(@"Nested option")
{
Items = new MenuItem[]
{
new OsuMenuItem(@"Sub-One"),
new OsuMenuItem(@"Sub-Two"),
new OsuMenuItem(@"Sub-Three"),
new OsuMenuItem(@"Sub-Nested option >")
new OsuMenuItem(@"Sub-Nested option")
{
Items = new MenuItem[]
{
new OsuMenuItem(@"Double Sub-One"),
new OsuMenuItem(@"Double Sub-Two"),
new OsuMenuItem(@"Double Sub-Three"),
new OsuMenuItem(@"Sub-Sub-Nested option >")
new OsuMenuItem(@"Sub-Sub-Nested option")
{
Items = new MenuItem[]
{
@@ -104,7 +104,7 @@ namespace osu.Game.Tests.Visual.UserInterface
Files = { new RealmNamedFileUsage(new RealmFile { Hash = $"{i}" }, string.Empty) }
};
importedScores.Add(scoreManager.Import(score).Value);
importedScores.Add(scoreManager.Import(score)!.Value);
}
});
});
@@ -123,6 +123,43 @@ namespace osu.Game.Tests.Visual.UserInterface
assertSelectedModsEquivalentTo(new Mod[] { new OsuModTouchDevice(), new OsuModHardRock(), new OsuModDoubleTime { SpeedChange = { Value = 1.5 } } });
}
[Test]
public void TestSystemModsNotPreservedIfIncompatibleWithPresetMods()
{
ModPresetPanel? panel = null;
AddStep("create panel", () => Child = panel = new ModPresetPanel(new ModPreset
{
Name = "Autopilot included",
Description = "no way",
Mods = new Mod[]
{
new OsuModAutopilot()
},
Ruleset = new OsuRuleset().RulesetInfo
}.ToLiveUnmanaged())
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 0.5f
});
AddStep("Add touch device to selected mods", () => SelectedMods.Value = new Mod[] { new OsuModTouchDevice() });
AddStep("activate panel", () => panel.AsNonNull().TriggerClick());
// touch device should be removed due to incompatibility with autopilot.
assertSelectedModsEquivalentTo(new Mod[] { new OsuModAutopilot() });
AddStep("deactivate panel", () => panel.AsNonNull().TriggerClick());
assertSelectedModsEquivalentTo(Array.Empty<Mod>());
// just for test purposes, can't/shouldn't happen in reality
AddStep("Add score v2 to selected mod", () => SelectedMods.Value = new Mod[] { new ModScoreV2() });
AddStep("activate panel", () => panel.AsNonNull().TriggerClick());
assertSelectedModsEquivalentTo(new Mod[] { new OsuModAutopilot(), new ModScoreV2() });
}
private void assertSelectedModsEquivalentTo(IEnumerable<Mod> mods)
=> AddAssert("selected mods changed correctly", () => new HashSet<Mod>(SelectedMods.Value).SetEquals(mods));
@@ -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()
{
@@ -5,7 +5,9 @@
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Rulesets.Osu;
@@ -20,9 +22,9 @@ namespace osu.Game.Tests.Visual.UserInterface
private NowPlayingOverlay nowPlayingOverlay;
[BackgroundDependencyLoader]
private void load()
private void load(FrameworkConfigManager frameworkConfig)
{
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
AddToggleStep("toggle unicode", v => frameworkConfig.SetValue(FrameworkSetting.ShowUnicode, v));
nowPlayingOverlay = new NowPlayingOverlay
{
@@ -37,9 +39,38 @@ namespace osu.Game.Tests.Visual.UserInterface
[Test]
public void TestShowHideDisable()
{
AddStep(@"set beatmap", () => Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo));
AddStep(@"show", () => nowPlayingOverlay.Show());
AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state);
AddStep(@"hide", () => nowPlayingOverlay.Hide());
}
[Test]
public void TestLongMetadata()
{
AddStep(@"set metadata within tolerance", () => Beatmap.Value = CreateWorkingBeatmap(new Beatmap
{
Metadata =
{
Artist = "very very very very very very very very very very verry long artist",
ArtistUnicode = "very very very very very very very very very very verry long artist unicode",
Title = "very very very very very verry long title",
TitleUnicode = "very very very very very verry long title unicode",
}
}));
AddStep(@"set metadata outside bounds", () => Beatmap.Value = CreateWorkingBeatmap(new Beatmap
{
Metadata =
{
Artist = "very very very very very very very very very very verrry long artist",
ArtistUnicode = "not very long artist unicode",
Title = "very very very very very verrry long title",
TitleUnicode = "not very long title unicode",
}
}));
AddStep(@"show", () => nowPlayingOverlay.Show());
}
}
}
@@ -1,6 +1,8 @@
// 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;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
@@ -10,16 +12,19 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Testing;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Select.FooterV2;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.Footer;
using osu.Game.Screens.SelectV2.Footer;
using osuTK.Input;
namespace osu.Game.Tests.Visual.SongSelect
namespace osu.Game.Tests.Visual.UserInterface
{
public partial class TestSceneSongSelectFooterV2 : OsuManualInputManagerTestScene
public partial class TestSceneScreenFooter : OsuManualInputManagerTestScene
{
private FooterButtonRandomV2 randomButton = null!;
private FooterButtonModsV2 modsButton = null!;
private ScreenFooterButtonRandom randomButton = null!;
private ScreenFooterButtonMods modsButton = null!;
private bool nextRandomCalled;
private bool previousRandomCalled;
@@ -35,25 +40,25 @@ namespace osu.Game.Tests.Visual.SongSelect
nextRandomCalled = false;
previousRandomCalled = false;
FooterV2 footer;
ScreenFooter footer;
Children = new Drawable[]
{
new PopoverContainer
{
RelativeSizeAxes = Axes.Both,
Child = footer = new FooterV2(),
Child = footer = new ScreenFooter(),
},
overlay = new DummyOverlay()
};
footer.AddButton(modsButton = new FooterButtonModsV2(), overlay);
footer.AddButton(randomButton = new FooterButtonRandomV2
footer.AddButton(modsButton = new ScreenFooterButtonMods { Current = SelectedMods }, overlay);
footer.AddButton(randomButton = new ScreenFooterButtonRandom
{
NextRandom = () => nextRandomCalled = true,
PreviousRandom = () => previousRandomCalled = true
});
footer.AddButton(new FooterButtonOptionsV2());
footer.AddButton(new ScreenFooterButtonOptions());
overlay.Hide();
});
@@ -61,15 +66,40 @@ namespace osu.Game.Tests.Visual.SongSelect
[SetUpSteps]
public void SetUpSteps()
{
AddStep("clear mods", () => SelectedMods.Value = Array.Empty<Mod>());
AddStep("set beatmap", () => Beatmap.Value = CreateWorkingBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo)));
}
[Test]
public void TestMods()
{
AddStep("one mod", () => SelectedMods.Value = new List<Mod> { new OsuModHidden() });
AddStep("two mods", () => SelectedMods.Value = new List<Mod> { new OsuModHidden(), new OsuModHardRock() });
AddStep("three mods", () => SelectedMods.Value = new List<Mod> { new OsuModHidden(), new OsuModHardRock(), new OsuModDoubleTime() });
AddStep("four mods", () => SelectedMods.Value = new List<Mod> { new OsuModHidden(), new OsuModHardRock(), new OsuModDoubleTime(), new OsuModClassic() });
AddStep("five mods", () => SelectedMods.Value = new List<Mod> { new OsuModHidden(), new OsuModHardRock(), new OsuModDoubleTime(), new OsuModClassic(), new OsuModDifficultyAdjust() });
AddStep("modified", () => SelectedMods.Value = new List<Mod> { new OsuModDoubleTime { SpeedChange = { Value = 1.2 } } });
AddStep("modified + one", () => SelectedMods.Value = new List<Mod> { new OsuModHidden(), new OsuModDoubleTime { SpeedChange = { Value = 1.2 } } });
AddStep("modified + two", () => SelectedMods.Value = new List<Mod> { new OsuModHidden(), new OsuModHardRock(), new OsuModDoubleTime { SpeedChange = { Value = 1.2 } } });
AddStep("modified + three", () => SelectedMods.Value = new List<Mod> { new OsuModHidden(), new OsuModHardRock(), new OsuModClassic(), new OsuModDoubleTime { SpeedChange = { Value = 1.2 } } });
AddStep("modified + four", () => SelectedMods.Value = new List<Mod> { new OsuModHidden(), new OsuModHardRock(), new OsuModClassic(), new OsuModDifficultyAdjust(), new OsuModDoubleTime { SpeedChange = { Value = 1.2 } } });
AddStep("clear mods", () => SelectedMods.Value = Array.Empty<Mod>());
AddWaitStep("wait", 3);
AddStep("one mod", () => SelectedMods.Value = new List<Mod> { new OsuModHidden() });
AddStep("clear mods", () => SelectedMods.Value = Array.Empty<Mod>());
AddWaitStep("wait", 3);
AddStep("five mods", () => SelectedMods.Value = new List<Mod> { new OsuModHidden(), new OsuModHardRock(), new OsuModDoubleTime(), new OsuModClassic(), new OsuModDifficultyAdjust() });
}
[Test]
public void TestShowOptions()
{
AddStep("enable options", () =>
{
var optionsButton = this.ChildrenOfType<FooterButtonV2>().Last();
var optionsButton = this.ChildrenOfType<ScreenFooterButton>().Last();
optionsButton.Enabled.Value = true;
optionsButton.TriggerClick();
@@ -79,7 +109,7 @@ namespace osu.Game.Tests.Visual.SongSelect
[Test]
public void TestState()
{
AddToggleStep("set options enabled state", state => this.ChildrenOfType<FooterButtonV2>().Last().Enabled.Value = state);
AddToggleStep("set options enabled state", state => this.ChildrenOfType<ScreenFooterButton>().Last().Enabled.Value = state);
}
[Test]
@@ -0,0 +1,120 @@
// 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;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.SelectV2.Footer;
using osu.Game.Utils;
namespace osu.Game.Tests.Visual.UserInterface
{
public partial class TestSceneScreenFooterButtonMods : OsuTestScene
{
private readonly TestScreenFooterButtonMods footerButtonMods;
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
public TestSceneScreenFooterButtonMods()
{
Add(footerButtonMods = new TestScreenFooterButtonMods
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft,
X = -100,
Action = () => { },
});
}
[Test]
public void TestDisplay()
{
AddStep("one mod", () => changeMods(new List<Mod> { new OsuModHidden() }));
AddStep("two mods", () => changeMods(new List<Mod> { new OsuModHidden(), new OsuModHardRock() }));
AddStep("three mods", () => changeMods(new List<Mod> { new OsuModHidden(), new OsuModHardRock(), new OsuModDoubleTime() }));
AddStep("four mods", () => changeMods(new List<Mod> { new OsuModHidden(), new OsuModHardRock(), new OsuModDoubleTime(), new OsuModClassic() }));
AddStep("five mods", () => changeMods(new List<Mod> { new OsuModHidden(), new OsuModHardRock(), new OsuModDoubleTime(), new OsuModClassic(), new OsuModDifficultyAdjust() }));
AddStep("modified", () => changeMods(new List<Mod> { new OsuModDoubleTime { SpeedChange = { Value = 1.2 } } }));
AddStep("modified + one", () => changeMods(new List<Mod> { new OsuModHidden(), new OsuModDoubleTime { SpeedChange = { Value = 1.2 } } }));
AddStep("modified + two", () => changeMods(new List<Mod> { new OsuModHidden(), new OsuModHardRock(), new OsuModDoubleTime { SpeedChange = { Value = 1.2 } } }));
AddStep("clear mods", () => changeMods(Array.Empty<Mod>()));
AddWaitStep("wait", 3);
AddStep("one mod", () => changeMods(new List<Mod> { new OsuModHidden() }));
AddStep("clear mods", () => changeMods(Array.Empty<Mod>()));
AddWaitStep("wait", 3);
AddStep("five mods", () => changeMods(new List<Mod> { new OsuModHidden(), new OsuModHardRock(), new OsuModDoubleTime(), new OsuModClassic(), new OsuModDifficultyAdjust() }));
}
[Test]
public void TestIncrementMultiplier()
{
var hiddenMod = new Mod[] { new OsuModHidden() };
AddStep(@"Add Hidden", () => changeMods(hiddenMod));
AddAssert(@"Check Hidden multiplier", () => assertModsMultiplier(hiddenMod));
var hardRockMod = new Mod[] { new OsuModHardRock() };
AddStep(@"Add HardRock", () => changeMods(hardRockMod));
AddAssert(@"Check HardRock multiplier", () => assertModsMultiplier(hardRockMod));
var doubleTimeMod = new Mod[] { new OsuModDoubleTime() };
AddStep(@"Add DoubleTime", () => changeMods(doubleTimeMod));
AddAssert(@"Check DoubleTime multiplier", () => assertModsMultiplier(doubleTimeMod));
var multipleIncrementMods = new Mod[] { new OsuModDoubleTime(), new OsuModHidden(), new OsuModHardRock() };
AddStep(@"Add multiple Mods", () => changeMods(multipleIncrementMods));
AddAssert(@"Check multiple mod multiplier", () => assertModsMultiplier(multipleIncrementMods));
}
[Test]
public void TestDecrementMultiplier()
{
var easyMod = new Mod[] { new OsuModEasy() };
AddStep(@"Add Easy", () => changeMods(easyMod));
AddAssert(@"Check Easy multiplier", () => assertModsMultiplier(easyMod));
var noFailMod = new Mod[] { new OsuModNoFail() };
AddStep(@"Add NoFail", () => changeMods(noFailMod));
AddAssert(@"Check NoFail multiplier", () => assertModsMultiplier(noFailMod));
var multipleDecrementMods = new Mod[] { new OsuModEasy(), new OsuModNoFail() };
AddStep(@"Add Multiple Mods", () => changeMods(multipleDecrementMods));
AddAssert(@"Check multiple mod multiplier", () => assertModsMultiplier(multipleDecrementMods));
}
[Test]
public void TestUnrankedBadge()
{
AddStep(@"Add unranked mod", () => changeMods(new[] { new OsuModDeflate() }));
AddUntilStep("Unranked badge shown", () => footerButtonMods.ChildrenOfType<ScreenFooterButtonMods.UnrankedBadge>().Single().Alpha == 1);
AddStep(@"Clear selected mod", () => changeMods(Array.Empty<Mod>()));
AddUntilStep("Unranked badge not shown", () => footerButtonMods.ChildrenOfType<ScreenFooterButtonMods.UnrankedBadge>().Single().Alpha == 0);
}
private void changeMods(IReadOnlyList<Mod> mods) => footerButtonMods.Current.Value = mods;
private bool assertModsMultiplier(IEnumerable<Mod> mods)
{
double multiplier = mods.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier);
string expectedValue = ModUtils.FormatScoreMultiplier(multiplier).ToString();
return expectedValue == footerButtonMods.MultiplierText.Current.Value;
}
private partial class TestScreenFooterButtonMods : ScreenFooterButtonMods
{
public new OsuSpriteText MultiplierText => base.MultiplierText;
}
}
}
@@ -114,6 +114,51 @@ namespace osu.Game.Tests.Visual.UserInterface
=> AddAssert($"state is {expected}", () => state.Value == expected);
}
[Test]
public void TestItemRespondsToRightClick()
{
OsuMenu menu = null;
Bindable<TernaryState> state = new Bindable<TernaryState>(TernaryState.Indeterminate);
AddStep("create menu", () =>
{
state.Value = TernaryState.Indeterminate;
Child = menu = new OsuMenu(Direction.Vertical, true)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Items = new[]
{
new TernaryStateToggleMenuItem("First"),
new TernaryStateToggleMenuItem("Second") { State = { BindTarget = state } },
new TernaryStateToggleMenuItem("Third") { State = { Value = TernaryState.True } },
}
};
});
checkState(TernaryState.Indeterminate);
click();
checkState(TernaryState.True);
click();
checkState(TernaryState.False);
AddStep("change state via bindable", () => state.Value = TernaryState.True);
void click() =>
AddStep("click", () =>
{
InputManager.MoveMouseTo(menu.ScreenSpaceDrawQuad.Centre);
InputManager.Click(MouseButton.Right);
});
void checkState(TernaryState expected)
=> AddAssert($"state is {expected}", () => state.Value == expected);
}
[Test]
public void TestCustomState()
{
@@ -22,7 +22,7 @@ namespace osu.Game.Tournament.Screens.Ladder
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false;
public override bool UpdateSubTreeMasking(Drawable source, RectangleF maskingBounds) => false;
public override bool UpdateSubTreeMasking() => false;
protected override void OnDrag(DragEvent e)
{
+2
View File
@@ -63,6 +63,8 @@ namespace osu.Game.Beatmaps
public List<BreakPeriod> Breaks { get; set; } = new List<BreakPeriod>();
public List<string> UnhandledEventLines { get; set; } = new List<string>();
[JsonIgnore]
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
+1
View File
@@ -66,6 +66,7 @@ namespace osu.Game.Beatmaps
beatmap.ControlPointInfo = original.ControlPointInfo;
beatmap.HitObjects = convertHitObjects(original.HitObjects, original, cancellationToken).OrderBy(s => s.StartTime).ToList();
beatmap.Breaks = original.Breaks;
beatmap.UnhandledEventLines = original.UnhandledEventLines;
return beatmap;
}
@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text.RegularExpressions;
using osu.Framework.Allocation;
@@ -21,6 +22,8 @@ using osu.Game.Utils;
namespace osu.Game.Beatmaps.Drawables
{
[SuppressMessage("ReSharper", "StringLiteralTypo")]
[SuppressMessage("ReSharper", "CommentTypo")]
public partial class BundledBeatmapDownloader : CompositeDrawable
{
private readonly bool shouldPostNotifications;
@@ -50,7 +53,7 @@ namespace osu.Game.Beatmaps.Drawables
{
queueDownloads(always_bundled_beatmaps);
queueDownloads(bundled_osu, 8);
queueDownloads(bundled_osu, 6);
queueDownloads(bundled_taiko, 3);
queueDownloads(bundled_catch, 3);
queueDownloads(bundled_mania, 3);
@@ -128,6 +131,26 @@ namespace osu.Game.Beatmaps.Drawables
}
}
/*
* criteria for bundled maps (managed by pishifat)
*
* auto:
* - licensed song
* - includes ENHI diffs
* - between 60s and 240s
*
* manual:
* - bg is explicitly permitted as okay to use. lots of artists say some variation of "it's ok for personal use/non-commercial use/with credit"
* (which is prob fine when maps are presented as user-generated content), but for a new osu! player, it's easy to assume bundled maps are
* commercial content like other rhythm games, so it's best to be cautious about using not-explicitly-permitted artwork.
*
* - no ai/thirst bgs
* - no controversial/explicit song content or titles
* - no repeating bundled songs (within each mode)
* - no songs that are relatively low production value
* - no songs with limited accessibility (annoying high pitch vocals, noise rock, etc)
*/
private const string tutorial_filename = "1011011 nekodex - new beginnings.osz";
/// <summary>
@@ -135,215 +158,312 @@ namespace osu.Game.Beatmaps.Drawables
/// </summary>
private static readonly string[] always_bundled_beatmaps =
{
// This thing is 40mb, I'm not sure we want it here...
// winner of https://osu.ppy.sh/home/news/2013-09-06-osu-monthly-beatmapping-contest-1
@"123593 Rostik - Liquid (Paul Rosenthal Remix).osz",
// winner of https://osu.ppy.sh/home/news/2013-10-28-monthly-beatmapping-contest-2-submissions-open
@"140662 cYsmix feat. Emmy - Tear Rain.osz",
// winner of https://osu.ppy.sh/home/news/2013-12-15-monthly-beatmapping-contest-3-submissions-open
@"151878 Chasers - Lost.osz",
// winner of https://osu.ppy.sh/home/news/2014-02-14-monthly-beatmapping-contest-4-submissions-now
@"163112 Kuba Oms - My Love.osz",
// winner of https://osu.ppy.sh/home/news/2014-05-07-monthly-beatmapping-contest-5-submissions-now
@"190390 Rameses B - Flaklypa.osz",
// winner of https://osu.ppy.sh/home/news/2014-09-24-monthly-beatmapping-contest-7
@"241526 Soleily - Renatus.osz",
// winner of https://osu.ppy.sh/home/news/2015-02-11-monthly-beatmapping-contest-8
@"299224 raja - the light.osz",
// winner of https://osu.ppy.sh/home/news/2015-04-13-monthly-beatmapping-contest-9-taiko-only
@"319473 Furries in a Blender - Storm World.osz",
// winner of https://osu.ppy.sh/home/news/2015-06-15-monthly-beatmapping-contest-10-ctb-only
@"342751 Hylian Lemon - Foresight Is for Losers.osz",
// winner of https://osu.ppy.sh/home/news/2015-08-22-monthly-beatmapping-contest-11-mania-only
@"385056 Toni Leys - Dragon Valley (Toni Leys Remix feat. Esteban Bellucci).osz",
// winner of https://osu.ppy.sh/home/news/2016-03-04-beatmapping-contest-12-osu
@"456054 IAHN - Candy Luv (Short Ver.).osz",
// winner of https://osu.ppy.sh/home/news/2020-11-30-a-labour-of-love
// (this thing is 40mb, I'm not sure if we want it here...)
@"1388906 Raphlesia & BilliumMoto - My Love.osz",
// Winner of Triangles mapping competition: https://osu.ppy.sh/home/news/2022-10-06-results-triangles
// winner of https://osu.ppy.sh/home/news/2022-05-31-triangles
@"1841885 cYsmix - triangles.osz",
// winner of https://osu.ppy.sh/home/news/2023-02-01-twin-trials-contest-beatmapping-phase
@"1971987 James Landino - Aresene's Bazaar.osz",
};
private static readonly string[] bundled_osu =
{
"682286 Yuyoyuppe - Emerald Galaxy.osz",
"682287 baker - For a Dead Girl+.osz",
"682289 Hige Driver - I Wanna Feel Your Love (feat. shully).osz",
"682290 Hige Driver - Miracle Sugite Yabai (feat. shully).osz",
"682416 Hige Driver - Palette.osz",
"682595 baker - Kimi ga Kimi ga -vocanico remix-.osz",
"716211 yuki. - Spring Signal.osz",
"716213 dark cat - BUBBLE TEA (feat. juu & cinders).osz",
"716215 LukHash - CLONED.osz",
"716219 IAHN - Snowdrop.osz",
"716249 *namirin - Senaka Awase no Kuukyo (with Kakichoco).osz",
"716390 sakuraburst - SHA.osz",
"716441 Fractal Dreamers - Paradigm Shift.osz",
"729808 Thaehan - Leprechaun.osz",
"751771 Cranky - Hanaarashi.osz",
"751772 Cranky - Ran.osz",
"751773 Cranky - Feline, the White....osz",
"751774 Function Phantom - Variable.osz",
"751779 Rin - Daishibyo set 14 ~ Sado no Futatsuiwa.osz",
"751782 Fractal Dreamers - Fata Morgana.osz",
"751785 Cranky - Chandelier - King.osz",
"751846 Fractal Dreamers - Celestial Horizon.osz",
"751866 Rin - Moriya set 08 ReEdit ~ Youkai no Yama.osz",
"751894 Fractal Dreamers - Blue Haven.osz",
"751896 Cranky - Rave 2 Rave.osz",
"751932 Cranky - La fuite des jours.osz",
"751972 Cranky - CHASER.osz",
"779173 Thaehan - Superpower.osz",
"780932 VINXIS - A Centralized View.osz",
"785572 S3RL - I'll See You Again (feat. Chi Chi).osz",
"785650 yuki. feat. setsunan - Hello! World.osz",
"785677 Dictate - Militant.osz",
"785731 S3RL - Catchit (Radio Edit).osz",
"785774 LukHash - GLITCH.osz",
"786498 Trial & Error - Tokoyami no keiyaku KEGARETA-SHOUJO feat. GUMI.osz",
"789374 Pulse - LP.osz",
"789528 James Portland - Sky.osz",
"789529 Lexurus - Gravity.osz",
"789544 Andromedik - Invasion.osz",
"789905 Gourski x Himmes - Silence.osz",
"791667 cYsmix - Babaroque (Short Ver.).osz",
"791798 cYsmix - Behind the Walls.osz",
"791845 cYsmix - Little Knight.osz",
"792241 cYsmix - Eden.osz",
"792396 cYsmix - The Ballad of a Mindless Girl.osz",
"795432 Phonetic - Journey.osz",
"831322 DJ'TEKINA//SOMETHING - Hidamari no Uta.osz",
"847764 Cranky - Crocus.osz",
"847776 Culprate & Joe Ford - Gaucho.osz",
"847812 J. Pachelbel - Canon (Cranky Remix).osz",
"847900 Cranky - Time Alter.osz",
"847930 LukHash - 8BIT FAIRY TALE.osz",
"848003 Culprate - Aurora.osz",
"848068 nanobii - popsicle beach.osz",
"848090 Trial & Error - DAI*TAN SENSATION feat. Nanahira, Mii, Aitsuki Nakuru (Short Ver.).osz",
"848259 Culprate & Skorpion - Jester.osz",
"848976 Dictate - Treason.osz",
"851543 Culprate - Florn.osz",
"864748 Thaehan - Angry Birds Epic (Remix).osz",
"873667 OISHII - ONIGIRI FREEWAY.osz",
"876227 Culprate, Keota & Sophie Meiers - Mechanic Heartbeat.osz",
"880487 cYsmix - Peer Gynt.osz",
"883088 Wisp X - Somewhere I'd Rather Be.osz",
"891333 HyuN - White Aura.osz",
"891334 HyuN - Wild Card.osz",
"891337 HyuN feat. LyuU - Cross Over.osz",
"891338 HyuN & Ritoru - Apocalypse in Love.osz",
"891339 HyuN feat. Ato - Asu wa Ame ga Yamukara.osz",
"891345 HyuN - Infinity Heaven.osz",
"891348 HyuN - Guitian.osz",
"891356 HyuN - Legend of Genesis.osz",
"891366 HyuN - Illusion of Inflict.osz",
"891417 HyuN feat. Yu-A - My life is for you.osz",
"891441 HyuN - You'Re aRleAdY dEAd.osz",
"891632 HyuN feat. YURI - Disorder.osz",
"891712 HyuN - Tokyo's Starlight.osz",
"901091 *namirin - Ciel etoile.osz",
"916990 *namirin - Koishiteiku Planet.osz",
"929284 tieff - Sense of Nostalgia.osz",
"933940 Ben Briggs - Yes (Maybe).osz",
"934415 Ben Briggs - Fearless Living.osz",
"934627 Ben Briggs - New Game Plus.osz",
"934666 Ben Briggs - Wave Island.osz",
"936126 siromaru + cranky - conflict.osz",
"940377 onumi - ARROGANCE.osz",
"940597 tieff - Take Your Swimsuit.osz",
"941085 tieff - Our Story.osz",
"949297 tieff - Sunflower.osz",
"952380 Ben Briggs - Why Are We Yelling.osz",
"954272 *namirin - Kanzen Shouri*Esper Girl.osz",
"955866 KIRA & Heartbreaker - B.B.F (feat. Hatsune Miku & Kagamine Rin).osz",
"961320 Kuba Oms - All In All.osz",
"964553 The Flashbulb - You Take the World's Weight Away.osz",
"965651 Fractal Dreamers - Ad Astra.osz",
"966225 The Flashbulb - Passage D.osz",
"966324 DJ'TEKINA//SOMETHING - Hidamari no Uta.osz",
"972810 James Landino & Kabuki - Birdsong.osz",
"972932 James Landino - Hide And Seek.osz",
"977276 The Flashbulb - Mellann.osz",
"981616 *namirin - Mizutamari Tobikoete (with Nanahira).osz",
"985788 Loki - Wizard's Tower.osz",
"996628 OISHII - ONIGIRI FREEWAY.osz",
"996898 HyuN - White Aura.osz",
"1003554 yuki. - Nadeshiko Sensation.osz",
"1014936 Thaehan - Bwa !.osz",
"1019827 UNDEAD CORPORATION - Sad Dream.osz",
"1020213 Creo - Idolize.osz",
"1021450 Thaehan - Chiptune & Baroque.osz",
@"682286 Yuyoyuppe - Emerald Galaxy.osz",
@"682287 baker - For a Dead Girl+.osz",
@"682595 baker - Kimi ga Kimi ga -vocanico remix-.osz",
@"1048705 Thaehan - Never Give Up.osz",
@"1050185 Carpool Tunnel - Hooked Again.osz",
@"1052846 Carpool Tunnel - Impressions.osz",
@"1062477 Ricky Montgomery - Line Without a Hook.osz",
@"1081119 Celldweller - Pulsar.osz",
@"1086289 Frums - 24eeev0-$.osz",
@"1133317 PUP - Free At Last.osz",
@"1171188 PUP - Full Blown Meltdown.osz",
@"1177043 PUP - My Life Is Over And I Couldn't Be Happier.osz",
@"1250387 Circle of Dust - Humanarchy (Cut Ver.).osz",
@"1255411 Wisp X - Somewhere I'd Rather Be.osz",
@"1320298 nekodex - Little Drummer Girl.osz",
@"1323877 Masahiro ""Godspeed"" Aoki - Blaze.osz",
@"1342280 Minagu feat. Aitsuki Nakuru - Theater Endroll.osz",
@"1356447 SECONDWALL - Boku wa Boku de shika Nakute.osz",
@"1368054 SECONDWALL - Shooting Star.osz",
@"1398580 La priere - Senjou no Utahime.osz",
@"1403962 m108 - Sunflower.osz",
@"1405913 fiend - FEVER DREAM (feat. yzzyx).osz",
@"1409184 Omoi - Hey William (New Translation).osz",
@"1413418 URBANGARDE - KAMING OUT (Cut Ver.).osz",
@"1417793 P4koo (NONE) - Sogaikan Utopia.osz",
@"1428384 DUAL ALTER WORLD - Veracila.osz",
@"1442963 PUP - DVP.osz",
@"1460370 Sound Souler - Empty Stars.osz",
@"1485184 Koven - Love Wins Again.osz",
@"1496811 T & Sugah - Wicked Days (Cut Ver.).osz",
@"1501511 Masahiro ""Godspeed"" Aoki - Frostbite (Cut Ver.).osz",
@"1511518 T & Sugah X Zazu - Lost On My Own (Cut Ver.).osz",
@"1516617 wotoha - Digital Life Hacker.osz",
@"1524273 Michael Cera Palin - Admiral.osz",
@"1564234 P4koo - Fly High (feat. rerone).osz",
@"1572918 Lexurus - Take Me Away (Cut Ver.).osz",
@"1577313 Kurubukko - The 84th Flight.osz",
@"1587839 Amidst - Droplet.osz",
@"1595193 BlackY - Sakura Ranman Cleopatra.osz",
@"1667560 xi - FREEDOM DiVE.osz",
@"1668789 City Girl - L2M (feat. Kelsey Kuan).osz",
@"1672934 xi - Parousia.osz",
@"1673457 Boom Kitty - Any Other Way (feat. Ivy Marie).osz",
@"1685122 xi - Time files.osz",
@"1689372 NIWASHI - Y.osz",
@"1729551 JOYLESS - Dream.osz",
@"1742868 Ritorikal - Synergy.osz",
@"1757511 KINEMA106 - KARASU.osz",
@"1778169 Ricky Montgomery - Cabo.osz",
@"1848184 FRASER EDWARDS - Ruination.osz",
@"1862574 Pegboard Nerds - Try This (Cut Ver.).osz",
@"1873680 happy30 - You spin my world.osz",
@"1890055 A.SAKA - Mutsuki Akari no Yuki.osz",
@"1911933 Marmalade butcher - Waltz for Chroma (feat. Natsushiro Takaaki).osz",
@"1940007 Mili - Ga1ahad and Scientific Witchery.osz",
@"1948970 Shadren - You're Here Forever.osz",
@"1967856 Annabel - alpine blue.osz",
@"1969316 Silentroom - NULCTRL.osz",
@"1978614 Krimek - Idyllic World.osz",
@"1991315 Feint - Tower Of Heaven (You Are Slaves) (Cut Ver.).osz",
@"1997470 tephe - Genjitsu Escape.osz",
@"1999116 soowamisu - .vaporcore.osz",
@"2010589 Junk - Yellow Smile (bms edit).osz",
@"2022054 Yokomin - STINGER.osz",
@"2025686 Aice room - For U.osz",
@"2035357 C-Show feat. Ishizawa Yukari - Border Line.osz",
@"2039403 SECONDWALL - Freedom.osz",
@"2046487 Rameses B - Against the Grain (feat. Veela).osz",
@"2052201 ColBreakz & Vizzen - Remember.osz",
@"2055535 Sephid - Thunderstrike 1988.osz",
@"2057584 SAMString - Ataraxia.osz",
@"2067270 Blue Stahli - The Fall.osz",
@"2075039 garlagan - Skyless.osz",
@"2079089 Hamu feat. yuiko - Innocent Letter.osz",
@"2082895 FATE GEAR - Heart's Grave.osz",
@"2085974 HoneyComeBear - Twilight.osz",
@"2094934 F.O.O.L & Laura Brehm - Waking Up.osz",
@"2097481 Mameyudoufu - Wave feat. Aitsuki Nakuru.osz",
@"2106075 MYUKKE. - The 89's Momentum.osz",
@"2117392 t+pazolite & Komiya Mao - Elustametat.osz",
@"2123533 LeaF - Calamity Fortune.osz",
@"2143876 Alkome - Your Voice.osz",
@"2145826 Sephid - Cross-D Skyline.osz",
@"2153172 Emiru no Aishita Tsukiyo ni Dai San Gensou Kyoku wo - Eternal Bliss.osz",
};
private static readonly string[] bundled_taiko =
{
"707824 Fractal Dreamers - Fortuna Redux.osz",
"789553 Cranky - Ran.osz",
"827822 Function Phantom - Neuronecia.osz",
"847323 Nakanojojo - Bittersweet (feat. Kuishinboakachan a.k.a Kiato).osz",
"847433 Trial & Error - Tokoyami no keiyaku KEGARETA-SHOUJO feat. GUMI.osz",
"847576 dark cat - hot chocolate.osz",
"847957 Wisp X - Final Moments.osz",
"876282 VINXIS - Greetings.osz",
"876648 Thaehan - Angry Birds Epic (Remix).osz",
"877069 IAHN - Transform (Original Mix).osz",
"877496 Thaehan - Leprechaun.osz",
"877935 Thaehan - Overpowered.osz",
"878344 yuki. - Be Your Light.osz",
"918446 VINXIS - Facade.osz",
"918903 LukHash - Ghosts.osz",
"919251 *namirin - Hitokoto no Kyori.osz",
"919704 S3RL - I Will Pick You Up (feat. Tamika).osz",
"921535 SOOOO - Raven Haven.osz",
"927206 *namirin - Kanzen Shouri*Esper Girl.osz",
"927544 Camellia feat. Nanahira - Kansoku Eisei.osz",
"930806 Nakanojojo - Pararara (feat. Amekoya).osz",
"931741 Camellia - Quaoar.osz",
"935699 Rin - Mythic set ~ Heart-Stirring Urban Legends.osz",
"935732 Thaehan - Yuujou.osz",
"941145 Function Phantom - Euclid.osz",
"942334 Dictate - Cauldron.osz",
"946540 nanobii - astral blast.osz",
"948844 Rin - Kishinjou set 01 ~ Mist Lake.osz",
"949122 Wisp X - Petal.osz",
"951618 Rin - Kishinjou set 02 ~ Mermaid from the Uncharted Land.osz",
"957412 Rin - Lunatic set 16 ~ The Space Shrine Maiden Returns Home.osz",
"961335 Thaehan - Insert Coin.osz",
"965178 The Flashbulb - DIDJ PVC.osz",
"966087 The Flashbulb - Creep.osz",
"966277 The Flashbulb - Amen Iraq.osz",
"966407 LukHash - ROOM 12.osz",
"966451 The Flashbulb - Six Acid Strings.osz",
"972301 BilliumMoto - four veiled stars.osz",
"973173 nanobii - popsicle beach.osz",
"973954 BilliumMoto - Rocky Buinne (Short Ver.).osz",
"975435 BilliumMoto - life flashes before weeb eyes.osz",
"978759 L. V. Beethoven - Moonlight Sonata (Cranky Remix).osz",
"982559 BilliumMoto - HDHR.osz",
"984361 The Flashbulb - Ninedump.osz",
"1023681 Inferi - The Ruin of Mankind.osz",
"1034358 ALEPH - The Evil Spirit.osz",
"1037567 ALEPH - Scintillations.osz",
"1048153 Chroma - [@__@].osz",
"1229307 Venetian Snares - Shaky Sometimes.osz",
"1236083 meganeko - Sirius A (osu! edit).osz",
"1248594 Noisia - Anomaly.osz",
"1272851 siqlo - One Way Street.osz",
"1290736 Kola Kid - good old times.osz",
"1318825 SECONDWALL - Light.osz",
"1320872 MYUKKE. - The 89's Momentum.osz",
"1337389 cute girls doing cute things - Main Heroine.osz",
"1397782 Reku Mochizuki - Yorixiro.osz",
"1407228 II-L - VANGUARD-1.osz",
"1422686 II-L - VANGUARD-2.osz",
"1429217 Street - Phi.osz",
"1442235 2ToneDisco x Cosmicosmo - Shoelaces (feat. Puniden).osz",
"1447478 Cres. - End Time.osz",
"1449942 m108 - Crescent Sakura.osz",
"1463778 MuryokuP - A tree without a branch.osz",
"1465152 fiend - Fever Dream (feat. yzzyx).osz",
"1472397 MYUKKE. - Boudica.osz",
"1488148 Aoi vs. siqlo - Hacktivism.osz",
"1522733 wotoha - Digital Life Hacker.osz",
"1540010 Marmalade butcher - Floccinaucinihilipilification.osz",
"1584690 MYUKKE. - AKKERA-COUNTRY-BOY.osz",
"1608857 BLOOD STAIN CHILD - S.O.P.H.I.A.osz",
"1609365 Reku Mochizuki - Faith of Eastward.osz",
"1622545 METAROOM - I - DINKI THE STARGUIDE.osz",
"1629336 METAROOM - PINK ORIGINS.osz",
"1644680 Neko Hacker - Pictures feat. 4s4ki.osz",
"1650835 RiraN - Ready For The Madness.osz",
"1661508 PTB10 - Starfall.osz",
"1671987 xi - World Fragments II.osz",
"1703065 tokiwa - wasurena feat. Sennzai.osz",
"1703527 tokiwa feat. Nakamura Sanso - Kotodama Refrain.osz",
"1704340 A-One feat. Shihori - Magic Girl !!.osz",
"1712783 xi - Parousia.osz",
"1718774 Harumaki Gohan - Suisei ni Nareta nara.osz",
"1719687 EmoCosine - Love Kills U.osz",
"1733940 WHITEFISTS feat. Sennzai - Paralyzed Ash.osz",
"1734692 EmoCosine - Cutter.osz",
"1739529 luvlxckdown - tbh i dont like being social.osz",
"1756970 Kurubukko vs. yukitani - Minamichita EVOLVED.osz",
"1762209 Marmalade butcher - Immortality Math Club.osz",
"1765720 ZxNX - FORTALiCE.osz",
"1786165 NILFRUITS - Arandano.osz",
"1787258 SAMString - Night Fighter.osz",
"1791462 ZxNX - Schadenfreude.osz",
"1793821 Kobaryo - The Lightning Sword.osz",
"1796440 kuru x miraie - re:start.osz",
"1799285 Origami Angel - 666 Flags.osz",
"1812415 nanobii - Rainbow Road.osz",
"1814682 NIWASHI - Y.osz",
"1818361 meganeko - Feral (osu! edit).osz",
"1818924 fiend - Disconnect.osz",
"1838730 Pegboard Nerds - Disconnected.osz",
"1854710 Blaster & Extra Terra - Spacecraft (Cut Ver.).osz",
"1859322 Hino Isuka - Delightness Brightness.osz",
"1884102 Maduk - Go (feat. Lachi) (Cut Ver.).osz",
"1884578 Neko Hacker - People People feat. Nanahira.osz",
"1897902 uma vs. Morimori Atsushi - Re: End of a Dream.osz",
"1905582 KINEMA106 - Fly Away (Cut Ver.).osz",
"1934686 ARForest - Rainbow Magic!!.osz",
"1963076 METAROOM - S.N.U.F.F.Y.osz",
"1968973 Stars Hollow - Out the Sunroof..osz",
"1971951 James Landino - Shiba Paradise.osz",
"1972518 Toromaru - Sleight of Hand.osz",
"1982302 KINEMA106 - INVITE.osz",
"1983475 KNOWER - The Government Knows.osz",
"2010165 Junk - Yellow Smile (bms edit).osz",
"2022737 Andora - Euphoria (feat. WaMi).osz",
"2025023 tephe - Genjitsu Escape.osz",
"2052754 P4koo - 8th:Planet ~Re:search~.osz",
"2054122 Raimukun - Myths Orbis.osz",
"2121470 Raimukun - Nyarlathotep's Dreamland.osz",
"2122284 Agressor Bunx - Tornado (Cut Ver.).osz",
"2125034 Agressor Bunx - Acid Mirage (Cut Ver.).osz",
"2136263 Se-U-Ra - Cris Fortress.osz",
};
private static readonly string[] bundled_catch =
{
"554256 Helblinde - When Time Sleeps.osz",
"693123 yuki. - Nadeshiko Sensation.osz",
"767009 OISHII - PIZZA PLAZA.osz",
"767346 Thaehan - Bwa !.osz",
"815162 VINXIS - Greetings.osz",
"840964 cYsmix - Breeze.osz",
"932657 Wisp X - Eventide.osz",
"933700 onumi - CONFUSION PART ONE.osz",
"933984 onumi - PERSONALITY.osz",
"934785 onumi - FAKE.osz",
"936545 onumi - REGRET PART ONE.osz",
"943803 Fractal Dreamers - Everything for a Dream.osz",
"943876 S3RL - I Will Pick You Up (feat. Tamika).osz",
"946773 Trial & Error - DREAMING COLOR (Short Ver.).osz",
"955808 Trial & Error - Tokoyami no keiyaku KEGARETA-SHOUJO feat. GUMI (Short Ver.).osz",
"957808 Fractal Dreamers - Module_410.osz",
"957842 antiPLUR - One Life Left to Live.osz",
"965730 The Flashbulb - Lawn Wake IV (Black).osz",
"966240 Creo - Challenger.osz",
"968232 Rin - Lunatic set 15 ~ The Moon as Seen from the Shrine.osz",
"972302 VINXIS - A Centralized View.osz",
"972887 HyuN - Illusion of Inflict.osz",
"1008600 LukHash - WHEN AN ANGEL DIES.osz",
"1032103 LukHash - H8 U.osz",
@"693123 yuki. - Nadeshiko Sensation.osz",
@"833719 FOLiACETATE - Heterochromia Iridis.osz",
@"981762 siromaru + cranky - conflict.osz",
@"1008600 LukHash - WHEN AN ANGEL DIES.osz",
@"1071294 dark cat - pursuit of happiness.osz",
@"1102115 meganeko - Nova.osz",
@"1115500 Chopin - Etude Op. 25, No. 12 (meganeko Remix).osz",
@"1128274 LeaF - Wizdomiot.osz",
@"1141049 HyuN feat. JeeE - Fallen Angel.osz",
@"1148215 Zekk - Fluctuation.osz",
@"1151833 ginkiha - nightfall.osz",
@"1158124 PUP - Dark Days.osz",
@"1184890 IAHN - Transform (Original Mix).osz",
@"1195922 Disasterpeace - Home.osz",
@"1197461 MIMI - Nanimo nai Youna.osz",
@"1197924 Camellia feat. Nanahira - Looking For A New Adventure.osz",
@"1203594 ginkiha - Anemoi.osz",
@"1211572 MIMI - Lapis Lazuli.osz",
@"1231601 Lime - Harmony.osz",
@"1240162 P4koo - 8th:Planet ~Re:search~.osz",
@"1246000 Zekk - Calling.osz",
@"1249928 Thaehan - Yuujou.osz",
@"1258751 Umeboshi Chazuke - ICHIBANBOSHI*ROCKET.osz",
@"1264818 Umeboshi Chazuke - Panic! Pop'n! Picnic! (2019 REMASTER).osz",
@"1280183 IAHN - Mad Halloween.osz",
@"1303201 Umeboshi Chazuke - Run*2 Run To You!!.osz",
@"1328918 Kobaryo - Theme for Psychopath Justice.osz",
@"1338215 Lime - Renai Syndrome.osz",
@"1338796 uma vs. Morimori Atsushi - Re:End of a Dream.osz",
@"1340492 MYUKKE. - The 89's Momentum.osz",
@"1393933 Mastermind (xi+nora2r) - Dreadnought.osz",
@"1400205 m108 - XIII Charlotte.osz",
@"1471328 Lime - Chronomia.osz",
@"1503591 Origami Angel - The Title Track.osz",
@"1524173 litmus* as Ester - Krave.osz",
@"1541235 Getty vs. DJ DiA - Grayed Out -Antifront-.osz",
@"1554250 Shawn Wasabi - Otter Pop (feat. Hollis).osz",
@"1583461 Sound Souler - Absent Color.osz",
@"1638487 tokiwa - wasurena feat. Sennzai.osz",
@"1698949 ZxNX - Schadenfreude.osz",
@"1704324 xi - Time files.osz",
@"1756405 Fractal Dreamers - Kingdom of Silence.osz",
@"1769575 cYsmix - Peer Gynt.osz",
@"1770054 Ardolf - Split.osz",
@"1772648 in love with a ghost - interdimensional portal leading to a cute place feat. snail's house.osz",
@"1776379 in love with a ghost - i thought we were lovers w/ basil.osz",
@"1779476 URBANGARDE - KIMI WA OKUMAGASO.osz",
@"1789435 xi - Parousia.osz",
@"1794190 Se-U-Ra - The Endless for Traveler.osz",
@"1799889 Waterflame - Ricochet Love.osz",
@"1816401 Gram vs. Yooh - Apocalypse.osz",
@"1826327 -45 - Total Eclipse of The Sun.osz",
@"1830796 xi - Halcyon.osz",
@"1924231 Mili - Nine Point Eight.osz",
@"1952903 Cres. - End Time.osz",
@"1970946 Good Kid - Slingshot.osz",
@"1982063 linear ring - enchanted love.osz",
@"2000438 Toromaru - Erinyes.osz",
@"2124277 II-L - VANGUARD-3.osz",
@"2147529 Nashimoto Ui - AaAaAaAAaAaAAa (Cut Ver.).osz",
};
private static readonly string[] bundled_mania =
{
"943516 antiPLUR - Clockwork Spooks.osz",
"946394 VINXIS - Three Times The Original Charm.osz",
"966408 antiPLUR - One Life Left to Live.osz",
"971561 antiPLUR - Runengon.osz",
"983864 James Landino - Shiba Island.osz",
"989512 BilliumMoto - 1xMISS.osz",
"994104 James Landino - Reaction feat. Slyleaf.osz",
"1003217 nekodex - circles!.osz",
"1009907 James Landino & Kabuki - Birdsong.osz",
"1015169 Thaehan - Insert Coin.osz",
@"1008419 BilliumMoto - Four Veiled Stars.osz",
@"1025170 Frums - We Want To Run.osz",
@"1092856 F-777 - Viking Arena.osz",
@"1139247 O2i3 - Heart Function.osz",
@"1154007 LeaF - ATHAZA.osz",
@"1170054 Zekk - Fallen.osz",
@"1212132 Street - Koiyamai (TV Size).osz",
@"1226466 Se-U-Ra - Elif to Shiro Kura no Yoru -Called-.osz",
@"1247210 Frums - Credits.osz",
@"1254196 ARForest - Regret.osz",
@"1258829 Umeboshi Chazuke - Cineraria.osz",
@"1300398 ARForest - The Last Page.osz",
@"1305627 Frums - Star of the COME ON!!.osz",
@"1348806 Se-U-Ra - LOA2.osz",
@"1375449 yuki. - Nadeshiko Sensation.osz",
@"1448292 Cres. - End Time.osz",
@"1479741 Reku Mochizuki - FORViDDEN ENERZY -Fataldoze-.osz",
@"1494747 Fractal Dreamers - Whispers from a Distant Star.osz",
@"1505336 litmus* - Rush-More.osz",
@"1508963 ARForest - Rainbow Magic!!.osz",
@"1727126 Chroma - Strange Inventor.osz",
@"1737101 ZxNX - FORTALiCE.osz",
@"1740952 Sobrem x Silentroom - Random.osz",
@"1756251 Plum - Mad Piano Party.osz",
@"1909163 Frums - theyaremanycolors.osz",
@"1916285 siromaru + cranky - conflict.osz",
@"1948972 Ardolf - Split.osz",
@"1957138 GLORYHAMMER - Rise Of The Chaos Wizards.osz",
@"1972411 James Landino - Shiba Paradise.osz",
@"1978179 Andora - Flicker (feat. RANASOL).osz",
@"1987180 cygnus - The Evolution of War.osz",
@"1994458 tephe - Genjitsu Escape.osz",
@"1999339 Aice room - Nyan Nyan Dive (EmoCosine Remix).osz",
@"2015361 HoneyComeBear - Rainy Girl.osz",
@"2028108 HyuN - Infinity Heaven.osz",
@"2055329 miraie & blackwinterwells - facade.osz",
@"2069877 Sephid - Thunderstrike 1988.osz",
@"2119716 Aethoro - Snowy.osz",
@"2120379 Synthion - VIVIDVELOCITY.osz",
@"2124805 Frums (unknown ""lambda"") - 19ZZ.osz",
@"2127811 Wiklund - Joy of Living (Cut Ver.).osz",
};
}
}
@@ -52,8 +52,11 @@ namespace osu.Game.Beatmaps.Drawables
private Drawable getDrawableForModel(IBeatmapInfo? model)
{
if (model == null)
return Empty();
// prefer online cover where available.
if (model?.BeatmapSet is IBeatmapSetOnlineInfo online)
if (model.BeatmapSet is IBeatmapSetOnlineInfo online)
return new OnlineBeatmapSetCover(online, beatmapSetCoverType);
if (model is BeatmapInfo localModel)
+1 -1
View File
@@ -53,7 +53,7 @@ namespace osu.Game.Beatmaps
protected override IBeatmap GetBeatmap() => new Beatmap();
public override Texture GetBackground() => textures?.Get(@"Backgrounds/bg4");
public override Texture GetBackground() => textures?.Get(@"Backgrounds/bg2");
protected override Track GetBeatmapTrack() => GetVirtualTrack();
@@ -167,8 +167,6 @@ namespace osu.Game.Beatmaps.Formats
beatmapInfo.SamplesMatchPlaybackRate = false;
}
protected override bool ShouldSkipLine(string line) => base.ShouldSkipLine(line) || line.StartsWith(' ') || line.StartsWith('_');
protected override void ParseLine(Beatmap beatmap, Section section, string line)
{
switch (section)
@@ -417,43 +415,57 @@ namespace osu.Game.Beatmaps.Formats
{
string[] split = line.Split(',');
if (!Enum.TryParse(split[0], out LegacyEventType type))
throw new InvalidDataException($@"Unknown event type: {split[0]}");
// Until we have full storyboard encoder coverage, let's track any lines which aren't handled
// and store them to a temporary location such that they aren't lost on editor save / export.
bool lineSupportedByEncoder = false;
switch (type)
if (Enum.TryParse(split[0], out LegacyEventType type))
{
case LegacyEventType.Sprite:
// Generally, the background is the first thing defined in a beatmap file.
// In some older beatmaps, it is not present and replaced by a storyboard-level background instead.
// Allow the first sprite (by file order) to act as the background in such cases.
if (string.IsNullOrEmpty(beatmap.BeatmapInfo.Metadata.BackgroundFile))
beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[3]);
break;
switch (type)
{
case LegacyEventType.Sprite:
// Generally, the background is the first thing defined in a beatmap file.
// In some older beatmaps, it is not present and replaced by a storyboard-level background instead.
// Allow the first sprite (by file order) to act as the background in such cases.
if (string.IsNullOrEmpty(beatmap.BeatmapInfo.Metadata.BackgroundFile))
{
beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[3]);
lineSupportedByEncoder = true;
}
case LegacyEventType.Video:
string filename = CleanFilename(split[2]);
break;
// Some very old beatmaps had incorrect type specifications for their backgrounds (ie. using 1 for VIDEO
// instead of 0 for BACKGROUND). To handle this gracefully, check the file extension against known supported
// video extensions and handle similar to a background if it doesn't match.
if (!OsuGameBase.VIDEO_EXTENSIONS.Contains(Path.GetExtension(filename).ToLowerInvariant()))
{
beatmap.BeatmapInfo.Metadata.BackgroundFile = filename;
}
case LegacyEventType.Video:
string filename = CleanFilename(split[2]);
break;
// Some very old beatmaps had incorrect type specifications for their backgrounds (ie. using 1 for VIDEO
// instead of 0 for BACKGROUND). To handle this gracefully, check the file extension against known supported
// video extensions and handle similar to a background if it doesn't match.
if (!OsuGameBase.VIDEO_EXTENSIONS.Contains(Path.GetExtension(filename).ToLowerInvariant()))
{
beatmap.BeatmapInfo.Metadata.BackgroundFile = filename;
lineSupportedByEncoder = true;
}
case LegacyEventType.Background:
beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[2]);
break;
break;
case LegacyEventType.Break:
double start = getOffsetTime(Parsing.ParseDouble(split[1]));
double end = Math.Max(start, getOffsetTime(Parsing.ParseDouble(split[2])));
case LegacyEventType.Background:
beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[2]);
lineSupportedByEncoder = true;
break;
beatmap.Breaks.Add(new BreakPeriod(start, end));
break;
case LegacyEventType.Break:
double start = getOffsetTime(Parsing.ParseDouble(split[1]));
double end = Math.Max(start, getOffsetTime(Parsing.ParseDouble(split[2])));
beatmap.Breaks.Add(new BreakPeriod(start, end));
lineSupportedByEncoder = true;
break;
}
}
if (!lineSupportedByEncoder)
beatmap.UnhandledEventLines.Add(line);
}
private void handleTimingPoint(string line)
@@ -156,6 +156,9 @@ namespace osu.Game.Beatmaps.Formats
foreach (var b in beatmap.Breaks)
writer.WriteLine(FormattableString.Invariant($"{(int)LegacyEventType.Break},{b.StartTime},{b.EndTime}"));
foreach (string l in beatmap.UnhandledEventLines)
writer.WriteLine(l);
}
private void handleControlPoints(TextWriter writer)
@@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Game.Beatmaps.Legacy;
using osu.Game.IO;
using osu.Game.Storyboards;
using osu.Game.Storyboards.Commands;
using osuTK;
using osuTK.Graphics;
@@ -17,7 +18,7 @@ namespace osu.Game.Beatmaps.Formats
public class LegacyStoryboardDecoder : LegacyDecoder<Storyboard>
{
private StoryboardSprite? storyboardSprite;
private CommandTimelineGroup? timelineGroup;
private StoryboardCommandGroup? currentCommandsGroup;
private Storyboard storyboard = null!;
@@ -114,7 +115,7 @@ namespace osu.Game.Beatmaps.Formats
if (!OsuGameBase.VIDEO_EXTENSIONS.Contains(Path.GetExtension(path).ToLowerInvariant()))
break;
storyboard.GetLayer("Video").Add(new StoryboardVideo(path, offset));
storyboard.GetLayer("Video").Add(storyboardSprite = new StoryboardVideo(path, offset));
break;
}
@@ -164,7 +165,7 @@ namespace osu.Game.Beatmaps.Formats
else
{
if (depth < 2)
timelineGroup = storyboardSprite?.TimelineGroup;
currentCommandsGroup = storyboardSprite?.Commands;
string commandType = split[0];
@@ -176,7 +177,7 @@ namespace osu.Game.Beatmaps.Formats
double startTime = split.Length > 2 ? Parsing.ParseDouble(split[2]) : double.MinValue;
double endTime = split.Length > 3 ? Parsing.ParseDouble(split[3]) : double.MaxValue;
int groupNumber = split.Length > 4 ? Parsing.ParseInt(split[4]) : 0;
timelineGroup = storyboardSprite?.AddTrigger(triggerName, startTime, endTime, groupNumber);
currentCommandsGroup = storyboardSprite?.AddTriggerGroup(triggerName, startTime, endTime, groupNumber);
break;
}
@@ -184,7 +185,7 @@ namespace osu.Game.Beatmaps.Formats
{
double startTime = Parsing.ParseDouble(split[1]);
int repeatCount = Parsing.ParseInt(split[2]);
timelineGroup = storyboardSprite?.AddLoop(startTime, Math.Max(0, repeatCount - 1));
currentCommandsGroup = storyboardSprite?.AddLoopingGroup(startTime, Math.Max(0, repeatCount - 1));
break;
}
@@ -203,7 +204,7 @@ namespace osu.Game.Beatmaps.Formats
{
float startValue = Parsing.ParseFloat(split[4]);
float endValue = split.Length > 5 ? Parsing.ParseFloat(split[5]) : startValue;
timelineGroup?.Alpha.Add(easing, startTime, endTime, startValue, endValue);
currentCommandsGroup?.AddAlpha(easing, startTime, endTime, startValue, endValue);
break;
}
@@ -211,7 +212,7 @@ namespace osu.Game.Beatmaps.Formats
{
float startValue = Parsing.ParseFloat(split[4]);
float endValue = split.Length > 5 ? Parsing.ParseFloat(split[5]) : startValue;
timelineGroup?.Scale.Add(easing, startTime, endTime, startValue, endValue);
currentCommandsGroup?.AddScale(easing, startTime, endTime, startValue, endValue);
break;
}
@@ -221,7 +222,7 @@ namespace osu.Game.Beatmaps.Formats
float startY = Parsing.ParseFloat(split[5]);
float endX = split.Length > 6 ? Parsing.ParseFloat(split[6]) : startX;
float endY = split.Length > 7 ? Parsing.ParseFloat(split[7]) : startY;
timelineGroup?.VectorScale.Add(easing, startTime, endTime, new Vector2(startX, startY), new Vector2(endX, endY));
currentCommandsGroup?.AddVectorScale(easing, startTime, endTime, new Vector2(startX, startY), new Vector2(endX, endY));
break;
}
@@ -229,7 +230,7 @@ namespace osu.Game.Beatmaps.Formats
{
float startValue = Parsing.ParseFloat(split[4]);
float endValue = split.Length > 5 ? Parsing.ParseFloat(split[5]) : startValue;
timelineGroup?.Rotation.Add(easing, startTime, endTime, float.RadiansToDegrees(startValue), float.RadiansToDegrees(endValue));
currentCommandsGroup?.AddRotation(easing, startTime, endTime, float.RadiansToDegrees(startValue), float.RadiansToDegrees(endValue));
break;
}
@@ -239,8 +240,8 @@ namespace osu.Game.Beatmaps.Formats
float startY = Parsing.ParseFloat(split[5]);
float endX = split.Length > 6 ? Parsing.ParseFloat(split[6]) : startX;
float endY = split.Length > 7 ? Parsing.ParseFloat(split[7]) : startY;
timelineGroup?.X.Add(easing, startTime, endTime, startX, endX);
timelineGroup?.Y.Add(easing, startTime, endTime, startY, endY);
currentCommandsGroup?.AddX(easing, startTime, endTime, startX, endX);
currentCommandsGroup?.AddY(easing, startTime, endTime, startY, endY);
break;
}
@@ -248,7 +249,7 @@ namespace osu.Game.Beatmaps.Formats
{
float startValue = Parsing.ParseFloat(split[4]);
float endValue = split.Length > 5 ? Parsing.ParseFloat(split[5]) : startValue;
timelineGroup?.X.Add(easing, startTime, endTime, startValue, endValue);
currentCommandsGroup?.AddX(easing, startTime, endTime, startValue, endValue);
break;
}
@@ -256,7 +257,7 @@ namespace osu.Game.Beatmaps.Formats
{
float startValue = Parsing.ParseFloat(split[4]);
float endValue = split.Length > 5 ? Parsing.ParseFloat(split[5]) : startValue;
timelineGroup?.Y.Add(easing, startTime, endTime, startValue, endValue);
currentCommandsGroup?.AddY(easing, startTime, endTime, startValue, endValue);
break;
}
@@ -268,7 +269,7 @@ namespace osu.Game.Beatmaps.Formats
float endRed = split.Length > 7 ? Parsing.ParseFloat(split[7]) : startRed;
float endGreen = split.Length > 8 ? Parsing.ParseFloat(split[8]) : startGreen;
float endBlue = split.Length > 9 ? Parsing.ParseFloat(split[9]) : startBlue;
timelineGroup?.Colour.Add(easing, startTime, endTime,
currentCommandsGroup?.AddColour(easing, startTime, endTime,
new Color4(startRed / 255f, startGreen / 255f, startBlue / 255f, 1),
new Color4(endRed / 255f, endGreen / 255f, endBlue / 255f, 1));
break;
@@ -281,16 +282,16 @@ namespace osu.Game.Beatmaps.Formats
switch (type)
{
case "A":
timelineGroup?.BlendingParameters.Add(easing, startTime, endTime, BlendingParameters.Additive,
currentCommandsGroup?.AddBlendingParameters(easing, startTime, endTime, BlendingParameters.Additive,
startTime == endTime ? BlendingParameters.Additive : BlendingParameters.Inherit);
break;
case "H":
timelineGroup?.FlipH.Add(easing, startTime, endTime, true, startTime == endTime);
currentCommandsGroup?.AddFlipH(easing, startTime, endTime, true, startTime == endTime);
break;
case "V":
timelineGroup?.FlipV.Add(easing, startTime, endTime, true, startTime == endTime);
currentCommandsGroup?.AddFlipV(easing, startTime, endTime, true, startTime == endTime);
break;
}

Some files were not shown because too many files have changed in this diff Show More