Compare commits
55 Commits
2025.829.0
...
65f275106e
| Author | SHA1 | Date | |
|---|---|---|---|
| 65f275106e | |||
| 6e374762fd | |||
| 80646a166c | |||
| 8f0510d903 | |||
| 02e7000ee4 | |||
|
|
c26e669fc5 | ||
|
|
e621eed0ba | ||
|
|
41b8033ebd | ||
|
|
1d9de88aaa | ||
|
|
3ca5e20e70 | ||
|
|
404044e8d7 | ||
|
|
d5575b4037 | ||
|
|
04ba5aa575 | ||
|
|
51ed19cb99 | ||
|
|
0a408a3ac4 | ||
|
|
22ba956f25 | ||
|
|
526ee32268 | ||
|
|
df6d6edaca | ||
|
|
24ec43b3b6 | ||
|
|
9e77a5b050 | ||
|
|
12832e9fef | ||
|
|
e83f3d5e77 | ||
|
|
f2f5cf19a2 | ||
|
|
bb9f9e4d35 | ||
|
|
6e1316241a | ||
|
|
3eaa5314ac | ||
|
|
6ba72fa481 | ||
|
|
8dd131f17e | ||
|
|
7e109add96 | ||
|
|
f953d58922 | ||
|
|
47164c61b4 | ||
|
|
311c75aa53 | ||
|
|
0b40f1d0db | ||
|
|
e831d1b6fa | ||
|
|
ed15e1fb88 | ||
|
|
33b99a51b1 | ||
|
|
8a6c857719 | ||
|
|
5abd93eda7 | ||
|
|
4030383276 | ||
|
|
f9c1b24df4 | ||
|
|
197c318180 | ||
|
|
fda40d7fd5 | ||
|
|
be6fb9aa77 | ||
|
|
0e57ee9ba6 | ||
|
|
043235fed2 | ||
|
|
ec21685c25 | ||
|
|
244bad07c7 | ||
|
|
149f18c3f5 | ||
|
|
6a82b7331f | ||
|
|
65253708d8 | ||
|
|
556c2469bf | ||
|
|
f7b0e114a9 | ||
|
|
68677200f3 | ||
|
|
083365f332 | ||
|
|
62b4999184 |
@@ -49,7 +49,7 @@
|
||||
<PackageProjectUrl>https://github.com/ppy/osu</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/ppy/osu</RepositoryUrl>
|
||||
<PackageReleaseNotes>Automated release.</PackageReleaseNotes>
|
||||
<Company>ppy Pty Ltd</Company>
|
||||
<Company>ppy Pty Ltd, jvnkosu! team</Company>
|
||||
<Copyright>Copyright (c) 2025 ppy Pty Ltd</Copyright>
|
||||
<PackageTags>osu game</PackageTags>
|
||||
</PropertyGroup>
|
||||
|
||||
149
README.md
149
README.md
@@ -1,147 +1,40 @@
|
||||
<p align="center">
|
||||
<img width="500" alt="osu! logo" src="assets/lazer.png">
|
||||
</p>
|
||||
# jvnkosu! client
|
||||
|
||||
# osu!
|
||||
A free-to-win rhythm game based on osu!(lazer). Click is just a *rhythm* away!
|
||||
|
||||
[](https://github.com/ppy/osu/actions/workflows/ci.yml)
|
||||
[](https://github.com/ppy/osu/releases/latest)
|
||||
[](https://www.codefactor.io/repository/github/ppy/osu)
|
||||
[](https://discord.gg/ppy)
|
||||
[](https://crowdin.com/project/osu-web)
|
||||
## Disclaimer
|
||||
|
||||
A free-to-win rhythm game. Rhythm is just a *click* away!
|
||||
*osu!* is a registered trademark of ppy Pty Ltd.
|
||||
jvnkosu! is not affiliated with, or endorsed by ppy Pty Ltd., but makes use of its open-source components and resources.
|
||||
|
||||
This is the future – and final – iteration of the [osu!](https://osu.ppy.sh) game client which marks the beginning of an open era! Currently known by and released under the release codename "*lazer*". As in sharper than cutting-edge.
|
||||
## License
|
||||
Client source code is licensed under the MIT license, see the [LICENCE](LICENCE) file in repository root for more info.
|
||||
|
||||
## Status
|
||||
Game assets are included as a NuGet package and licensed under the CC BY-NC 4.0, which prohibits commercial use. See [ppy/osu-resources](https://github.com/ppy/osu-resources) for more info.
|
||||
|
||||
This project is under constant development, but we do our best to keep things in a stable state. Players are encouraged to install from a release alongside their stable *osu!* client. This project will continue to evolve until we eventually reach the point where most users prefer it over the previous "osu!stable" release.
|
||||
Registered trademarks "osu!" and "ppy" are property of ppy Pty Ltd., and protected by trademark law.
|
||||
|
||||
A few resources are available as starting points to getting involved and understanding the project:
|
||||
## Compiling from source
|
||||
Building jvnkosu! from source is pretty much possible (and welcome here).
|
||||
|
||||
- Detailed release changelogs are available on the [official osu! site](https://osu.ppy.sh/home/changelog/lazer).
|
||||
- You can learn more about our approach to [project management](https://github.com/ppy/osu/wiki/Project-management).
|
||||
- Track our current efforts [towards improving the game](https://github.com/orgs/ppy/projects/7/views/6).
|
||||
First, you must have a desktop platform with [.NET Core SDK 8](https://dotnet.microsoft.com/download) installed. Windows, Linux, macOS should work well. You can check if you have the SDK installed by running `dotnet --version` in your command prompt/terminal.
|
||||
|
||||
## Running osu!
|
||||
|
||||
If you are just looking to give the game a whirl, you can grab the latest release for your platform:
|
||||
|
||||
### Latest release:
|
||||
|
||||
| [Windows 10+ (x64)](https://github.com/ppy/osu/releases/latest/download/install.exe) | macOS 12+ ([Intel](https://github.com/ppy/osu/releases/latest/download/osu.app.Intel.zip), [Apple Silicon](https://github.com/ppy/osu/releases/latest/download/osu.app.Apple.Silicon.zip)) | [Linux (x64)](https://github.com/ppy/osu/releases/latest/download/osu.AppImage) | [iOS 13.4+](https://osu.ppy.sh/home/testflight) | [Android 5+](https://github.com/ppy/osu/releases/latest/download/sh.ppy.osulazer.apk) |
|
||||
|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------------- | ------------- | ------------- |
|
||||
|
||||
You can also generally download a version for your current device from the [osu! site](https://osu.ppy.sh/home/download).
|
||||
|
||||
If your platform is unsupported or not listed above, there is still a chance you can run the release or manually build it by following the instructions below.
|
||||
|
||||
**For iOS/iPadOS users**: The iOS testflight link fills up very fast (Apple has a hard limit of 10,000 users). We reset it occasionally. Please do not ask about this. Check back regularly for link resets or follow [peppy](https://twitter.com/ppy) on twitter for announcements. Our goal is to get the game on mobile app stores very soon so we don't have to live with this limitation.
|
||||
|
||||
## Developing a custom ruleset
|
||||
|
||||
osu! is designed to allow user-created gameplay variations, called "rulesets". Building one of these allows a developer to harness the power of the osu! beatmap library, game engine, and general UX for a new style of gameplay. To get started working on a ruleset, we have some templates available [here](https://github.com/ppy/osu/tree/master/Templates).
|
||||
|
||||
You can see some examples of custom rulesets by visiting the [custom ruleset directory](https://github.com/ppy/osu/discussions/13096).
|
||||
|
||||
## Developing osu!
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Please make sure you have the following prerequisites:
|
||||
|
||||
- A desktop platform with the [.NET 8.0 SDK](https://dotnet.microsoft.com/download) installed.
|
||||
|
||||
When working with the codebase, we recommend using an IDE with intelligent code completion and syntax highlighting, such as the latest version of [Visual Studio](https://visualstudio.microsoft.com/vs/), [JetBrains Rider](https://www.jetbrains.com/rider/), or [Visual Studio Code](https://code.visualstudio.com/) with the [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) and [C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit) plugin installed.
|
||||
|
||||
### Downloading the source code
|
||||
|
||||
Clone the repository:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/ppy/osu
|
||||
cd osu
|
||||
Then, download the source code. You may download it as an archive and unzip it, but using [Git](https://git-scm.com/) instead is recommended:
|
||||
```
|
||||
git clone https://gitea.jvnko.boats/jvnkosu/client
|
||||
```
|
||||
|
||||
To update the source code to the latest commit, run the following command inside the `osu` directory:
|
||||
|
||||
```shell
|
||||
git pull
|
||||
To **run** the project, switch to project's directory and run the following:
|
||||
```
|
||||
|
||||
### Building
|
||||
|
||||
#### From an IDE
|
||||
|
||||
You should load the solution via one of the platform-specific `.slnf` files, rather than the main `.sln`. This will reduce dependencies and hide platforms that you don't care about. Valid `.slnf` files are:
|
||||
|
||||
- `osu.Desktop.slnf` (most common)
|
||||
- `osu.Android.slnf`
|
||||
- `osu.iOS.slnf`
|
||||
|
||||
Run configurations for the recommended IDEs (listed above) are included. You should use the provided Build/Run functionality of your IDE to get things going. When testing or building new components, it's highly encouraged you use the `osu! (Tests)` project/configuration. More information on this is provided [below](#contributing).
|
||||
|
||||
To build for mobile platforms, you will likely need to run `sudo dotnet workload restore` if you haven't done so previously. This will install Android/iOS tooling required to complete the build.
|
||||
|
||||
#### From CLI
|
||||
|
||||
You can also build and run *osu!* from the command-line with a single command:
|
||||
|
||||
```shell
|
||||
dotnet run --project osu.Desktop
|
||||
```
|
||||
|
||||
When running locally to do any kind of performance testing, make sure to add `-c Release` to the build command, as the overhead of running with the default `Debug` configuration can be large (especially when testing with local framework modifications as below).
|
||||
|
||||
If the build fails, try to restore NuGet packages with `dotnet restore`.
|
||||
|
||||
### Testing with resource/framework modifications
|
||||
|
||||
Sometimes it may be necessary to cross-test changes in [osu-resources](https://github.com/ppy/osu-resources) or [osu-framework](https://github.com/ppy/osu-framework). This can be quickly achieved using included commands:
|
||||
|
||||
Windows:
|
||||
|
||||
```ps
|
||||
UseLocalFramework.ps1
|
||||
UseLocalResources.ps1
|
||||
To **compile**:
|
||||
```
|
||||
dotnet build osu.Desktop
|
||||
```
|
||||
|
||||
macOS / Linux:
|
||||
To reduce performance overhead in custom builds, it's recommended to build with the `-c Release` flag, that will use the release profile and remove possibly unneeded debugging code.
|
||||
|
||||
```ps
|
||||
UseLocalFramework.sh
|
||||
UseLocalResources.sh
|
||||
```
|
||||
|
||||
Note that these commands assume you have the relevant project(s) checked out in adjacent directories:
|
||||
|
||||
```
|
||||
|- osu // this repository
|
||||
|- osu-framework
|
||||
|- osu-resources
|
||||
```
|
||||
|
||||
### Code analysis
|
||||
|
||||
Before committing your code, please run a code formatter. This can be achieved by running `dotnet format` in the command line, or using the `Format code` command in your IDE.
|
||||
|
||||
We have adopted some cross-platform, compiler integrated analyzers. They can provide warnings when you are editing, building inside IDE or from command line, as-if they are provided by the compiler itself.
|
||||
|
||||
JetBrains ReSharper InspectCode is also used for wider rule sets. You can run it from PowerShell with `.\InspectCode.ps1`. Alternatively, you can install ReSharper or use Rider to get inline support in your IDE of choice.
|
||||
|
||||
## Contributing
|
||||
|
||||
When it comes to contributing to the project, the two main things you can do to help out are reporting issues and submitting pull requests. Please refer to the [contributing guidelines](CONTRIBUTING.md) to understand how to help in the most effective way possible.
|
||||
|
||||
If you wish to help with localisation efforts, head over to [crowdin](https://crowdin.com/project/osu-web).
|
||||
|
||||
We love to reward quality contributions. If you have made a large contribution, or are a regular contributor, you are welcome to [submit an expense via opencollective](https://opencollective.com/ppy/expenses/new). If you have any questions, feel free to [reach out to peppy](mailto:pe@ppy.sh) before doing so.
|
||||
|
||||
## Licence
|
||||
|
||||
*osu!*'s code and framework are licensed under the [MIT licence](https://opensource.org/licenses/MIT). Please see [the licence file](LICENCE) for more information. [tl;dr](https://tldrlegal.com/license/mit-license) you can do whatever you want as long as you include the original copyright and license notice in any copy of the software/source.
|
||||
|
||||
Please note that this *does not cover* the usage of the "osu!" or "ppy" branding in any software, resources, advertising or promotion, as this is protected by trademark law.
|
||||
|
||||
Please also note that game resources are covered by a separate licence. Please see the [ppy/osu-resources](https://github.com/ppy/osu-resources) repository for clarifications.
|
||||
### See the [original readme](README.original.md) for more info.
|
||||
147
README.original.md
Normal file
147
README.original.md
Normal file
@@ -0,0 +1,147 @@
|
||||
<p align="center">
|
||||
<img width="500" alt="osu! logo" src="assets/lazer.png">
|
||||
</p>
|
||||
|
||||
# osu!
|
||||
|
||||
[](https://github.com/ppy/osu/actions/workflows/ci.yml)
|
||||
[](https://github.com/ppy/osu/releases/latest)
|
||||
[](https://www.codefactor.io/repository/github/ppy/osu)
|
||||
[](https://discord.gg/ppy)
|
||||
[](https://crowdin.com/project/osu-web)
|
||||
|
||||
A free-to-win rhythm game. Rhythm is just a *click* away!
|
||||
|
||||
This is the future – and final – iteration of the [osu!](https://osu.ppy.sh) game client which marks the beginning of an open era! Currently known by and released under the release codename "*lazer*". As in sharper than cutting-edge.
|
||||
|
||||
## Status
|
||||
|
||||
This project is under constant development, but we do our best to keep things in a stable state. Players are encouraged to install from a release alongside their stable *osu!* client. This project will continue to evolve until we eventually reach the point where most users prefer it over the previous "osu!stable" release.
|
||||
|
||||
A few resources are available as starting points to getting involved and understanding the project:
|
||||
|
||||
- Detailed release changelogs are available on the [official osu! site](https://osu.ppy.sh/home/changelog/lazer).
|
||||
- You can learn more about our approach to [project management](https://github.com/ppy/osu/wiki/Project-management).
|
||||
- Track our current efforts [towards improving the game](https://github.com/orgs/ppy/projects/7/views/6).
|
||||
|
||||
## Running osu!
|
||||
|
||||
If you are just looking to give the game a whirl, you can grab the latest release for your platform:
|
||||
|
||||
### Latest release:
|
||||
|
||||
| [Windows 10+ (x64)](https://github.com/ppy/osu/releases/latest/download/install.exe) | macOS 12+ ([Intel](https://github.com/ppy/osu/releases/latest/download/osu.app.Intel.zip), [Apple Silicon](https://github.com/ppy/osu/releases/latest/download/osu.app.Apple.Silicon.zip)) | [Linux (x64)](https://github.com/ppy/osu/releases/latest/download/osu.AppImage) | [iOS 13.4+](https://osu.ppy.sh/home/testflight) | [Android 5+](https://github.com/ppy/osu/releases/latest/download/sh.ppy.osulazer.apk) |
|
||||
|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------------- | ------------- | ------------- |
|
||||
|
||||
You can also generally download a version for your current device from the [osu! site](https://osu.ppy.sh/home/download).
|
||||
|
||||
If your platform is unsupported or not listed above, there is still a chance you can run the release or manually build it by following the instructions below.
|
||||
|
||||
**For iOS/iPadOS users**: The iOS testflight link fills up very fast (Apple has a hard limit of 10,000 users). We reset it occasionally. Please do not ask about this. Check back regularly for link resets or follow [peppy](https://twitter.com/ppy) on twitter for announcements. Our goal is to get the game on mobile app stores very soon so we don't have to live with this limitation.
|
||||
|
||||
## Developing a custom ruleset
|
||||
|
||||
osu! is designed to allow user-created gameplay variations, called "rulesets". Building one of these allows a developer to harness the power of the osu! beatmap library, game engine, and general UX for a new style of gameplay. To get started working on a ruleset, we have some templates available [here](https://github.com/ppy/osu/tree/master/Templates).
|
||||
|
||||
You can see some examples of custom rulesets by visiting the [custom ruleset directory](https://github.com/ppy/osu/discussions/13096).
|
||||
|
||||
## Developing osu!
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Please make sure you have the following prerequisites:
|
||||
|
||||
- A desktop platform with the [.NET 8.0 SDK](https://dotnet.microsoft.com/download) installed.
|
||||
|
||||
When working with the codebase, we recommend using an IDE with intelligent code completion and syntax highlighting, such as the latest version of [Visual Studio](https://visualstudio.microsoft.com/vs/), [JetBrains Rider](https://www.jetbrains.com/rider/), or [Visual Studio Code](https://code.visualstudio.com/) with the [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) and [C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit) plugin installed.
|
||||
|
||||
### Downloading the source code
|
||||
|
||||
Clone the repository:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/ppy/osu
|
||||
cd osu
|
||||
```
|
||||
|
||||
To update the source code to the latest commit, run the following command inside the `osu` directory:
|
||||
|
||||
```shell
|
||||
git pull
|
||||
```
|
||||
|
||||
### Building
|
||||
|
||||
#### From an IDE
|
||||
|
||||
You should load the solution via one of the platform-specific `.slnf` files, rather than the main `.sln`. This will reduce dependencies and hide platforms that you don't care about. Valid `.slnf` files are:
|
||||
|
||||
- `osu.Desktop.slnf` (most common)
|
||||
- `osu.Android.slnf`
|
||||
- `osu.iOS.slnf`
|
||||
|
||||
Run configurations for the recommended IDEs (listed above) are included. You should use the provided Build/Run functionality of your IDE to get things going. When testing or building new components, it's highly encouraged you use the `osu! (Tests)` project/configuration. More information on this is provided [below](#contributing).
|
||||
|
||||
To build for mobile platforms, you will likely need to run `sudo dotnet workload restore` if you haven't done so previously. This will install Android/iOS tooling required to complete the build.
|
||||
|
||||
#### From CLI
|
||||
|
||||
You can also build and run *osu!* from the command-line with a single command:
|
||||
|
||||
```shell
|
||||
dotnet run --project osu.Desktop
|
||||
```
|
||||
|
||||
When running locally to do any kind of performance testing, make sure to add `-c Release` to the build command, as the overhead of running with the default `Debug` configuration can be large (especially when testing with local framework modifications as below).
|
||||
|
||||
If the build fails, try to restore NuGet packages with `dotnet restore`.
|
||||
|
||||
### Testing with resource/framework modifications
|
||||
|
||||
Sometimes it may be necessary to cross-test changes in [osu-resources](https://github.com/ppy/osu-resources) or [osu-framework](https://github.com/ppy/osu-framework). This can be quickly achieved using included commands:
|
||||
|
||||
Windows:
|
||||
|
||||
```ps
|
||||
UseLocalFramework.ps1
|
||||
UseLocalResources.ps1
|
||||
```
|
||||
|
||||
macOS / Linux:
|
||||
|
||||
```ps
|
||||
UseLocalFramework.sh
|
||||
UseLocalResources.sh
|
||||
```
|
||||
|
||||
Note that these commands assume you have the relevant project(s) checked out in adjacent directories:
|
||||
|
||||
```
|
||||
|- osu // this repository
|
||||
|- osu-framework
|
||||
|- osu-resources
|
||||
```
|
||||
|
||||
### Code analysis
|
||||
|
||||
Before committing your code, please run a code formatter. This can be achieved by running `dotnet format` in the command line, or using the `Format code` command in your IDE.
|
||||
|
||||
We have adopted some cross-platform, compiler integrated analyzers. They can provide warnings when you are editing, building inside IDE or from command line, as-if they are provided by the compiler itself.
|
||||
|
||||
JetBrains ReSharper InspectCode is also used for wider rule sets. You can run it from PowerShell with `.\InspectCode.ps1`. Alternatively, you can install ReSharper or use Rider to get inline support in your IDE of choice.
|
||||
|
||||
## Contributing
|
||||
|
||||
When it comes to contributing to the project, the two main things you can do to help out are reporting issues and submitting pull requests. Please refer to the [contributing guidelines](CONTRIBUTING.md) to understand how to help in the most effective way possible.
|
||||
|
||||
If you wish to help with localisation efforts, head over to [crowdin](https://crowdin.com/project/osu-web).
|
||||
|
||||
We love to reward quality contributions. If you have made a large contribution, or are a regular contributor, you are welcome to [submit an expense via opencollective](https://opencollective.com/ppy/expenses/new). If you have any questions, feel free to [reach out to peppy](mailto:pe@ppy.sh) before doing so.
|
||||
|
||||
## Licence
|
||||
|
||||
*osu!*'s code and framework are licensed under the [MIT licence](https://opensource.org/licenses/MIT). Please see [the licence file](LICENCE) for more information. [tl;dr](https://tldrlegal.com/license/mit-license) you can do whatever you want as long as you include the original copyright and license notice in any copy of the software/source.
|
||||
|
||||
Please note that this *does not cover* the usage of the "osu!" or "ppy" branding in any software, resources, advertising or promotion, as this is protected by trademark law.
|
||||
|
||||
Please also note that game resources are covered by a separate licence. Please see the [ppy/osu-resources](https://github.com/ppy/osu-resources) repository for clarifications.
|
||||
@@ -10,7 +10,7 @@
|
||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2025.808.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2025.829.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<!-- Fody does not handle Android build well, and warns when unchanged.
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Description>A free-to-win rhythm game. Rhythm is just a *click* away!</Description>
|
||||
<Description>A free-to-win rhythm game based on osu!(lazer). Click is just a *rhythm* away!</Description>
|
||||
<AssemblyName>osu!</AssemblyName>
|
||||
<AssemblyTitle>osu!(lazer)</AssemblyTitle>
|
||||
<Title>osu!</Title>
|
||||
<Product>osu!(lazer)</Product>
|
||||
<AssemblyTitle>jvnkosu!</AssemblyTitle>
|
||||
<Title>jvnkosu!</Title>
|
||||
<Product>jvnkosu!</Product>
|
||||
<ApplicationIcon>lazer.ico</ApplicationIcon>
|
||||
<Version>0.0.0</Version>
|
||||
<FileVersion>0.0.0</FileVersion>
|
||||
|
||||
@@ -3,16 +3,19 @@
|
||||
<metadata>
|
||||
<id>osulazer</id>
|
||||
<version>0.0.0</version>
|
||||
<title>osu!</title>
|
||||
<authors>ppy Pty Ltd</authors>
|
||||
<title>jvnkosu!</title>
|
||||
<authors>ppy Pty Ltd., jvnkosu! team</authors>
|
||||
<owners>Dean Herbert</owners>
|
||||
<projectUrl>https://osu.ppy.sh/</projectUrl>
|
||||
<projectUrl>https://osu.jvnko.boats/</projectUrl>
|
||||
<iconUrl>https://github.com/ppy/osu/blob/master/assets/lazer-nuget.png?raw=true</iconUrl>
|
||||
<icon>icon.png</icon>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>A free-to-win rhythm game. Rhythm is just a *click* away!</description>
|
||||
<description>A free-to-win rhythm game based on osu!(lazer). Click is just a *rhythm* away!</description>
|
||||
<releaseNotes>testing</releaseNotes>
|
||||
<copyright>Copyright (c) 2025 ppy Pty Ltd</copyright>
|
||||
<copyright>
|
||||
Copyright (c) 2025 ppy Pty Ltd
|
||||
Copyright (c) 2025 jvnkosu! team
|
||||
</copyright>
|
||||
<language>en-AU</language>
|
||||
</metadata>
|
||||
<files>
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
}
|
||||
|
||||
[TestCase]
|
||||
public void TestFilterIntersection()
|
||||
public void TestKeysFilterIntersection()
|
||||
{
|
||||
var criteria = new ManiaFilterCriteria();
|
||||
criteria.TryParseCustomKeywordCriteria("keys", Operator.Greater, "4");
|
||||
@@ -175,7 +175,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
}
|
||||
|
||||
[TestCase]
|
||||
public void TestInvalidFilters()
|
||||
public void TestInvalidKeysFilters()
|
||||
{
|
||||
var criteria = new ManiaFilterCriteria();
|
||||
|
||||
@@ -183,5 +183,132 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
Assert.False(criteria.TryParseCustomKeywordCriteria("keys", Operator.NotEqual, "4,some text"));
|
||||
Assert.False(criteria.TryParseCustomKeywordCriteria("keys", Operator.GreaterOrEqual, "4,5,6"));
|
||||
}
|
||||
|
||||
[TestCase]
|
||||
public void TestLnsEqual()
|
||||
{
|
||||
var criteria = new ManiaFilterCriteria();
|
||||
var filterCriteria = new FilterCriteria
|
||||
{
|
||||
Ruleset = new ManiaRuleset().RulesetInfo
|
||||
};
|
||||
|
||||
criteria.TryParseCustomKeywordCriteria("lns", Operator.Equal, "0");
|
||||
BeatmapInfo beatmapInfo1 = new BeatmapInfo(new ManiaRuleset().RulesetInfo)
|
||||
{
|
||||
TotalObjectCount = 0,
|
||||
EndTimeObjectCount = 0
|
||||
};
|
||||
Assert.True(criteria.Matches(beatmapInfo1, filterCriteria));
|
||||
|
||||
criteria.TryParseCustomKeywordCriteria("lns", Operator.Equal, "0");
|
||||
BeatmapInfo beatmapInfo2 = new BeatmapInfo(new ManiaRuleset().RulesetInfo)
|
||||
{
|
||||
TotalObjectCount = 100,
|
||||
EndTimeObjectCount = 0
|
||||
};
|
||||
Assert.True(criteria.Matches(beatmapInfo2, filterCriteria));
|
||||
|
||||
criteria.TryParseCustomKeywordCriteria("lns", Operator.Equal, "100");
|
||||
BeatmapInfo beatmapInfo3 = new BeatmapInfo(new ManiaRuleset().RulesetInfo)
|
||||
{
|
||||
TotalObjectCount = 100,
|
||||
EndTimeObjectCount = 100
|
||||
};
|
||||
Assert.True(criteria.Matches(beatmapInfo3, filterCriteria));
|
||||
|
||||
criteria.TryParseCustomKeywordCriteria("lns", Operator.Equal, "1");
|
||||
BeatmapInfo beatmapInfo4 = new BeatmapInfo(new ManiaRuleset().RulesetInfo)
|
||||
{
|
||||
TotalObjectCount = 100,
|
||||
EndTimeObjectCount = 1
|
||||
};
|
||||
Assert.True(criteria.Matches(beatmapInfo4, filterCriteria));
|
||||
|
||||
criteria.TryParseCustomKeywordCriteria("lns", Operator.Equal, "0.1");
|
||||
BeatmapInfo beatmapInfo5 = new BeatmapInfo(new ManiaRuleset().RulesetInfo)
|
||||
{
|
||||
TotalObjectCount = 1000,
|
||||
EndTimeObjectCount = 1
|
||||
};
|
||||
Assert.True(criteria.Matches(beatmapInfo5, filterCriteria));
|
||||
}
|
||||
|
||||
[TestCase]
|
||||
public void TestLnsGreaterOrEqual()
|
||||
{
|
||||
var criteria = new ManiaFilterCriteria();
|
||||
var filterCriteria = new FilterCriteria
|
||||
{
|
||||
Ruleset = new ManiaRuleset().RulesetInfo
|
||||
};
|
||||
|
||||
criteria.TryParseCustomKeywordCriteria("lns", Operator.GreaterOrEqual, "0");
|
||||
BeatmapInfo beatmapInfo1 = new BeatmapInfo(new ManiaRuleset().RulesetInfo)
|
||||
{
|
||||
TotalObjectCount = 0,
|
||||
EndTimeObjectCount = 0
|
||||
};
|
||||
Assert.True(criteria.Matches(beatmapInfo1, filterCriteria));
|
||||
|
||||
criteria.TryParseCustomKeywordCriteria("lns", Operator.GreaterOrEqual, "0");
|
||||
BeatmapInfo beatmapInfo2 = new BeatmapInfo(new ManiaRuleset().RulesetInfo)
|
||||
{
|
||||
TotalObjectCount = 100,
|
||||
EndTimeObjectCount = 0
|
||||
};
|
||||
Assert.True(criteria.Matches(beatmapInfo2, filterCriteria));
|
||||
|
||||
criteria.TryParseCustomKeywordCriteria("lns", Operator.GreaterOrEqual, "100");
|
||||
BeatmapInfo beatmapInfo3 = new BeatmapInfo(new ManiaRuleset().RulesetInfo)
|
||||
{
|
||||
TotalObjectCount = 100,
|
||||
EndTimeObjectCount = 100
|
||||
};
|
||||
Assert.True(criteria.Matches(beatmapInfo3, filterCriteria));
|
||||
|
||||
criteria.TryParseCustomKeywordCriteria("lns", Operator.GreaterOrEqual, "1");
|
||||
BeatmapInfo beatmapInfo4 = new BeatmapInfo(new ManiaRuleset().RulesetInfo)
|
||||
{
|
||||
TotalObjectCount = 100,
|
||||
EndTimeObjectCount = 1
|
||||
};
|
||||
Assert.True(criteria.Matches(beatmapInfo4, filterCriteria));
|
||||
|
||||
criteria.TryParseCustomKeywordCriteria("lns", Operator.GreaterOrEqual, "0.1");
|
||||
BeatmapInfo beatmapInfo5 = new BeatmapInfo(new ManiaRuleset().RulesetInfo)
|
||||
{
|
||||
TotalObjectCount = 1000,
|
||||
EndTimeObjectCount = 1
|
||||
};
|
||||
Assert.True(criteria.Matches(beatmapInfo5, filterCriteria));
|
||||
}
|
||||
|
||||
[TestCase]
|
||||
public void TestLnsNotManiaRuleset()
|
||||
{
|
||||
var criteria = new ManiaFilterCriteria();
|
||||
var filterCriteria = new FilterCriteria
|
||||
{
|
||||
Ruleset = new ManiaRuleset().RulesetInfo
|
||||
};
|
||||
|
||||
criteria.TryParseCustomKeywordCriteria("lns", Operator.LessOrEqual, "100");
|
||||
BeatmapInfo beatmapInfo = new BeatmapInfo
|
||||
{
|
||||
TotalObjectCount = 100,
|
||||
EndTimeObjectCount = 50
|
||||
};
|
||||
Assert.False(criteria.Matches(beatmapInfo, filterCriteria));
|
||||
}
|
||||
|
||||
[TestCase]
|
||||
public void TestInvalidLnsFilters()
|
||||
{
|
||||
var criteria = new ManiaFilterCriteria();
|
||||
|
||||
Assert.False(criteria.TryParseCustomKeywordCriteria("lns", Operator.Equal, "some text"));
|
||||
Assert.False(criteria.TryParseCustomKeywordCriteria("lns", Operator.GreaterOrEqual, "1some text"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
@@ -19,12 +20,16 @@ namespace osu.Game.Rulesets.Mania
|
||||
public class ManiaFilterCriteria : IRulesetFilterCriteria
|
||||
{
|
||||
private readonly HashSet<int> includedKeyCounts = Enumerable.Range(1, LegacyBeatmapDecoder.MAX_MANIA_KEY_COUNT).ToHashSet();
|
||||
private FilterCriteria.OptionalRange<float> longNotePercentage;
|
||||
|
||||
public bool Matches(BeatmapInfo beatmapInfo, FilterCriteria criteria)
|
||||
{
|
||||
int keyCount = ManiaBeatmapConverter.GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmapInfo(beatmapInfo), criteria.Mods);
|
||||
|
||||
return includedKeyCounts.Contains(keyCount);
|
||||
bool keyCountMatch = includedKeyCounts.Contains(keyCount);
|
||||
bool longNotePercentageMatch = !longNotePercentage.HasFilter || (!isConvertedBeatmap(beatmapInfo) && longNotePercentage.IsInRange(calculateLongNotePercentage(beatmapInfo)));
|
||||
|
||||
return keyCountMatch && longNotePercentageMatch;
|
||||
}
|
||||
|
||||
public bool TryParseCustomKeywordCriteria(string key, Operator op, string strValues)
|
||||
@@ -84,6 +89,10 @@ namespace osu.Game.Rulesets.Mania
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
case "ln":
|
||||
case "lns":
|
||||
return FilterQueryParser.TryUpdateCriteriaRange(ref longNotePercentage, op, strValues);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -103,5 +112,18 @@ namespace osu.Game.Rulesets.Mania
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool isConvertedBeatmap(BeatmapInfo beatmapInfo)
|
||||
{
|
||||
return !beatmapInfo.Ruleset.Equals(new ManiaRuleset().RulesetInfo);
|
||||
}
|
||||
|
||||
private static float calculateLongNotePercentage(BeatmapInfo beatmapInfo)
|
||||
{
|
||||
int holdNotes = beatmapInfo.EndTimeObjectCount;
|
||||
int totalNotes = Math.Max(1, beatmapInfo.TotalObjectCount);
|
||||
|
||||
return holdNotes / (float)totalNotes * 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ using osu.Game.Storyboards;
|
||||
using osu.Game.Tests.Beatmaps.IO;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
@@ -302,9 +303,69 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddWaitStep("wait a bit", 10);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Explicit("Test relies on timing of arriving frames to exercise assertions which doesn't work headless.")]
|
||||
public void TestMaximisedUserIsAudioSource()
|
||||
{
|
||||
start(new[] { PLAYER_1_ID, PLAYER_2_ID });
|
||||
loadSpectateScreen();
|
||||
|
||||
// With no frames, the synchronisation state will be TooFarAhead.
|
||||
// In this state, all players should be muted.
|
||||
assertMuted(PLAYER_1_ID, true);
|
||||
assertMuted(PLAYER_2_ID, true);
|
||||
|
||||
// Send frames for both players.
|
||||
sendFrames(PLAYER_1_ID, 20);
|
||||
sendFrames(PLAYER_2_ID, 40);
|
||||
|
||||
waitUntilRunning(PLAYER_1_ID);
|
||||
AddStep("maximise player 1", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(getInstance(PLAYER_1_ID));
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
assertMuted(PLAYER_1_ID, false);
|
||||
assertMuted(PLAYER_2_ID, true);
|
||||
|
||||
waitUntilPaused(PLAYER_1_ID);
|
||||
assertMuted(PLAYER_1_ID, false);
|
||||
assertMuted(PLAYER_2_ID, true);
|
||||
|
||||
AddStep("minimise player 1", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(getInstance(PLAYER_1_ID));
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
assertMuted(PLAYER_1_ID, true);
|
||||
assertMuted(PLAYER_2_ID, false);
|
||||
|
||||
AddStep("maximise player 2", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(getInstance(PLAYER_2_ID));
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
assertMuted(PLAYER_1_ID, true);
|
||||
assertMuted(PLAYER_2_ID, false);
|
||||
|
||||
waitUntilPaused(PLAYER_2_ID);
|
||||
sendFrames(PLAYER_1_ID, 60);
|
||||
|
||||
assertMuted(PLAYER_1_ID, true);
|
||||
assertMuted(PLAYER_2_ID, false);
|
||||
|
||||
AddStep("minimise player 2", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(getInstance(PLAYER_2_ID));
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
assertMuted(PLAYER_1_ID, false);
|
||||
assertMuted(PLAYER_2_ID, true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[FlakyTest]
|
||||
public void TestMostInSyncUserIsAudioSource()
|
||||
public void TestMostInSyncUserIsAudioSourceIfNoneMaximised()
|
||||
{
|
||||
start(new[] { PLAYER_1_ID, PLAYER_2_ID });
|
||||
loadSpectateScreen();
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
AddUntilStep("beatmap in song select", () =>
|
||||
{
|
||||
var songSelect = (SoloSongSelect)Game.ScreenStack.CurrentScreen;
|
||||
return songSelect.ChildrenOfType<BeatmapCarousel>().Single().GetCarouselItems()!.Any(i => i.Model is BeatmapSetInfo bsi && bsi.MatchesOnlineID(getImport()));
|
||||
return songSelect.ChildrenOfType<BeatmapCarousel>().Single().GetCarouselItems()!.Any(i => i.Model is GroupedBeatmapSet gbs && gbs.BeatmapSet.MatchesOnlineID(getImport()));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,8 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
{
|
||||
public Bindable<Vector2> AreaOffset { get; } = new Bindable<Vector2>();
|
||||
public Bindable<Vector2> AreaSize { get; } = new Bindable<Vector2>();
|
||||
public Bindable<Vector2> OutputAreaOffset { get; } = new Bindable<Vector2>();
|
||||
public Bindable<Vector2> OutputAreaSize { get; } = new Bindable<Vector2>();
|
||||
|
||||
public Bindable<float> Rotation { get; } = new Bindable<float>();
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
];
|
||||
|
||||
var results = await runGrouping(GroupMode.None, beatmapSets);
|
||||
Assert.That(results.Select(r => r.Model).OfType<BeatmapSetInfo>(), Is.EquivalentTo(beatmapSets));
|
||||
Assert.That(results.Select(r => r.Model).OfType<GroupedBeatmapSet>().Select(groupedSet => groupedSet.BeatmapSet), Is.EquivalentTo(beatmapSets));
|
||||
Assert.That(results.Select(r => r.Model).OfType<BeatmapInfo>(), Is.EquivalentTo(allBeatmaps));
|
||||
assertTotal(results, beatmapSets.Count + allBeatmaps.Length);
|
||||
}
|
||||
@@ -74,11 +74,11 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
addBeatmapSet(applyBeatmap('_'), beatmapSets, out var underscoreBeatmap);
|
||||
|
||||
var results = await runGrouping(mode, beatmapSets);
|
||||
assertGroup(results, 0, "0-9", new[] { fiveBeatmap, fourBeatmap }, ref total);
|
||||
assertGroup(results, 1, "A", new[] { aBeatmap }, ref total);
|
||||
assertGroup(results, 2, "F", new[] { fBeatmap }, ref total);
|
||||
assertGroup(results, 3, "Z", new[] { zBeatmap }, ref total);
|
||||
assertGroup(results, 4, "Other", new[] { dashBeatmap, underscoreBeatmap }, ref total);
|
||||
assertGroup(results, 0, "0-9", fiveBeatmap.Beatmaps.Concat(fourBeatmap.Beatmaps), ref total);
|
||||
assertGroup(results, 1, "A", aBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 2, "F", fBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 3, "Z", zBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 4, "Other", dashBeatmap.Beatmaps.Concat(underscoreBeatmap.Beatmaps), ref total);
|
||||
assertTotal(results, total);
|
||||
}
|
||||
|
||||
@@ -115,12 +115,12 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
addBeatmapSet(s => s.DateAdded = DateTimeOffset.Now.AddMonths(-2).AddDays(-3), beatmapSets, out var twoMonthsAgoBeatmap);
|
||||
|
||||
var results = await runGrouping(GroupMode.DateAdded, beatmapSets);
|
||||
assertGroup(results, 0, "Today", new[] { todayBeatmap }, ref total);
|
||||
assertGroup(results, 1, "Yesterday", new[] { yesterdayBeatmap }, ref total);
|
||||
assertGroup(results, 2, "Last week", new[] { lastWeekBeatmap }, ref total);
|
||||
assertGroup(results, 3, "Last month", new[] { lastMonthBeatmap }, ref total);
|
||||
assertGroup(results, 4, "1 month ago", new[] { oneMonthAgoBeatmap }, ref total);
|
||||
assertGroup(results, 5, "2 months ago", new[] { twoMonthsAgoBeatmap }, ref total);
|
||||
assertGroup(results, 0, "Today", todayBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 1, "Yesterday", yesterdayBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 2, "Last week", lastWeekBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 3, "Last month", lastMonthBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 4, "1 month ago", oneMonthAgoBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 5, "2 months ago", twoMonthsAgoBeatmap.Beatmaps, ref total);
|
||||
assertTotal(results, total);
|
||||
}
|
||||
|
||||
@@ -139,13 +139,13 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
addBeatmapSet(applyLastPlayed(null), beatmapSets, out var neverBeatmap);
|
||||
|
||||
var results = await runGrouping(GroupMode.LastPlayed, beatmapSets);
|
||||
assertGroup(results, 0, "Today", new[] { todayBeatmap }, ref total);
|
||||
assertGroup(results, 1, "Yesterday", new[] { yesterdayBeatmap }, ref total);
|
||||
assertGroup(results, 2, "Last week", new[] { lastWeekBeatmap }, ref total);
|
||||
assertGroup(results, 3, "Last month", new[] { lastMonthBeatmap }, ref total);
|
||||
assertGroup(results, 4, "1 month ago", new[] { oneMonthAgoBeatmap }, ref total);
|
||||
assertGroup(results, 5, "2 months ago", new[] { twoMonthsBeatmap }, ref total);
|
||||
assertGroup(results, 6, "Never", new[] { neverBeatmap }, ref total);
|
||||
assertGroup(results, 0, "Today", todayBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 1, "Yesterday", yesterdayBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 2, "Last week", lastWeekBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 3, "Last month", lastMonthBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 4, "1 month ago", oneMonthAgoBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 5, "2 months ago", twoMonthsBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 6, "Never", neverBeatmap.Beatmaps, ref total);
|
||||
assertTotal(results, total);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,8 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
var results = await runGrouping(GroupMode.LastPlayed, beatmapSets);
|
||||
int total = 0;
|
||||
|
||||
assertGroup(results, 0, "Today", new[] { set }, ref total);
|
||||
assertGroup(results, 0, "Today", [set.Beatmaps[2]], ref total);
|
||||
assertGroup(results, 1, "Never", [set.Beatmaps[0], set.Beatmaps[1]], ref total);
|
||||
assertTotal(results, total);
|
||||
}
|
||||
|
||||
@@ -176,8 +177,8 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
var results = await runGrouping(GroupMode.LastPlayed, beatmapSets);
|
||||
int total = 0;
|
||||
|
||||
assertGroup(results, 0, "Over 5 months ago", new[] { overFiveMonthsBeatmap }, ref total);
|
||||
assertGroup(results, 1, "Never", new[] { neverBeatmap }, ref total);
|
||||
assertGroup(results, 0, "Over 5 months ago", overFiveMonthsBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 1, "Never", neverBeatmap.Beatmaps, ref total);
|
||||
assertTotal(results, total);
|
||||
}
|
||||
|
||||
@@ -207,14 +208,14 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
addBeatmapSet(s => s.Status = BeatmapOnlineStatus.LocallyModified, beatmapSets, out var localBeatmap);
|
||||
|
||||
var results = await runGrouping(GroupMode.RankedStatus, beatmapSets);
|
||||
assertGroup(results, 0, "Ranked", new[] { rankedBeatmap, approvedBeatmap }, ref total);
|
||||
assertGroup(results, 1, "Qualified", new[] { qualifiedBeatmap }, ref total);
|
||||
assertGroup(results, 2, "WIP", new[] { wipBeatmap }, ref total);
|
||||
assertGroup(results, 3, "Pending", new[] { pendingBeatmap }, ref total);
|
||||
assertGroup(results, 4, "Graveyard", new[] { graveyardBeatmap }, ref total);
|
||||
assertGroup(results, 5, "Local", new[] { localBeatmap }, ref total);
|
||||
assertGroup(results, 6, "Unknown", new[] { noneBeatmap }, ref total);
|
||||
assertGroup(results, 7, "Loved", new[] { lovedBeatmap }, ref total);
|
||||
assertGroup(results, 0, "Ranked", rankedBeatmap.Beatmaps.Concat(approvedBeatmap.Beatmaps), ref total);
|
||||
assertGroup(results, 1, "Qualified", qualifiedBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 2, "WIP", wipBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 3, "Pending", pendingBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 4, "Graveyard", graveyardBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 5, "Local", localBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 6, "Unknown", noneBeatmap.Beatmaps, ref total);
|
||||
assertGroup(results, 7, "Loved", lovedBeatmap.Beatmaps, ref total);
|
||||
assertTotal(results, total);
|
||||
}
|
||||
|
||||
@@ -240,12 +241,12 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
addBeatmapSet(applyBPM(330), beatmapSets, out var beatmap330);
|
||||
|
||||
var results = await runGrouping(GroupMode.BPM, beatmapSets);
|
||||
assertGroup(results, 0, "Under 60 BPM", new[] { beatmap30 }, ref total);
|
||||
assertGroup(results, 1, "60 - 70 BPM", new[] { beatmap59, beatmap60 }, ref total);
|
||||
assertGroup(results, 2, "90 - 100 BPM", new[] { beatmap90, beatmap95 }, ref total);
|
||||
assertGroup(results, 3, "270 - 280 BPM", new[] { beatmap269, beatmap270 }, ref total);
|
||||
assertGroup(results, 4, "290 - 300 BPM", new[] { beatmap299 }, ref total);
|
||||
assertGroup(results, 5, "Over 300 BPM", new[] { beatmap300, beatmap330 }, ref total);
|
||||
assertGroup(results, 0, "Under 60 BPM", beatmap30.Beatmaps, ref total);
|
||||
assertGroup(results, 1, "60 - 70 BPM", (beatmap59.Beatmaps.Concat(beatmap60.Beatmaps)), ref total);
|
||||
assertGroup(results, 2, "90 - 100 BPM", (beatmap90.Beatmaps.Concat(beatmap95.Beatmaps)), ref total);
|
||||
assertGroup(results, 3, "270 - 280 BPM", (beatmap269.Beatmaps.Concat(beatmap270.Beatmaps)), ref total);
|
||||
assertGroup(results, 4, "290 - 300 BPM", beatmap299.Beatmaps, ref total);
|
||||
assertGroup(results, 5, "Over 300 BPM", (beatmap300.Beatmaps.Concat(beatmap330.Beatmaps)), ref total);
|
||||
assertTotal(results, total);
|
||||
}
|
||||
|
||||
@@ -272,10 +273,10 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
addBeatmapSet(applyStars(7), beatmapSets, out var beatmap7);
|
||||
|
||||
var results = await runGrouping(GroupMode.Difficulty, beatmapSets);
|
||||
assertGroup(results, 0, "Below 1 Star", new[] { beatmapBelow1 }, ref total);
|
||||
assertGroup(results, 1, "1 Star", new[] { beatmapAbove1, beatmapAlmost2 }, ref total);
|
||||
assertGroup(results, 2, "2 Stars", new[] { beatmap2, beatmapAbove2 }, ref total);
|
||||
assertGroup(results, 3, "7 Stars", new[] { beatmap7 }, ref total);
|
||||
assertGroup(results, 0, "Below 1 Star", beatmapBelow1.Beatmaps, ref total);
|
||||
assertGroup(results, 1, "1 Star", (beatmapAbove1.Beatmaps.Concat(beatmapAlmost2.Beatmaps)), ref total);
|
||||
assertGroup(results, 2, "2 Stars", (beatmap2.Beatmaps.Concat(beatmapAbove2.Beatmaps)), ref total);
|
||||
assertGroup(results, 3, "7 Stars", beatmap7.Beatmaps, ref total);
|
||||
assertTotal(results, total);
|
||||
}
|
||||
|
||||
@@ -304,11 +305,11 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
addBeatmapSet(applyLength(630_000), beatmapSets, out var beatmap10Min30Sec);
|
||||
|
||||
var results = await runGrouping(GroupMode.Length, beatmapSets);
|
||||
assertGroup(results, 0, "1 minute or less", new[] { beatmap30Sec, beatmap1Min }, ref total);
|
||||
assertGroup(results, 1, "2 minutes or less", new[] { beatmap1Min30Sec, beatmap2Min }, ref total);
|
||||
assertGroup(results, 2, "5 minutes or less", new[] { beatmap5Min }, ref total);
|
||||
assertGroup(results, 3, "10 minutes or less", new[] { beatmap6Min, beatmap10Min }, ref total);
|
||||
assertGroup(results, 4, "Over 10 minutes", new[] { beatmap10Min30Sec }, ref total);
|
||||
assertGroup(results, 0, "1 minute or less", (beatmap30Sec.Beatmaps.Concat(beatmap1Min.Beatmaps)), ref total);
|
||||
assertGroup(results, 1, "2 minutes or less", (beatmap1Min30Sec.Beatmaps.Concat(beatmap2Min.Beatmaps)), ref total);
|
||||
assertGroup(results, 2, "5 minutes or less", beatmap5Min.Beatmaps, ref total);
|
||||
assertGroup(results, 3, "10 minutes or less", (beatmap6Min.Beatmaps.Concat(beatmap10Min.Beatmaps)), ref total);
|
||||
assertGroup(results, 4, "Over 10 minutes", beatmap10Min30Sec.Beatmaps, ref total);
|
||||
assertTotal(results, total);
|
||||
}
|
||||
|
||||
@@ -334,10 +335,10 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
addBeatmapSet(s => s.DateRanked = null, beatmapSets, out var beatmapUnranked);
|
||||
|
||||
var results = await runGrouping(GroupMode.DateRanked, beatmapSets);
|
||||
assertGroup(results, 0, "2025", new[] { beatmap2025 }, ref total);
|
||||
assertGroup(results, 1, "2010", new[] { beatmap2010 }, ref total);
|
||||
assertGroup(results, 2, "2007", new[] { beatmapOct2007, beatmapDec2007 }, ref total);
|
||||
assertGroup(results, 3, "Unranked", new[] { beatmapUnranked }, ref total);
|
||||
assertGroup(results, 0, "2025", beatmap2025.Beatmaps, ref total);
|
||||
assertGroup(results, 1, "2010", beatmap2010.Beatmaps, ref total);
|
||||
assertGroup(results, 2, "2007", (beatmapOct2007.Beatmaps.Concat(beatmapDec2007.Beatmaps)), ref total);
|
||||
assertGroup(results, 3, "Unranked", beatmapUnranked.Beatmaps, ref total);
|
||||
assertTotal(results, total);
|
||||
}
|
||||
|
||||
@@ -357,9 +358,9 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
addBeatmapSet(s => s.Beatmaps[0].Metadata.Source = string.Empty, beatmapSets, out var beatmapUnsourced);
|
||||
|
||||
var results = await runGrouping(GroupMode.Source, beatmapSets);
|
||||
assertGroup(results, 0, "Cool Game", new[] { beatmapCoolGame, beatmapCoolGameB }, ref total);
|
||||
assertGroup(results, 1, "Nice Movie", new[] { beatmapNiceMovie }, ref total);
|
||||
assertGroup(results, 2, "Unsourced", new[] { beatmapUnsourced }, ref total);
|
||||
assertGroup(results, 0, "Cool Game", (beatmapCoolGame.Beatmaps.Concat(beatmapCoolGameB.Beatmaps)), ref total);
|
||||
assertGroup(results, 1, "Nice Movie", beatmapNiceMovie.Beatmaps, ref total);
|
||||
assertGroup(results, 2, "Unsourced", beatmapUnsourced.Beatmaps, ref total);
|
||||
assertTotal(results, total);
|
||||
}
|
||||
|
||||
@@ -375,7 +376,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
return await groupingFilter.Run(beatmapSets.SelectMany(s => s.Beatmaps.Select(b => new CarouselItem(b))).ToList(), CancellationToken.None);
|
||||
}
|
||||
|
||||
private static void assertGroup(List<CarouselItem> items, int index, string expectedTitle, IEnumerable<BeatmapSetInfo> expectedBeatmapSets, ref int totalItems)
|
||||
private static void assertGroup(List<CarouselItem> items, int index, string expectedTitle, IEnumerable<BeatmapInfo> expectedBeatmaps, ref int totalItems)
|
||||
{
|
||||
var groupItem = items.Where(i => i.Model is GroupDefinition).ElementAtOrDefault(index);
|
||||
|
||||
@@ -390,7 +391,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
var groupModel = (GroupDefinition)groupItem.Model;
|
||||
|
||||
Assert.That(groupModel.Title, Is.EqualTo(expectedTitle));
|
||||
Assert.That(itemsInGroup.Select(i => i.Model).OfType<BeatmapInfo>(), Is.EquivalentTo(expectedBeatmapSets.SelectMany(bs => bs.Beatmaps)));
|
||||
Assert.That(itemsInGroup.Select(i => i.Model).OfType<BeatmapInfo>(), Is.EquivalentTo(expectedBeatmaps));
|
||||
|
||||
totalItems += itemsInGroup.Count() + 1;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
|
||||
// Using groupingFilter.SetItems.Count alone doesn't work.
|
||||
// When sorting by difficulty, there can be more than one set panel for the same set displayed.
|
||||
return groupingFilter.SetItems.Sum(s => s.Value.Count(i => i.Model is BeatmapSetInfo));
|
||||
return groupingFilter.SetItems.Sum(s => s.Value.Count(i => i.Model is GroupedBeatmapSet));
|
||||
}, () => Is.EqualTo(expected));
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
public BeatmapInfo? SelectedBeatmapInfo => CurrentSelection as BeatmapInfo;
|
||||
public BeatmapSetInfo? SelectedBeatmapSet => SelectedBeatmapInfo?.BeatmapSet;
|
||||
|
||||
public new BeatmapSetInfo? ExpandedBeatmapSet => base.ExpandedBeatmapSet;
|
||||
public new GroupedBeatmapSet? ExpandedBeatmapSet => base.ExpandedBeatmapSet;
|
||||
public new GroupDefinition? ExpandedGroup => base.ExpandedGroup;
|
||||
|
||||
public TestBeatmapCarousel()
|
||||
|
||||
@@ -22,8 +22,6 @@ using osu.Game.Overlays.Toolbar;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.Footer;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Select.Filter;
|
||||
using osu.Game.Screens.SelectV2;
|
||||
@@ -43,9 +41,6 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
protected Screens.SelectV2.SongSelect SongSelect { get; private set; } = null!;
|
||||
protected BeatmapCarousel Carousel => SongSelect.ChildrenOfType<BeatmapCarousel>().Single();
|
||||
|
||||
[Cached]
|
||||
protected readonly ScreenFooter Footer;
|
||||
|
||||
[Cached]
|
||||
private readonly OsuLogo logo;
|
||||
|
||||
@@ -72,10 +67,6 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
{
|
||||
State = { Value = Visibility.Visible },
|
||||
},
|
||||
Footer = new ScreenFooter
|
||||
{
|
||||
BackButtonPressed = () => Stack.CurrentScreen.Exit(),
|
||||
},
|
||||
logo = new OsuLogo
|
||||
{
|
||||
Alpha = 0f,
|
||||
@@ -111,14 +102,6 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
Add(beatmapStore);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Stack.ScreenPushed += updateFooter;
|
||||
Stack.ScreenExited += updateFooter;
|
||||
}
|
||||
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
@@ -207,38 +190,5 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
}
|
||||
|
||||
protected void WaitForSuspension() => AddUntilStep("wait for not current", () => !SongSelect.AsNonNull().IsCurrentScreen());
|
||||
|
||||
private void updateFooter(IScreen? _, IScreen? newScreen)
|
||||
{
|
||||
if (newScreen is OsuScreen osuScreen && osuScreen.ShowFooter)
|
||||
{
|
||||
Footer.Show();
|
||||
|
||||
if (osuScreen.IsLoaded)
|
||||
updateFooterButtons();
|
||||
else
|
||||
{
|
||||
// ensure the current buttons are immediately disabled on screen change (so they can't be pressed).
|
||||
Footer.SetButtons(Array.Empty<ScreenFooterButton>());
|
||||
|
||||
osuScreen.OnLoadComplete += _ => updateFooterButtons();
|
||||
}
|
||||
|
||||
void updateFooterButtons()
|
||||
{
|
||||
var buttons = osuScreen.CreateFooterButtons();
|
||||
|
||||
osuScreen.LoadComponentsAgainstScreenDependencies(buttons);
|
||||
|
||||
Footer.SetButtons(buttons);
|
||||
Footer.Show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Footer.Hide();
|
||||
Footer.SetButtons(Array.Empty<ScreenFooterButton>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,7 +396,9 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
ApplyToFilterAndWaitForFilter("filter first away", c => c.UserStarDifficulty.Min = 3);
|
||||
|
||||
SelectNextPanel();
|
||||
AddAssert("keyboard selected is first set", () => GetKeyboardSelectedPanel()?.Item?.Model, () => Is.EqualTo(BeatmapSets.First()));
|
||||
AddAssert("keyboard selected is first set",
|
||||
() => (GetKeyboardSelectedPanel()?.Item?.Model as GroupedBeatmapSet)?.BeatmapSet,
|
||||
() => Is.EqualTo(BeatmapSets.First()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -413,7 +415,9 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
ApplyToFilterAndWaitForFilter("filter first away", c => c.UserStarDifficulty.Min = 3);
|
||||
|
||||
SelectPrevPanel();
|
||||
AddAssert("keyboard selected is last set", () => GetKeyboardSelectedPanel()?.Item?.Model, () => Is.EqualTo(BeatmapSets.Last()));
|
||||
AddAssert("keyboard selected is last set",
|
||||
() => (GetKeyboardSelectedPanel()?.Item?.Model as GroupedBeatmapSet)?.BeatmapSet,
|
||||
() => Is.EqualTo(BeatmapSets.Last()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -428,7 +432,9 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
ApplyToFilterAndWaitForFilter("filter last set away", c => c.SearchText = BeatmapSets.First().Metadata.Title);
|
||||
|
||||
SelectPrevPanel();
|
||||
AddAssert("keyboard selected is first set", () => GetKeyboardSelectedPanel()?.Item?.Model, () => Is.EqualTo(BeatmapSets.First()));
|
||||
AddAssert("keyboard selected is first set",
|
||||
() => (GetKeyboardSelectedPanel()?.Item?.Model as GroupedBeatmapSet)?.BeatmapSet,
|
||||
() => Is.EqualTo(BeatmapSets.First()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -444,7 +450,9 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
|
||||
// Single result is automatically selected for us, so we iterate once backwards to the set header.
|
||||
SelectPrevPanel();
|
||||
AddAssert("keyboard selected is second set", () => GetKeyboardSelectedPanel()?.Item?.Model, () => Is.EqualTo(BeatmapSets.Last()));
|
||||
AddAssert("keyboard selected is second set",
|
||||
() => (GetKeyboardSelectedPanel()?.Item?.Model as GroupedBeatmapSet)?.BeatmapSet,
|
||||
() => Is.EqualTo(BeatmapSets.Last()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Screens.Select.Filter;
|
||||
using osu.Game.Screens.SelectV2;
|
||||
|
||||
namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
{
|
||||
[TestFixture]
|
||||
public partial class TestSceneBeatmapCarouselSetsSplitApart : BeatmapCarouselTestScene
|
||||
{
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
RemoveAllBeatmaps();
|
||||
CreateCarousel();
|
||||
|
||||
SortAndGroupBy(SortMode.Title, GroupMode.Length);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSetTraversal()
|
||||
{
|
||||
AddBeatmaps(3, splitApart: true);
|
||||
AddBeatmaps(3, splitApart: false);
|
||||
WaitForDrawablePanels();
|
||||
|
||||
SelectNextSet();
|
||||
WaitForSetSelection(set: 0, diff: 0);
|
||||
|
||||
SelectNextSet();
|
||||
WaitForSetSelection(set: 1, diff: 0);
|
||||
|
||||
SelectPrevSet();
|
||||
WaitForSetSelection(set: 0, diff: 0);
|
||||
|
||||
SelectPrevSet();
|
||||
WaitForSetSelection(set: 5, diff: 0);
|
||||
|
||||
SelectPrevSet();
|
||||
SelectPrevSet();
|
||||
SelectPrevSet();
|
||||
WaitForSetSelection(set: 2, diff: 4);
|
||||
AddAssert("only two beatmap panels visible", () => GetVisiblePanels<PanelBeatmap>().Count(), () => Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBeatmapTraversal()
|
||||
{
|
||||
AddBeatmaps(3, splitApart: true);
|
||||
AddBeatmaps(3, splitApart: false);
|
||||
WaitForDrawablePanels();
|
||||
|
||||
SelectNextSet();
|
||||
WaitForSetSelection(set: 0, diff: 0);
|
||||
|
||||
SelectNextPanel();
|
||||
WaitForSetSelection(set: 0, diff: 1);
|
||||
|
||||
SelectNextPanel(); // header of set 1 in group 0
|
||||
Select();
|
||||
WaitForSetSelection(set: 1, diff: 0);
|
||||
|
||||
SelectPrevPanel(); // header of set 1 in group 0
|
||||
SelectPrevPanel(); // header of set 0 in group 0
|
||||
Select();
|
||||
WaitForSetSelection(set: 0, diff: 0);
|
||||
|
||||
SelectPrevPanel(); // header of set 0 in group 0
|
||||
SelectPrevPanel(); // header of group 0
|
||||
SelectPrevPanel(); // header of group 2
|
||||
Select();
|
||||
SelectNextPanel(); // header of set 0 in group 2
|
||||
Select();
|
||||
WaitForSetSelection(set: 0, diff: 4);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRandomStaysInGroup()
|
||||
{
|
||||
AddBeatmaps(2, splitApart: false);
|
||||
AddBeatmaps(1, splitApart: true);
|
||||
WaitForDrawablePanels();
|
||||
|
||||
SelectPrevSet();
|
||||
SelectPrevSet();
|
||||
WaitForSetSelection(set: 1);
|
||||
WaitForExpandedGroup(2);
|
||||
|
||||
AddStep("select next random", () => Carousel.NextRandom());
|
||||
WaitForExpandedGroup(2);
|
||||
AddStep("select next random", () => Carousel.NextRandom());
|
||||
WaitForExpandedGroup(2);
|
||||
}
|
||||
|
||||
protected void AddBeatmaps(int count, bool splitApart) => AddStep($"add {count} beatmaps ({(splitApart ? "" : "not ")}split apart)", () =>
|
||||
{
|
||||
var beatmapSets = new List<BeatmapSetInfo>();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var beatmapSet = CreateTestBeatmapSetInfo(6, false);
|
||||
|
||||
for (int j = 0; j < beatmapSet.Beatmaps.Count; j++)
|
||||
{
|
||||
beatmapSet.Beatmaps[j].Length = splitApart ? 30_000 * (j + 1) : 180_000;
|
||||
}
|
||||
|
||||
beatmapSets.Add(beatmapSet);
|
||||
}
|
||||
|
||||
BeatmapSets.AddRange(beatmapSets);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -22,12 +22,16 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
{
|
||||
private BeatmapSetInfo baseTestBeatmap = null!;
|
||||
|
||||
private const int initial_filter_count = 3;
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
RemoveAllBeatmaps();
|
||||
CreateCarousel();
|
||||
WaitForFiltering();
|
||||
AddBeatmaps(1, 3);
|
||||
WaitForFiltering();
|
||||
AddStep("generate and add test beatmap", () =>
|
||||
{
|
||||
baseTestBeatmap = TestResources.CreateTestBeatmapSetInfo(3);
|
||||
@@ -42,8 +46,9 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
b.Metadata = metadata;
|
||||
BeatmapSets.Add(baseTestBeatmap);
|
||||
});
|
||||
|
||||
WaitForFiltering();
|
||||
|
||||
AddAssert("filter count correct", () => Carousel.FilterCount, () => Is.EqualTo(initial_filter_count));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -81,12 +86,18 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
|
||||
AddUntilStep("is scrolled to end", () => Carousel.ChildrenOfType<UserTrackingScrollContainer>().Single().IsScrolledToEnd());
|
||||
|
||||
updateBeatmap(b => b.Metadata = new BeatmapMetadata
|
||||
updateBeatmap(b =>
|
||||
{
|
||||
Artist = "updated test",
|
||||
Title = $"beatmap {RNG.Next().ToString()}"
|
||||
// hash will be updated when important metadata changes, such as title, difficulty, author etc.
|
||||
b.Hash = "new hash";
|
||||
b.Metadata = new BeatmapMetadata
|
||||
{
|
||||
Artist = "updated test",
|
||||
Title = $"beatmap {RNG.Next().ToString()}"
|
||||
};
|
||||
});
|
||||
|
||||
assertDidFilter();
|
||||
WaitForFiltering();
|
||||
|
||||
AddAssert("scroll is still at end", () => Carousel.ChildrenOfType<UserTrackingScrollContainer>().Single().IsScrolledToEnd());
|
||||
@@ -113,8 +124,14 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
|
||||
AddStep("find panel", () => panel = Carousel.ChildrenOfType<PanelBeatmapSet>().Single(p => p.ChildrenOfType<OsuSpriteText>().Any(t => t.Text.ToString() == "beatmap")));
|
||||
|
||||
updateBeatmap(b => b.Metadata = metadata);
|
||||
updateBeatmap(b =>
|
||||
{
|
||||
b.Metadata = metadata;
|
||||
// hash will be updated when important metadata changes, such as title, difficulty, author etc.
|
||||
b.Hash = "new hash";
|
||||
});
|
||||
|
||||
assertDidFilter();
|
||||
WaitForFiltering();
|
||||
|
||||
AddAssert("drawables unchanged", () => Carousel.ChildrenOfType<Panel>(), () => Is.EqualTo(originalDrawables));
|
||||
@@ -123,7 +140,41 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSelectionHeld()
|
||||
public void TestOnlineStatusUpdated()
|
||||
{
|
||||
List<Panel> originalDrawables = new List<Panel>();
|
||||
|
||||
AddStep("store drawable references", () =>
|
||||
{
|
||||
originalDrawables.Clear();
|
||||
originalDrawables.AddRange(Carousel.ChildrenOfType<Panel>().ToList());
|
||||
});
|
||||
|
||||
updateBeatmap(b => b.Status = BeatmapOnlineStatus.Graveyard);
|
||||
|
||||
assertDidFilter();
|
||||
WaitForFiltering();
|
||||
|
||||
AddAssert("drawables unchanged", () => Carousel.ChildrenOfType<Panel>(), () => Is.EqualTo(originalDrawables));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNoUpdateTriggeredOnUserTagsChange()
|
||||
{
|
||||
var metadata = new BeatmapMetadata
|
||||
{
|
||||
Artist = "updated test",
|
||||
Title = "new beatmap title",
|
||||
UserTags = { "hi" }
|
||||
};
|
||||
|
||||
updateBeatmap(b => b.Metadata = metadata);
|
||||
assertDidNotFilter();
|
||||
}
|
||||
|
||||
[TestCase(false)]
|
||||
[TestCase(true)]
|
||||
public void TestSelectionHeld(bool hashChanged)
|
||||
{
|
||||
SelectNextSet();
|
||||
|
||||
@@ -131,7 +182,17 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
AddAssert("selection is updateable beatmap", () => Carousel.CurrentSelection, () => Is.EqualTo(baseTestBeatmap.Beatmaps[0]));
|
||||
AddAssert("visible panel is updateable beatmap", () => GetSelectedPanel()?.Item?.Model, () => Is.EqualTo(baseTestBeatmap.Beatmaps[0]));
|
||||
|
||||
updateBeatmap();
|
||||
updateBeatmap(b =>
|
||||
{
|
||||
if (hashChanged)
|
||||
b.Hash = "new hash";
|
||||
});
|
||||
|
||||
if (hashChanged)
|
||||
assertDidFilter();
|
||||
else
|
||||
assertDidNotFilter();
|
||||
|
||||
WaitForFiltering();
|
||||
|
||||
AddAssert("selection is updateable beatmap", () => Carousel.CurrentSelection, () => Is.EqualTo(baseTestBeatmap.Beatmaps[0]));
|
||||
@@ -148,6 +209,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
AddAssert("visible panel is updateable beatmap", () => GetSelectedPanel()?.Item?.Model, () => Is.EqualTo(baseTestBeatmap.Beatmaps[0]));
|
||||
|
||||
updateBeatmap(b => b.DifficultyName = "new name");
|
||||
assertDidFilter();
|
||||
WaitForFiltering();
|
||||
|
||||
AddAssert("selection is updateable beatmap", () => Carousel.CurrentSelection, () => Is.EqualTo(baseTestBeatmap.Beatmaps[0]));
|
||||
@@ -164,6 +226,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
AddAssert("visible panel is updateable beatmap", () => GetSelectedPanel()?.Item?.Model, () => Is.EqualTo(baseTestBeatmap.Beatmaps[0]));
|
||||
|
||||
updateBeatmap(b => b.OnlineID = b.OnlineID + 1);
|
||||
assertDidFilter();
|
||||
WaitForFiltering();
|
||||
|
||||
AddAssert("selection is updateable beatmap", () => Carousel.CurrentSelection, () => Is.EqualTo(baseTestBeatmap.Beatmaps[0]));
|
||||
@@ -339,6 +402,10 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
AddAssert("Order didn't change", () => Carousel.PostFilterBeatmaps.Select(b => b.ID), () => Is.EqualTo(originalOrder));
|
||||
}
|
||||
|
||||
private void assertDidFilter() => AddAssert("did filter", () => Carousel.FilterCount, () => Is.EqualTo(initial_filter_count + 1));
|
||||
|
||||
private void assertDidNotFilter() => AddAssert("did not filter", () => Carousel.FilterCount, () => Is.EqualTo(initial_filter_count));
|
||||
|
||||
private void updateBeatmap(Action<BeatmapInfo>? updateBeatmap = null, Action<BeatmapSetInfo>? updateSet = null)
|
||||
{
|
||||
AddStep("update beatmap with different reference", () =>
|
||||
|
||||
@@ -75,21 +75,21 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
{
|
||||
new PanelBeatmapSet
|
||||
{
|
||||
Item = new CarouselItem(beatmapSet)
|
||||
Item = new CarouselItem(new GroupedBeatmapSet(null, beatmapSet))
|
||||
},
|
||||
new PanelBeatmapSet
|
||||
{
|
||||
Item = new CarouselItem(beatmapSet),
|
||||
Item = new CarouselItem(new GroupedBeatmapSet(null, beatmapSet)),
|
||||
KeyboardSelected = { Value = true }
|
||||
},
|
||||
new PanelBeatmapSet
|
||||
{
|
||||
Item = new CarouselItem(beatmapSet),
|
||||
Item = new CarouselItem(new GroupedBeatmapSet(null, beatmapSet)),
|
||||
Expanded = { Value = true }
|
||||
},
|
||||
new PanelBeatmapSet
|
||||
{
|
||||
Item = new CarouselItem(beatmapSet),
|
||||
Item = new CarouselItem(new GroupedBeatmapSet(null, beatmapSet)),
|
||||
KeyboardSelected = { Value = true },
|
||||
Expanded = { Value = true }
|
||||
},
|
||||
|
||||
@@ -23,7 +23,9 @@ using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Screens.Select;
|
||||
using osu.Game.Screens.Select.Leaderboards;
|
||||
using osu.Game.Screens.SelectV2;
|
||||
using osu.Game.Tests.Resources;
|
||||
using osuTK.Input;
|
||||
using BeatmapCarousel = osu.Game.Screens.SelectV2.BeatmapCarousel;
|
||||
using FooterButtonMods = osu.Game.Screens.SelectV2.FooterButtonMods;
|
||||
using FooterButtonOptions = osu.Game.Screens.SelectV2.FooterButtonOptions;
|
||||
using FooterButtonRandom = osu.Game.Screens.SelectV2.FooterButtonRandom;
|
||||
@@ -302,6 +304,28 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Last played and rank achieved may have changed, so we want to make sure filtering runs on resume to song select.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestFilteringRunsAfterReturningFromGameplay()
|
||||
{
|
||||
AddStep("import actual beatmap", () => Beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()));
|
||||
LoadSongSelect();
|
||||
|
||||
AddUntilStep("wait for filtered", () => SongSelect.ChildrenOfType<BeatmapCarousel>().Single().FilterCount, () => Is.EqualTo(1));
|
||||
|
||||
AddStep("enter gameplay", () => InputManager.Key(Key.Enter));
|
||||
|
||||
AddUntilStep("wait for player", () => Stack.CurrentScreen is Player);
|
||||
AddUntilStep("wait for fail", () => ((Player)Stack.CurrentScreen).GameplayState.HasFailed);
|
||||
|
||||
AddStep("exit gameplay", () => InputManager.Key(Key.Escape));
|
||||
AddStep("exit gameplay", () => InputManager.Key(Key.Escape));
|
||||
|
||||
AddUntilStep("wait for filtered", () => SongSelect.ChildrenOfType<BeatmapCarousel>().Single().FilterCount, () => Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAutoplayShortcut()
|
||||
{
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
AddAssert("no-collection group present", () =>
|
||||
{
|
||||
var group = grouping.GroupItems.Single(g => g.Key.Title == "Not in collection");
|
||||
return group.Value.Select(i => i.Model).OfType<BeatmapSetInfo>().Single().Equals(beatmapSet);
|
||||
return group.Value.Select(i => i.Model).OfType<GroupedBeatmapSet>().Single().BeatmapSet.Equals(beatmapSet);
|
||||
});
|
||||
|
||||
AddStep("add beatmap to collection", () =>
|
||||
|
||||
@@ -6,6 +6,7 @@ using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osu.Game.Tournament.IPC;
|
||||
using osu.Game.Tournament.Screens.Gameplay;
|
||||
@@ -66,6 +67,6 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
() => this.ChildrenOfType<TeamScore>().All(score => score.Alpha == (visible ? 1 : 0)));
|
||||
|
||||
private void toggleWarmup()
|
||||
=> AddStep("toggle warmup", () => this.ChildrenOfType<TourneyButton>().First().TriggerClick());
|
||||
=> AddStep("toggle warmup", () => this.ChildrenOfType<LabelledSwitchButton>().First().ChildrenOfType<SwitchButton>().First().TriggerClick());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osu.Game.Tournament.IPC;
|
||||
@@ -24,7 +24,6 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
private readonly BindableBool warmup = new BindableBool();
|
||||
|
||||
public readonly Bindable<TourneyState> State = new Bindable<TourneyState>();
|
||||
private OsuButton warmupButton = null!;
|
||||
private MatchIPCInfo ipc = null!;
|
||||
|
||||
[Resolved]
|
||||
@@ -40,6 +39,8 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
{
|
||||
this.ipc = ipc;
|
||||
|
||||
LabelledSwitchButton chatToggle;
|
||||
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
new TourneyVideo("gameplay")
|
||||
@@ -95,17 +96,14 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
warmupButton = new TourneyButton
|
||||
new LabelledSwitchButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Toggle warmup",
|
||||
Action = () => warmup.Toggle()
|
||||
Label = "Warmup",
|
||||
Current = warmup,
|
||||
},
|
||||
new TourneyButton
|
||||
chatToggle = new LabelledSwitchButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Toggle chat",
|
||||
Action = () => { State.Value = State.Value == TourneyState.Idle ? TourneyState.Playing : TourneyState.Idle; }
|
||||
Label = "Show chat",
|
||||
},
|
||||
new SettingsSlider<int>
|
||||
{
|
||||
@@ -123,13 +121,12 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
}
|
||||
});
|
||||
|
||||
State.BindValueChanged(state => chatToggle.Current.Value = State.Value == TourneyState.Idle, true);
|
||||
chatToggle.Current.BindValueChanged(v => State.Value = v.NewValue ? TourneyState.Idle : TourneyState.Playing);
|
||||
|
||||
LadderInfo.ChromaKeyWidth.BindValueChanged(width => chroma.Width = width.NewValue, true);
|
||||
|
||||
warmup.BindValueChanged(w =>
|
||||
{
|
||||
warmupButton.Alpha = !w.NewValue ? 0.5f : 1;
|
||||
header.ShowScores = !w.NewValue;
|
||||
}, true);
|
||||
warmup.BindValueChanged(w => header.ShowScores = !w.NewValue, true);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
||||
@@ -13,6 +13,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Collections;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
@@ -36,8 +37,8 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public ProcessBeatmapDelegate? ProcessBeatmap { private get; set; }
|
||||
|
||||
public BeatmapImporter(Storage storage, RealmAccess realm)
|
||||
: base(storage, realm)
|
||||
public BeatmapImporter(Storage storage, RealmAccess realm, OsuConfigManager? config)
|
||||
: base(storage, realm, config)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.IO.Archives;
|
||||
@@ -59,7 +60,7 @@ namespace osu.Game.Beatmaps
|
||||
}
|
||||
|
||||
public BeatmapManager(Storage storage, RealmAccess realm, IAPIProvider? api, AudioManager audioManager, IResourceStore<byte[]> gameResources, GameHost? host = null,
|
||||
WorkingBeatmap? defaultBeatmap = null, BeatmapDifficultyCache? difficultyCache = null, bool performOnlineLookups = false)
|
||||
WorkingBeatmap? defaultBeatmap = null, BeatmapDifficultyCache? difficultyCache = null, bool performOnlineLookups = false, OsuConfigManager? config = null)
|
||||
: base(storage, realm)
|
||||
{
|
||||
if (performOnlineLookups)
|
||||
@@ -75,7 +76,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
BeatmapTrackStore = audioManager.GetTrackStore(userResources);
|
||||
|
||||
beatmapImporter = CreateBeatmapImporter(storage, realm);
|
||||
beatmapImporter = CreateBeatmapImporter(storage, realm, config);
|
||||
beatmapImporter.ProcessBeatmap = (beatmapSet, scope) => ProcessBeatmap?.Invoke(beatmapSet, scope);
|
||||
beatmapImporter.PostNotification = obj => PostNotification?.Invoke(obj);
|
||||
|
||||
@@ -98,7 +99,7 @@ namespace osu.Game.Beatmaps
|
||||
return new WorkingBeatmapCache(BeatmapTrackStore, audioManager, resources, storage, defaultBeatmap, host);
|
||||
}
|
||||
|
||||
protected virtual BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm) => new BeatmapImporter(storage, realm);
|
||||
protected virtual BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm, OsuConfigManager? config = null) => new BeatmapImporter(storage, realm, config);
|
||||
|
||||
/// <summary>
|
||||
/// Create a new beatmap set, backed by a <see cref="BeatmapSetInfo"/> model,
|
||||
|
||||
@@ -59,7 +59,10 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
// An interpolating clock is used to ensure precise time values even when the host audio subsystem is not reporting
|
||||
// high precision times (on windows there's generally only 5-10ms reporting intervals, as an example).
|
||||
interpolatedTrack = new InterpolatingFramedClock(decoupledTrack);
|
||||
interpolatedTrack = new InterpolatingFramedClock(decoupledTrack)
|
||||
{
|
||||
DriftRecoveryHalfLife = 80,
|
||||
};
|
||||
|
||||
if (applyOffsets)
|
||||
{
|
||||
|
||||
@@ -202,6 +202,8 @@ namespace osu.Game.Configuration
|
||||
|
||||
SetDefault(OsuSetting.DiscordRichPresence, DiscordRichPresenceMode.Full);
|
||||
|
||||
SetDefault(OsuSetting.DeleteImportedArchives, true);
|
||||
|
||||
SetDefault(OsuSetting.EditorDim, 0.25f, 0f, 0.75f, 0.25f);
|
||||
SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f, 0f, 1f, 0.25f);
|
||||
SetDefault(OsuSetting.EditorShowHitMarkers, true);
|
||||
@@ -449,6 +451,7 @@ namespace osu.Game.Configuration
|
||||
EditorShowHitMarkers,
|
||||
EditorAutoSeekOnPlacement,
|
||||
DiscordRichPresence,
|
||||
DeleteImportedArchives,
|
||||
|
||||
ShowOnlineExplicitContent,
|
||||
LastProcessedMetadataId,
|
||||
|
||||
@@ -8,11 +8,14 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Humanizer;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.IO.Archives;
|
||||
using osu.Game.Models;
|
||||
@@ -77,11 +80,19 @@ namespace osu.Game.Database
|
||||
/// </summary>
|
||||
public Action<Notification>? PostNotification { get; set; }
|
||||
|
||||
protected RealmArchiveModelImporter(Storage storage, RealmAccess realm)
|
||||
private readonly OsuConfigManager? config;
|
||||
|
||||
private Bindable<bool>? deleteImportedArchives;
|
||||
|
||||
protected RealmArchiveModelImporter(Storage storage, RealmAccess realm, OsuConfigManager? config = null)
|
||||
{
|
||||
Realm = realm;
|
||||
|
||||
Files = new RealmFileStore(realm, storage);
|
||||
|
||||
deleteImportedArchives = config?.GetBindable<bool>(OsuSetting.DeleteImportedArchives);
|
||||
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public Task Import(params string[] paths) => Import(paths.Select(p => new ImportTask(p)).ToArray());
|
||||
@@ -241,9 +252,10 @@ namespace osu.Game.Database
|
||||
// e.g. reconstructing/repairing database with items from default storage.
|
||||
// Also, not always a single file, i.e. for LegacyFilesystemReader
|
||||
// TODO: Add a check to prevent files from storage to be deleted.
|
||||
bool allowDelete = deleteImportedArchives?.Value ?? true;
|
||||
try
|
||||
{
|
||||
if (import != null && ShouldDeleteArchive(task.Path))
|
||||
if (import != null && ShouldDeleteArchive(task.Path) && allowDelete)
|
||||
task.DeleteFile();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@@ -79,7 +80,7 @@ namespace osu.Game.Graphics.Carousel
|
||||
/// <summary>
|
||||
/// The number of times filter operations have been triggered.
|
||||
/// </summary>
|
||||
internal int FilterCount { get; private set; }
|
||||
public int FilterCount { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of displayable items currently being tracked (before filtering).
|
||||
@@ -210,6 +211,12 @@ namespace osu.Game.Graphics.Carousel
|
||||
return filterTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when <see cref="Items"/> changes in any way.
|
||||
/// </summary>
|
||||
/// <returns>Whether a re-filter is required.</returns>
|
||||
protected virtual bool HandleItemsChanged(NotifyCollectionChangedEventArgs args) => true;
|
||||
|
||||
/// <summary>
|
||||
/// Fired after a filter operation completed.
|
||||
/// </summary>
|
||||
@@ -301,7 +308,11 @@ namespace osu.Game.Graphics.Carousel
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
};
|
||||
|
||||
Items.BindCollectionChanged((_, _) => filterAfterItemsChanged.Invalidate());
|
||||
Items.BindCollectionChanged((_, args) =>
|
||||
{
|
||||
if (HandleItemsChanged(args))
|
||||
filterAfterItemsChanged.Invalidate();
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace osu.Game
|
||||
|
||||
Audio.Samples.PlaybackConcurrency = SAMPLE_CONCURRENCY;
|
||||
|
||||
dependencies.Cache(SkinManager = new SkinManager(Storage, realm, Host, Resources, Audio, Scheduler));
|
||||
dependencies.Cache(SkinManager = new SkinManager(Storage, realm, Host, Resources, Audio, Scheduler, LocalConfig));
|
||||
dependencies.CacheAs<ISkinSource>(SkinManager);
|
||||
|
||||
EndpointConfiguration endpoints = CreateEndpoints();
|
||||
@@ -322,7 +322,7 @@ namespace osu.Game
|
||||
// ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup()
|
||||
dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, realm, API, LocalConfig));
|
||||
|
||||
dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, realm, API, Audio, Resources, Host, defaultBeatmap, difficultyCache, performOnlineLookups: true));
|
||||
dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, realm, API, Audio, Resources, Host, defaultBeatmap, difficultyCache, performOnlineLookups: true, config: LocalConfig));
|
||||
dependencies.CacheAs<IWorkingBeatmapCache>(BeatmapManager);
|
||||
|
||||
dependencies.Cache(BeatmapDownloader = new BeatmapModelDownloader(BeatmapManager, API));
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace osu.Game.Overlays
|
||||
notification.Closed += () => notificationClosed(notification);
|
||||
|
||||
if (notification is IHasCompletionTarget hasCompletionTarget)
|
||||
hasCompletionTarget.CompletionTarget = Post;
|
||||
hasCompletionTarget.CompletionTarget ??= Post;
|
||||
|
||||
playDebouncedSample(notification.PopInSampleName);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.Import;
|
||||
@@ -22,13 +23,19 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
private ISystemFileSelector? selector;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase game, GameHost host, IPerformFromScreenRunner? performer)
|
||||
private void load(OsuGameBase game, GameHost host, IPerformFromScreenRunner? performer, OsuConfigManager config)
|
||||
{
|
||||
if ((selector = host.CreateSystemFileSelector(game.HandledExtensions.ToArray())) != null)
|
||||
selector.Selected += f => Task.Run(() => game.Import(f.FullName));
|
||||
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Delete archives on import",
|
||||
Current = config.GetBindable<bool>(OsuSetting.DeleteImportedArchives),
|
||||
ClassicDefault = true
|
||||
},
|
||||
new SettingsButton
|
||||
{
|
||||
Text = DebugSettingsStrings.ImportFiles,
|
||||
@@ -44,7 +51,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
{
|
||||
Text = DebugSettingsStrings.RunLatencyCertifier,
|
||||
Action = () => performer?.PerformFromScreen(menu => menu.Push(new LatencyCertifierScreen()))
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,9 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
var bindable = (IBindable)property.GetValue(this)!;
|
||||
|
||||
if (bindable.IsDefault)
|
||||
continue;
|
||||
|
||||
string valueText;
|
||||
|
||||
switch (bindable)
|
||||
@@ -69,8 +72,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
break;
|
||||
}
|
||||
|
||||
if (!bindable.IsDefault)
|
||||
yield return (attr.Label, valueText);
|
||||
yield return (attr.Label, valueText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,8 +46,10 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ("Roll speed", $"{SpinSpeed.Value:N2} rpm");
|
||||
yield return ("Direction", Direction.Value.GetDescription());
|
||||
if (!SpinSpeed.IsDefault)
|
||||
yield return ("Roll speed", $"{SpinSpeed.Value:N2} rpm");
|
||||
if (!Direction.IsDefault)
|
||||
yield return ("Direction", Direction.Value.GetDescription());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +57,8 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
public virtual void Update(Playfield playfield)
|
||||
{
|
||||
playfieldAdjustmentContainer.Rotation = CurrentRotation = (Direction.Value == RotationDirection.Counterclockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
|
||||
playfieldAdjustmentContainer.Rotation =
|
||||
CurrentRotation = (Direction.Value == RotationDirection.Counterclockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
|
||||
}
|
||||
|
||||
public void ApplyToDrawableRuleset(DrawableRuleset<TObject> drawableRuleset)
|
||||
|
||||
@@ -41,7 +41,8 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ("Speed change", $"{InitialRate.Value:N2}x to {FinalRate.Value:N2}x");
|
||||
if (!InitialRate.IsDefault || !FinalRate.IsDefault)
|
||||
yield return ("Speed change", $"{InitialRate.Value:N2}x to {FinalRate.Value:N2}x");
|
||||
|
||||
if (!AdjustPitch.IsDefault)
|
||||
yield return ("Adjust pitch", AdjustPitch.Value ? "On" : "Off");
|
||||
|
||||
@@ -160,8 +160,8 @@ namespace osu.Game.Rulesets.Objects.Pooling
|
||||
if (!IsPresent)
|
||||
return false;
|
||||
|
||||
bool aliveChanged = base.CheckChildrenLife();
|
||||
aliveChanged |= lifetimeManager.Update(Time.Current - PastLifetimeExtension, Time.Current + FutureLifetimeExtension);
|
||||
bool aliveChanged = lifetimeManager.Update(Time.Current - PastLifetimeExtension, Time.Current + FutureLifetimeExtension);
|
||||
aliveChanged |= base.CheckChildrenLife();
|
||||
return aliveChanged;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,11 +59,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
|
||||
protected override void RevertResultInternal(JudgementResult result)
|
||||
{
|
||||
// TODO: this is rudimentary as to make rewinding failed replays work,
|
||||
// but it also acts up (sometimes rewinding a replay several times around the fail boundary moves the point of fail forward).
|
||||
// needs further investigation.
|
||||
if (result.FailedAtJudgement)
|
||||
HasFailed = false;
|
||||
HasFailed = result.FailedAtJudgement;
|
||||
|
||||
if (HasFailed)
|
||||
return;
|
||||
|
||||
@@ -1402,9 +1402,36 @@ namespace osu.Game.Screens.Edit
|
||||
private void anonymizeBeatmap()
|
||||
{
|
||||
dialogOverlay.Push(new ConfirmDialog(
|
||||
"Really remove online IDs?",
|
||||
() => playableBeatmap.BeatmapInfo.ResetOnlineInfo(true)
|
||||
));
|
||||
"Really remove online IDs?", () => attemptAsyncMutationOperation(anonymizeMaps))
|
||||
);
|
||||
|
||||
Task anonymizeMaps()
|
||||
{
|
||||
var maps = editorBeatmap.BeatmapInfo.BeatmapSet.Beatmaps;
|
||||
foreach (BeatmapInfo map in maps)
|
||||
{
|
||||
try
|
||||
{
|
||||
map.OnlineID = -1;
|
||||
map.BeatmapSet.OnlineID = -1;
|
||||
map.ResetOnlineInfo(true);
|
||||
beatmapManager.Save(
|
||||
map,
|
||||
beatmapManager.GetWorkingBeatmap(map, true).Beatmap,
|
||||
editorBeatmap.BeatmapSkin
|
||||
);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex, ex.Message);
|
||||
notifications?.Post(new SimpleErrorNotification { Text = "Failed to update beatmap difficulty!\nCheck logs for details" });
|
||||
throw; // we don't want to handle it further, task will do it for us
|
||||
}
|
||||
}
|
||||
updateLastSavedHash();
|
||||
onScreenDisplay?.Display(new BeatmapEditorToast("Online IDs removed", editorBeatmap.BeatmapInfo.GetDisplayTitle()));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
private void exportBeatmap(bool legacy)
|
||||
|
||||
@@ -178,17 +178,31 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (!isCandidateAudioSource(currentAudioSource?.SpectatorPlayerClock))
|
||||
{
|
||||
currentAudioSource = instances.Where(i => isCandidateAudioSource(i.SpectatorPlayerClock)).MinBy(i => Math.Abs(i.SpectatorPlayerClock.CurrentTime - syncManager.CurrentMasterTime));
|
||||
checkAudioSource();
|
||||
}
|
||||
|
||||
// Only bind adjustments if there's actually a valid source, else just use the previous ones to ensure no sudden changes to audio.
|
||||
if (currentAudioSource != null)
|
||||
bindAudioAdjustments(currentAudioSource);
|
||||
private void checkAudioSource()
|
||||
{
|
||||
// always use the maximised player instance as the current audio source if there is one
|
||||
if (grid.MaximisedCell?.Content is PlayerArea maximisedPlayer && maximisedPlayer == currentAudioSource)
|
||||
return;
|
||||
|
||||
foreach (var instance in instances)
|
||||
instance.Mute = instance != currentAudioSource;
|
||||
}
|
||||
// if there is no maximised player instance and the previous audio source is still good to use, keep using it
|
||||
if (grid.MaximisedCell == null && isCandidateAudioSource(currentAudioSource?.SpectatorPlayerClock))
|
||||
return;
|
||||
|
||||
// at this point we're in one of the following scenarios:
|
||||
// - the maximised player instance is not the current audio source => we want to switch to the maximised player instance
|
||||
// - there is no maximised player instance, and the previous audio source is stopped => find another running audio source
|
||||
currentAudioSource = grid.MaximisedCell?.Content as PlayerArea
|
||||
?? instances.Where(i => isCandidateAudioSource(i.SpectatorPlayerClock)).MinBy(i => Math.Abs(i.SpectatorPlayerClock.CurrentTime - syncManager.CurrentMasterTime));
|
||||
|
||||
// Only bind adjustments if there's actually a valid source, else just use the previous ones to ensure no sudden changes to audio.
|
||||
if (currentAudioSource != null)
|
||||
bindAudioAdjustments(currentAudioSource);
|
||||
|
||||
foreach (var instance in instances)
|
||||
instance.Mute = instance != currentAudioSource;
|
||||
}
|
||||
|
||||
private void bindAudioAdjustments(PlayerArea first)
|
||||
|
||||
@@ -31,6 +31,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
/// </summary>
|
||||
public Facade MaximisedFacade { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The currently-maximised cell.
|
||||
/// </summary>
|
||||
public Cell? MaximisedCell { get; private set; }
|
||||
|
||||
private readonly Container paddingContainer;
|
||||
private readonly FillFlowContainer<Facade> facadeContainer;
|
||||
private readonly Container<Cell> cellContainer;
|
||||
@@ -99,7 +104,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
private void toggleMaximisationState(Cell target)
|
||||
{
|
||||
// in the case the target is the already maximised cell (or there is only one cell), no cell should be maximised.
|
||||
bool hasMaximised = !target.IsMaximised && cellContainer.Count > 1;
|
||||
bool hasMaximised = target != MaximisedCell && cellContainer.Count > 1;
|
||||
MaximisedCell = hasMaximised ? target : null;
|
||||
|
||||
// Iterate through all cells to ensure only one is maximised at any time.
|
||||
foreach (var cell in cellContainer.ToList())
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
/// <summary>
|
||||
/// A cell of the grid. Contains the content and tracks to the linked facade.
|
||||
/// </summary>
|
||||
private partial class Cell : CompositeDrawable
|
||||
public partial class Cell : CompositeDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// The index of the original facade of this cell.
|
||||
@@ -33,11 +33,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
/// </summary>
|
||||
public Action<Cell>? ToggleMaximisationState;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this cell is currently maximised.
|
||||
/// </summary>
|
||||
public bool IsMaximised { get; private set; }
|
||||
|
||||
private Facade facade;
|
||||
|
||||
private bool isAnimating;
|
||||
@@ -83,7 +78,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
public void SetFacade(Facade newFacade, bool isMaximised)
|
||||
{
|
||||
facade = newFacade;
|
||||
IsMaximised = isMaximised;
|
||||
isAnimating = true;
|
||||
|
||||
TweenEdgeEffectTo(new EdgeEffectParameters
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@@ -69,11 +70,11 @@ namespace osu.Game.Screens.SelectV2
|
||||
if (grouping.BeatmapSetsGroupedTogether)
|
||||
{
|
||||
// Give some space around the expanded beatmap set, at the top..
|
||||
if (bottom.Model is BeatmapSetInfo && bottom.IsExpanded)
|
||||
if (bottom.Model is GroupedBeatmapSet && bottom.IsExpanded)
|
||||
return SPACING * 2;
|
||||
|
||||
// ..and the bottom.
|
||||
if (top.Model is BeatmapInfo && bottom.Model is BeatmapSetInfo)
|
||||
if (top.Model is BeatmapInfo && bottom.Model is GroupedBeatmapSet)
|
||||
return SPACING * 2;
|
||||
|
||||
// Beatmap difficulty panels do not overlap with themselves or any other panel.
|
||||
@@ -143,6 +144,9 @@ namespace osu.Game.Screens.SelectV2
|
||||
switch (changed.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
if (!newItems!.Any())
|
||||
return;
|
||||
|
||||
Items.AddRange(newItems!.SelectMany(s => s.Beatmaps));
|
||||
break;
|
||||
|
||||
@@ -206,12 +210,12 @@ namespace osu.Game.Screens.SelectV2
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item.Model is BeatmapSetInfo beatmapSetInfo)
|
||||
if (item.Model is GroupedBeatmapSet groupedSet)
|
||||
{
|
||||
if (oldItems.Contains(beatmapSetInfo))
|
||||
if (oldItems.Contains(groupedSet.BeatmapSet))
|
||||
return false;
|
||||
|
||||
RequestRecommendedSelection(beatmapSetInfo.Beatmaps);
|
||||
RequestRecommendedSelection(groupedSet.BeatmapSet.Beatmaps);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -282,7 +286,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
|
||||
protected GroupDefinition? ExpandedGroup { get; private set; }
|
||||
|
||||
protected BeatmapSetInfo? ExpandedBeatmapSet { get; private set; }
|
||||
protected GroupedBeatmapSet? ExpandedBeatmapSet { get; private set; }
|
||||
|
||||
protected override bool ShouldActivateOnKeyboardSelection(CarouselItem item) =>
|
||||
grouping.BeatmapSetsGroupedTogether && item.Model is BeatmapInfo;
|
||||
@@ -310,8 +314,8 @@ namespace osu.Game.Screens.SelectV2
|
||||
|
||||
return;
|
||||
|
||||
case BeatmapSetInfo setInfo:
|
||||
selectRecommendedDifficultyForBeatmapSet(setInfo);
|
||||
case GroupedBeatmapSet groupedSet:
|
||||
selectRecommendedDifficultyForBeatmapSet(groupedSet);
|
||||
return;
|
||||
|
||||
case BeatmapInfo beatmapInfo:
|
||||
@@ -337,7 +341,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
|
||||
switch (model)
|
||||
{
|
||||
case BeatmapSetInfo:
|
||||
case GroupedBeatmapSet:
|
||||
case GroupDefinition:
|
||||
throw new InvalidOperationException("Groups should never become selected");
|
||||
|
||||
@@ -348,11 +352,62 @@ namespace osu.Game.Screens.SelectV2
|
||||
setExpandedGroup(containingGroup);
|
||||
|
||||
if (grouping.BeatmapSetsGroupedTogether)
|
||||
setExpandedSet(beatmapInfo);
|
||||
setExpandedSet(new GroupedBeatmapSet(containingGroup, beatmapInfo.BeatmapSet!));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool HandleItemsChanged(NotifyCollectionChangedEventArgs args)
|
||||
{
|
||||
switch (args.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
case NotifyCollectionChangedAction.Move:
|
||||
case NotifyCollectionChangedAction.Reset:
|
||||
return true;
|
||||
|
||||
case NotifyCollectionChangedAction.Replace:
|
||||
var oldBeatmaps = args.OldItems!.OfType<BeatmapInfo>().ToList();
|
||||
var newBeatmaps = args.NewItems!.OfType<BeatmapInfo>().ToList();
|
||||
|
||||
for (int i = 0; i < oldBeatmaps.Count; i++)
|
||||
{
|
||||
var oldBeatmap = oldBeatmaps[i];
|
||||
var newBeatmap = newBeatmaps[i];
|
||||
|
||||
// Ignore changes which don't concern us.
|
||||
//
|
||||
// Here are some examples of things that can go wrong:
|
||||
// - Background difficulty calculation runs and causes a realm update.
|
||||
// We use `BeatmapDifficultyCache` and don't want to know about these.
|
||||
// - Background user tag population runs and causes a realm update.
|
||||
// We don't display user tags so want to ignore this.
|
||||
bool equalForDisplayPurposes =
|
||||
// covers metadata changes
|
||||
oldBeatmap.Hash == newBeatmap.Hash &&
|
||||
// sanity check
|
||||
oldBeatmap.OnlineID == newBeatmap.OnlineID &&
|
||||
// displayed on panel
|
||||
oldBeatmap.Status == newBeatmap.Status &&
|
||||
// displayed on panel
|
||||
oldBeatmap.DifficultyName == newBeatmap.DifficultyName &&
|
||||
// hidden changed, needs re-filter
|
||||
oldBeatmap.Hidden == newBeatmap.Hidden &&
|
||||
// might be used for grouping, returning from gameplay
|
||||
oldBeatmap.LastPlayed == newBeatmap.LastPlayed;
|
||||
|
||||
if (equalForDisplayPurposes)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void HandleFilterCompleted()
|
||||
{
|
||||
base.HandleFilterCompleted();
|
||||
@@ -372,10 +427,10 @@ namespace osu.Game.Screens.SelectV2
|
||||
setExpandedGroup(groupForReselection);
|
||||
}
|
||||
|
||||
private void selectRecommendedDifficultyForBeatmapSet(BeatmapSetInfo beatmapSet)
|
||||
private void selectRecommendedDifficultyForBeatmapSet(GroupedBeatmapSet set)
|
||||
{
|
||||
// Selecting a set isn't valid – let's re-select the first visible difficulty.
|
||||
if (grouping.SetItems.TryGetValue(beatmapSet, out var items))
|
||||
if (grouping.SetItems.TryGetValue(set, out var items))
|
||||
{
|
||||
var beatmaps = items.Select(i => i.Model).OfType<BeatmapInfo>();
|
||||
RequestRecommendedSelection(beatmaps);
|
||||
@@ -423,7 +478,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
{
|
||||
switch (item.Model)
|
||||
{
|
||||
case BeatmapSetInfo:
|
||||
case GroupedBeatmapSet:
|
||||
return true;
|
||||
|
||||
case BeatmapInfo:
|
||||
@@ -462,11 +517,11 @@ namespace osu.Game.Screens.SelectV2
|
||||
i.IsExpanded = true;
|
||||
break;
|
||||
|
||||
case BeatmapSetInfo set:
|
||||
case GroupedBeatmapSet groupedSet:
|
||||
// Case where there are set headers, header should be visible
|
||||
// and items should use the set's expanded state.
|
||||
i.IsVisible = true;
|
||||
setExpansionStateOfSetItems(set, i.IsExpanded);
|
||||
setExpansionStateOfSetItems(groupedSet, i.IsExpanded);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -496,21 +551,21 @@ namespace osu.Game.Screens.SelectV2
|
||||
}
|
||||
}
|
||||
|
||||
private void setExpandedSet(BeatmapInfo beatmapInfo)
|
||||
private void setExpandedSet(GroupedBeatmapSet set)
|
||||
{
|
||||
if (ExpandedBeatmapSet != null)
|
||||
setExpansionStateOfSetItems(ExpandedBeatmapSet, false);
|
||||
ExpandedBeatmapSet = beatmapInfo.BeatmapSet!;
|
||||
ExpandedBeatmapSet = set;
|
||||
setExpansionStateOfSetItems(ExpandedBeatmapSet, true);
|
||||
}
|
||||
|
||||
private void setExpansionStateOfSetItems(BeatmapSetInfo set, bool expanded)
|
||||
private void setExpansionStateOfSetItems(GroupedBeatmapSet set, bool expanded)
|
||||
{
|
||||
if (grouping.SetItems.TryGetValue(set, out var items))
|
||||
{
|
||||
foreach (var i in items)
|
||||
{
|
||||
if (i.Model is BeatmapSetInfo)
|
||||
if (i.Model is GroupedBeatmapSet)
|
||||
i.IsExpanded = expanded;
|
||||
else
|
||||
i.IsVisible = expanded;
|
||||
@@ -548,7 +603,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
sampleToggleGroup?.Play();
|
||||
return;
|
||||
|
||||
case BeatmapSetInfo:
|
||||
case GroupedBeatmapSet:
|
||||
sampleChangeSet?.Play();
|
||||
return;
|
||||
|
||||
@@ -687,8 +742,8 @@ namespace osu.Game.Screens.SelectV2
|
||||
// it is doing a Replace operation on the list. If it is, then check the local handling in beatmapSetsChanged
|
||||
// before changing matching requirements here.
|
||||
|
||||
if (x is BeatmapSetInfo beatmapSetX && y is BeatmapSetInfo beatmapSetY)
|
||||
return beatmapSetX.Equals(beatmapSetY);
|
||||
if (x is GroupedBeatmapSet groupedSetX && y is GroupedBeatmapSet groupedSetY)
|
||||
return groupedSetX.Equals(groupedSetY);
|
||||
|
||||
if (x is BeatmapInfo beatmapX && y is BeatmapInfo beatmapY)
|
||||
return beatmapX.Equals(beatmapY);
|
||||
@@ -718,7 +773,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
|
||||
return beatmapPanelPool.Get();
|
||||
|
||||
case BeatmapSetInfo:
|
||||
case GroupedBeatmapSet:
|
||||
return setPanelPool.Get();
|
||||
}
|
||||
|
||||
@@ -828,30 +883,31 @@ namespace osu.Game.Screens.SelectV2
|
||||
|
||||
private bool nextRandomSet()
|
||||
{
|
||||
ICollection<BeatmapSetInfo> visibleSets = ExpandedGroup != null
|
||||
ICollection<GroupedBeatmapSet> visibleSetsUnderGrouping = ExpandedGroup != null
|
||||
// In the case of grouping, users expect random to only operate on the expanded group.
|
||||
// This is going to incur some overhead as we don't have a group-beatmapset mapping currently.
|
||||
//
|
||||
// If this becomes an issue, we could either store a mapping, or run the random algorithm many times
|
||||
// using the `SetItems` method until we get a group HIT.
|
||||
? grouping.GroupItems[ExpandedGroup].Select(i => i.Model).OfType<BeatmapSetInfo>().ToArray()
|
||||
? grouping.GroupItems[ExpandedGroup].Select(i => i.Model).OfType<GroupedBeatmapSet>().ToArray()
|
||||
// This is the fastest way to retrieve sets for randomisation.
|
||||
: grouping.SetItems.Keys;
|
||||
|
||||
BeatmapSetInfo set;
|
||||
GroupedBeatmapSet set;
|
||||
|
||||
switch (randomAlgorithm.Value)
|
||||
{
|
||||
case RandomSelectAlgorithm.RandomPermutation:
|
||||
{
|
||||
ICollection<BeatmapSetInfo> notYetVisitedSets = visibleSets.Except(previouslyVisitedRandomBeatmaps.Select(b => b.BeatmapSet!)).ToList();
|
||||
ICollection<GroupedBeatmapSet> notYetVisitedSets =
|
||||
visibleSetsUnderGrouping.ExceptBy(previouslyVisitedRandomBeatmaps.Select(b => b.BeatmapSet!), groupedSet => groupedSet.BeatmapSet).ToList();
|
||||
|
||||
if (!notYetVisitedSets.Any())
|
||||
{
|
||||
previouslyVisitedRandomBeatmaps.RemoveAll(b => visibleSets.Contains(b.BeatmapSet!));
|
||||
notYetVisitedSets = visibleSets;
|
||||
previouslyVisitedRandomBeatmaps.RemoveAll(b => visibleSetsUnderGrouping.Any(groupedSet => groupedSet.BeatmapSet.Equals(b.BeatmapSet!)));
|
||||
notYetVisitedSets = visibleSetsUnderGrouping;
|
||||
if (CurrentSelection is BeatmapInfo beatmapInfo)
|
||||
notYetVisitedSets = notYetVisitedSets.Except([beatmapInfo.BeatmapSet!]).ToList();
|
||||
notYetVisitedSets = notYetVisitedSets.ExceptBy([beatmapInfo.BeatmapSet!], groupedSet => groupedSet.BeatmapSet).ToList();
|
||||
}
|
||||
|
||||
if (notYetVisitedSets.Count == 0)
|
||||
@@ -862,7 +918,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
}
|
||||
|
||||
case RandomSelectAlgorithm.Random:
|
||||
set = visibleSets.ElementAt(RNG.Next(visibleSets.Count));
|
||||
set = visibleSetsUnderGrouping.ElementAt(RNG.Next(visibleSetsUnderGrouping.Count));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -959,4 +1015,10 @@ namespace osu.Game.Screens.SelectV2
|
||||
/// Defines a grouping header for a set of carousel items grouped by star difficulty.
|
||||
/// </summary>
|
||||
public record StarDifficultyGroupDefinition(int Order, string Title, StarDifficulty Difficulty) : GroupDefinition(Order, Title);
|
||||
|
||||
/// <summary>
|
||||
/// Used to represent a portion of a <see cref="BeatmapSetInfo"/> under a <see cref="GroupDefinition"/>.
|
||||
/// The purpose of this model is to support splitting beatmap sets apart when the active grouping mode demands it.
|
||||
/// </summary>
|
||||
public record GroupedBeatmapSet([UsedImplicitly] GroupDefinition? Group, BeatmapSetInfo BeatmapSet);
|
||||
}
|
||||
|
||||
@@ -29,21 +29,22 @@ namespace osu.Game.Screens.SelectV2
|
||||
/// <summary>
|
||||
/// Beatmap sets contain difficulties as related panels. This dictionary holds the relationships between set-difficulties to allow expanding them on selection.
|
||||
/// </summary>
|
||||
public IDictionary<BeatmapSetInfo, HashSet<CarouselItem>> SetItems => setMap;
|
||||
public IDictionary<GroupedBeatmapSet, HashSet<CarouselItem>> SetItems => setMap;
|
||||
|
||||
/// <summary>
|
||||
/// Groups contain children which are group-selectable. This dictionary holds the relationships between groups-panels to allow expanding them on selection.
|
||||
/// </summary>
|
||||
public IDictionary<GroupDefinition, HashSet<CarouselItem>> GroupItems => groupMap;
|
||||
|
||||
private Dictionary<BeatmapSetInfo, HashSet<CarouselItem>> setMap = new Dictionary<BeatmapSetInfo, HashSet<CarouselItem>>();
|
||||
private Dictionary<GroupedBeatmapSet, HashSet<CarouselItem>> setMap = new Dictionary<GroupedBeatmapSet, HashSet<CarouselItem>>();
|
||||
private Dictionary<GroupDefinition, HashSet<CarouselItem>> groupMap = new Dictionary<GroupDefinition, HashSet<CarouselItem>>();
|
||||
|
||||
private readonly Func<FilterCriteria> getCriteria;
|
||||
private readonly Func<List<BeatmapCollection>> getCollections;
|
||||
private readonly Func<FilterCriteria, IReadOnlyDictionary<Guid, ScoreRank>> getLocalUserTopRanks;
|
||||
|
||||
public BeatmapCarouselFilterGrouping(Func<FilterCriteria> getCriteria, Func<List<BeatmapCollection>> getCollections, Func<FilterCriteria, IReadOnlyDictionary<Guid, ScoreRank>> getLocalUserTopRanks)
|
||||
public BeatmapCarouselFilterGrouping(Func<FilterCriteria> getCriteria, Func<List<BeatmapCollection>> getCollections,
|
||||
Func<FilterCriteria, IReadOnlyDictionary<Guid, ScoreRank>> getLocalUserTopRanks)
|
||||
{
|
||||
this.getCriteria = getCriteria;
|
||||
this.getCollections = getCollections;
|
||||
@@ -55,7 +56,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
// preallocate space for the new mappings using last known estimates
|
||||
var newSetMap = new Dictionary<BeatmapSetInfo, HashSet<CarouselItem>>(setMap.Count);
|
||||
var newSetMap = new Dictionary<GroupedBeatmapSet, HashSet<CarouselItem>>(setMap.Count);
|
||||
var newGroupMap = new Dictionary<GroupDefinition, HashSet<CarouselItem>>(groupMap.Count);
|
||||
|
||||
var criteria = getCriteria();
|
||||
@@ -93,11 +94,12 @@ namespace osu.Game.Screens.SelectV2
|
||||
var beatmap = (BeatmapInfo)item.Model;
|
||||
|
||||
bool newBeatmapSet = lastBeatmap?.BeatmapSet!.ID != beatmap.BeatmapSet!.ID;
|
||||
var groupedBeatmapSet = new GroupedBeatmapSet(group, beatmap.BeatmapSet!);
|
||||
|
||||
if (newBeatmapSet)
|
||||
{
|
||||
if (!newSetMap.TryGetValue(beatmap.BeatmapSet!, out currentSetItems))
|
||||
newSetMap[beatmap.BeatmapSet!] = currentSetItems = new HashSet<CarouselItem>();
|
||||
if (!newSetMap.TryGetValue(groupedBeatmapSet, out currentSetItems))
|
||||
newSetMap[groupedBeatmapSet] = currentSetItems = new HashSet<CarouselItem>();
|
||||
}
|
||||
|
||||
if (BeatmapSetsGroupedTogether)
|
||||
@@ -107,7 +109,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
if (groupItem != null)
|
||||
groupItem.NestedItemCount++;
|
||||
|
||||
addItem(new CarouselItem(beatmap.BeatmapSet!)
|
||||
addItem(new CarouselItem(groupedBeatmapSet)
|
||||
{
|
||||
DrawHeight = PanelBeatmapSet.HEIGHT,
|
||||
DepthLayer = -1
|
||||
@@ -134,7 +136,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
currentGroupItems?.Add(i);
|
||||
currentSetItems?.Add(i);
|
||||
|
||||
i.IsVisible = i.Model is GroupDefinition || (group == null && (i.Model is BeatmapSetInfo || !BeatmapSetsGroupedTogether));
|
||||
i.IsVisible = i.Model is GroupDefinition || (group == null && (i.Model is GroupedBeatmapSet || !BeatmapSetsGroupedTogether));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,9 +191,6 @@ namespace osu.Game.Screens.SelectV2
|
||||
{
|
||||
var date = b.LastPlayed;
|
||||
|
||||
if (BeatmapSetsGroupedTogether)
|
||||
date = aggregateMax(b, static b => b.LastPlayed ?? DateTimeOffset.MinValue);
|
||||
|
||||
if (date == null || date == DateTimeOffset.MinValue)
|
||||
return new GroupDefinition(int.MaxValue, "Never");
|
||||
|
||||
@@ -202,29 +201,13 @@ namespace osu.Game.Screens.SelectV2
|
||||
return getGroupsBy(b => defineGroupByStatus(b.BeatmapSet!.Status), items);
|
||||
|
||||
case GroupMode.BPM:
|
||||
return getGroupsBy(b =>
|
||||
{
|
||||
double bpm = FormatUtils.RoundBPM(b.BPM);
|
||||
|
||||
if (BeatmapSetsGroupedTogether)
|
||||
bpm = aggregateMax(b, bb => FormatUtils.RoundBPM(bb.BPM));
|
||||
|
||||
return defineGroupByBPM(bpm);
|
||||
}, items);
|
||||
return getGroupsBy(b => defineGroupByBPM(FormatUtils.RoundBPM(b.BPM)), items);
|
||||
|
||||
case GroupMode.Difficulty:
|
||||
return getGroupsBy(b => defineGroupByStars(b.StarRating), items);
|
||||
|
||||
case GroupMode.Length:
|
||||
return getGroupsBy(b =>
|
||||
{
|
||||
double length = b.Length;
|
||||
|
||||
if (BeatmapSetsGroupedTogether)
|
||||
length = aggregateMax(b, bb => bb.Length);
|
||||
|
||||
return defineGroupByLength(length);
|
||||
}, items);
|
||||
return getGroupsBy(b => defineGroupByLength(b.Length), items);
|
||||
|
||||
case GroupMode.Source:
|
||||
return getGroupsBy(b => defineGroupBySource(b.BeatmapSet!.Metadata.Source), items);
|
||||
@@ -433,12 +416,6 @@ namespace osu.Game.Screens.SelectV2
|
||||
return new GroupDefinition(int.MaxValue, "Unplayed");
|
||||
}
|
||||
|
||||
private static T? aggregateMax<T>(BeatmapInfo b, Func<BeatmapInfo, T> func)
|
||||
{
|
||||
var beatmaps = b.BeatmapSet!.Beatmaps.Where(bb => !bb.Hidden);
|
||||
return beatmaps.Max(func);
|
||||
}
|
||||
|
||||
private record GroupMapping(GroupDefinition? Group, List<CarouselItem> ItemsInGroup);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,17 +199,8 @@ namespace osu.Game.Screens.SelectV2
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ruleset.BindValueChanged(_ =>
|
||||
{
|
||||
computeStarRating();
|
||||
updateKeyCount();
|
||||
});
|
||||
|
||||
mods.BindValueChanged(_ =>
|
||||
{
|
||||
computeStarRating();
|
||||
updateKeyCount();
|
||||
}, true);
|
||||
ruleset.BindValueChanged(_ => updateKeyCount());
|
||||
mods.BindValueChanged(_ => updateKeyCount(), true);
|
||||
}
|
||||
|
||||
protected override void PrepareForUse()
|
||||
|
||||
@@ -67,6 +67,15 @@ namespace osu.Game.Screens.SelectV2
|
||||
[Resolved]
|
||||
private IBindable<RulesetInfo> ruleset { get; set; } = null!;
|
||||
|
||||
private GroupedBeatmapSet groupedBeatmapSet
|
||||
{
|
||||
get
|
||||
{
|
||||
Debug.Assert(Item != null);
|
||||
return (GroupedBeatmapSet)Item!.Model;
|
||||
}
|
||||
}
|
||||
|
||||
public PanelBeatmapSet()
|
||||
{
|
||||
PanelXOffset = 20f;
|
||||
@@ -179,9 +188,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
{
|
||||
base.PrepareForUse();
|
||||
|
||||
Debug.Assert(Item != null);
|
||||
|
||||
var beatmapSet = (BeatmapSetInfo)Item.Model;
|
||||
var beatmapSet = groupedBeatmapSet.BeatmapSet;
|
||||
|
||||
// Choice of background image matches BSS implementation (always uses the lowest `beatmap_id` from the set).
|
||||
setBackground.Beatmap = beatmaps.GetWorkingBeatmap(beatmapSet.Beatmaps.MinBy(b => b.OnlineID));
|
||||
@@ -215,7 +222,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
if (Item == null)
|
||||
return Array.Empty<MenuItem>();
|
||||
|
||||
var beatmapSet = (BeatmapSetInfo)Item.Model;
|
||||
var beatmapSet = groupedBeatmapSet.BeatmapSet;
|
||||
|
||||
List<MenuItem> items = new List<MenuItem>();
|
||||
|
||||
@@ -268,9 +275,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
|
||||
private MenuItem createCollectionMenuItem(BeatmapCollection collection)
|
||||
{
|
||||
var beatmapSet = (BeatmapSetInfo)Item!.Model;
|
||||
|
||||
Debug.Assert(beatmapSet != null);
|
||||
var beatmapSet = groupedBeatmapSet.BeatmapSet;
|
||||
|
||||
TernaryState state;
|
||||
|
||||
|
||||
@@ -209,17 +209,8 @@ namespace osu.Game.Screens.SelectV2
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ruleset.BindValueChanged(_ =>
|
||||
{
|
||||
computeStarRating();
|
||||
updateKeyCount();
|
||||
});
|
||||
|
||||
mods.BindValueChanged(_ =>
|
||||
{
|
||||
computeStarRating();
|
||||
updateKeyCount();
|
||||
}, true);
|
||||
ruleset.BindValueChanged(_ => updateKeyCount());
|
||||
mods.BindValueChanged(_ => updateKeyCount(), true);
|
||||
|
||||
Selected.BindValueChanged(s => Expanded.Value = s.NewValue, true);
|
||||
}
|
||||
|
||||
@@ -653,6 +653,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
|
||||
ensurePlayingSelected();
|
||||
updateBackgroundDim();
|
||||
fetchOnlineInfo();
|
||||
}
|
||||
|
||||
private void onLeavingScreen()
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.IO;
|
||||
@@ -28,8 +29,8 @@ namespace osu.Game.Skinning
|
||||
|
||||
private readonly ModelManager<SkinInfo> modelManager;
|
||||
|
||||
public SkinImporter(Storage storage, RealmAccess realm, IStorageResourceProvider skinResources)
|
||||
: base(storage, realm)
|
||||
public SkinImporter(Storage storage, RealmAccess realm, IStorageResourceProvider skinResources, OsuConfigManager? config = null)
|
||||
: base(storage, realm, config)
|
||||
{
|
||||
this.skinResources = skinResources;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ using osu.Framework.Platform;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
@@ -74,7 +75,7 @@ namespace osu.Game.Skinning
|
||||
}
|
||||
}
|
||||
|
||||
public SkinManager(Storage storage, RealmAccess realm, GameHost host, IResourceStore<byte[]> resources, AudioManager audio, Scheduler scheduler)
|
||||
public SkinManager(Storage storage, RealmAccess realm, GameHost host, IResourceStore<byte[]> resources, AudioManager audio, Scheduler scheduler, OsuConfigManager config)
|
||||
: base(storage, realm)
|
||||
{
|
||||
this.audio = audio;
|
||||
@@ -84,7 +85,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
userFiles = new StorageBackedResourceStore(storage.GetStorageForDirectory("files"));
|
||||
|
||||
skinImporter = new SkinImporter(storage, realm, this)
|
||||
skinImporter = new SkinImporter(storage, realm, this, config)
|
||||
{
|
||||
PostNotification = obj => PostNotification?.Invoke(obj),
|
||||
};
|
||||
|
||||
@@ -7,7 +7,9 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays;
|
||||
@@ -32,7 +34,7 @@ namespace osu.Game.Tests.Visual
|
||||
protected DialogOverlay DialogOverlay { get; private set; }
|
||||
|
||||
[Cached]
|
||||
private ScreenFooter footer;
|
||||
protected ScreenFooter Footer { get; private set; }
|
||||
|
||||
protected ScreenTestScene()
|
||||
{
|
||||
@@ -43,17 +45,32 @@ namespace osu.Game.Tests.Visual
|
||||
Name = nameof(ScreenTestScene),
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
content = new Container { RelativeSizeAxes = Axes.Both },
|
||||
new PopoverContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
content = new Container { RelativeSizeAxes = Axes.Both },
|
||||
Footer = new ScreenFooter(),
|
||||
}
|
||||
},
|
||||
overlayContent = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = DialogOverlay = new DialogOverlay()
|
||||
},
|
||||
footer = new ScreenFooter(),
|
||||
});
|
||||
|
||||
Stack.ScreenPushed += (_, newScreen) => Logger.Log($"{nameof(ScreenTestScene)} screen changed → {newScreen}");
|
||||
Stack.ScreenExited += (_, newScreen) => Logger.Log($"{nameof(ScreenTestScene)} screen changed ← {newScreen}");
|
||||
Stack.ScreenPushed += (oldScreen, newScreen) =>
|
||||
{
|
||||
updateFooter(oldScreen, newScreen);
|
||||
Logger.Log($"{nameof(ScreenTestScene)} screen changed → {newScreen}");
|
||||
};
|
||||
Stack.ScreenExited += (oldScreen, newScreen) =>
|
||||
{
|
||||
updateFooter(oldScreen, newScreen);
|
||||
Logger.Log($"{nameof(ScreenTestScene)} screen changed ← {newScreen}");
|
||||
};
|
||||
}
|
||||
|
||||
protected void LoadScreen(OsuScreen screen) => Stack.Push(screen);
|
||||
@@ -79,6 +96,39 @@ namespace osu.Game.Tests.Visual
|
||||
});
|
||||
}
|
||||
|
||||
private void updateFooter(IScreen? _, IScreen? newScreen)
|
||||
{
|
||||
if (newScreen is OsuScreen osuScreen && osuScreen.ShowFooter)
|
||||
{
|
||||
Footer.Show();
|
||||
|
||||
if (osuScreen.IsLoaded)
|
||||
updateFooterButtons();
|
||||
else
|
||||
{
|
||||
// ensure the current buttons are immediately disabled on screen change (so they can't be pressed).
|
||||
Footer.SetButtons(Array.Empty<ScreenFooterButton>());
|
||||
|
||||
osuScreen.OnLoadComplete += _ => updateFooterButtons();
|
||||
}
|
||||
|
||||
void updateFooterButtons()
|
||||
{
|
||||
var buttons = osuScreen.CreateFooterButtons();
|
||||
|
||||
osuScreen.LoadComponentsAgainstScreenDependencies(buttons);
|
||||
|
||||
Footer.SetButtons(buttons);
|
||||
Footer.Show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Footer.Hide();
|
||||
Footer.SetButtons(Array.Empty<ScreenFooterButton>());
|
||||
}
|
||||
}
|
||||
|
||||
#region IOverlayManager
|
||||
|
||||
IBindable<OverlayActivation> IOverlayManager.OverlayActivationMode { get; } = new Bindable<OverlayActivation>(OverlayActivation.All);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Nuget">
|
||||
<Title>osu!</Title>
|
||||
<Title>jvnkosu!</Title>
|
||||
<PackageId>ppy.osu.Game</PackageId>
|
||||
<Version>0.0.0</Version>
|
||||
<PackageIcon>icon.png</PackageIcon>
|
||||
@@ -35,7 +35,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="20.1.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2025.808.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2025.829.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2025.821.0" />
|
||||
<PackageReference Include="Sentry" Version="5.1.1" />
|
||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
<MtouchInterpreter>-all</MtouchInterpreter>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2025.808.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2025.829.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user