mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 02:32:55 +08:00
Merge branch 'master' into beatmap-parsing-fallback-v2
This commit is contained in:
commit
6268bbcfc8
24
Gemfile.lock
24
Gemfile.lock
@ -1,11 +1,11 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
CFPropertyList (3.0.0)
|
CFPropertyList (3.0.1)
|
||||||
addressable (2.6.0)
|
addressable (2.7.0)
|
||||||
public_suffix (>= 2.0.2, < 4.0)
|
public_suffix (>= 2.0.2, < 5.0)
|
||||||
atomos (0.1.3)
|
atomos (0.1.3)
|
||||||
babosa (1.0.2)
|
babosa (1.0.3)
|
||||||
claide (1.0.3)
|
claide (1.0.3)
|
||||||
colored (1.2)
|
colored (1.2)
|
||||||
colored2 (3.1.2)
|
colored2 (3.1.2)
|
||||||
@ -26,8 +26,8 @@ GEM
|
|||||||
http-cookie (~> 1.0.0)
|
http-cookie (~> 1.0.0)
|
||||||
faraday_middleware (0.13.1)
|
faraday_middleware (0.13.1)
|
||||||
faraday (>= 0.7.4, < 1.0)
|
faraday (>= 0.7.4, < 1.0)
|
||||||
fastimage (2.1.5)
|
fastimage (2.1.7)
|
||||||
fastlane (2.129.0)
|
fastlane (2.131.0)
|
||||||
CFPropertyList (>= 2.3, < 4.0.0)
|
CFPropertyList (>= 2.3, < 4.0.0)
|
||||||
addressable (>= 2.3, < 3.0.0)
|
addressable (>= 2.3, < 3.0.0)
|
||||||
babosa (>= 1.0.2, < 2.0.0)
|
babosa (>= 1.0.2, < 2.0.0)
|
||||||
@ -77,9 +77,9 @@ GEM
|
|||||||
representable (~> 3.0)
|
representable (~> 3.0)
|
||||||
retriable (>= 2.0, < 4.0)
|
retriable (>= 2.0, < 4.0)
|
||||||
signet (~> 0.9)
|
signet (~> 0.9)
|
||||||
google-cloud-core (1.3.0)
|
google-cloud-core (1.3.1)
|
||||||
google-cloud-env (~> 1.0)
|
google-cloud-env (~> 1.0)
|
||||||
google-cloud-env (1.2.0)
|
google-cloud-env (1.2.1)
|
||||||
faraday (~> 0.11)
|
faraday (~> 0.11)
|
||||||
google-cloud-storage (1.16.0)
|
google-cloud-storage (1.16.0)
|
||||||
digest-crc (~> 0.4)
|
digest-crc (~> 0.4)
|
||||||
@ -100,9 +100,9 @@ GEM
|
|||||||
json (2.2.0)
|
json (2.2.0)
|
||||||
jwt (2.1.0)
|
jwt (2.1.0)
|
||||||
memoist (0.16.0)
|
memoist (0.16.0)
|
||||||
mime-types (3.2.2)
|
mime-types (3.3)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2019.0331)
|
mime-types-data (3.2019.0904)
|
||||||
mini_magick (4.9.5)
|
mini_magick (4.9.5)
|
||||||
mini_portile2 (2.4.0)
|
mini_portile2 (2.4.0)
|
||||||
multi_json (1.13.1)
|
multi_json (1.13.1)
|
||||||
@ -121,14 +121,14 @@ GEM
|
|||||||
uber (< 0.2.0)
|
uber (< 0.2.0)
|
||||||
retriable (3.1.2)
|
retriable (3.1.2)
|
||||||
rouge (2.0.7)
|
rouge (2.0.7)
|
||||||
rubyzip (1.2.3)
|
rubyzip (1.2.4)
|
||||||
security (0.1.3)
|
security (0.1.3)
|
||||||
signet (0.11.0)
|
signet (0.11.0)
|
||||||
addressable (~> 2.3)
|
addressable (~> 2.3)
|
||||||
faraday (~> 0.9)
|
faraday (~> 0.9)
|
||||||
jwt (>= 1.5, < 3.0)
|
jwt (>= 1.5, < 3.0)
|
||||||
multi_json (~> 1.10)
|
multi_json (~> 1.10)
|
||||||
simctl (1.6.5)
|
simctl (1.6.6)
|
||||||
CFPropertyList
|
CFPropertyList
|
||||||
naturally
|
naturally
|
||||||
slack-notifier (2.3.2)
|
slack-notifier (2.3.2)
|
||||||
|
@ -31,12 +31,10 @@ If you are not interested in developing the game, you can still consume our [bin
|
|||||||
|
|
||||||
**Latest build:**
|
**Latest build:**
|
||||||
|
|
||||||
| [Windows (x64)](https://github.com/ppy/osu/releases/latest/download/install.exe) | [macOS 10.12+](https://github.com/ppy/osu/releases/latest/download/osu.app.zip) |
|
| [Windows (x64)](https://github.com/ppy/osu/releases/latest/download/install.exe) | [macOS 10.12+](https://github.com/ppy/osu/releases/latest/download/osu.app.zip) | [iOS(iOS 10+)](https://testflight.apple.com/join/2tLcjWlF) | [Android (5+)](https://github.com/ppy/osu/releases/latest/download/sh.ppy.osulazer.apk)
|
||||||
| ------------- | ------------- |
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
|
||||||
- **Linux** users are recommended to self-compile until we have official deployment in place.
|
- **Linux** users are recommended to self-compile until we have official deployment in place.
|
||||||
- **iOS** users can join the [TestFlight beta program](https://testflight.apple.com/join/2tLcjWlF) (note that due to high demand this is regularly full).
|
|
||||||
- **Android** users can self-compile, and expect a public beta soon.
|
|
||||||
|
|
||||||
If your platform is not listed above, there is still a chance you can manually build it by following the instructions below.
|
If your platform is not listed above, there is still a chance you can manually build it by following the instructions below.
|
||||||
|
|
||||||
|
@ -1,5 +1,83 @@
|
|||||||
update_fastlane
|
update_fastlane
|
||||||
|
|
||||||
|
platform :android do
|
||||||
|
desc 'Deploy to play store'
|
||||||
|
lane :beta do |options|
|
||||||
|
|
||||||
|
update_version(
|
||||||
|
version: options[:version],
|
||||||
|
build: options[:build],
|
||||||
|
)
|
||||||
|
|
||||||
|
build(options)
|
||||||
|
|
||||||
|
supply(
|
||||||
|
apk: './osu.Android/bin/Release/sh.ppy.osulazer-Signed.apk',
|
||||||
|
package_name: 'sh.ppy.osulazer',
|
||||||
|
track: 'alpha', # upload to alpha, we can promote it later
|
||||||
|
json_key: options[:json_key],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Deploy to github release'
|
||||||
|
lane :build_github do |options|
|
||||||
|
|
||||||
|
update_version(
|
||||||
|
version: options[:version],
|
||||||
|
build: options[:build],
|
||||||
|
)
|
||||||
|
|
||||||
|
build(options)
|
||||||
|
|
||||||
|
client = HTTPClient.new
|
||||||
|
changelog = client.get_content 'https://gist.githubusercontent.com/peppy/aaa2ec1a323554b619671cac6dbbb776/raw'
|
||||||
|
changelog.gsub!('$BUILD_ID', options[:build])
|
||||||
|
|
||||||
|
set_github_release(
|
||||||
|
repository_name: "ppy/osu",
|
||||||
|
api_token: ENV["GITHUB_TOKEN"],
|
||||||
|
name: options[:build],
|
||||||
|
tag_name: options[:build],
|
||||||
|
is_draft: true,
|
||||||
|
description: changelog,
|
||||||
|
commitish: "master",
|
||||||
|
upload_assets: ["osu.Android/bin/Release/sh.ppy.osulazer.apk"]
|
||||||
|
)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Compile the project'
|
||||||
|
lane :build do |options|
|
||||||
|
nuget_restore(
|
||||||
|
project_path: 'osu.Android.sln'
|
||||||
|
)
|
||||||
|
|
||||||
|
souyuz(
|
||||||
|
build_configuration: 'Release',
|
||||||
|
solution_path: 'osu.Android.sln',
|
||||||
|
platform: "android",
|
||||||
|
output_path: "osu.Android/bin/Release/",
|
||||||
|
keystore_path: options[:keystore_path],
|
||||||
|
keystore_alias: options[:keystore_alias],
|
||||||
|
keystore_password: ENV["KEYSTORE_PASSWORD"]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
lane :update_version do |options|
|
||||||
|
|
||||||
|
split = options[:build].split('.')
|
||||||
|
split[1] = split[1].to_s.rjust(4, '0')
|
||||||
|
android_build = split.join('')
|
||||||
|
|
||||||
|
app_version(
|
||||||
|
solution_path: 'osu.Android.sln',
|
||||||
|
version: options[:version],
|
||||||
|
build: android_build,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
platform :ios do
|
platform :ios do
|
||||||
desc 'Deploy to testflight'
|
desc 'Deploy to testflight'
|
||||||
lane :beta do |options|
|
lane :beta do |options|
|
||||||
|
@ -15,6 +15,30 @@ Install _fastlane_ using
|
|||||||
or alternatively using `brew cask install fastlane`
|
or alternatively using `brew cask install fastlane`
|
||||||
|
|
||||||
# Available Actions
|
# Available Actions
|
||||||
|
## Android
|
||||||
|
### android beta
|
||||||
|
```
|
||||||
|
fastlane android beta
|
||||||
|
```
|
||||||
|
Deploy to play store
|
||||||
|
### android build_github
|
||||||
|
```
|
||||||
|
fastlane android build_github
|
||||||
|
```
|
||||||
|
Deploy to github release
|
||||||
|
### android build
|
||||||
|
```
|
||||||
|
fastlane android build
|
||||||
|
```
|
||||||
|
Compile the project
|
||||||
|
### android update_version
|
||||||
|
```
|
||||||
|
fastlane android update_version
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## iOS
|
## iOS
|
||||||
### ios beta
|
### ios beta
|
||||||
```
|
```
|
||||||
|
@ -62,6 +62,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.913.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.913.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.918.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.930.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -4,11 +4,37 @@
|
|||||||
using System;
|
using System;
|
||||||
using Android.App;
|
using Android.App;
|
||||||
using osu.Game;
|
using osu.Game;
|
||||||
|
using osu.Game.Updater;
|
||||||
|
|
||||||
namespace osu.Android
|
namespace osu.Android
|
||||||
{
|
{
|
||||||
public class OsuGameAndroid : OsuGame
|
public class OsuGameAndroid : OsuGame
|
||||||
{
|
{
|
||||||
public override Version AssemblyVersion => new Version(Application.Context.ApplicationContext.PackageManager.GetPackageInfo(Application.Context.ApplicationContext.PackageName, 0).VersionName);
|
public override Version AssemblyVersion
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var packageInfo = Application.Context.ApplicationContext.PackageManager.GetPackageInfo(Application.Context.ApplicationContext.PackageName, 0);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string versionName = packageInfo.VersionCode.ToString();
|
||||||
|
// undo play store version garbling
|
||||||
|
return new Version(int.Parse(versionName.Substring(0, 4)), int.Parse(versionName.Substring(4, 4)), int.Parse(versionName.Substring(8, 1)));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Version(packageInfo.VersionName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Add(new SimpleUpdateManager());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,6 +17,7 @@ using osu.Framework.Logging;
|
|||||||
using osu.Framework.Platform.Windows;
|
using osu.Framework.Platform.Windows;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
|
using osu.Game.Updater;
|
||||||
|
|
||||||
namespace osu.Desktop
|
namespace osu.Desktop
|
||||||
{
|
{
|
||||||
|
@ -8,11 +8,8 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game;
|
using osu.Game;
|
||||||
using osu.Game.Configuration;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Overlays;
|
|
||||||
using osu.Game.Overlays.Notifications;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -20,17 +17,9 @@ namespace osu.Desktop.Overlays
|
|||||||
{
|
{
|
||||||
public class VersionManager : OverlayContainer
|
public class VersionManager : OverlayContainer
|
||||||
{
|
{
|
||||||
private OsuConfigManager config;
|
|
||||||
private OsuGameBase game;
|
|
||||||
private NotificationOverlay notificationOverlay;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config)
|
private void load(OsuColour colours, TextureStore textures, OsuGameBase game)
|
||||||
{
|
{
|
||||||
notificationOverlay = notification;
|
|
||||||
this.config = config;
|
|
||||||
this.game = game;
|
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Anchor = Anchor.BottomCentre;
|
Anchor = Anchor.BottomCentre;
|
||||||
Origin = Anchor.BottomCentre;
|
Origin = Anchor.BottomCentre;
|
||||||
@ -85,48 +74,6 @@ namespace osu.Desktop.Overlays
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
var version = game.Version;
|
|
||||||
var lastVersion = config.Get<string>(OsuSetting.Version);
|
|
||||||
|
|
||||||
if (game.IsDeployedBuild && version != lastVersion)
|
|
||||||
{
|
|
||||||
config.Set(OsuSetting.Version, version);
|
|
||||||
|
|
||||||
// only show a notification if we've previously saved a version to the config file (ie. not the first run).
|
|
||||||
if (!string.IsNullOrEmpty(lastVersion))
|
|
||||||
notificationOverlay.Post(new UpdateCompleteNotification(version));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class UpdateCompleteNotification : SimpleNotification
|
|
||||||
{
|
|
||||||
private readonly string version;
|
|
||||||
|
|
||||||
public UpdateCompleteNotification(string version)
|
|
||||||
{
|
|
||||||
this.version = version;
|
|
||||||
Text = $"You are now running osu!lazer {version}.\nClick to see what's new!";
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours, ChangelogOverlay changelog, NotificationOverlay notificationOverlay)
|
|
||||||
{
|
|
||||||
Icon = FontAwesome.Solid.CheckSquare;
|
|
||||||
IconBackgound.Colour = colours.BlueDark;
|
|
||||||
|
|
||||||
Activated = delegate
|
|
||||||
{
|
|
||||||
notificationOverlay.Hide();
|
|
||||||
changelog.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, version);
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
this.FadeIn(1400, Easing.OutQuint);
|
this.FadeIn(1400, Easing.OutQuint);
|
||||||
|
@ -20,7 +20,7 @@ using LogLevel = Splat.LogLevel;
|
|||||||
|
|
||||||
namespace osu.Desktop.Updater
|
namespace osu.Desktop.Updater
|
||||||
{
|
{
|
||||||
public class SquirrelUpdateManager : Component
|
public class SquirrelUpdateManager : osu.Game.Updater.UpdateManager
|
||||||
{
|
{
|
||||||
private UpdateManager updateManager;
|
private UpdateManager updateManager;
|
||||||
private NotificationOverlay notificationOverlay;
|
private NotificationOverlay notificationOverlay;
|
||||||
|
@ -23,10 +23,10 @@
|
|||||||
<ProjectReference Include="..\osu.Game.Rulesets.Catch\osu.Game.Rulesets.Catch.csproj" />
|
<ProjectReference Include="..\osu.Game.Rulesets.Catch\osu.Game.Rulesets.Catch.csproj" />
|
||||||
<ProjectReference Include="..\osu.Game.Rulesets.Mania\osu.Game.Rulesets.Mania.csproj" />
|
<ProjectReference Include="..\osu.Game.Rulesets.Mania\osu.Game.Rulesets.Mania.csproj" />
|
||||||
<ProjectReference Include="..\osu.Game.Rulesets.Taiko\osu.Game.Rulesets.Taiko.csproj" />
|
<ProjectReference Include="..\osu.Game.Rulesets.Taiko\osu.Game.Rulesets.Taiko.csproj" />
|
||||||
<PackageReference Include="Microsoft.Win32.Registry" Version="4.5.0" />
|
<PackageReference Include="Microsoft.Win32.Registry" Version="4.6.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="System.IO.Packaging" Version="4.5.0" />
|
<PackageReference Include="System.IO.Packaging" Version="4.6.0" />
|
||||||
<PackageReference Include="ppy.squirrel.windows" Version="1.9.0.4" />
|
<PackageReference Include="ppy.squirrel.windows" Version="1.9.0.4" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" />
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Catch.Beatmaps;
|
using osu.Game.Rulesets.Catch.Beatmaps;
|
||||||
@ -37,9 +38,21 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
|
|
||||||
public int ComboOffset { get; set; }
|
public int ComboOffset { get; set; }
|
||||||
|
|
||||||
public int IndexInCurrentCombo { get; set; }
|
public Bindable<int> IndexInCurrentComboBindable { get; } = new Bindable<int>();
|
||||||
|
|
||||||
public int ComboIndex { get; set; }
|
public int IndexInCurrentCombo
|
||||||
|
{
|
||||||
|
get => IndexInCurrentComboBindable.Value;
|
||||||
|
set => IndexInCurrentComboBindable.Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bindable<int> ComboIndexBindable { get; } = new Bindable<int>();
|
||||||
|
|
||||||
|
public int ComboIndex
|
||||||
|
{
|
||||||
|
get => ComboIndexBindable.Value;
|
||||||
|
set => ComboIndexBindable.Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Difference between the distance to the next object
|
/// Difference between the distance to the next object
|
||||||
@ -48,10 +61,16 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public float DistanceToHyperDash { get; set; }
|
public float DistanceToHyperDash { get; set; }
|
||||||
|
|
||||||
|
public Bindable<bool> LastInComboBindable { get; } = new Bindable<bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The next fruit starts a new combo. Used for explodey.
|
/// The next fruit starts a new combo. Used for explodey.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual bool LastInCombo { get; set; }
|
public virtual bool LastInCombo
|
||||||
|
{
|
||||||
|
get => LastInComboBindable.Value;
|
||||||
|
set => LastInComboBindable.Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
public float Scale { get; set; } = 1;
|
public float Scale { get; set; } = 1;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ using osu.Game.Rulesets.Mania.Objects;
|
|||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -67,6 +66,8 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
|
|
||||||
AddAssert("check note anchors", () => notesInStageAreAnchored(stages[0], Anchor.TopCentre));
|
AddAssert("check note anchors", () => notesInStageAreAnchored(stages[0], Anchor.TopCentre));
|
||||||
AddAssert("check note anchors", () => notesInStageAreAnchored(stages[1], Anchor.BottomCentre));
|
AddAssert("check note anchors", () => notesInStageAreAnchored(stages[1], Anchor.BottomCentre));
|
||||||
|
AddAssert("check bar anchors", () => barsInStageAreAnchored(stages[0], Anchor.TopCentre));
|
||||||
|
AddAssert("check bar anchors", () => barsInStageAreAnchored(stages[1], Anchor.BottomCentre));
|
||||||
|
|
||||||
AddStep("flip direction", () =>
|
AddStep("flip direction", () =>
|
||||||
{
|
{
|
||||||
@ -76,10 +77,14 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
|
|
||||||
AddAssert("check note anchors", () => notesInStageAreAnchored(stages[0], Anchor.BottomCentre));
|
AddAssert("check note anchors", () => notesInStageAreAnchored(stages[0], Anchor.BottomCentre));
|
||||||
AddAssert("check note anchors", () => notesInStageAreAnchored(stages[1], Anchor.TopCentre));
|
AddAssert("check note anchors", () => notesInStageAreAnchored(stages[1], Anchor.TopCentre));
|
||||||
|
AddAssert("check bar anchors", () => barsInStageAreAnchored(stages[0], Anchor.BottomCentre));
|
||||||
|
AddAssert("check bar anchors", () => barsInStageAreAnchored(stages[1], Anchor.TopCentre));
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool notesInStageAreAnchored(ManiaStage stage, Anchor anchor) => stage.Columns.SelectMany(c => c.AllHitObjects).All(o => o.Anchor == anchor);
|
private bool notesInStageAreAnchored(ManiaStage stage, Anchor anchor) => stage.Columns.SelectMany(c => c.AllHitObjects).All(o => o.Anchor == anchor);
|
||||||
|
|
||||||
|
private bool barsInStageAreAnchored(ManiaStage stage, Anchor anchor) => stage.AllHitObjects.Where(obj => obj is DrawableBarLine).All(o => o.Anchor == anchor);
|
||||||
|
|
||||||
private void createNote()
|
private void createNote()
|
||||||
{
|
{
|
||||||
foreach (var stage in stages)
|
foreach (var stage in stages)
|
||||||
|
12
osu.Game.Rulesets.Mania/Objects/BarLine.cs
Normal file
12
osu.Game.Rulesets.Mania/Objects/BarLine.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Objects
|
||||||
|
{
|
||||||
|
public class BarLine : ManiaHitObject, IBarLine
|
||||||
|
{
|
||||||
|
public bool Major { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,6 @@
|
|||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -14,7 +13,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
/// Visualises a <see cref="BarLine"/>. Although this derives DrawableManiaHitObject,
|
/// Visualises a <see cref="BarLine"/>. Although this derives DrawableManiaHitObject,
|
||||||
/// this does not handle input/sound like a normal hit object.
|
/// this does not handle input/sound like a normal hit object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DrawableBarLine : DrawableHitObject<BarLine>
|
public class DrawableBarLine : DrawableManiaHitObject<BarLine>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Height of major bar line triangles.
|
/// Height of major bar line triangles.
|
||||||
|
@ -18,8 +18,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DrawableNote : DrawableManiaHitObject<Note>, IKeyBindingHandler<ManiaAction>
|
public class DrawableNote : DrawableManiaHitObject<Note>, IKeyBindingHandler<ManiaAction>
|
||||||
{
|
{
|
||||||
public const float CORNER_RADIUS = NotePiece.NOTE_HEIGHT / 2;
|
|
||||||
|
|
||||||
private readonly NotePiece headPiece;
|
private readonly NotePiece headPiece;
|
||||||
|
|
||||||
public DrawableNote(Note hitObject)
|
public DrawableNote(Note hitObject)
|
||||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
public DrawableManiaRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
public DrawableManiaRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap, mods)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
BarLines = new BarLineGenerator(Beatmap).BarLines;
|
BarLines = new BarLineGenerator<BarLine>(Beatmap).BarLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -8,7 +8,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
@ -12,7 +12,6 @@ using osu.Game.Rulesets.Judgements;
|
|||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
26
osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleComboChange.cs
Normal file
26
osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleComboChange.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
|
{
|
||||||
|
public class TestSceneHitCircleComboChange : TestSceneHitCircle
|
||||||
|
{
|
||||||
|
private readonly Bindable<int> comboIndex = new Bindable<int>();
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
Scheduler.AddDelayed(() => comboIndex.Value++, 250, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto)
|
||||||
|
{
|
||||||
|
circle.ComboIndexBindable.BindTo(comboIndex);
|
||||||
|
circle.IndexInCurrentComboBindable.BindTo(comboIndex);
|
||||||
|
return base.CreateDrawableHitCircle(circle, auto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -297,11 +297,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
slider.ApplyDefaults(cpi, new BeatmapDifficulty { CircleSize = circleSize, SliderTickRate = 3 });
|
slider.ApplyDefaults(cpi, new BeatmapDifficulty { CircleSize = circleSize, SliderTickRate = 3 });
|
||||||
|
|
||||||
var drawable = new DrawableSlider(slider)
|
var drawable = CreateDrawableSlider(slider);
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Depth = depthIndex++
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var mod in Mods.Value.OfType<IApplicableToDrawableHitObjects>())
|
foreach (var mod in Mods.Value.OfType<IApplicableToDrawableHitObjects>())
|
||||||
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
||||||
@ -311,6 +307,12 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual DrawableSlider CreateDrawableSlider(Slider slider) => new DrawableSlider(slider)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Depth = depthIndex++
|
||||||
|
};
|
||||||
|
|
||||||
private float judgementOffsetDirection = 1;
|
private float judgementOffsetDirection = 1;
|
||||||
|
|
||||||
private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
|
private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
|
||||||
|
28
osu.Game.Rulesets.Osu.Tests/TestSceneSliderComboChange.cs
Normal file
28
osu.Game.Rulesets.Osu.Tests/TestSceneSliderComboChange.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
|
{
|
||||||
|
public class TestSceneSliderComboChange : TestSceneSlider
|
||||||
|
{
|
||||||
|
private readonly Bindable<int> comboIndex = new Bindable<int>();
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
Scheduler.AddDelayed(() => comboIndex.Value++, 250, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override DrawableSlider CreateDrawableSlider(Slider slider)
|
||||||
|
{
|
||||||
|
slider.ComboIndexBindable.BindTo(comboIndex);
|
||||||
|
slider.IndexInCurrentComboBindable.BindTo(comboIndex);
|
||||||
|
|
||||||
|
return base.CreateDrawableSlider(slider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
96
osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs
Normal file
96
osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
using osuTK;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using static osu.Game.Tests.Visual.OsuTestScene.ClockBackedTestWorkingBeatmap;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
|
{
|
||||||
|
public class TestSceneSpinnerRotation : TestSceneOsuPlayer
|
||||||
|
{
|
||||||
|
[Resolved]
|
||||||
|
private AudioManager audioManager { get; set; }
|
||||||
|
|
||||||
|
private TrackVirtualManual track;
|
||||||
|
|
||||||
|
protected override bool Autoplay => true;
|
||||||
|
|
||||||
|
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap)
|
||||||
|
{
|
||||||
|
var working = new ClockBackedTestWorkingBeatmap(beatmap, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
|
||||||
|
track = (TrackVirtualManual)working.Track;
|
||||||
|
return working;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DrawableSpinner drawableSpinner;
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public override void SetUpSteps()
|
||||||
|
{
|
||||||
|
base.SetUpSteps();
|
||||||
|
|
||||||
|
AddUntilStep("wait for track to start running", () => track.IsRunning);
|
||||||
|
AddStep("retrieve spinner", () => drawableSpinner = (DrawableSpinner)((TestPlayer)Player).DrawableRuleset.Playfield.AllHitObjects.First());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSpinnerRewindingRotation()
|
||||||
|
{
|
||||||
|
addSeekStep(5000);
|
||||||
|
AddAssert("is rotation absolute not almost 0", () => !Precision.AlmostEquals(drawableSpinner.Disc.RotationAbsolute, 0, 100));
|
||||||
|
|
||||||
|
addSeekStep(0);
|
||||||
|
AddAssert("is rotation absolute almost 0", () => Precision.AlmostEquals(drawableSpinner.Disc.RotationAbsolute, 0, 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSpinnerMiddleRewindingRotation()
|
||||||
|
{
|
||||||
|
double estimatedRotation = 0;
|
||||||
|
|
||||||
|
addSeekStep(5000);
|
||||||
|
AddStep("retrieve rotation", () => estimatedRotation = drawableSpinner.Disc.RotationAbsolute);
|
||||||
|
|
||||||
|
addSeekStep(2500);
|
||||||
|
addSeekStep(5000);
|
||||||
|
AddAssert("is rotation absolute almost same", () => Precision.AlmostEquals(drawableSpinner.Disc.RotationAbsolute, estimatedRotation, 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addSeekStep(double time)
|
||||||
|
{
|
||||||
|
AddStep($"seek to {time}", () => track.Seek(time));
|
||||||
|
|
||||||
|
AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, ((TestPlayer)Player).DrawableRuleset.FrameStableClock.CurrentTime, 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new Beatmap
|
||||||
|
{
|
||||||
|
HitObjects = new List<HitObject>
|
||||||
|
{
|
||||||
|
new Spinner
|
||||||
|
{
|
||||||
|
Position = new Vector2(256, 192),
|
||||||
|
EndTime = 5000,
|
||||||
|
},
|
||||||
|
// placeholder object to avoid hitting the results screen
|
||||||
|
new HitObject
|
||||||
|
{
|
||||||
|
StartTime = 99999,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
CirclePiece = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.HitCircle), _ => new MainCirclePiece(HitObject.IndexInCurrentCombo)),
|
CirclePiece = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.HitCircle), _ => new MainCirclePiece()),
|
||||||
ApproachCircle = new ApproachCircle
|
ApproachCircle = new ApproachCircle
|
||||||
{
|
{
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
|
@ -173,6 +173,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
Body.AccentColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderTrackOverride)?.Value ?? AccentColour.Value;
|
Body.AccentColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderTrackOverride)?.Value ?? AccentColour.Value;
|
||||||
Body.BorderColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderBorder)?.Value ?? Color4.White;
|
Body.BorderColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderBorder)?.Value ?? Color4.White;
|
||||||
|
|
||||||
|
bool allowBallTint = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.AllowSliderBallTint)?.Value ?? false;
|
||||||
|
Ball.Colour = allowBallTint ? AccentColour.Value : Color4.White;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePathRadius() => Body.PathRadius = slider.Scale * sliderPathRadius;
|
private void updatePathRadius() => Body.PathRadius = slider.Scale * sliderPathRadius;
|
||||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
private readonly NumberPiece number;
|
private readonly NumberPiece number;
|
||||||
private readonly GlowPiece glow;
|
private readonly GlowPiece glow;
|
||||||
|
|
||||||
public MainCirclePiece(int index)
|
public MainCirclePiece()
|
||||||
{
|
{
|
||||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
|
|
||||||
@ -31,10 +31,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
{
|
{
|
||||||
glow = new GlowPiece(),
|
glow = new GlowPiece(),
|
||||||
circle = new CirclePiece(),
|
circle = new CirclePiece(),
|
||||||
number = new NumberPiece
|
number = new NumberPiece(),
|
||||||
{
|
|
||||||
Text = (index + 1).ToString(),
|
|
||||||
},
|
|
||||||
ring = new RingPiece(),
|
ring = new RingPiece(),
|
||||||
flash = new FlashPiece(),
|
flash = new FlashPiece(),
|
||||||
explode = new ExplodePiece(),
|
explode = new ExplodePiece(),
|
||||||
@ -42,12 +39,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly IBindable<ArmedState> state = new Bindable<ArmedState>();
|
private readonly IBindable<ArmedState> state = new Bindable<ArmedState>();
|
||||||
|
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
||||||
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(DrawableHitObject drawableObject)
|
private void load(DrawableHitObject drawableObject)
|
||||||
{
|
{
|
||||||
|
OsuHitObject osuObject = (OsuHitObject)drawableObject.HitObject;
|
||||||
|
|
||||||
state.BindTo(drawableObject.State);
|
state.BindTo(drawableObject.State);
|
||||||
state.BindValueChanged(updateState, true);
|
state.BindValueChanged(updateState, true);
|
||||||
|
|
||||||
@ -58,6 +57,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
glow.Colour = colour.NewValue;
|
glow.Colour = colour.NewValue;
|
||||||
circle.Colour = colour.NewValue;
|
circle.Colour = colour.NewValue;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
indexInCurrentCombo.BindTo(osuObject.IndexInCurrentComboBindable);
|
||||||
|
indexInCurrentCombo.BindValueChanged(index => number.Text = (index.NewValue + 1).ToString(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateState(ValueChangedEvent<ArmedState> state)
|
private void updateState(ValueChangedEvent<ArmedState> state)
|
||||||
|
@ -111,7 +111,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
lastAngle -= 360;
|
lastAngle -= 360;
|
||||||
|
|
||||||
currentRotation += thisAngle - lastAngle;
|
currentRotation += thisAngle - lastAngle;
|
||||||
RotationAbsolute += Math.Abs(thisAngle - lastAngle);
|
RotationAbsolute += Math.Abs(thisAngle - lastAngle) * Math.Sign(Clock.ElapsedFrameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastAngle = thisAngle;
|
lastAngle = thisAngle;
|
||||||
|
@ -58,13 +58,37 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
public virtual bool NewCombo { get; set; }
|
public virtual bool NewCombo { get; set; }
|
||||||
|
|
||||||
public int ComboOffset { get; set; }
|
public readonly Bindable<int> ComboOffsetBindable = new Bindable<int>();
|
||||||
|
|
||||||
public virtual int IndexInCurrentCombo { get; set; }
|
public int ComboOffset
|
||||||
|
{
|
||||||
|
get => ComboOffsetBindable.Value;
|
||||||
|
set => ComboOffsetBindable.Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual int ComboIndex { get; set; }
|
public Bindable<int> IndexInCurrentComboBindable { get; } = new Bindable<int>();
|
||||||
|
|
||||||
public bool LastInCombo { get; set; }
|
public virtual int IndexInCurrentCombo
|
||||||
|
{
|
||||||
|
get => IndexInCurrentComboBindable.Value;
|
||||||
|
set => IndexInCurrentComboBindable.Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bindable<int> ComboIndexBindable { get; } = new Bindable<int>();
|
||||||
|
|
||||||
|
public virtual int ComboIndex
|
||||||
|
{
|
||||||
|
get => ComboIndexBindable.Value;
|
||||||
|
set => ComboIndexBindable.Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bindable<bool> LastInComboBindable { get; } = new Bindable<bool>();
|
||||||
|
|
||||||
|
public bool LastInCombo
|
||||||
|
{
|
||||||
|
get => LastInComboBindable.Value;
|
||||||
|
set => LastInComboBindable.Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
|
@ -33,28 +33,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
public Vector2 StackedPositionAt(double t) => StackedPosition + this.CurvePositionAt(t);
|
public Vector2 StackedPositionAt(double t) => StackedPosition + this.CurvePositionAt(t);
|
||||||
|
|
||||||
public override int ComboIndex
|
|
||||||
{
|
|
||||||
get => base.ComboIndex;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
base.ComboIndex = value;
|
|
||||||
foreach (var n in NestedHitObjects.OfType<IHasComboInformation>())
|
|
||||||
n.ComboIndex = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int IndexInCurrentCombo
|
|
||||||
{
|
|
||||||
get => base.IndexInCurrentCombo;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
base.IndexInCurrentCombo = value;
|
|
||||||
foreach (var n in NestedHitObjects.OfType<IHasComboInformation>())
|
|
||||||
n.IndexInCurrentCombo = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly Bindable<SliderPath> PathBindable = new Bindable<SliderPath>();
|
public readonly Bindable<SliderPath> PathBindable = new Bindable<SliderPath>();
|
||||||
|
|
||||||
public SliderPath Path
|
public SliderPath Path
|
||||||
@ -192,8 +170,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
Position = Position,
|
Position = Position,
|
||||||
Samples = getNodeSamples(0),
|
Samples = getNodeSamples(0),
|
||||||
SampleControlPoint = SampleControlPoint,
|
SampleControlPoint = SampleControlPoint,
|
||||||
IndexInCurrentCombo = IndexInCurrentCombo,
|
|
||||||
ComboIndex = ComboIndex,
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -205,8 +181,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
StartTime = e.Time,
|
StartTime = e.Time,
|
||||||
Position = EndPosition,
|
Position = EndPosition,
|
||||||
IndexInCurrentCombo = IndexInCurrentCombo,
|
|
||||||
ComboIndex = ComboIndex,
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -25,13 +24,16 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly IBindable<ArmedState> state = new Bindable<ArmedState>();
|
private readonly IBindable<ArmedState> state = new Bindable<ArmedState>();
|
||||||
|
|
||||||
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
||||||
|
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(DrawableHitObject drawableObject, ISkinSource skin)
|
private void load(DrawableHitObject drawableObject, ISkinSource skin)
|
||||||
{
|
{
|
||||||
|
OsuHitObject osuObject = (OsuHitObject)drawableObject.HitObject;
|
||||||
|
|
||||||
Sprite hitCircleSprite;
|
Sprite hitCircleSprite;
|
||||||
|
SkinnableSpriteText hitCircleText;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -42,14 +44,11 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
new SkinnableSpriteText(new OsuSkinComponent(OsuSkinComponents.HitCircleText), _ => new OsuSpriteText
|
hitCircleText = new SkinnableSpriteText(new OsuSkinComponent(OsuSkinComponents.HitCircleText), _ => new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.Numeric.With(size: 40),
|
Font = OsuFont.Numeric.With(size: 40),
|
||||||
UseFullGlyphHeight = false,
|
UseFullGlyphHeight = false,
|
||||||
}, confineMode: ConfineMode.NoScaling)
|
}, confineMode: ConfineMode.NoScaling),
|
||||||
{
|
|
||||||
Text = (((IHasComboInformation)drawableObject.HitObject).IndexInCurrentCombo + 1).ToString()
|
|
||||||
},
|
|
||||||
new Sprite
|
new Sprite
|
||||||
{
|
{
|
||||||
Texture = skin.GetTexture("hitcircleoverlay"),
|
Texture = skin.GetTexture("hitcircleoverlay"),
|
||||||
@ -63,6 +62,9 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
|
|
||||||
accentColour.BindTo(drawableObject.AccentColour);
|
accentColour.BindTo(drawableObject.AccentColour);
|
||||||
accentColour.BindValueChanged(colour => hitCircleSprite.Colour = colour.NewValue, true);
|
accentColour.BindValueChanged(colour => hitCircleSprite.Colour = colour.NewValue, true);
|
||||||
|
|
||||||
|
indexInCurrentCombo.BindTo(osuObject.IndexInCurrentComboBindable);
|
||||||
|
indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateState(ValueChangedEvent<ArmedState> state)
|
private void updateState(ValueChangedEvent<ArmedState> state)
|
||||||
|
@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
HitCircleOverlap,
|
HitCircleOverlap,
|
||||||
SliderBorderSize,
|
SliderBorderSize,
|
||||||
SliderPathRadius,
|
SliderPathRadius,
|
||||||
|
AllowSliderBallTint,
|
||||||
CursorExpand,
|
CursorExpand,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
|
|
||||||
for (int i = 0; i < max_sprites; i++)
|
for (int i = 0; i < max_sprites; i++)
|
||||||
{
|
{
|
||||||
// InvalidationID 1 forces an update of each part of the cursor trail the first time ApplyState is run on the draw node
|
// -1 signals that the part is unusable, and should not be drawn
|
||||||
// This is to prevent garbage data from being sent to the vertex shader, resulting in visual issues on some platforms
|
parts[i].InvalidationID = -1;
|
||||||
parts[i].InvalidationID = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,6 +111,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
for (int i = 0; i < parts.Length; ++i)
|
for (int i = 0; i < parts.Length; ++i)
|
||||||
{
|
{
|
||||||
parts[i].Time -= time;
|
parts[i].Time -= time;
|
||||||
|
|
||||||
|
if (parts[i].InvalidationID != -1)
|
||||||
++parts[i].InvalidationID;
|
++parts[i].InvalidationID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,8 +206,6 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
public TrailDrawNode(CursorTrail source)
|
public TrailDrawNode(CursorTrail source)
|
||||||
: base(source)
|
: base(source)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < max_sprites; i++)
|
|
||||||
parts[i].InvalidationID = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyState()
|
public override void ApplyState()
|
||||||
@ -218,11 +217,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
size = Source.partSize;
|
size = Source.partSize;
|
||||||
time = Source.time;
|
time = Source.time;
|
||||||
|
|
||||||
for (int i = 0; i < Source.parts.Length; ++i)
|
Source.parts.CopyTo(parts, 0);
|
||||||
{
|
|
||||||
if (Source.parts[i].InvalidationID > parts[i].InvalidationID)
|
|
||||||
parts[i] = Source.parts[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw(Action<TexturedVertex2D> vertexAction)
|
public override void Draw(Action<TexturedVertex2D> vertexAction)
|
||||||
@ -234,6 +229,9 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
|
|
||||||
for (int i = 0; i < parts.Length; ++i)
|
for (int i = 0; i < parts.Length; ++i)
|
||||||
{
|
{
|
||||||
|
if (parts[i].InvalidationID == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
vertexBatch.DrawTime = parts[i].Time;
|
vertexBatch.DrawTime = parts[i].Time;
|
||||||
|
|
||||||
Vector2 pos = parts[i].Position;
|
Vector2 pos = parts[i].Position;
|
||||||
|
@ -53,6 +53,11 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
AddStep("Strong Rim", () => addRimHit(true));
|
AddStep("Strong Rim", () => addRimHit(true));
|
||||||
AddStep("Add bar line", () => addBarLine(false));
|
AddStep("Add bar line", () => addBarLine(false));
|
||||||
AddStep("Add major bar line", () => addBarLine(true));
|
AddStep("Add major bar line", () => addBarLine(true));
|
||||||
|
AddStep("Add centre w/ bar line", () =>
|
||||||
|
{
|
||||||
|
addCentreHit(false);
|
||||||
|
addBarLine(true);
|
||||||
|
});
|
||||||
AddStep("Height test 1", () => changePlayfieldSize(1));
|
AddStep("Height test 1", () => changePlayfieldSize(1));
|
||||||
AddStep("Height test 2", () => changePlayfieldSize(2));
|
AddStep("Height test 2", () => changePlayfieldSize(2));
|
||||||
AddStep("Height test 3", () => changePlayfieldSize(3));
|
AddStep("Height test 3", () => changePlayfieldSize(3));
|
||||||
|
12
osu.Game.Rulesets.Taiko/Objects/BarLine.cs
Normal file
12
osu.Game.Rulesets.Taiko/Objects/BarLine.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Objects
|
||||||
|
{
|
||||||
|
public class BarLine : TaikoHitObject, IBarLine
|
||||||
|
{
|
||||||
|
public bool Major { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
new BarLineGenerator(Beatmap).BarLines.ForEach(bar => Playfield.Add(bar.Major ? new DrawableBarLineMajor(bar) : new DrawableBarLine(bar)));
|
new BarLineGenerator<BarLine>(Beatmap).BarLines.ForEach(bar => Playfield.Add(bar.Major ? new DrawableBarLineMajor(bar) : new DrawableBarLine(bar)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this);
|
public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this);
|
||||||
|
@ -90,6 +90,48 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task TestImportCorruptThenImport()
|
||||||
|
{
|
||||||
|
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
|
||||||
|
using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportThenImport"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var osu = loadOsu(host);
|
||||||
|
|
||||||
|
var imported = await LoadOszIntoOsu(osu);
|
||||||
|
|
||||||
|
var firstFile = imported.Files.First();
|
||||||
|
|
||||||
|
var files = osu.Dependencies.Get<FileStore>();
|
||||||
|
|
||||||
|
long originalLength;
|
||||||
|
using (var stream = files.Storage.GetStream(firstFile.FileInfo.StoragePath))
|
||||||
|
originalLength = stream.Length;
|
||||||
|
|
||||||
|
using (var stream = files.Storage.GetStream(firstFile.FileInfo.StoragePath, FileAccess.Write, FileMode.Create))
|
||||||
|
stream.WriteByte(0);
|
||||||
|
|
||||||
|
var importedSecondTime = await LoadOszIntoOsu(osu);
|
||||||
|
|
||||||
|
using (var stream = files.Storage.GetStream(firstFile.FileInfo.StoragePath))
|
||||||
|
Assert.AreEqual(stream.Length, originalLength, "Corruption was not fixed on second import");
|
||||||
|
|
||||||
|
// check the newly "imported" beatmap is actually just the restored previous import. since it matches hash.
|
||||||
|
Assert.IsTrue(imported.ID == importedSecondTime.ID);
|
||||||
|
Assert.IsTrue(imported.Beatmaps.First().ID == importedSecondTime.Beatmaps.First().ID);
|
||||||
|
|
||||||
|
checkBeatmapSetCount(osu, 1);
|
||||||
|
checkSingleReferencedFileCount(osu, 18);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
host.Exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task TestRollbackOnFailure()
|
public async Task TestRollbackOnFailure()
|
||||||
{
|
{
|
||||||
|
201
osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs
Normal file
201
osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Screens.Select;
|
||||||
|
using osu.Game.Screens.Select.Carousel;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.NonVisual.Filtering
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class FilterMatchingTest
|
||||||
|
{
|
||||||
|
private BeatmapInfo getExampleBeatmap() => new BeatmapInfo
|
||||||
|
{
|
||||||
|
Ruleset = new RulesetInfo { ID = 5 },
|
||||||
|
StarDifficulty = 4.0d,
|
||||||
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
ApproachRate = 5.0f,
|
||||||
|
DrainRate = 3.0f,
|
||||||
|
CircleSize = 2.0f,
|
||||||
|
},
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Artist = "The Artist",
|
||||||
|
ArtistUnicode = "check unicode too",
|
||||||
|
Title = "Title goes here",
|
||||||
|
TitleUnicode = "Title goes here",
|
||||||
|
AuthorString = "The Author",
|
||||||
|
Source = "unit tests",
|
||||||
|
Tags = "look for tags too",
|
||||||
|
},
|
||||||
|
Version = "version as well",
|
||||||
|
Length = 2500,
|
||||||
|
BPM = 160,
|
||||||
|
BeatDivisor = 12,
|
||||||
|
Status = BeatmapSetOnlineStatus.Loved
|
||||||
|
};
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCriteriaMatchingNoRuleset()
|
||||||
|
{
|
||||||
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
|
var criteria = new FilterCriteria();
|
||||||
|
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
||||||
|
carouselItem.Filter(criteria);
|
||||||
|
Assert.IsFalse(carouselItem.Filtered.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCriteriaMatchingSpecificRuleset()
|
||||||
|
{
|
||||||
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
|
var criteria = new FilterCriteria
|
||||||
|
{
|
||||||
|
Ruleset = new RulesetInfo { ID = 6 }
|
||||||
|
};
|
||||||
|
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
||||||
|
carouselItem.Filter(criteria);
|
||||||
|
Assert.IsTrue(carouselItem.Filtered.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCriteriaMatchingConvertedBeatmaps()
|
||||||
|
{
|
||||||
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
|
var criteria = new FilterCriteria
|
||||||
|
{
|
||||||
|
Ruleset = new RulesetInfo { ID = 6 },
|
||||||
|
AllowConvertedBeatmaps = true
|
||||||
|
};
|
||||||
|
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
||||||
|
carouselItem.Filter(criteria);
|
||||||
|
Assert.IsFalse(carouselItem.Filtered.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[TestCase(true)]
|
||||||
|
[TestCase(false)]
|
||||||
|
public void TestCriteriaMatchingRangeMin(bool inclusive)
|
||||||
|
{
|
||||||
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
|
var criteria = new FilterCriteria
|
||||||
|
{
|
||||||
|
Ruleset = new RulesetInfo { ID = 6 },
|
||||||
|
AllowConvertedBeatmaps = true,
|
||||||
|
ApproachRate = new FilterCriteria.OptionalRange<float>
|
||||||
|
{
|
||||||
|
IsLowerInclusive = inclusive,
|
||||||
|
Min = 5.0f
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
||||||
|
carouselItem.Filter(criteria);
|
||||||
|
Assert.AreEqual(!inclusive, carouselItem.Filtered.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[TestCase(true)]
|
||||||
|
[TestCase(false)]
|
||||||
|
public void TestCriteriaMatchingRangeMax(bool inclusive)
|
||||||
|
{
|
||||||
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
|
var criteria = new FilterCriteria
|
||||||
|
{
|
||||||
|
Ruleset = new RulesetInfo { ID = 6 },
|
||||||
|
AllowConvertedBeatmaps = true,
|
||||||
|
BPM = new FilterCriteria.OptionalRange<double>
|
||||||
|
{
|
||||||
|
IsUpperInclusive = inclusive,
|
||||||
|
Max = 160d
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
||||||
|
carouselItem.Filter(criteria);
|
||||||
|
Assert.AreEqual(!inclusive, carouselItem.Filtered.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[TestCase("artist", false)]
|
||||||
|
[TestCase("artist title author", false)]
|
||||||
|
[TestCase("an artist", true)]
|
||||||
|
[TestCase("tags too", false)]
|
||||||
|
[TestCase("version", false)]
|
||||||
|
[TestCase("an auteur", true)]
|
||||||
|
public void TestCriteriaMatchingTerms(string terms, bool filtered)
|
||||||
|
{
|
||||||
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
|
var criteria = new FilterCriteria
|
||||||
|
{
|
||||||
|
Ruleset = new RulesetInfo { ID = 6 },
|
||||||
|
AllowConvertedBeatmaps = true,
|
||||||
|
SearchText = terms
|
||||||
|
};
|
||||||
|
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
||||||
|
carouselItem.Filter(criteria);
|
||||||
|
Assert.AreEqual(filtered, carouselItem.Filtered.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[TestCase("", false)]
|
||||||
|
[TestCase("The", false)]
|
||||||
|
[TestCase("THE", false)]
|
||||||
|
[TestCase("author", false)]
|
||||||
|
[TestCase("the author", false)]
|
||||||
|
[TestCase("the author AND then something else", true)]
|
||||||
|
[TestCase("unknown", true)]
|
||||||
|
public void TestCriteriaMatchingCreator(string creatorName, bool filtered)
|
||||||
|
{
|
||||||
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
|
var criteria = new FilterCriteria
|
||||||
|
{
|
||||||
|
Creator = new FilterCriteria.OptionalTextFilter { SearchTerm = creatorName }
|
||||||
|
};
|
||||||
|
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
||||||
|
carouselItem.Filter(criteria);
|
||||||
|
Assert.AreEqual(filtered, carouselItem.Filtered.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[TestCase("", false)]
|
||||||
|
[TestCase("The", false)]
|
||||||
|
[TestCase("THE", false)]
|
||||||
|
[TestCase("artist", false)]
|
||||||
|
[TestCase("the artist", false)]
|
||||||
|
[TestCase("the artist AND then something else", true)]
|
||||||
|
[TestCase("unicode too", false)]
|
||||||
|
[TestCase("unknown", true)]
|
||||||
|
public void TestCriteriaMatchingArtist(string artistName, bool filtered)
|
||||||
|
{
|
||||||
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
|
var criteria = new FilterCriteria
|
||||||
|
{
|
||||||
|
Artist = new FilterCriteria.OptionalTextFilter { SearchTerm = artistName }
|
||||||
|
};
|
||||||
|
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
||||||
|
carouselItem.Filter(criteria);
|
||||||
|
Assert.AreEqual(filtered, carouselItem.Filtered.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[TestCase("", false)]
|
||||||
|
[TestCase("artist", false)]
|
||||||
|
[TestCase("unknown", true)]
|
||||||
|
public void TestCriteriaMatchingArtistWithNullUnicodeName(string artistName, bool filtered)
|
||||||
|
{
|
||||||
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
|
exampleBeatmapInfo.Metadata.ArtistUnicode = null;
|
||||||
|
|
||||||
|
var criteria = new FilterCriteria
|
||||||
|
{
|
||||||
|
Artist = new FilterCriteria.OptionalTextFilter { SearchTerm = artistName }
|
||||||
|
};
|
||||||
|
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
||||||
|
carouselItem.Filter(criteria);
|
||||||
|
Assert.AreEqual(filtered, carouselItem.Filtered.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
184
osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs
Normal file
184
osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Screens.Select;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.NonVisual.Filtering
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class FilterQueryParserTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestApplyQueriesBareWords()
|
||||||
|
{
|
||||||
|
const string query = "looking for a beatmap";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual("looking for a beatmap", filterCriteria.SearchText);
|
||||||
|
Assert.AreEqual(4, filterCriteria.SearchTerms.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following tests have been written a bit strangely (they don't check exact
|
||||||
|
* bound equality with what the filter says).
|
||||||
|
* This is to account for floating-point arithmetic issues.
|
||||||
|
* For example, specifying a bpm<140 filter would previously match beatmaps with BPM
|
||||||
|
* of 139.99999, which would be displayed in the UI as 140.
|
||||||
|
* Due to this the tests check the last tick inside the range and the first tick
|
||||||
|
* outside of the range.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestApplyStarQueries()
|
||||||
|
{
|
||||||
|
const string query = "stars<4 easy";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual("easy", filterCriteria.SearchText.Trim());
|
||||||
|
Assert.AreEqual(1, filterCriteria.SearchTerms.Length);
|
||||||
|
Assert.IsNotNull(filterCriteria.StarDifficulty.Max);
|
||||||
|
Assert.Greater(filterCriteria.StarDifficulty.Max, 3.99d);
|
||||||
|
Assert.Less(filterCriteria.StarDifficulty.Max, 4.00d);
|
||||||
|
Assert.IsNull(filterCriteria.StarDifficulty.Min);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestApplyApproachRateQueries()
|
||||||
|
{
|
||||||
|
const string query = "ar>=9 difficult";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual("difficult", filterCriteria.SearchText.Trim());
|
||||||
|
Assert.AreEqual(1, filterCriteria.SearchTerms.Length);
|
||||||
|
Assert.IsNotNull(filterCriteria.ApproachRate.Min);
|
||||||
|
Assert.Greater(filterCriteria.ApproachRate.Min, 8.9f);
|
||||||
|
Assert.Less(filterCriteria.ApproachRate.Min, 9.0f);
|
||||||
|
Assert.IsNull(filterCriteria.ApproachRate.Max);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestApplyDrainRateQueries()
|
||||||
|
{
|
||||||
|
const string query = "dr>2 quite specific dr<:6";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual("quite specific", filterCriteria.SearchText.Trim());
|
||||||
|
Assert.AreEqual(2, filterCriteria.SearchTerms.Length);
|
||||||
|
Assert.Greater(filterCriteria.DrainRate.Min, 2.0f);
|
||||||
|
Assert.Less(filterCriteria.DrainRate.Min, 2.1f);
|
||||||
|
Assert.Greater(filterCriteria.DrainRate.Max, 6.0f);
|
||||||
|
Assert.Less(filterCriteria.DrainRate.Min, 6.1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestApplyBPMQueries()
|
||||||
|
{
|
||||||
|
const string query = "bpm>:200 gotta go fast";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual("gotta go fast", filterCriteria.SearchText.Trim());
|
||||||
|
Assert.AreEqual(3, filterCriteria.SearchTerms.Length);
|
||||||
|
Assert.IsNotNull(filterCriteria.BPM.Min);
|
||||||
|
Assert.Greater(filterCriteria.BPM.Min, 199.99d);
|
||||||
|
Assert.Less(filterCriteria.BPM.Min, 200.00d);
|
||||||
|
Assert.IsNull(filterCriteria.BPM.Max);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static object[] lengthQueryExamples =
|
||||||
|
{
|
||||||
|
new object[] { "6ms", TimeSpan.FromMilliseconds(6), TimeSpan.FromMilliseconds(1) },
|
||||||
|
new object[] { "23s", TimeSpan.FromSeconds(23), TimeSpan.FromSeconds(1) },
|
||||||
|
new object[] { "9m", TimeSpan.FromMinutes(9), TimeSpan.FromMinutes(1) },
|
||||||
|
new object[] { "0.25h", TimeSpan.FromHours(0.25), TimeSpan.FromHours(1) },
|
||||||
|
new object[] { "70", TimeSpan.FromSeconds(70), TimeSpan.FromSeconds(1) },
|
||||||
|
};
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[TestCaseSource(nameof(lengthQueryExamples))]
|
||||||
|
public void TestApplyLengthQueries(string lengthQuery, TimeSpan expectedLength, TimeSpan scale)
|
||||||
|
{
|
||||||
|
string query = $"length={lengthQuery} time";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual("time", filterCriteria.SearchText.Trim());
|
||||||
|
Assert.AreEqual(1, filterCriteria.SearchTerms.Length);
|
||||||
|
Assert.AreEqual(expectedLength.TotalMilliseconds - scale.TotalMilliseconds / 2.0, filterCriteria.Length.Min);
|
||||||
|
Assert.AreEqual(expectedLength.TotalMilliseconds + scale.TotalMilliseconds / 2.0, filterCriteria.Length.Max);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestApplyDivisorQueries()
|
||||||
|
{
|
||||||
|
const string query = "that's a time signature alright! divisor:12";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual("that's a time signature alright!", filterCriteria.SearchText.Trim());
|
||||||
|
Assert.AreEqual(5, filterCriteria.SearchTerms.Length);
|
||||||
|
Assert.AreEqual(12, filterCriteria.BeatDivisor.Min);
|
||||||
|
Assert.IsTrue(filterCriteria.BeatDivisor.IsLowerInclusive);
|
||||||
|
Assert.AreEqual(12, filterCriteria.BeatDivisor.Max);
|
||||||
|
Assert.IsTrue(filterCriteria.BeatDivisor.IsUpperInclusive);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestApplyStatusQueries()
|
||||||
|
{
|
||||||
|
const string query = "I want the pp status=ranked";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual("I want the pp", filterCriteria.SearchText.Trim());
|
||||||
|
Assert.AreEqual(4, filterCriteria.SearchTerms.Length);
|
||||||
|
Assert.AreEqual(BeatmapSetOnlineStatus.Ranked, filterCriteria.OnlineStatus.Min);
|
||||||
|
Assert.IsTrue(filterCriteria.OnlineStatus.IsLowerInclusive);
|
||||||
|
Assert.AreEqual(BeatmapSetOnlineStatus.Ranked, filterCriteria.OnlineStatus.Max);
|
||||||
|
Assert.IsTrue(filterCriteria.OnlineStatus.IsUpperInclusive);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestApplyCreatorQueries()
|
||||||
|
{
|
||||||
|
const string query = "beatmap specifically by creator=my_fav";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual("beatmap specifically by", filterCriteria.SearchText.Trim());
|
||||||
|
Assert.AreEqual(3, filterCriteria.SearchTerms.Length);
|
||||||
|
Assert.AreEqual("my_fav", filterCriteria.Creator.SearchTerm);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestApplyArtistQueries()
|
||||||
|
{
|
||||||
|
const string query = "find me songs by artist=singer please";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual("find me songs by please", filterCriteria.SearchText.Trim());
|
||||||
|
Assert.AreEqual(5, filterCriteria.SearchTerms.Length);
|
||||||
|
Assert.AreEqual("singer", filterCriteria.Artist.SearchTerm);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestApplyArtistQueriesWithSpaces()
|
||||||
|
{
|
||||||
|
const string query = "really like artist=\"name with space\" yes";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual("really like yes", filterCriteria.SearchText.Trim());
|
||||||
|
Assert.AreEqual(3, filterCriteria.SearchTerms.Length);
|
||||||
|
Assert.AreEqual("name with space", filterCriteria.Artist.SearchTerm);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestApplyArtistQueriesOneDoubleQuote()
|
||||||
|
{
|
||||||
|
const string query = "weird artist=double\"quote";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual("weird", filterCriteria.SearchText.Trim());
|
||||||
|
Assert.AreEqual(1, filterCriteria.SearchTerms.Length);
|
||||||
|
Assert.AreEqual("double\"quote", filterCriteria.Artist.SearchTerm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -117,17 +117,57 @@ namespace osu.Game.Tests.Scores.IO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task TestImportWithDeletedBeatmapSet()
|
||||||
|
{
|
||||||
|
using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportWithDeletedBeatmapSet"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var osu = await loadOsu(host);
|
||||||
|
|
||||||
|
var toImport = new ScoreInfo
|
||||||
|
{
|
||||||
|
Hash = Guid.NewGuid().ToString(),
|
||||||
|
Statistics = new Dictionary<HitResult, int>
|
||||||
|
{
|
||||||
|
{ HitResult.Perfect, 100 },
|
||||||
|
{ HitResult.Miss, 50 }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var imported = await loadIntoOsu(osu, toImport);
|
||||||
|
|
||||||
|
var beatmapManager = osu.Dependencies.Get<BeatmapManager>();
|
||||||
|
var scoreManager = osu.Dependencies.Get<ScoreManager>();
|
||||||
|
|
||||||
|
beatmapManager.Delete(beatmapManager.QueryBeatmapSet(s => s.Beatmaps.Any(b => b.ID == imported.Beatmap.ID)));
|
||||||
|
Assert.That(scoreManager.Query(s => s.ID == imported.ID).DeletePending, Is.EqualTo(true));
|
||||||
|
|
||||||
|
var secondImport = await loadIntoOsu(osu, imported);
|
||||||
|
Assert.That(secondImport, Is.Null);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
host.Exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<ScoreInfo> loadIntoOsu(OsuGameBase osu, ScoreInfo score)
|
private async Task<ScoreInfo> loadIntoOsu(OsuGameBase osu, ScoreInfo score)
|
||||||
{
|
{
|
||||||
var beatmapManager = osu.Dependencies.Get<BeatmapManager>();
|
var beatmapManager = osu.Dependencies.Get<BeatmapManager>();
|
||||||
|
|
||||||
|
if (score.Beatmap == null)
|
||||||
score.Beatmap = beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps.First();
|
score.Beatmap = beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps.First();
|
||||||
|
|
||||||
|
if (score.Ruleset == null)
|
||||||
score.Ruleset = new OsuRuleset().RulesetInfo;
|
score.Ruleset = new OsuRuleset().RulesetInfo;
|
||||||
|
|
||||||
var scoreManager = osu.Dependencies.Get<ScoreManager>();
|
var scoreManager = osu.Dependencies.Get<ScoreManager>();
|
||||||
await scoreManager.Import(score);
|
await scoreManager.Import(score);
|
||||||
|
|
||||||
return scoreManager.GetAllUsableScores().First();
|
return scoreManager.GetAllUsableScores().FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<OsuGameBase> loadOsu(GameHost host)
|
private async Task<OsuGameBase> loadOsu(GameHost host)
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
@ -17,6 +18,7 @@ using osuTK.Graphics;
|
|||||||
namespace osu.Game.Tests.Skins
|
namespace osu.Game.Tests.Skins
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
[HeadlessTest]
|
||||||
public class TestSceneSkinConfigurationLookup : OsuTestScene
|
public class TestSceneSkinConfigurationLookup : OsuTestScene
|
||||||
{
|
{
|
||||||
private LegacySkin source1;
|
private LegacySkin source1;
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -115,6 +116,32 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
assertPosition(4, 1f);
|
assertPosition(4, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSliderMultiplierDoesNotAffectRelativeBeatLength()
|
||||||
|
{
|
||||||
|
var beatmap = createBeatmap(new TimingControlPoint { BeatLength = time_range });
|
||||||
|
beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier = 2;
|
||||||
|
|
||||||
|
createTest(beatmap, d => d.RelativeScaleBeatLengthsOverride = true);
|
||||||
|
AddStep("adjust time range", () => drawableRuleset.TimeRange.Value = 5000);
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
assertPosition(i, i / 5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSliderMultiplierAffectsNonRelativeBeatLength()
|
||||||
|
{
|
||||||
|
var beatmap = createBeatmap(new TimingControlPoint { BeatLength = time_range });
|
||||||
|
beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier = 2;
|
||||||
|
|
||||||
|
createTest(beatmap);
|
||||||
|
AddStep("adjust time range", () => drawableRuleset.TimeRange.Value = 2000);
|
||||||
|
|
||||||
|
assertPosition(0, 0);
|
||||||
|
assertPosition(1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
private void assertPosition(int index, float relativeY) => AddAssert($"hitobject {index} at {relativeY}",
|
private void assertPosition(int index, float relativeY) => AddAssert($"hitobject {index} at {relativeY}",
|
||||||
() => Precision.AlmostEquals(drawableRuleset.Playfield.AllHitObjects.ElementAt(index).DrawPosition.Y, drawableRuleset.Playfield.HitObjectContainer.DrawHeight * relativeY));
|
() => Precision.AlmostEquals(drawableRuleset.Playfield.AllHitObjects.ElementAt(index).DrawPosition.Y, drawableRuleset.Playfield.HitObjectContainer.DrawHeight * relativeY));
|
||||||
|
|
||||||
@ -193,6 +220,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping;
|
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping;
|
||||||
|
|
||||||
|
public new Bindable<double> TimeRange => base.TimeRange;
|
||||||
|
|
||||||
public TestDrawableScrollingRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
public TestDrawableScrollingRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap, mods)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
|
202
osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs
Normal file
202
osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
// 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.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Platform;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Mods;
|
||||||
|
using osu.Game.Screens;
|
||||||
|
using osu.Game.Screens.Menu;
|
||||||
|
using osu.Game.Screens.Select;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
using osuTK.Input;
|
||||||
|
using IntroSequence = osu.Game.Configuration.IntroSequence;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Menus
|
||||||
|
{
|
||||||
|
public class TestSceneScreenNavigation : ManualInputManagerTestScene
|
||||||
|
{
|
||||||
|
private const float click_padding = 25;
|
||||||
|
|
||||||
|
private GameHost host;
|
||||||
|
private TestOsuGame osuGame;
|
||||||
|
|
||||||
|
private Vector2 backButtonPosition => osuGame.ToScreenSpace(new Vector2(click_padding, osuGame.LayoutRectangle.Bottom - click_padding));
|
||||||
|
|
||||||
|
private Vector2 optionsButtonPosition => osuGame.ToScreenSpace(new Vector2(click_padding, click_padding));
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(GameHost host)
|
||||||
|
{
|
||||||
|
this.host = host;
|
||||||
|
|
||||||
|
Child = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.Black,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
|
{
|
||||||
|
AddStep("Create new game instance", () =>
|
||||||
|
{
|
||||||
|
if (osuGame != null)
|
||||||
|
{
|
||||||
|
Remove(osuGame);
|
||||||
|
osuGame.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
osuGame = new TestOsuGame(LocalStorage, API);
|
||||||
|
osuGame.SetHost(host);
|
||||||
|
|
||||||
|
// todo: this can be removed once we can run audio trakcs without a device present
|
||||||
|
// see https://github.com/ppy/osu/issues/1302
|
||||||
|
osuGame.LocalConfig.Set(OsuSetting.IntroSequence, IntroSequence.Circles);
|
||||||
|
|
||||||
|
Add(osuGame);
|
||||||
|
});
|
||||||
|
AddUntilStep("Wait for load", () => osuGame.IsLoaded);
|
||||||
|
AddUntilStep("Wait for intro", () => osuGame.ScreenStack.CurrentScreen is IntroScreen);
|
||||||
|
confirmAtMainMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestExitSongSelectWithEscape()
|
||||||
|
{
|
||||||
|
TestSongSelect songSelect = null;
|
||||||
|
|
||||||
|
pushAndConfirm(() => songSelect = new TestSongSelect());
|
||||||
|
AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show());
|
||||||
|
AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible);
|
||||||
|
AddStep("Press escape", () => pressAndRelease(Key.Escape));
|
||||||
|
AddAssert("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden);
|
||||||
|
exitViaEscapeAndConfirm();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestExitSongSelectWithClick()
|
||||||
|
{
|
||||||
|
TestSongSelect songSelect = null;
|
||||||
|
|
||||||
|
pushAndConfirm(() => songSelect = new TestSongSelect());
|
||||||
|
AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show());
|
||||||
|
AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible);
|
||||||
|
AddStep("Move mouse to backButton", () => InputManager.MoveMouseTo(backButtonPosition));
|
||||||
|
|
||||||
|
// BackButton handles hover using its child button, so this checks whether or not any of BackButton's children are hovered.
|
||||||
|
AddUntilStep("Back button is hovered", () => InputManager.HoveredDrawables.Any(d => d.Parent == osuGame.BackButton));
|
||||||
|
|
||||||
|
AddStep("Click back button", () => InputManager.Click(MouseButton.Left));
|
||||||
|
AddUntilStep("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden);
|
||||||
|
exitViaBackButtonAndConfirm();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestExitMultiWithEscape()
|
||||||
|
{
|
||||||
|
pushAndConfirm(() => new Screens.Multi.Multiplayer());
|
||||||
|
exitViaEscapeAndConfirm();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestExitMultiWithBackButton()
|
||||||
|
{
|
||||||
|
pushAndConfirm(() => new Screens.Multi.Multiplayer());
|
||||||
|
exitViaBackButtonAndConfirm();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOpenOptionsAndExitWithEscape()
|
||||||
|
{
|
||||||
|
AddUntilStep("Wait for options to load", () => osuGame.Settings.IsLoaded);
|
||||||
|
AddStep("Enter menu", () => pressAndRelease(Key.Enter));
|
||||||
|
AddStep("Move mouse to options overlay", () => InputManager.MoveMouseTo(optionsButtonPosition));
|
||||||
|
AddStep("Click options overlay", () => InputManager.Click(MouseButton.Left));
|
||||||
|
AddAssert("Options overlay was opened", () => osuGame.Settings.State.Value == Visibility.Visible);
|
||||||
|
AddStep("Hide options overlay using escape", () => pressAndRelease(Key.Escape));
|
||||||
|
AddAssert("Options overlay was closed", () => osuGame.Settings.State.Value == Visibility.Hidden);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pushAndConfirm(Func<Screen> newScreen)
|
||||||
|
{
|
||||||
|
Screen screen = null;
|
||||||
|
AddStep("Push new screen", () => osuGame.ScreenStack.Push(screen = newScreen()));
|
||||||
|
AddUntilStep("Wait for new screen", () => osuGame.ScreenStack.CurrentScreen == screen && screen.IsLoaded);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void exitViaEscapeAndConfirm()
|
||||||
|
{
|
||||||
|
AddStep("Press escape", () => pressAndRelease(Key.Escape));
|
||||||
|
confirmAtMainMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void exitViaBackButtonAndConfirm()
|
||||||
|
{
|
||||||
|
AddStep("Move mouse to backButton", () => InputManager.MoveMouseTo(backButtonPosition));
|
||||||
|
AddStep("Click back button", () => InputManager.Click(MouseButton.Left));
|
||||||
|
confirmAtMainMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void confirmAtMainMenu() => AddUntilStep("Wait for main menu", () => osuGame.ScreenStack.CurrentScreen is MainMenu menu && menu.IsLoaded);
|
||||||
|
|
||||||
|
private void pressAndRelease(Key key)
|
||||||
|
{
|
||||||
|
InputManager.PressKey(key);
|
||||||
|
InputManager.ReleaseKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestOsuGame : OsuGame
|
||||||
|
{
|
||||||
|
public new ScreenStack ScreenStack => base.ScreenStack;
|
||||||
|
|
||||||
|
public new BackButton BackButton => base.BackButton;
|
||||||
|
|
||||||
|
public new SettingsPanel Settings => base.Settings;
|
||||||
|
|
||||||
|
public new OsuConfigManager LocalConfig => base.LocalConfig;
|
||||||
|
|
||||||
|
protected override Loader CreateLoader() => new TestLoader();
|
||||||
|
|
||||||
|
public TestOsuGame(Storage storage, IAPIProvider api)
|
||||||
|
{
|
||||||
|
Storage = storage;
|
||||||
|
API = api;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
API.Login("Rhythm Champion", "osu!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestSongSelect : PlaySongSelect
|
||||||
|
{
|
||||||
|
public ModSelectOverlay ModSelectOverlay => ModSelect;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestLoader : Loader
|
||||||
|
{
|
||||||
|
protected override ShaderPrecompiler CreateShaderPrecompiler() => new TestShaderPrecompiler();
|
||||||
|
|
||||||
|
private class TestShaderPrecompiler : ShaderPrecompiler
|
||||||
|
{
|
||||||
|
protected override bool AllLoaded => true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -68,6 +68,34 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
changelog.ShowListing();
|
changelog.ShowListing();
|
||||||
changelog.Show();
|
changelog.Show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddStep(@"Ensure HTML string unescaping", () =>
|
||||||
|
{
|
||||||
|
changelog.ShowBuild(new APIChangelogBuild
|
||||||
|
{
|
||||||
|
Version = "2019.920.0",
|
||||||
|
DisplayVersion = "2019.920.0",
|
||||||
|
UpdateStream = new APIUpdateStream
|
||||||
|
{
|
||||||
|
Name = "Test",
|
||||||
|
DisplayName = "Test"
|
||||||
|
},
|
||||||
|
ChangelogEntries = new List<APIChangelogEntry>
|
||||||
|
{
|
||||||
|
new APIChangelogEntry
|
||||||
|
{
|
||||||
|
Category = "Testing HTML strings unescaping",
|
||||||
|
Title = "Ensuring HTML strings are being unescaped",
|
||||||
|
MessageHtml = """"This text should appear triple-quoted""" >_<",
|
||||||
|
GithubUser = new APIChangelogUser
|
||||||
|
{
|
||||||
|
DisplayName = "Dummy",
|
||||||
|
OsuUsername = "Dummy",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,12 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Id = 4,
|
Id = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private readonly User longUsernameUser = new User
|
||||||
|
{
|
||||||
|
Username = "Very Long Long Username",
|
||||||
|
Id = 5,
|
||||||
|
};
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private ChannelManager channelManager = new ChannelManager();
|
private ChannelManager channelManager = new ChannelManager();
|
||||||
|
|
||||||
@ -99,6 +105,12 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Sender = admin,
|
Sender = admin,
|
||||||
Content = "Okay okay, calm down guys. Let's do this!"
|
Content = "Okay okay, calm down guys. Let's do this!"
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
AddStep("message from long username", () => testChannel.AddNewMessages(new Message(sequence++)
|
||||||
|
{
|
||||||
|
Sender = longUsernameUser,
|
||||||
|
Content = "Hi guys, my new username is lit!"
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,15 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
|
||||||
}, api.IsLoggedIn));
|
}, api.IsLoggedIn));
|
||||||
|
|
||||||
|
AddStep("Show bancho", () => profile.ShowUser(new User
|
||||||
|
{
|
||||||
|
Username = @"BanchoBot",
|
||||||
|
Id = 3,
|
||||||
|
IsBot = true,
|
||||||
|
Country = new Country { FullName = @"Saint Helena", FlagName = @"SH" },
|
||||||
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg"
|
||||||
|
}, api.IsLoggedIn));
|
||||||
|
|
||||||
AddStep("Hide", profile.Hide);
|
AddStep("Hide", profile.Hide);
|
||||||
AddStep("Show without reload", profile.Show);
|
AddStep("Show without reload", profile.Show);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
private readonly Stack<BeatmapSetInfo> selectedSets = new Stack<BeatmapSetInfo>();
|
private readonly Stack<BeatmapSetInfo> selectedSets = new Stack<BeatmapSetInfo>();
|
||||||
private readonly HashSet<int> eagerSelectedIDs = new HashSet<int>();
|
private readonly HashSet<int> eagerSelectedIDs = new HashSet<int>();
|
||||||
|
|
||||||
private BeatmapInfo currentSelection;
|
private BeatmapInfo currentSelection => carousel.SelectedBeatmap;
|
||||||
|
|
||||||
private const int set_count = 5;
|
private const int set_count = 5;
|
||||||
|
|
||||||
@ -56,45 +56,34 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
List<BeatmapSetInfo> beatmapSets = new List<BeatmapSetInfo>();
|
private void loadBeatmaps(List<BeatmapSetInfo> beatmapSets = null)
|
||||||
|
{
|
||||||
|
if (beatmapSets == null)
|
||||||
|
{
|
||||||
|
beatmapSets = new List<BeatmapSetInfo>();
|
||||||
|
|
||||||
for (int i = 1; i <= set_count; i++)
|
for (int i = 1; i <= set_count; i++)
|
||||||
beatmapSets.Add(createTestBeatmapSet(i));
|
beatmapSets.Add(createTestBeatmapSet(i));
|
||||||
|
|
||||||
carousel.SelectionChanged = s => currentSelection = s;
|
|
||||||
|
|
||||||
loadBeatmaps(beatmapSets);
|
|
||||||
|
|
||||||
testTraversal();
|
|
||||||
testFiltering();
|
|
||||||
testRandom();
|
|
||||||
testAddRemove();
|
|
||||||
testSorting();
|
|
||||||
|
|
||||||
testRemoveAll();
|
|
||||||
testEmptyTraversal();
|
|
||||||
testHiding();
|
|
||||||
testSelectingFilteredRuleset();
|
|
||||||
testCarouselRootIsRandom();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadBeatmaps(List<BeatmapSetInfo> beatmapSets)
|
|
||||||
{
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
AddStep($"Load {beatmapSets.Count} Beatmaps", () =>
|
AddStep($"Load {beatmapSets.Count} Beatmaps", () =>
|
||||||
{
|
{
|
||||||
|
carousel.Filter(new FilterCriteria());
|
||||||
carousel.BeatmapSetsChanged = () => changed = true;
|
carousel.BeatmapSetsChanged = () => changed = true;
|
||||||
carousel.BeatmapSets = beatmapSets;
|
carousel.BeatmapSets = beatmapSets;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("Wait for load", () => changed);
|
AddUntilStep("Wait for load", () => changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureRandomFetchSuccess() =>
|
private void ensureRandomFetchSuccess() =>
|
||||||
AddAssert("ensure prev random fetch worked", () => selectedSets.Peek() == carousel.SelectedBeatmapSet);
|
AddAssert("ensure prev random fetch worked", () => selectedSets.Peek() == carousel.SelectedBeatmapSet);
|
||||||
|
|
||||||
private void checkSelected(int set, int? diff = null) =>
|
private void waitForSelection(int set, int? diff = null) =>
|
||||||
AddAssert($"selected is set{set}{(diff.HasValue ? $" diff{diff.Value}" : "")}", () =>
|
AddUntilStep($"selected is set{set}{(diff.HasValue ? $" diff{diff.Value}" : "")}", () =>
|
||||||
{
|
{
|
||||||
if (diff != null)
|
if (diff != null)
|
||||||
return carousel.SelectedBeatmap == carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Skip(diff.Value - 1).First();
|
return carousel.SelectedBeatmap == carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Skip(diff.Value - 1).First();
|
||||||
@ -173,34 +162,40 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test keyboard traversal
|
/// Test keyboard traversal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void testTraversal()
|
[Test]
|
||||||
|
public void TestTraversal()
|
||||||
{
|
{
|
||||||
|
loadBeatmaps();
|
||||||
|
|
||||||
advanceSelection(direction: 1, diff: false);
|
advanceSelection(direction: 1, diff: false);
|
||||||
checkSelected(1, 1);
|
waitForSelection(1, 1);
|
||||||
|
|
||||||
advanceSelection(direction: 1, diff: true);
|
advanceSelection(direction: 1, diff: true);
|
||||||
checkSelected(1, 2);
|
waitForSelection(1, 2);
|
||||||
|
|
||||||
advanceSelection(direction: -1, diff: false);
|
advanceSelection(direction: -1, diff: false);
|
||||||
checkSelected(set_count, 1);
|
waitForSelection(set_count, 1);
|
||||||
|
|
||||||
advanceSelection(direction: -1, diff: true);
|
advanceSelection(direction: -1, diff: true);
|
||||||
checkSelected(set_count - 1, 3);
|
waitForSelection(set_count - 1, 3);
|
||||||
|
|
||||||
advanceSelection(diff: false);
|
advanceSelection(diff: false);
|
||||||
advanceSelection(diff: false);
|
advanceSelection(diff: false);
|
||||||
checkSelected(1, 2);
|
waitForSelection(1, 2);
|
||||||
|
|
||||||
advanceSelection(direction: -1, diff: true);
|
advanceSelection(direction: -1, diff: true);
|
||||||
advanceSelection(direction: -1, diff: true);
|
advanceSelection(direction: -1, diff: true);
|
||||||
checkSelected(set_count, 3);
|
waitForSelection(set_count, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test filtering
|
/// Test filtering
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void testFiltering()
|
[Test]
|
||||||
|
public void TestFiltering()
|
||||||
{
|
{
|
||||||
|
loadBeatmaps();
|
||||||
|
|
||||||
// basic filtering
|
// basic filtering
|
||||||
|
|
||||||
setSelected(1, 1);
|
setSelected(1, 1);
|
||||||
@ -208,10 +203,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddStep("Filter", () => carousel.Filter(new FilterCriteria { SearchText = "set #3!" }, false));
|
AddStep("Filter", () => carousel.Filter(new FilterCriteria { SearchText = "set #3!" }, false));
|
||||||
checkVisibleItemCount(diff: false, count: 1);
|
checkVisibleItemCount(diff: false, count: 1);
|
||||||
checkVisibleItemCount(diff: true, count: 3);
|
checkVisibleItemCount(diff: true, count: 3);
|
||||||
checkSelected(3, 1);
|
waitForSelection(3, 1);
|
||||||
|
|
||||||
advanceSelection(diff: true, count: 4);
|
advanceSelection(diff: true, count: 4);
|
||||||
checkSelected(3, 2);
|
waitForSelection(3, 2);
|
||||||
|
|
||||||
AddStep("Un-filter (debounce)", () => carousel.Filter(new FilterCriteria()));
|
AddStep("Un-filter (debounce)", () => carousel.Filter(new FilterCriteria()));
|
||||||
AddUntilStep("Wait for debounce", () => !carousel.PendingFilterTask);
|
AddUntilStep("Wait for debounce", () => !carousel.PendingFilterTask);
|
||||||
@ -222,10 +217,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
setSelected(1, 2);
|
setSelected(1, 2);
|
||||||
AddStep("Filter some difficulties", () => carousel.Filter(new FilterCriteria { SearchText = "Normal" }, false));
|
AddStep("Filter some difficulties", () => carousel.Filter(new FilterCriteria { SearchText = "Normal" }, false));
|
||||||
checkSelected(1, 1);
|
waitForSelection(1, 1);
|
||||||
|
|
||||||
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
||||||
checkSelected(1, 1);
|
waitForSelection(1, 1);
|
||||||
|
|
||||||
AddStep("Filter all", () => carousel.Filter(new FilterCriteria { SearchText = "Dingo" }, false));
|
AddStep("Filter all", () => carousel.Filter(new FilterCriteria { SearchText = "Dingo" }, false));
|
||||||
|
|
||||||
@ -242,13 +237,31 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
||||||
|
|
||||||
AddAssert("Selection is non-null", () => currentSelection != null);
|
AddAssert("Selection is non-null", () => currentSelection != null);
|
||||||
|
|
||||||
|
setSelected(1, 3);
|
||||||
|
AddStep("Apply a range filter", () => carousel.Filter(new FilterCriteria
|
||||||
|
{
|
||||||
|
SearchText = "#3",
|
||||||
|
StarDifficulty = new FilterCriteria.OptionalRange<double>
|
||||||
|
{
|
||||||
|
Min = 2,
|
||||||
|
Max = 5.5,
|
||||||
|
IsLowerInclusive = true
|
||||||
|
}
|
||||||
|
}, false));
|
||||||
|
waitForSelection(3, 2);
|
||||||
|
|
||||||
|
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test random non-repeating algorithm
|
/// Test random non-repeating algorithm
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void testRandom()
|
[Test]
|
||||||
|
public void TestRandom()
|
||||||
{
|
{
|
||||||
|
loadBeatmaps();
|
||||||
|
|
||||||
setSelected(1, 1);
|
setSelected(1, 1);
|
||||||
|
|
||||||
nextRandom();
|
nextRandom();
|
||||||
@ -284,8 +297,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test adding and removing beatmap sets
|
/// Test adding and removing beatmap sets
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void testAddRemove()
|
[Test]
|
||||||
|
public void TestAddRemove()
|
||||||
{
|
{
|
||||||
|
loadBeatmaps();
|
||||||
|
|
||||||
AddStep("Add new set", () => carousel.UpdateBeatmapSet(createTestBeatmapSet(set_count + 1)));
|
AddStep("Add new set", () => carousel.UpdateBeatmapSet(createTestBeatmapSet(set_count + 1)));
|
||||||
AddStep("Add new set", () => carousel.UpdateBeatmapSet(createTestBeatmapSet(set_count + 2)));
|
AddStep("Add new set", () => carousel.UpdateBeatmapSet(createTestBeatmapSet(set_count + 2)));
|
||||||
|
|
||||||
@ -301,31 +317,37 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
checkVisibleItemCount(false, set_count);
|
checkVisibleItemCount(false, set_count);
|
||||||
|
|
||||||
checkSelected(set_count);
|
waitForSelection(set_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test sorting
|
/// Test sorting
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void testSorting()
|
[Test]
|
||||||
|
public void TestSorting()
|
||||||
{
|
{
|
||||||
|
loadBeatmaps();
|
||||||
|
|
||||||
AddStep("Sort by author", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Author }, false));
|
AddStep("Sort by author", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Author }, false));
|
||||||
AddAssert("Check zzzzz is at bottom", () => carousel.BeatmapSets.Last().Metadata.AuthorString == "zzzzz");
|
AddAssert("Check zzzzz is at bottom", () => carousel.BeatmapSets.Last().Metadata.AuthorString == "zzzzz");
|
||||||
AddStep("Sort by artist", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Artist }, false));
|
AddStep("Sort by artist", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Artist }, false));
|
||||||
AddAssert($"Check #{set_count} is at bottom", () => carousel.BeatmapSets.Last().Metadata.Title.EndsWith($"#{set_count}!"));
|
AddAssert($"Check #{set_count} is at bottom", () => carousel.BeatmapSets.Last().Metadata.Title.EndsWith($"#{set_count}!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testRemoveAll()
|
[Test]
|
||||||
|
public void TestRemoveAll()
|
||||||
{
|
{
|
||||||
|
loadBeatmaps();
|
||||||
|
|
||||||
setSelected(2, 1);
|
setSelected(2, 1);
|
||||||
AddAssert("Selection is non-null", () => currentSelection != null);
|
AddAssert("Selection is non-null", () => currentSelection != null);
|
||||||
|
|
||||||
AddStep("Remove selected", () => carousel.RemoveBeatmapSet(carousel.SelectedBeatmapSet));
|
AddStep("Remove selected", () => carousel.RemoveBeatmapSet(carousel.SelectedBeatmapSet));
|
||||||
checkSelected(2);
|
waitForSelection(2);
|
||||||
|
|
||||||
AddStep("Remove first", () => carousel.RemoveBeatmapSet(carousel.BeatmapSets.First()));
|
AddStep("Remove first", () => carousel.RemoveBeatmapSet(carousel.BeatmapSets.First()));
|
||||||
AddStep("Remove first", () => carousel.RemoveBeatmapSet(carousel.BeatmapSets.First()));
|
AddStep("Remove first", () => carousel.RemoveBeatmapSet(carousel.BeatmapSets.First()));
|
||||||
checkSelected(1);
|
waitForSelection(1);
|
||||||
|
|
||||||
AddUntilStep("Remove all", () =>
|
AddUntilStep("Remove all", () =>
|
||||||
{
|
{
|
||||||
@ -338,8 +360,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
checkNoSelection();
|
checkNoSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testEmptyTraversal()
|
[Test]
|
||||||
|
public void TestEmptyTraversal()
|
||||||
{
|
{
|
||||||
|
loadBeatmaps(new List<BeatmapSetInfo>());
|
||||||
|
|
||||||
advanceSelection(direction: 1, diff: false);
|
advanceSelection(direction: 1, diff: false);
|
||||||
checkNoSelection();
|
checkNoSelection();
|
||||||
|
|
||||||
@ -353,26 +378,29 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
checkNoSelection();
|
checkNoSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testHiding()
|
[Test]
|
||||||
|
public void TestHiding()
|
||||||
{
|
{
|
||||||
var hidingSet = createTestBeatmapSet(1);
|
BeatmapSetInfo hidingSet = createTestBeatmapSet(1);
|
||||||
hidingSet.Beatmaps[1].Hidden = true;
|
hidingSet.Beatmaps[1].Hidden = true;
|
||||||
AddStep("Add set with diff 2 hidden", () => carousel.UpdateBeatmapSet(hidingSet));
|
|
||||||
|
loadBeatmaps(new List<BeatmapSetInfo> { hidingSet });
|
||||||
|
|
||||||
setSelected(1, 1);
|
setSelected(1, 1);
|
||||||
|
|
||||||
checkVisibleItemCount(true, 2);
|
checkVisibleItemCount(true, 2);
|
||||||
advanceSelection(true);
|
advanceSelection(true);
|
||||||
checkSelected(1, 3);
|
waitForSelection(1, 3);
|
||||||
|
|
||||||
setHidden(3);
|
setHidden(3);
|
||||||
checkSelected(1, 1);
|
waitForSelection(1, 1);
|
||||||
|
|
||||||
setHidden(2, false);
|
setHidden(2, false);
|
||||||
advanceSelection(true);
|
advanceSelection(true);
|
||||||
checkSelected(1, 2);
|
waitForSelection(1, 2);
|
||||||
|
|
||||||
setHidden(1);
|
setHidden(1);
|
||||||
checkSelected(1, 2);
|
waitForSelection(1, 2);
|
||||||
|
|
||||||
setHidden(2);
|
setHidden(2);
|
||||||
checkNoSelection();
|
checkNoSelection();
|
||||||
@ -387,7 +415,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testSelectingFilteredRuleset()
|
[Test]
|
||||||
|
public void TestSelectingFilteredRuleset()
|
||||||
{
|
{
|
||||||
var testMixed = createTestBeatmapSet(set_count + 1);
|
var testMixed = createTestBeatmapSet(set_count + 1);
|
||||||
AddStep("add mixed ruleset beatmapset", () =>
|
AddStep("add mixed ruleset beatmapset", () =>
|
||||||
@ -422,14 +451,16 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddStep("remove single ruleset set", () => carousel.RemoveBeatmapSet(testSingle));
|
AddStep("remove single ruleset set", () => carousel.RemoveBeatmapSet(testSingle));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testCarouselRootIsRandom()
|
[Test]
|
||||||
|
public void TestCarouselRootIsRandom()
|
||||||
{
|
{
|
||||||
List<BeatmapSetInfo> beatmapSets = new List<BeatmapSetInfo>();
|
List<BeatmapSetInfo> manySets = new List<BeatmapSetInfo>();
|
||||||
|
|
||||||
for (int i = 1; i <= 50; i++)
|
for (int i = 1; i <= 50; i++)
|
||||||
beatmapSets.Add(createTestBeatmapSet(i));
|
manySets.Add(createTestBeatmapSet(i));
|
||||||
|
|
||||||
|
loadBeatmaps(manySets);
|
||||||
|
|
||||||
loadBeatmaps(beatmapSets);
|
|
||||||
advanceSelection(direction: 1, diff: false);
|
advanceSelection(direction: 1, diff: false);
|
||||||
checkNonmatchingFilter();
|
checkNonmatchingFilter();
|
||||||
checkNonmatchingFilter();
|
checkNonmatchingFilter();
|
||||||
|
@ -22,6 +22,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
public TestSceneBackButton()
|
public TestSceneBackButton()
|
||||||
{
|
{
|
||||||
BackButton button;
|
BackButton button;
|
||||||
|
BackButton.Receptor receptor = new BackButton.Receptor();
|
||||||
|
|
||||||
Child = new Container
|
Child = new Container
|
||||||
{
|
{
|
||||||
@ -31,12 +32,13 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
Masking = true,
|
Masking = true,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
receptor,
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.SlateGray
|
Colour = Color4.SlateGray
|
||||||
},
|
},
|
||||||
button = new BackButton
|
button = new BackButton(receptor)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
|
@ -0,0 +1,89 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
|
{
|
||||||
|
public class TestSceneLabelledComponent : OsuTestScene
|
||||||
|
{
|
||||||
|
[TestCase(false)]
|
||||||
|
[TestCase(true)]
|
||||||
|
public void TestPadded(bool hasDescription) => createPaddedComponent(hasDescription);
|
||||||
|
|
||||||
|
[TestCase(false)]
|
||||||
|
[TestCase(true)]
|
||||||
|
public void TestNonPadded(bool hasDescription) => createPaddedComponent(hasDescription, false);
|
||||||
|
|
||||||
|
private void createPaddedComponent(bool hasDescription = false, bool padded = true)
|
||||||
|
{
|
||||||
|
AddStep("create component", () =>
|
||||||
|
{
|
||||||
|
LabelledComponent<Drawable> component;
|
||||||
|
|
||||||
|
Child = new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Width = 500,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Child = component = padded ? (LabelledComponent<Drawable>)new PaddedLabelledComponent() : new NonPaddedLabelledComponent(),
|
||||||
|
};
|
||||||
|
|
||||||
|
component.Label = "a sample component";
|
||||||
|
component.Description = hasDescription ? "this text describes the component" : string.Empty;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PaddedLabelledComponent : LabelledComponent<Drawable>
|
||||||
|
{
|
||||||
|
public PaddedLabelledComponent()
|
||||||
|
: base(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Drawable CreateComponent() => new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Colour = Color4.Red,
|
||||||
|
Text = @"(( Component ))"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private class NonPaddedLabelledComponent : LabelledComponent<Drawable>
|
||||||
|
{
|
||||||
|
public NonPaddedLabelledComponent()
|
||||||
|
: base(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Drawable CreateComponent() => new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 40,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.SlateGray
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Colour = Color4.Red,
|
||||||
|
Text = @"(( Component ))"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,8 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Screens.Edit.Setup.Components.LabelledComponents;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.UserInterface
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
{
|
{
|
||||||
@ -19,6 +20,36 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
typeof(LabelledTextBox),
|
typeof(LabelledTextBox),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[TestCase(false)]
|
||||||
|
[TestCase(true)]
|
||||||
|
public void TestTextBox(bool hasDescription) => createTextBox(hasDescription);
|
||||||
|
|
||||||
|
private void createTextBox(bool hasDescription = false)
|
||||||
|
{
|
||||||
|
AddStep("create component", () =>
|
||||||
|
{
|
||||||
|
LabelledComponent<OsuTextBox> component;
|
||||||
|
|
||||||
|
Child = new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Width = 500,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Child = component = new LabelledTextBox
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Label = "Testing text",
|
||||||
|
PlaceholderText = "This is definitely working as intended",
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
component.Label = "a sample component";
|
||||||
|
component.Description = hasDescription ? "this text describes the component" : string.Empty;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -32,7 +63,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
LabelText = "Testing text",
|
Label = "Testing text",
|
||||||
PlaceholderText = "This is definitely working as intended",
|
PlaceholderText = "This is definitely working as intended",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
17
osu.Game.Tournament.Tests/Screens/TestSceneSetupScreen.cs
Normal file
17
osu.Game.Tournament.Tests/Screens/TestSceneSetupScreen.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Tournament.Screens;
|
||||||
|
|
||||||
|
namespace osu.Game.Tournament.Tests.Screens
|
||||||
|
{
|
||||||
|
public class TestSceneSetupScreen : TournamentTestScene
|
||||||
|
{
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
Add(new SetupScreen());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Platform.Windows;
|
using osu.Framework.Platform.Windows;
|
||||||
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Legacy;
|
using osu.Game.Beatmaps.Legacy;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
@ -26,34 +27,44 @@ namespace osu.Game.Tournament.IPC
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
protected RulesetStore Rulesets { get; private set; }
|
protected RulesetStore Rulesets { get; private set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private GameHost host { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private LadderInfo ladder { get; set; }
|
||||||
|
|
||||||
private int lastBeatmapId;
|
private int lastBeatmapId;
|
||||||
|
private ScheduledDelegate scheduled;
|
||||||
|
|
||||||
|
public Storage Storage { get; private set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LadderInfo ladder, GameHost host)
|
private void load()
|
||||||
{
|
{
|
||||||
StableStorage stable;
|
LocateStableStorage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Storage LocateStableStorage()
|
||||||
|
{
|
||||||
|
scheduled?.Cancel();
|
||||||
|
|
||||||
|
Storage = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stable = new StableStorage(host as DesktopGameHost);
|
Storage = new StableStorage(host as DesktopGameHost);
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Logger.Error(e, "Stable installation could not be found; disabling file based IPC");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const string file_ipc_filename = "ipc.txt";
|
const string file_ipc_filename = "ipc.txt";
|
||||||
const string file_ipc_state_filename = "ipc-state.txt";
|
const string file_ipc_state_filename = "ipc-state.txt";
|
||||||
const string file_ipc_scores_filename = "ipc-scores.txt";
|
const string file_ipc_scores_filename = "ipc-scores.txt";
|
||||||
const string file_ipc_channel_filename = "ipc-channel.txt";
|
const string file_ipc_channel_filename = "ipc-channel.txt";
|
||||||
|
|
||||||
if (stable.Exists(file_ipc_filename))
|
if (Storage.Exists(file_ipc_filename))
|
||||||
Scheduler.AddDelayed(delegate
|
scheduled = Scheduler.AddDelayed(delegate
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var stream = stable.GetStream(file_ipc_filename))
|
using (var stream = Storage.GetStream(file_ipc_filename))
|
||||||
using (var sr = new StreamReader(stream))
|
using (var sr = new StreamReader(stream))
|
||||||
{
|
{
|
||||||
var beatmapId = int.Parse(sr.ReadLine());
|
var beatmapId = int.Parse(sr.ReadLine());
|
||||||
@ -85,7 +96,7 @@ namespace osu.Game.Tournament.IPC
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var stream = stable.GetStream(file_ipc_channel_filename))
|
using (var stream = Storage.GetStream(file_ipc_channel_filename))
|
||||||
using (var sr = new StreamReader(stream))
|
using (var sr = new StreamReader(stream))
|
||||||
{
|
{
|
||||||
ChatChannel.Value = sr.ReadLine();
|
ChatChannel.Value = sr.ReadLine();
|
||||||
@ -98,7 +109,7 @@ namespace osu.Game.Tournament.IPC
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var stream = stable.GetStream(file_ipc_state_filename))
|
using (var stream = Storage.GetStream(file_ipc_state_filename))
|
||||||
using (var sr = new StreamReader(stream))
|
using (var sr = new StreamReader(stream))
|
||||||
{
|
{
|
||||||
State.Value = (TourneyState)Enum.Parse(typeof(TourneyState), sr.ReadLine());
|
State.Value = (TourneyState)Enum.Parse(typeof(TourneyState), sr.ReadLine());
|
||||||
@ -111,7 +122,7 @@ namespace osu.Game.Tournament.IPC
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var stream = stable.GetStream(file_ipc_scores_filename))
|
using (var stream = Storage.GetStream(file_ipc_scores_filename))
|
||||||
using (var sr = new StreamReader(stream))
|
using (var sr = new StreamReader(stream))
|
||||||
{
|
{
|
||||||
Score1.Value = int.Parse(sr.ReadLine());
|
Score1.Value = int.Parse(sr.ReadLine());
|
||||||
@ -124,6 +135,13 @@ namespace osu.Game.Tournament.IPC
|
|||||||
}
|
}
|
||||||
}, 250, true);
|
}, 250, true);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Error(e, "Stable installation could not be found; disabling file based IPC");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Storage;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A method of accessing an osu-stable install in a controlled fashion.
|
/// A method of accessing an osu-stable install in a controlled fashion.
|
||||||
|
142
osu.Game.Tournament/Screens/SetupScreen.cs
Normal file
142
osu.Game.Tournament/Screens/SetupScreen.cs
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
// 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 osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Tournament.IPC;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tournament.Screens
|
||||||
|
{
|
||||||
|
public class SetupScreen : TournamentScreen, IProvideVideo
|
||||||
|
{
|
||||||
|
private FillFlowContainer fillFlow;
|
||||||
|
|
||||||
|
private LoginOverlay loginOverlay;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private MatchIPCInfo ipc { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
InternalChild = fillFlow = new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Padding = new MarginPadding(10),
|
||||||
|
Spacing = new Vector2(10),
|
||||||
|
};
|
||||||
|
|
||||||
|
api.LocalUser.BindValueChanged(_ => Schedule(reload));
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void reload()
|
||||||
|
{
|
||||||
|
var fileBasedIpc = ipc as FileBasedIPC;
|
||||||
|
|
||||||
|
fillFlow.Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new ActionableInfo
|
||||||
|
{
|
||||||
|
Label = "Current IPC source",
|
||||||
|
ButtonText = "Refresh",
|
||||||
|
Action = () =>
|
||||||
|
{
|
||||||
|
fileBasedIpc?.LocateStableStorage();
|
||||||
|
reload();
|
||||||
|
},
|
||||||
|
Value = fileBasedIpc?.Storage?.GetFullPath(string.Empty) ?? "Not found",
|
||||||
|
Failing = fileBasedIpc?.Storage == null,
|
||||||
|
Description = "The osu!stable installation which is currently being used as a data source. If a source is not found, make sure you have created an empty ipc.txt in your stable cutting-edge installation, and that it is registered as the default osu! install."
|
||||||
|
},
|
||||||
|
new ActionableInfo
|
||||||
|
{
|
||||||
|
Label = "Current User",
|
||||||
|
ButtonText = "Change Login",
|
||||||
|
Action = () =>
|
||||||
|
{
|
||||||
|
api.Logout();
|
||||||
|
|
||||||
|
if (loginOverlay == null)
|
||||||
|
{
|
||||||
|
AddInternal(loginOverlay = new LoginOverlay
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
loginOverlay.State.Value = Visibility.Visible;
|
||||||
|
},
|
||||||
|
Value = api?.LocalUser.Value.Username,
|
||||||
|
Failing = api?.IsLoggedIn != true,
|
||||||
|
Description = "In order to access the API and display metadata, a login is required."
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ActionableInfo : LabelledComponent<Drawable>
|
||||||
|
{
|
||||||
|
private OsuButton button;
|
||||||
|
|
||||||
|
public ActionableInfo()
|
||||||
|
: base(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ButtonText
|
||||||
|
{
|
||||||
|
set => button.Text = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Value
|
||||||
|
{
|
||||||
|
set => valueText.Text = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Failing
|
||||||
|
{
|
||||||
|
set => valueText.Colour = value ? Color4.Red : Color4.White;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action Action;
|
||||||
|
|
||||||
|
private OsuSpriteText valueText;
|
||||||
|
|
||||||
|
protected override Drawable CreateComponent() => new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
valueText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
},
|
||||||
|
button = new TriangleButton
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Size = new Vector2(100, 30),
|
||||||
|
Action = () => Action?.Invoke()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -69,6 +69,7 @@ namespace osu.Game.Tournament
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
new SetupScreen(),
|
||||||
new ScheduleScreen(),
|
new ScheduleScreen(),
|
||||||
new LadderScreen(),
|
new LadderScreen(),
|
||||||
new LadderEditorScreen(),
|
new LadderEditorScreen(),
|
||||||
@ -106,6 +107,8 @@ namespace osu.Game.Tournament
|
|||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Setup", Action = () => SetScreen(typeof(SetupScreen)) },
|
||||||
|
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
||||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Team Editor", Action = () => SetScreen(typeof(TeamEditorScreen)) },
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Team Editor", Action = () => SetScreen(typeof(TeamEditorScreen)) },
|
||||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Rounds Editor", Action = () => SetScreen(typeof(RoundEditorScreen)) },
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Rounds Editor", Action = () => SetScreen(typeof(RoundEditorScreen)) },
|
||||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) },
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) },
|
||||||
@ -127,7 +130,7 @@ namespace osu.Game.Tournament
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
SetScreen(typeof(ScheduleScreen));
|
SetScreen(typeof(SetupScreen));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetScreen(Type screenType)
|
public void SetScreen(Type screenType)
|
||||||
|
@ -11,6 +11,6 @@
|
|||||||
<ProjectReference Include="..\osu.Game\osu.Game.csproj" />
|
<ProjectReference Include="..\osu.Game\osu.Game.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Microsoft.Win32.Registry" Version="4.5.0" />
|
<PackageReference Include="Microsoft.Win32.Registry" Version="4.6.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
@ -45,25 +44,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public virtual void PostProcess()
|
public virtual void PostProcess()
|
||||||
{
|
{
|
||||||
void updateNestedCombo(HitObject obj, int comboIndex, int indexInCurrentCombo)
|
|
||||||
{
|
|
||||||
if (obj is IHasComboInformation objectComboInfo)
|
|
||||||
{
|
|
||||||
objectComboInfo.ComboIndex = comboIndex;
|
|
||||||
objectComboInfo.IndexInCurrentCombo = indexInCurrentCombo;
|
|
||||||
foreach (var nestedObject in obj.NestedHitObjects)
|
|
||||||
updateNestedCombo(nestedObject, comboIndex, indexInCurrentCombo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var hitObject in Beatmap.HitObjects)
|
|
||||||
{
|
|
||||||
if (hitObject is IHasComboInformation objectComboInfo)
|
|
||||||
{
|
|
||||||
foreach (var nested in hitObject.NestedHitObjects)
|
|
||||||
updateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using System.Diagnostics;
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A <see cref="Bindable{T}"/> for the <see cref="OsuGame"/> beatmap.
|
|
||||||
/// This should be used sparingly in-favour of <see cref="IBindable{WorkingBeatmap}"/>.
|
|
||||||
/// </summary>
|
|
||||||
public abstract class BindableBeatmap : NonNullableBindable<WorkingBeatmap>
|
|
||||||
{
|
|
||||||
private WorkingBeatmap lastBeatmap;
|
|
||||||
|
|
||||||
protected BindableBeatmap(WorkingBeatmap defaultValue)
|
|
||||||
: base(defaultValue)
|
|
||||||
{
|
|
||||||
BindValueChanged(b => updateAudioTrack(b.NewValue), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateAudioTrack(WorkingBeatmap beatmap)
|
|
||||||
{
|
|
||||||
var trackLoaded = lastBeatmap?.TrackLoaded ?? false;
|
|
||||||
|
|
||||||
// compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
|
|
||||||
if (!trackLoaded || lastBeatmap?.Track != beatmap.Track)
|
|
||||||
{
|
|
||||||
if (trackLoaded)
|
|
||||||
{
|
|
||||||
Debug.Assert(lastBeatmap != null);
|
|
||||||
Debug.Assert(lastBeatmap.Track != null);
|
|
||||||
|
|
||||||
lastBeatmap.RecycleTrack();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lastBeatmap = beatmap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
22
osu.Game/Configuration/InMemoryConfigManager.cs
Normal file
22
osu.Game/Configuration/InMemoryConfigManager.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
|
||||||
|
namespace osu.Game.Configuration
|
||||||
|
{
|
||||||
|
public class InMemoryConfigManager<T> : ConfigManager<T>
|
||||||
|
where T : struct
|
||||||
|
{
|
||||||
|
public InMemoryConfigManager()
|
||||||
|
{
|
||||||
|
InitialiseDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void PerformLoad()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool PerformSave() => true;
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@ namespace osu.Game.Configuration
|
|||||||
public enum IntroSequence
|
public enum IntroSequence
|
||||||
{
|
{
|
||||||
Circles,
|
Circles,
|
||||||
Triangles
|
Triangles,
|
||||||
|
Random
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
Set(OsuSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f);
|
Set(OsuSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f);
|
||||||
|
|
||||||
Set(OsuSetting.UIHoldActivationDelay, 200, 0, 500);
|
Set(OsuSetting.UIHoldActivationDelay, 200f, 0f, 500f, 50f);
|
||||||
|
|
||||||
Set(OsuSetting.IntroSequence, IntroSequence.Triangles);
|
Set(OsuSetting.IntroSequence, IntroSequence.Triangles);
|
||||||
}
|
}
|
||||||
|
21
osu.Game/Configuration/SessionStatics.cs
Normal file
21
osu.Game/Configuration/SessionStatics.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
namespace osu.Game.Configuration
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Stores global per-session statics. These will not be stored after exiting the game.
|
||||||
|
/// </summary>
|
||||||
|
public class SessionStatics : InMemoryConfigManager<Static>
|
||||||
|
{
|
||||||
|
protected override void InitialiseDefaults()
|
||||||
|
{
|
||||||
|
Set(Static.LoginOverlayDisplayed, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Static
|
||||||
|
{
|
||||||
|
LoginOverlayDisplayed,
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Humanizer;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
@ -110,7 +111,7 @@ namespace osu.Game.Database
|
|||||||
protected async Task Import(ProgressNotification notification, params string[] paths)
|
protected async Task Import(ProgressNotification notification, params string[] paths)
|
||||||
{
|
{
|
||||||
notification.Progress = 0;
|
notification.Progress = 0;
|
||||||
notification.Text = "Import is initialising...";
|
notification.Text = $"{HumanisedModelName.Humanize(LetterCasing.Title)} import is initialising...";
|
||||||
|
|
||||||
int current = 0;
|
int current = 0;
|
||||||
|
|
||||||
@ -146,7 +147,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
if (imported.Count == 0)
|
if (imported.Count == 0)
|
||||||
{
|
{
|
||||||
notification.Text = "Import failed!";
|
notification.Text = $"{HumanisedModelName.Humanize(LetterCasing.Title)} import failed!";
|
||||||
notification.State = ProgressNotificationState.Cancelled;
|
notification.State = ProgressNotificationState.Cancelled;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -399,8 +400,6 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
using (ContextFactory.GetForWrite())
|
|
||||||
{
|
|
||||||
foreach (var b in items)
|
foreach (var b in items)
|
||||||
{
|
{
|
||||||
if (notification.State == ProgressNotificationState.Cancelled)
|
if (notification.State == ProgressNotificationState.Cancelled)
|
||||||
@ -413,7 +412,6 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
notification.Progress = (float)i / items.Count;
|
notification.Progress = (float)i / items.Count;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
notification.State = ProgressNotificationState.Completed;
|
notification.State = ProgressNotificationState.Completed;
|
||||||
}
|
}
|
||||||
@ -438,8 +436,6 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
using (ContextFactory.GetForWrite())
|
|
||||||
{
|
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
if (notification.State == ProgressNotificationState.Cancelled)
|
if (notification.State == ProgressNotificationState.Cancelled)
|
||||||
@ -452,7 +448,6 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
notification.Progress = (float)i / items.Count;
|
notification.Progress = (float)i / items.Count;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
notification.State = ProgressNotificationState.Completed;
|
notification.State = ProgressNotificationState.Completed;
|
||||||
}
|
}
|
||||||
@ -590,7 +585,7 @@ namespace osu.Game.Database
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="existing">The existing model.</param>
|
/// <param name="existing">The existing model.</param>
|
||||||
/// <param name="import">The newly imported model.</param>
|
/// <param name="import">The newly imported model.</param>
|
||||||
/// <returns>Whether the existing model should be restored and used. Returning false will delete the existing a force a re-import.</returns>
|
/// <returns>Whether the existing model should be restored and used. Returning false will delete the existing and force a re-import.</returns>
|
||||||
protected virtual bool CanUndelete(TModel existing, TModel import) => true;
|
protected virtual bool CanUndelete(TModel existing, TModel import) => true;
|
||||||
|
|
||||||
private DbSet<TModel> queryModel() => ContextFactory.Get().Set<TModel>();
|
private DbSet<TModel> queryModel() => ContextFactory.Get().Set<TModel>();
|
||||||
|
@ -30,12 +30,12 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
public Bindable<double> Progress = new BindableDouble();
|
public Bindable<double> Progress = new BindableDouble();
|
||||||
|
|
||||||
private Bindable<int> holdActivationDelay;
|
private Bindable<float> holdActivationDelay;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
holdActivationDelay = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay);
|
holdActivationDelay = config.GetBindable<float>(OsuSetting.UIHoldActivationDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void BeginConfirm()
|
protected void BeginConfirm()
|
||||||
|
@ -10,14 +10,16 @@ using osu.Game.Input.Bindings;
|
|||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public class BackButton : VisibilityContainer, IKeyBindingHandler<GlobalAction>
|
public class BackButton : VisibilityContainer
|
||||||
{
|
{
|
||||||
public Action Action;
|
public Action Action;
|
||||||
|
|
||||||
private readonly TwoLayerButton button;
|
private readonly TwoLayerButton button;
|
||||||
|
|
||||||
public BackButton()
|
public BackButton(Receptor receptor)
|
||||||
{
|
{
|
||||||
|
receptor.OnBackPressed = () => button.Click();
|
||||||
|
|
||||||
Size = TwoLayerButton.SIZE_EXTENDED;
|
Size = TwoLayerButton.SIZE_EXTENDED;
|
||||||
|
|
||||||
Child = button = new TwoLayerButton
|
Child = button = new TwoLayerButton
|
||||||
@ -37,19 +39,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
button.HoverColour = colours.PinkDark;
|
button.HoverColour = colours.PinkDark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnPressed(GlobalAction action)
|
|
||||||
{
|
|
||||||
if (action == GlobalAction.Back)
|
|
||||||
{
|
|
||||||
Action?.Invoke();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back;
|
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
button.MoveToX(0, 400, Easing.OutQuint);
|
button.MoveToX(0, 400, Easing.OutQuint);
|
||||||
@ -61,5 +50,24 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
button.MoveToX(-TwoLayerButton.SIZE_EXTENDED.X / 2, 400, Easing.OutQuint);
|
button.MoveToX(-TwoLayerButton.SIZE_EXTENDED.X / 2, 400, Easing.OutQuint);
|
||||||
button.FadeOut(400, Easing.OutQuint);
|
button.FadeOut(400, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Receptor : Drawable, IKeyBindingHandler<GlobalAction>
|
||||||
|
{
|
||||||
|
public Action OnBackPressed;
|
||||||
|
|
||||||
|
public bool OnPressed(GlobalAction action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case GlobalAction.Back:
|
||||||
|
OnBackPressed?.Invoke();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,22 +2,20 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using System;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A textbox which holds focus eagerly.
|
/// A textbox which holds focus eagerly.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FocusedTextBox : OsuTextBox
|
public class FocusedTextBox : OsuTextBox, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
public Action Exit;
|
|
||||||
|
|
||||||
private bool focus;
|
private bool focus;
|
||||||
|
|
||||||
private bool allowImmediateFocus => host?.OnScreenKeyboardOverlapsGameWindow != true;
|
private bool allowImmediateFocus => host?.OnScreenKeyboardOverlapsGameWindow != true;
|
||||||
@ -63,12 +61,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
if (!HasFocus) return false;
|
if (!HasFocus) return false;
|
||||||
|
|
||||||
if (e.Key == Key.Escape)
|
if (e.Key == Key.Escape)
|
||||||
return false; // disable the framework-level handling of escape key for confority (we use GlobalAction.Back).
|
return false; // disable the framework-level handling of escape key for conformity (we use GlobalAction.Back).
|
||||||
|
|
||||||
return base.OnKeyDown(e);
|
return base.OnKeyDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnPressed(GlobalAction action)
|
public bool OnPressed(GlobalAction action)
|
||||||
{
|
{
|
||||||
if (action == GlobalAction.Back)
|
if (action == GlobalAction.Back)
|
||||||
{
|
{
|
||||||
@ -79,14 +77,10 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnPressed(action);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void KillFocus()
|
public bool OnReleased(GlobalAction action) => false;
|
||||||
{
|
|
||||||
base.KillFocus();
|
|
||||||
Exit?.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool RequestsFocus => HoldFocus;
|
public override bool RequestsFocus => HoldFocus;
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,11 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Input.Bindings;
|
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Input.Bindings;
|
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public class OsuTextBox : TextBox, IKeyBindingHandler<GlobalAction>
|
public class OsuTextBox : TextBox
|
||||||
{
|
{
|
||||||
protected override float LeftRightPadding => 10;
|
protected override float LeftRightPadding => 10;
|
||||||
|
|
||||||
@ -57,18 +55,5 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) };
|
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) };
|
||||||
|
|
||||||
public virtual bool OnPressed(GlobalAction action)
|
|
||||||
{
|
|
||||||
if (action == GlobalAction.Back)
|
|
||||||
{
|
|
||||||
KillFocus();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
132
osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs
Normal file
132
osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterfaceV2
|
||||||
|
{
|
||||||
|
public abstract class LabelledComponent<T> : CompositeDrawable
|
||||||
|
where T : Drawable
|
||||||
|
{
|
||||||
|
protected const float CONTENT_PADDING_VERTICAL = 10;
|
||||||
|
protected const float CONTENT_PADDING_HORIZONTAL = 15;
|
||||||
|
protected const float CORNER_RADIUS = 15;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The component that is being displayed.
|
||||||
|
/// </summary>
|
||||||
|
protected readonly T Component;
|
||||||
|
|
||||||
|
private readonly OsuTextFlowContainer labelText;
|
||||||
|
private readonly OsuTextFlowContainer descriptionText;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new <see cref="LabelledComponent{T}"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="padded">Whether the component should be padded or should be expanded to the bounds of this <see cref="LabelledComponent{T}"/>.</param>
|
||||||
|
protected LabelledComponent(bool padded)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
CornerRadius = CORNER_RADIUS;
|
||||||
|
Masking = true;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = OsuColour.FromHex("1c2125"),
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Padding = padded
|
||||||
|
? new MarginPadding { Horizontal = CONTENT_PADDING_HORIZONTAL, Vertical = CONTENT_PADDING_VERTICAL }
|
||||||
|
: new MarginPadding { Left = CONTENT_PADDING_HORIZONTAL },
|
||||||
|
Spacing = new Vector2(0, 12),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new GridContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Content = new[]
|
||||||
|
{
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
labelText = new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(weight: FontWeight.Bold))
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding { Right = 20 }
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Child = Component = CreateComponent().With(d =>
|
||||||
|
{
|
||||||
|
d.Anchor = Anchor.CentreRight;
|
||||||
|
d.Origin = Anchor.CentreRight;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) },
|
||||||
|
ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }
|
||||||
|
},
|
||||||
|
descriptionText = new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold, italics: true))
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = new MarginPadding { Bottom = padded ? 0 : CONTENT_PADDING_VERTICAL },
|
||||||
|
Alpha = 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour osuColour)
|
||||||
|
{
|
||||||
|
descriptionText.Colour = osuColour.Yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Label
|
||||||
|
{
|
||||||
|
set => labelText.Text = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
descriptionText.Text = value;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(value))
|
||||||
|
descriptionText.Show();
|
||||||
|
else
|
||||||
|
descriptionText.Hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates the component that should be displayed.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The component.</returns>
|
||||||
|
protected abstract T CreateComponent();
|
||||||
|
}
|
||||||
|
}
|
49
osu.Game/Graphics/UserInterfaceV2/LabelledTextBox.cs
Normal file
49
osu.Game/Graphics/UserInterfaceV2/LabelledTextBox.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterfaceV2
|
||||||
|
{
|
||||||
|
public class LabelledTextBox : LabelledComponent<OsuTextBox>
|
||||||
|
{
|
||||||
|
public event TextBox.OnCommitHandler OnCommit;
|
||||||
|
|
||||||
|
public LabelledTextBox()
|
||||||
|
: base(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ReadOnly
|
||||||
|
{
|
||||||
|
set => Component.ReadOnly = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string PlaceholderText
|
||||||
|
{
|
||||||
|
set => Component.PlaceholderText = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
set => Component.Text = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Component.BorderColour = colours.Blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override OsuTextBox CreateComponent() => new OsuTextBox
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
CornerRadius = CORNER_RADIUS,
|
||||||
|
}.With(t => t.OnCommit += (sender, newText) => OnCommit?.Invoke(sender, newText));
|
||||||
|
}
|
||||||
|
}
|
@ -50,7 +50,16 @@ namespace osu.Game.IO
|
|||||||
string path = info.StoragePath;
|
string path = info.StoragePath;
|
||||||
|
|
||||||
// we may be re-adding a file to fix missing store entries.
|
// we may be re-adding a file to fix missing store entries.
|
||||||
if (!Storage.Exists(path))
|
bool requiresCopy = !Storage.Exists(path);
|
||||||
|
|
||||||
|
if (!requiresCopy)
|
||||||
|
{
|
||||||
|
// even if the file already exists, check the existing checksum for safety.
|
||||||
|
using (var stream = Storage.GetStream(path))
|
||||||
|
requiresCopy |= stream.ComputeSHA2Hash() != hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requiresCopy)
|
||||||
{
|
{
|
||||||
data.Seek(0, SeekOrigin.Begin);
|
data.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
|
@ -64,7 +64,10 @@ namespace osu.Game.Online.API
|
|||||||
public void Perform(IAPIProvider api)
|
public void Perform(IAPIProvider api)
|
||||||
{
|
{
|
||||||
if (!(api is APIAccess apiAccess))
|
if (!(api is APIAccess apiAccess))
|
||||||
throw new NotSupportedException($"A {nameof(APIAccess)} is required to perform requests.");
|
{
|
||||||
|
Fail(new NotSupportedException($"A {nameof(APIAccess)} is required to perform requests."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
API = apiAccess;
|
API = apiAccess;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
public string Url { get; set; }
|
public string Url { get; set; }
|
||||||
|
|
||||||
[JsonProperty("type")]
|
[JsonProperty("type")]
|
||||||
public string Type { get; set; }
|
public ChangelogEntryType Type { get; set; }
|
||||||
|
|
||||||
[JsonProperty("category")]
|
[JsonProperty("category")]
|
||||||
public string Category { get; set; }
|
public string Category { get; set; }
|
||||||
@ -44,4 +44,10 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
[JsonProperty("github_user")]
|
[JsonProperty("github_user")]
|
||||||
public APIChangelogUser GithubUser { get; set; }
|
public APIChangelogUser GithubUser { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ChangelogEntryType
|
||||||
|
{
|
||||||
|
Add,
|
||||||
|
Fix
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,6 @@ namespace osu.Game.Online.Chat
|
|||||||
{
|
{
|
||||||
public readonly Bindable<Channel> Channel = new Bindable<Channel>();
|
public readonly Bindable<Channel> Channel = new Bindable<Channel>();
|
||||||
|
|
||||||
public Action Exit;
|
|
||||||
|
|
||||||
private readonly FocusedTextBox textbox;
|
private readonly FocusedTextBox textbox;
|
||||||
|
|
||||||
protected ChannelManager ChannelManager;
|
protected ChannelManager ChannelManager;
|
||||||
@ -66,8 +64,6 @@ namespace osu.Game.Online.Chat
|
|||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
});
|
});
|
||||||
|
|
||||||
textbox.Exit += () => Exit?.Invoke();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel.BindValueChanged(channelChanged);
|
Channel.BindValueChanged(channelChanged);
|
||||||
@ -146,6 +142,7 @@ namespace osu.Game.Online.Chat
|
|||||||
|
|
||||||
protected override float HorizontalPadding => 10;
|
protected override float HorizontalPadding => 10;
|
||||||
protected override float MessagePadding => 120;
|
protected override float MessagePadding => 120;
|
||||||
|
protected override float TimestampPadding => 50;
|
||||||
|
|
||||||
public StandAloneMessage(Message message)
|
public StandAloneMessage(Message message)
|
||||||
: base(message)
|
: base(message)
|
||||||
|
@ -81,10 +81,14 @@ namespace osu.Game
|
|||||||
|
|
||||||
public readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
|
public readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
|
||||||
|
|
||||||
private OsuScreenStack screenStack;
|
protected OsuScreenStack ScreenStack;
|
||||||
|
|
||||||
|
protected BackButton BackButton;
|
||||||
|
|
||||||
|
protected SettingsPanel Settings;
|
||||||
|
|
||||||
private VolumeOverlay volume;
|
private VolumeOverlay volume;
|
||||||
private OsuLogo osuLogo;
|
private OsuLogo osuLogo;
|
||||||
private BackButton backButton;
|
|
||||||
|
|
||||||
private MainMenu menuScreen;
|
private MainMenu menuScreen;
|
||||||
|
|
||||||
@ -96,8 +100,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
private readonly string[] args;
|
private readonly string[] args;
|
||||||
|
|
||||||
private SettingsPanel settings;
|
|
||||||
|
|
||||||
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
||||||
|
|
||||||
private readonly List<OverlayContainer> toolbarElements = new List<OverlayContainer>();
|
private readonly List<OverlayContainer> toolbarElements = new List<OverlayContainer>();
|
||||||
@ -318,6 +320,8 @@ namespace osu.Game
|
|||||||
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
|
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual Loader CreateLoader() => new Loader();
|
||||||
|
|
||||||
#region Beatmap progression
|
#region Beatmap progression
|
||||||
|
|
||||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
|
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
|
||||||
@ -356,7 +360,7 @@ namespace osu.Game
|
|||||||
performFromMainMenuTask?.Cancel();
|
performFromMainMenuTask?.Cancel();
|
||||||
|
|
||||||
// if the current screen does not allow screen changing, give the user an option to try again later.
|
// if the current screen does not allow screen changing, give the user an option to try again later.
|
||||||
if (!bypassScreenAllowChecks && (screenStack.CurrentScreen as IOsuScreen)?.AllowExternalScreenChange == false)
|
if (!bypassScreenAllowChecks && (ScreenStack.CurrentScreen as IOsuScreen)?.AllowExternalScreenChange == false)
|
||||||
{
|
{
|
||||||
notifications.Post(new SimpleNotification
|
notifications.Post(new SimpleNotification
|
||||||
{
|
{
|
||||||
@ -374,7 +378,7 @@ namespace osu.Game
|
|||||||
CloseAllOverlays(false);
|
CloseAllOverlays(false);
|
||||||
|
|
||||||
// we may already be at the target screen type.
|
// we may already be at the target screen type.
|
||||||
if (targetScreen != null && screenStack.CurrentScreen?.GetType() == targetScreen)
|
if (targetScreen != null && ScreenStack.CurrentScreen?.GetType() == targetScreen)
|
||||||
{
|
{
|
||||||
action();
|
action();
|
||||||
return;
|
return;
|
||||||
@ -421,6 +425,7 @@ namespace osu.Game
|
|||||||
ScoreManager.PresentImport = items => PresentScore(items.First());
|
ScoreManager.PresentImport = items => PresentScore(items.First());
|
||||||
|
|
||||||
Container logoContainer;
|
Container logoContainer;
|
||||||
|
BackButton.Receptor receptor;
|
||||||
|
|
||||||
dependencies.CacheAs(idleTracker = new GameIdleTracker(6000));
|
dependencies.CacheAs(idleTracker = new GameIdleTracker(6000));
|
||||||
|
|
||||||
@ -437,15 +442,16 @@ namespace osu.Game
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both },
|
receptor = new BackButton.Receptor(),
|
||||||
backButton = new BackButton
|
ScreenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both },
|
||||||
|
BackButton = new BackButton(receptor)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
if ((screenStack.CurrentScreen as IOsuScreen)?.AllowBackButton == true)
|
if ((ScreenStack.CurrentScreen as IOsuScreen)?.AllowBackButton == true)
|
||||||
screenStack.Exit();
|
ScreenStack.Exit();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
logoContainer = new Container { RelativeSizeAxes = Axes.Both },
|
logoContainer = new Container { RelativeSizeAxes = Axes.Both },
|
||||||
@ -458,18 +464,15 @@ namespace osu.Game
|
|||||||
idleTracker
|
idleTracker
|
||||||
});
|
});
|
||||||
|
|
||||||
screenStack.ScreenPushed += screenPushed;
|
ScreenStack.ScreenPushed += screenPushed;
|
||||||
screenStack.ScreenExited += screenExited;
|
ScreenStack.ScreenExited += screenExited;
|
||||||
|
|
||||||
loadComponentSingleFile(osuLogo, logo =>
|
loadComponentSingleFile(osuLogo, logo =>
|
||||||
{
|
{
|
||||||
logoContainer.Add(logo);
|
logoContainer.Add(logo);
|
||||||
|
|
||||||
// Loader has to be created after the logo has finished loading as Loader performs logo transformations on entering.
|
// Loader has to be created after the logo has finished loading as Loader performs logo transformations on entering.
|
||||||
screenStack.Push(new Loader
|
ScreenStack.Push(CreateLoader().With(l => l.RelativeSizeAxes = Axes.Both));
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
loadComponentSingleFile(Toolbar = new Toolbar
|
loadComponentSingleFile(Toolbar = new Toolbar
|
||||||
@ -504,7 +507,7 @@ namespace osu.Game
|
|||||||
loadComponentSingleFile(social = new SocialOverlay(), overlayContent.Add, true);
|
loadComponentSingleFile(social = new SocialOverlay(), overlayContent.Add, true);
|
||||||
loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal, true);
|
loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal, true);
|
||||||
loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add, true);
|
loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add, true);
|
||||||
loadComponentSingleFile(settings = new SettingsOverlay { GetToolbarHeight = () => ToolbarOffset }, leftFloatingOverlayContent.Add, true);
|
loadComponentSingleFile(Settings = new SettingsOverlay { GetToolbarHeight = () => ToolbarOffset }, leftFloatingOverlayContent.Add, true);
|
||||||
var changelogOverlay = loadComponentSingleFile(new ChangelogOverlay(), overlayContent.Add, true);
|
var changelogOverlay = loadComponentSingleFile(new ChangelogOverlay(), overlayContent.Add, true);
|
||||||
loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add, true);
|
loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add, true);
|
||||||
loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add, true);
|
loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add, true);
|
||||||
@ -535,7 +538,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
Add(externalLinkOpener = new ExternalLinkOpener());
|
Add(externalLinkOpener = new ExternalLinkOpener());
|
||||||
|
|
||||||
var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications };
|
var singleDisplaySideOverlays = new OverlayContainer[] { Settings, notifications };
|
||||||
overlays.AddRange(singleDisplaySideOverlays);
|
overlays.AddRange(singleDisplaySideOverlays);
|
||||||
|
|
||||||
foreach (var overlay in singleDisplaySideOverlays)
|
foreach (var overlay in singleDisplaySideOverlays)
|
||||||
@ -588,7 +591,7 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
float offset = 0;
|
float offset = 0;
|
||||||
|
|
||||||
if (settings.State.Value == Visibility.Visible)
|
if (Settings.State.Value == Visibility.Visible)
|
||||||
offset += ToolbarButton.WIDTH / 2;
|
offset += ToolbarButton.WIDTH / 2;
|
||||||
if (notifications.State.Value == Visibility.Visible)
|
if (notifications.State.Value == Visibility.Visible)
|
||||||
offset -= ToolbarButton.WIDTH / 2;
|
offset -= ToolbarButton.WIDTH / 2;
|
||||||
@ -596,7 +599,7 @@ namespace osu.Game
|
|||||||
screenContainer.MoveToX(offset, SettingsPanel.TRANSITION_LENGTH, Easing.OutQuint);
|
screenContainer.MoveToX(offset, SettingsPanel.TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.State.ValueChanged += _ => updateScreenOffset();
|
Settings.State.ValueChanged += _ => updateScreenOffset();
|
||||||
notifications.State.ValueChanged += _ => updateScreenOffset();
|
notifications.State.ValueChanged += _ => updateScreenOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -741,7 +744,7 @@ namespace osu.Game
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case GlobalAction.ToggleSettings:
|
case GlobalAction.ToggleSettings:
|
||||||
settings.ToggleVisibility();
|
Settings.ToggleVisibility();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case GlobalAction.ToggleDirect:
|
case GlobalAction.ToggleDirect:
|
||||||
@ -788,13 +791,13 @@ namespace osu.Game
|
|||||||
|
|
||||||
protected override bool OnExiting()
|
protected override bool OnExiting()
|
||||||
{
|
{
|
||||||
if (screenStack.CurrentScreen is Loader)
|
if (ScreenStack.CurrentScreen is Loader)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (introScreen == null)
|
if (introScreen == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!introScreen.DidLoadMenu || !(screenStack.CurrentScreen is IntroScreen))
|
if (!introScreen.DidLoadMenu || !(ScreenStack.CurrentScreen is IntroScreen))
|
||||||
{
|
{
|
||||||
Scheduler.Add(introScreen.MakeCurrent);
|
Scheduler.Add(introScreen.MakeCurrent);
|
||||||
return true;
|
return true;
|
||||||
@ -822,7 +825,7 @@ namespace osu.Game
|
|||||||
screenContainer.Padding = new MarginPadding { Top = ToolbarOffset };
|
screenContainer.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||||
overlayContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
overlayContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||||
|
|
||||||
MenuCursorContainer.CanShowCursor = (screenStack.CurrentScreen as IOsuScreen)?.CursorVisible ?? false;
|
MenuCursorContainer.CanShowCursor = (ScreenStack.CurrentScreen as IOsuScreen)?.CursorVisible ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void ScreenChanged(IScreen current, IScreen newScreen)
|
protected virtual void ScreenChanged(IScreen current, IScreen newScreen)
|
||||||
@ -848,9 +851,9 @@ namespace osu.Game
|
|||||||
Toolbar.Show();
|
Toolbar.Show();
|
||||||
|
|
||||||
if (newOsuScreen.AllowBackButton)
|
if (newOsuScreen.AllowBackButton)
|
||||||
backButton.Show();
|
BackButton.Show();
|
||||||
else
|
else
|
||||||
backButton.Hide();
|
BackButton.Hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
protected RulesetConfigCache RulesetConfigCache;
|
protected RulesetConfigCache RulesetConfigCache;
|
||||||
|
|
||||||
protected APIAccess API;
|
protected IAPIProvider API;
|
||||||
|
|
||||||
protected MenuCursorContainer MenuCursorContainer;
|
protected MenuCursorContainer MenuCursorContainer;
|
||||||
|
|
||||||
@ -73,6 +73,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
|
protected Storage Storage { get; set; }
|
||||||
|
|
||||||
private Bindable<WorkingBeatmap> beatmap; // cached via load() method
|
private Bindable<WorkingBeatmap> beatmap; // cached via load() method
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
@ -123,7 +125,7 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
Resources.AddStore(new DllResourceStore(@"osu.Game.Resources.dll"));
|
Resources.AddStore(new DllResourceStore(@"osu.Game.Resources.dll"));
|
||||||
|
|
||||||
dependencies.Cache(contextFactory = new DatabaseContextFactory(Host.Storage));
|
dependencies.Cache(contextFactory = new DatabaseContextFactory(Storage));
|
||||||
|
|
||||||
var largeStore = new LargeTextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore<byte[]>(Resources, @"Textures")));
|
var largeStore = new LargeTextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore<byte[]>(Resources, @"Textures")));
|
||||||
largeStore.AddStore(Host.CreateTextureLoaderStore(new OnlineStore()));
|
largeStore.AddStore(Host.CreateTextureLoaderStore(new OnlineStore()));
|
||||||
@ -158,21 +160,21 @@ namespace osu.Game
|
|||||||
|
|
||||||
runMigrations();
|
runMigrations();
|
||||||
|
|
||||||
dependencies.Cache(SkinManager = new SkinManager(Host.Storage, contextFactory, Host, Audio, new NamespacedResourceStore<byte[]>(Resources, "Skins/Legacy")));
|
dependencies.Cache(SkinManager = new SkinManager(Storage, contextFactory, Host, Audio, new NamespacedResourceStore<byte[]>(Resources, "Skins/Legacy")));
|
||||||
dependencies.CacheAs<ISkinSource>(SkinManager);
|
dependencies.CacheAs<ISkinSource>(SkinManager);
|
||||||
|
|
||||||
API = new APIAccess(LocalConfig);
|
if (API == null) API = new APIAccess(LocalConfig);
|
||||||
|
|
||||||
dependencies.CacheAs<IAPIProvider>(API);
|
dependencies.CacheAs(API);
|
||||||
|
|
||||||
var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures);
|
var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures);
|
||||||
|
|
||||||
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory));
|
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory));
|
||||||
dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage));
|
dependencies.Cache(FileStore = new FileStore(contextFactory, Storage));
|
||||||
|
|
||||||
// ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup()
|
// ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup()
|
||||||
dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Host.Storage, API, contextFactory, Host));
|
dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, API, contextFactory, Host));
|
||||||
dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, API, Audio, Host, defaultBeatmap));
|
dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, contextFactory, RulesetStore, API, Audio, Host, defaultBeatmap));
|
||||||
|
|
||||||
// this should likely be moved to ArchiveModelManager when another case appers where it is necessary
|
// this should likely be moved to ArchiveModelManager when another case appers where it is necessary
|
||||||
// to have inter-dependent model managers. this could be obtained with an IHasForeign<T> interface to
|
// to have inter-dependent model managers. this could be obtained with an IHasForeign<T> interface to
|
||||||
@ -189,6 +191,7 @@ namespace osu.Game
|
|||||||
dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
|
dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
|
||||||
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
|
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
|
||||||
dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore));
|
dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore));
|
||||||
|
dependencies.Cache(new SessionStatics());
|
||||||
dependencies.Cache(new OsuColour());
|
dependencies.Cache(new OsuColour());
|
||||||
|
|
||||||
fileImporters.Add(BeatmapManager);
|
fileImporters.Add(BeatmapManager);
|
||||||
@ -199,14 +202,21 @@ namespace osu.Game
|
|||||||
// this adds a global reduction of track volume for the time being.
|
// this adds a global reduction of track volume for the time being.
|
||||||
Audio.Tracks.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(0.8));
|
Audio.Tracks.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(0.8));
|
||||||
|
|
||||||
beatmap = new OsuBindableBeatmap(defaultBeatmap);
|
beatmap = new NonNullableBindable<WorkingBeatmap>(defaultBeatmap);
|
||||||
|
beatmap.BindValueChanged(b => ScheduleAfterChildren(() =>
|
||||||
|
{
|
||||||
|
// compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
|
||||||
|
if (b.OldValue?.TrackLoaded == true && b.OldValue?.Track != b.NewValue?.Track)
|
||||||
|
b.OldValue.RecycleTrack();
|
||||||
|
}));
|
||||||
|
|
||||||
dependencies.CacheAs<IBindable<WorkingBeatmap>>(beatmap);
|
dependencies.CacheAs<IBindable<WorkingBeatmap>>(beatmap);
|
||||||
dependencies.CacheAs(beatmap);
|
dependencies.CacheAs(beatmap);
|
||||||
|
|
||||||
FileStore.Cleanup();
|
FileStore.Cleanup();
|
||||||
|
|
||||||
AddInternal(API);
|
if (API is APIAccess apiAcces)
|
||||||
|
AddInternal(apiAcces);
|
||||||
AddInternal(RulesetConfigCache);
|
AddInternal(RulesetConfigCache);
|
||||||
|
|
||||||
GlobalActionContainer globalBinding;
|
GlobalActionContainer globalBinding;
|
||||||
@ -266,9 +276,13 @@ namespace osu.Game
|
|||||||
|
|
||||||
public override void SetHost(GameHost host)
|
public override void SetHost(GameHost host)
|
||||||
{
|
{
|
||||||
if (LocalConfig == null)
|
|
||||||
LocalConfig = new OsuConfigManager(host.Storage);
|
|
||||||
base.SetHost(host);
|
base.SetHost(host);
|
||||||
|
|
||||||
|
if (Storage == null)
|
||||||
|
Storage = host.Storage;
|
||||||
|
|
||||||
|
if (LocalConfig == null)
|
||||||
|
LocalConfig = new OsuConfigManager(Storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly List<ICanAcceptFiles> fileImporters = new List<ICanAcceptFiles>();
|
private readonly List<ICanAcceptFiles> fileImporters = new List<ICanAcceptFiles>();
|
||||||
@ -284,14 +298,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
public string[] HandledExtensions => fileImporters.SelectMany(i => i.HandledExtensions).ToArray();
|
public string[] HandledExtensions => fileImporters.SelectMany(i => i.HandledExtensions).ToArray();
|
||||||
|
|
||||||
private class OsuBindableBeatmap : BindableBeatmap
|
|
||||||
{
|
|
||||||
public OsuBindableBeatmap(WorkingBeatmap defaultValue)
|
|
||||||
: base(defaultValue)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class OsuUserInputManager : UserInputManager
|
private class OsuUserInputManager : UserInputManager
|
||||||
{
|
{
|
||||||
protected override MouseButtonEventManager CreateButtonManagerFor(MouseButton button)
|
protected override MouseButtonEventManager CreateButtonManagerFor(MouseButton button)
|
||||||
|
@ -14,6 +14,8 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using System.Net;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Changelog
|
namespace osu.Game.Overlays.Changelog
|
||||||
{
|
{
|
||||||
@ -66,23 +68,35 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
|
|
||||||
foreach (APIChangelogEntry entry in categoryEntries)
|
foreach (APIChangelogEntry entry in categoryEntries)
|
||||||
{
|
{
|
||||||
LinkFlowContainer title = new LinkFlowContainer
|
var entryColour = entry.Major ? colours.YellowLight : Color4.White;
|
||||||
|
|
||||||
|
LinkFlowContainer title;
|
||||||
|
|
||||||
|
Container titleContainer = new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Margin = new MarginPadding { Vertical = 5 },
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new SpriteIcon
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Size = new Vector2(fontSmall.Size),
|
||||||
|
Icon = entry.Type == ChangelogEntryType.Fix ? FontAwesome.Solid.Check : FontAwesome.Solid.Plus,
|
||||||
|
Colour = entryColour,
|
||||||
|
Margin = new MarginPadding { Right = 5 },
|
||||||
|
},
|
||||||
|
title = new LinkFlowContainer
|
||||||
{
|
{
|
||||||
Direction = FillDirection.Full,
|
Direction = FillDirection.Full,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Margin = new MarginPadding { Vertical = 5 },
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var entryColour = entry.Major ? colours.YellowLight : Color4.White;
|
|
||||||
|
|
||||||
title.AddIcon(FontAwesome.Solid.Check, t =>
|
|
||||||
{
|
|
||||||
t.Font = fontSmall;
|
|
||||||
t.Colour = entryColour;
|
|
||||||
t.Padding = new MarginPadding { Left = -17, Right = 5 };
|
|
||||||
});
|
|
||||||
|
|
||||||
title.AddText(entry.Title, t =>
|
title.AddText(entry.Title, t =>
|
||||||
{
|
{
|
||||||
t.Font = fontLarge;
|
t.Font = fontLarge;
|
||||||
@ -138,7 +152,7 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
t.Colour = entryColour;
|
t.Colour = entryColour;
|
||||||
});
|
});
|
||||||
|
|
||||||
ChangelogEntries.Add(title);
|
ChangelogEntries.Add(titleContainer);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(entry.MessageHtml))
|
if (!string.IsNullOrEmpty(entry.MessageHtml))
|
||||||
{
|
{
|
||||||
@ -149,7 +163,7 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
};
|
};
|
||||||
|
|
||||||
// todo: use markdown parsing once API returns markdown
|
// todo: use markdown parsing once API returns markdown
|
||||||
message.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t =>
|
message.AddText(WebUtility.HtmlDecode(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty)), t =>
|
||||||
{
|
{
|
||||||
t.Font = fontSmall;
|
t.Font = fontSmall;
|
||||||
t.Colour = new Color4(235, 184, 254, 255);
|
t.Colour = new Color4(235, 184, 254, 255);
|
||||||
|
@ -31,7 +31,9 @@ namespace osu.Game.Overlays.Chat
|
|||||||
|
|
||||||
protected virtual float MessagePadding => default_message_padding;
|
protected virtual float MessagePadding => default_message_padding;
|
||||||
|
|
||||||
private const float timestamp_padding = 65;
|
private const float default_timestamp_padding = 65;
|
||||||
|
|
||||||
|
protected virtual float TimestampPadding => default_timestamp_padding;
|
||||||
|
|
||||||
private const float default_horizontal_padding = 15;
|
private const float default_horizontal_padding = 15;
|
||||||
|
|
||||||
@ -94,7 +96,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true),
|
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true),
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
MaxWidth = default_message_padding - timestamp_padding
|
MaxWidth = MessagePadding - TimestampPadding
|
||||||
};
|
};
|
||||||
|
|
||||||
if (hasBackground)
|
if (hasBackground)
|
||||||
@ -149,7 +151,6 @@ namespace osu.Game.Overlays.Chat
|
|||||||
new MessageSender(message.Sender)
|
new MessageSender(message.Sender)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Left = timestamp_padding },
|
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Child = effectedUsername,
|
Child = effectedUsername,
|
||||||
|
@ -119,7 +119,6 @@ namespace osu.Game.Overlays.Chat.Selection
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
PlaceholderText = @"Search",
|
PlaceholderText = @"Search",
|
||||||
Exit = Hide,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -138,7 +138,6 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Height = 1,
|
Height = 1,
|
||||||
PlaceholderText = "type your message",
|
PlaceholderText = "type your message",
|
||||||
Exit = Hide,
|
|
||||||
OnCommit = postMessage,
|
OnCommit = postMessage,
|
||||||
ReleaseFocusOnCommit = false,
|
ReleaseFocusOnCommit = false,
|
||||||
HoldFocus = true,
|
HoldFocus = true,
|
||||||
|
@ -31,7 +31,6 @@ namespace osu.Game.Overlays.Music
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = 40,
|
Height = 40,
|
||||||
Exit = () => ExitRequested?.Invoke(),
|
|
||||||
},
|
},
|
||||||
new CollectionsDropdown<PlaylistCollection>
|
new CollectionsDropdown<PlaylistCollection>
|
||||||
{
|
{
|
||||||
@ -47,8 +46,6 @@ namespace osu.Game.Overlays.Music
|
|||||||
|
|
||||||
private void current_ValueChanged(ValueChangedEvent<string> e) => FilterChanged?.Invoke(e.NewValue);
|
private void current_ValueChanged(ValueChangedEvent<string> e) => FilterChanged?.Invoke(e.NewValue);
|
||||||
|
|
||||||
public Action ExitRequested;
|
|
||||||
|
|
||||||
public Action<string> FilterChanged;
|
public Action<string> FilterChanged;
|
||||||
|
|
||||||
public class FilterTextBox : SearchTextBox
|
public class FilterTextBox : SearchTextBox
|
||||||
|
@ -63,7 +63,6 @@ namespace osu.Game.Overlays.Music
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
ExitRequested = Hide,
|
|
||||||
FilterChanged = search => list.Filter(search),
|
FilterChanged = search => list.Filter(search),
|
||||||
Padding = new MarginPadding(10),
|
Padding = new MarginPadding(10),
|
||||||
},
|
},
|
||||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Overlays
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
beatmap.BindValueChanged(beatmapChanged, true);
|
beatmap.BindValueChanged(beatmapChanged, true);
|
||||||
mods.BindValueChanged(_ => updateAudioAdjustments(), true);
|
mods.BindValueChanged(_ => ResetTrackAdjustments(), true);
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ namespace osu.Game.Overlays
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns whether the current beatmap track is playing.
|
/// Returns whether the current beatmap track is playing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsPlaying => beatmap.Value.Track.IsRunning;
|
public bool IsPlaying => beatmap.Value?.Track.IsRunning ?? false;
|
||||||
|
|
||||||
private void handleBeatmapAdded(BeatmapSetInfo set) =>
|
private void handleBeatmapAdded(BeatmapSetInfo set) =>
|
||||||
Schedule(() => beatmapSets.Add(set));
|
Schedule(() => beatmapSets.Add(set));
|
||||||
@ -213,12 +213,12 @@ namespace osu.Game.Overlays
|
|||||||
current = beatmap.NewValue;
|
current = beatmap.NewValue;
|
||||||
TrackChanged?.Invoke(current, direction);
|
TrackChanged?.Invoke(current, direction);
|
||||||
|
|
||||||
updateAudioAdjustments();
|
ResetTrackAdjustments();
|
||||||
|
|
||||||
queuedDirection = null;
|
queuedDirection = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAudioAdjustments()
|
public void ResetTrackAdjustments()
|
||||||
{
|
{
|
||||||
var track = current?.Track;
|
var track = current?.Track;
|
||||||
if (track == null)
|
if (track == null)
|
||||||
|
@ -88,8 +88,6 @@ namespace osu.Game.Overlays.SearchableList
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Filter.Search.Exit = Hide;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
api?.Register(this);
|
api?.Register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void APIStateChanged(IAPIProvider api, APIState state)
|
public void APIStateChanged(IAPIProvider api, APIState state) => Schedule(() =>
|
||||||
{
|
{
|
||||||
form = null;
|
form = null;
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (form != null) GetContainingInputManager()?.ChangeFocus(form);
|
if (form != null) GetContainingInputManager()?.ChangeFocus(form);
|
||||||
}
|
});
|
||||||
|
|
||||||
public override bool AcceptsFocus => true;
|
public override bool AcceptsFocus => true;
|
||||||
|
|
||||||
|
@ -27,16 +27,16 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
LabelText = "Parallax",
|
LabelText = "Parallax",
|
||||||
Bindable = config.GetBindable<bool>(OsuSetting.MenuParallax)
|
Bindable = config.GetBindable<bool>(OsuSetting.MenuParallax)
|
||||||
},
|
},
|
||||||
new SettingsSlider<int, TimeSlider>
|
new SettingsSlider<float, TimeSlider>
|
||||||
{
|
{
|
||||||
LabelText = "Hold-to-confirm activation time",
|
LabelText = "Hold-to-confirm activation time",
|
||||||
Bindable = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay),
|
Bindable = config.GetBindable<float>(OsuSetting.UIHoldActivationDelay),
|
||||||
KeyboardStep = 50
|
KeyboardStep = 50
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TimeSlider : OsuSliderBar<int>
|
private class TimeSlider : OsuSliderBar<float>
|
||||||
{
|
{
|
||||||
public override string TooltipText => Current.Value.ToString("N0") + "ms";
|
public override string TooltipText => Current.Value.ToString("N0") + "ms";
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,6 @@ namespace osu.Game.Overlays
|
|||||||
Top = 20,
|
Top = 20,
|
||||||
Bottom = 20
|
Bottom = 20
|
||||||
},
|
},
|
||||||
Exit = Hide,
|
|
||||||
},
|
},
|
||||||
Footer = CreateFooter()
|
Footer = CreateFooter()
|
||||||
},
|
},
|
||||||
|
@ -44,7 +44,8 @@ namespace osu.Game.Overlays
|
|||||||
Clear();
|
Clear();
|
||||||
lastSection = null;
|
lastSection = null;
|
||||||
|
|
||||||
sections = new ProfileSection[]
|
sections = !user.IsBot
|
||||||
|
? new ProfileSection[]
|
||||||
{
|
{
|
||||||
//new AboutSection(),
|
//new AboutSection(),
|
||||||
new RecentSection(),
|
new RecentSection(),
|
||||||
@ -53,6 +54,10 @@ namespace osu.Game.Overlays
|
|||||||
new HistoricalSection(),
|
new HistoricalSection(),
|
||||||
new BeatmapsSection(),
|
new BeatmapsSection(),
|
||||||
new KudosuSection()
|
new KudosuSection()
|
||||||
|
}
|
||||||
|
: new ProfileSection[]
|
||||||
|
{
|
||||||
|
//new AboutSection(),
|
||||||
};
|
};
|
||||||
|
|
||||||
tabs = new ProfileTabControl
|
tabs = new ProfileTabControl
|
||||||
|
@ -2,13 +2,16 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
public abstract class ModEasy : Mod, IApplicableToDifficulty
|
public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableFailOverride, IApplicableToScoreProcessor
|
||||||
{
|
{
|
||||||
public override string Name => "Easy";
|
public override string Name => "Easy";
|
||||||
public override string Acronym => "EZ";
|
public override string Acronym => "EZ";
|
||||||
@ -18,6 +21,10 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
|
||||||
|
|
||||||
|
private int retries = 2;
|
||||||
|
|
||||||
|
private BindableNumber<double> health;
|
||||||
|
|
||||||
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
const float ratio = 0.5f;
|
const float ratio = 0.5f;
|
||||||
@ -26,5 +33,27 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
difficulty.DrainRate *= ratio;
|
difficulty.DrainRate *= ratio;
|
||||||
difficulty.OverallDifficulty *= ratio;
|
difficulty.OverallDifficulty *= ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool AllowFail
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (retries == 0) return true;
|
||||||
|
|
||||||
|
health.Value = health.MaxValue;
|
||||||
|
retries--;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool RestartOnFail => false;
|
||||||
|
|
||||||
|
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
||||||
|
{
|
||||||
|
health = scoreProcessor.Health.GetBoundCopy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A hit object representing the end of a bar.
|
|
||||||
/// </summary>
|
|
||||||
public class BarLine : HitObject
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Whether this barline is a prominent beat (based on time signature of beatmap).
|
|
||||||
/// </summary>
|
|
||||||
public bool Major;
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,12 +10,13 @@ using osu.Game.Rulesets.Objects.Types;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects
|
namespace osu.Game.Rulesets.Objects
|
||||||
{
|
{
|
||||||
public class BarLineGenerator
|
public class BarLineGenerator<TBarLine>
|
||||||
|
where TBarLine : class, IBarLine, new()
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The generated bar lines.
|
/// The generated bar lines.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly List<BarLine> BarLines = new List<BarLine>();
|
public readonly List<TBarLine> BarLines = new List<TBarLine>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs and generates bar lines for provided beatmap.
|
/// Constructs and generates bar lines for provided beatmap.
|
||||||
@ -46,7 +47,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
|
|
||||||
for (double t = currentTimingPoint.Time; Precision.DefinitelyBigger(endTime, t); t += barLength, currentBeat++)
|
for (double t = currentTimingPoint.Time; Precision.DefinitelyBigger(endTime, t); t += barLength, currentBeat++)
|
||||||
{
|
{
|
||||||
BarLines.Add(new BarLine
|
BarLines.Add(new TBarLine
|
||||||
{
|
{
|
||||||
StartTime = t,
|
StartTime = t,
|
||||||
Major = currentBeat % (int)currentTimingPoint.TimeSignature == 0
|
Major = currentBeat % (int)currentTimingPoint.TimeSignature == 0
|
||||||
|
@ -76,6 +76,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public JudgementResult Result { get; private set; }
|
public JudgementResult Result { get; private set; }
|
||||||
|
|
||||||
|
private Bindable<int> comboIndexBindable;
|
||||||
|
|
||||||
public override bool RemoveWhenNotAlive => false;
|
public override bool RemoveWhenNotAlive => false;
|
||||||
public override bool RemoveCompletedTransforms => false;
|
public override bool RemoveCompletedTransforms => false;
|
||||||
protected override bool RequiresChildrenUpdate => true;
|
protected override bool RequiresChildrenUpdate => true;
|
||||||
@ -122,6 +124,13 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
|
if (HitObject is IHasComboInformation combo)
|
||||||
|
{
|
||||||
|
comboIndexBindable = combo.ComboIndexBindable.GetBoundCopy();
|
||||||
|
comboIndexBindable.BindValueChanged(_ => updateAccentColour());
|
||||||
|
}
|
||||||
|
|
||||||
updateState(ArmedState.Idle, true);
|
updateState(ArmedState.Idle, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,12 +253,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
{
|
{
|
||||||
base.SkinChanged(skin, allowFallback);
|
base.SkinChanged(skin, allowFallback);
|
||||||
|
|
||||||
if (HitObject is IHasComboInformation combo)
|
updateAccentColour();
|
||||||
{
|
|
||||||
var comboColours = skin.GetConfig<GlobalSkinConfiguration, List<Color4>>(GlobalSkinConfiguration.ComboColours)?.Value;
|
|
||||||
|
|
||||||
AccentColour.Value = comboColours?.Count > 0 ? comboColours[combo.ComboIndex % comboColours.Count] : Color4.White;
|
|
||||||
}
|
|
||||||
|
|
||||||
ApplySkin(skin, allowFallback);
|
ApplySkin(skin, allowFallback);
|
||||||
|
|
||||||
@ -257,6 +261,15 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
updateState(State.Value, true);
|
updateState(State.Value, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateAccentColour()
|
||||||
|
{
|
||||||
|
if (HitObject is IHasComboInformation combo)
|
||||||
|
{
|
||||||
|
var comboColours = CurrentSkin.GetConfig<GlobalSkinConfiguration, List<Color4>>(GlobalSkinConfiguration.ComboColours)?.Value;
|
||||||
|
AccentColour.Value = comboColours?.Count > 0 ? comboColours[combo.ComboIndex % comboColours.Count] : Color4.White;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when a change is made to the skin.
|
/// Called when a change is made to the skin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -316,8 +329,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
get => lifetimeStart ?? (HitObject.StartTime - InitialLifetimeOffset);
|
get => lifetimeStart ?? (HitObject.StartTime - InitialLifetimeOffset);
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
base.LifetimeStart = value;
|
|
||||||
lifetimeStart = value;
|
lifetimeStart = value;
|
||||||
|
base.LifetimeStart = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
@ -82,6 +83,15 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
|
|
||||||
CreateNestedHitObjects();
|
CreateNestedHitObjects();
|
||||||
|
|
||||||
|
if (this is IHasComboInformation hasCombo)
|
||||||
|
{
|
||||||
|
foreach (var n in NestedHitObjects.OfType<IHasComboInformation>())
|
||||||
|
{
|
||||||
|
n.ComboIndexBindable.BindTo(hasCombo.ComboIndexBindable);
|
||||||
|
n.IndexInCurrentComboBindable.BindTo(hasCombo.IndexInCurrentComboBindable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime));
|
nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime));
|
||||||
|
|
||||||
foreach (var h in nestedHitObjects)
|
foreach (var h in nestedHitObjects)
|
||||||
|
22
osu.Game/Rulesets/Objects/IBarLine.cs
Normal file
22
osu.Game/Rulesets/Objects/IBarLine.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Objects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for bar line hitobjects.
|
||||||
|
/// Used to decouple bar line generation from ruleset-specific rendering/drawing hierarchies.
|
||||||
|
/// </summary>
|
||||||
|
public interface IBarLine
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The time position of the bar.
|
||||||
|
/// </summary>
|
||||||
|
double StartTime { set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this bar line is a prominent beat (based on time signature of beatmap).
|
||||||
|
/// </summary>
|
||||||
|
bool Major { set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Types
|
namespace osu.Game.Rulesets.Objects.Types
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -8,16 +10,22 @@ namespace osu.Game.Rulesets.Objects.Types
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IHasComboInformation : IHasCombo
|
public interface IHasComboInformation : IHasCombo
|
||||||
{
|
{
|
||||||
|
Bindable<int> IndexInCurrentComboBindable { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The offset of this hitobject in the current combo.
|
/// The offset of this hitobject in the current combo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int IndexInCurrentCombo { get; set; }
|
int IndexInCurrentCombo { get; set; }
|
||||||
|
|
||||||
|
Bindable<int> ComboIndexBindable { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The offset of this combo in relation to the beatmap.
|
/// The offset of this combo in relation to the beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int ComboIndex { get; set; }
|
int ComboIndex { get; set; }
|
||||||
|
|
||||||
|
Bindable<bool> LastInComboBindable { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this is the last object in the current combo.
|
/// Whether this is the last object in the current combo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -84,7 +84,7 @@ namespace osu.Game.Rulesets
|
|||||||
|
|
||||||
public virtual Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.Solid.QuestionCircle };
|
public virtual Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.Solid.QuestionCircle };
|
||||||
|
|
||||||
public virtual IResourceStore<byte[]> CreateReourceStore() => new NamespacedResourceStore<byte[]>(new DllResourceStore(GetType().Assembly.Location), @"Resources");
|
public virtual IResourceStore<byte[]> CreateResourceStore() => new NamespacedResourceStore<byte[]>(new DllResourceStore(GetType().Assembly.Location), @"Resources");
|
||||||
|
|
||||||
public abstract string Description { get; }
|
public abstract string Description { get; }
|
||||||
|
|
||||||
|
@ -135,9 +135,9 @@ namespace osu.Game.Rulesets
|
|||||||
foreach (string file in files.Where(f => !Path.GetFileName(f).Contains("Tests")))
|
foreach (string file in files.Where(f => !Path.GetFileName(f).Contains("Tests")))
|
||||||
loadRulesetFromFile(file);
|
loadRulesetFromFile(file);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.Log($"Could not load rulesets from directory {Environment.CurrentDirectory}");
|
Logger.Error(e, $"Could not load rulesets from directory {Environment.CurrentDirectory}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
{
|
{
|
||||||
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
|
||||||
var resources = Ruleset.CreateReourceStore();
|
var resources = Ruleset.CreateResourceStore();
|
||||||
|
|
||||||
if (resources != null)
|
if (resources != null)
|
||||||
{
|
{
|
||||||
|
@ -131,7 +131,9 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
if (duration > maxDuration)
|
if (duration > maxDuration)
|
||||||
{
|
{
|
||||||
maxDuration = duration;
|
maxDuration = duration;
|
||||||
baseBeatLength = timingPoints[i].BeatLength;
|
// The slider multiplier is post-multiplied to determine the final velocity, but for relative scale beat lengths
|
||||||
|
// the multiplier should not affect the effective timing point (the longest in the beatmap), so it is factored out here
|
||||||
|
baseBeatLength = timingPoints[i].BeatLength / Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,9 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
|
|
||||||
if (!initialStateCache.IsValid)
|
if (!initialStateCache.IsValid)
|
||||||
{
|
{
|
||||||
|
foreach (var cached in hitObjectInitialStateCache.Values)
|
||||||
|
cached.Invalidate();
|
||||||
|
|
||||||
switch (direction.Value)
|
switch (direction.Value)
|
||||||
{
|
{
|
||||||
case ScrollingDirection.Up:
|
case ScrollingDirection.Up:
|
||||||
|
@ -22,6 +22,6 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override Ruleset GetRuleset(int rulesetId) => rulesets.GetRuleset(rulesetId).CreateInstance();
|
protected override Ruleset GetRuleset(int rulesetId) => rulesets.GetRuleset(rulesetId).CreateInstance();
|
||||||
protected override WorkingBeatmap GetBeatmap(string md5Hash) => beatmaps.GetWorkingBeatmap(beatmaps.QueryBeatmap(b => b.MD5Hash == md5Hash));
|
protected override WorkingBeatmap GetBeatmap(string md5Hash) => beatmaps.GetWorkingBeatmap(beatmaps.QueryBeatmap(b => !b.BeatmapSet.DeletePending && b.MD5Hash == md5Hash));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,129 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Graphics.UserInterface;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents
|
|
||||||
{
|
|
||||||
public class LabelledTextBox : CompositeDrawable
|
|
||||||
{
|
|
||||||
private const float label_container_width = 150;
|
|
||||||
private const float corner_radius = 15;
|
|
||||||
private const float default_height = 40;
|
|
||||||
private const float default_label_left_padding = 15;
|
|
||||||
private const float default_label_top_padding = 12;
|
|
||||||
private const float default_label_text_size = 16;
|
|
||||||
|
|
||||||
public event TextBox.OnCommitHandler OnCommit;
|
|
||||||
|
|
||||||
public bool ReadOnly
|
|
||||||
{
|
|
||||||
get => textBox.ReadOnly;
|
|
||||||
set => textBox.ReadOnly = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string LabelText
|
|
||||||
{
|
|
||||||
get => label.Text;
|
|
||||||
set => label.Text = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float LabelTextSize
|
|
||||||
{
|
|
||||||
get => label.Font.Size;
|
|
||||||
set => label.Font = label.Font.With(size: value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string PlaceholderText
|
|
||||||
{
|
|
||||||
get => textBox.PlaceholderText;
|
|
||||||
set => textBox.PlaceholderText = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Text
|
|
||||||
{
|
|
||||||
get => textBox.Text;
|
|
||||||
set => textBox.Text = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color4 LabelTextColour
|
|
||||||
{
|
|
||||||
get => label.Colour;
|
|
||||||
set => label.Colour = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly OsuTextBox textBox;
|
|
||||||
private readonly OsuSpriteText label;
|
|
||||||
|
|
||||||
public LabelledTextBox()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X;
|
|
||||||
Height = default_height;
|
|
||||||
CornerRadius = corner_radius;
|
|
||||||
Masking = true;
|
|
||||||
|
|
||||||
InternalChild = new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
CornerRadius = corner_radius,
|
|
||||||
Masking = true,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = OsuColour.FromHex("1c2125"),
|
|
||||||
},
|
|
||||||
new GridContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = default_height,
|
|
||||||
Content = new[]
|
|
||||||
{
|
|
||||||
new Drawable[]
|
|
||||||
{
|
|
||||||
label = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopLeft,
|
|
||||||
Origin = Anchor.TopLeft,
|
|
||||||
Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding },
|
|
||||||
Colour = Color4.White,
|
|
||||||
Font = OsuFont.GetFont(size: default_label_text_size, weight: FontWeight.Bold),
|
|
||||||
},
|
|
||||||
textBox = new OsuTextBox
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopLeft,
|
|
||||||
Origin = Anchor.TopLeft,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Height = 1,
|
|
||||||
CornerRadius = corner_radius,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ColumnDimensions = new[]
|
|
||||||
{
|
|
||||||
new Dimension(GridSizeMode.Absolute, label_container_width),
|
|
||||||
new Dimension()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
textBox.OnCommit += OnCommit;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
textBox.BorderColour = colours.Blue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Shaders;
|
using osu.Framework.Graphics.Shaders;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
@ -59,6 +60,9 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
private IntroScreen getIntroSequence()
|
private IntroScreen getIntroSequence()
|
||||||
{
|
{
|
||||||
|
if (introSequence == IntroSequence.Random)
|
||||||
|
introSequence = (IntroSequence)RNG.Next(0, (int)IntroSequence.Random);
|
||||||
|
|
||||||
switch (introSequence)
|
switch (introSequence)
|
||||||
{
|
{
|
||||||
case IntroSequence.Circles:
|
case IntroSequence.Circles:
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user