1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 21:02:55 +08:00

Merge branch 'master' into heatmap-misses

This commit is contained in:
Bartłomiej Dach 2024-02-06 18:02:50 +01:00 committed by GitHub
commit d150d69abf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 108 additions and 6 deletions

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty
private readonly bool isForCurrentRuleset;
private readonly double originalOverallDifficulty;
public override int Version => 20220902;
public override int Version => 20230817;
public ManiaDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)

View File

@ -31,6 +31,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.12 : 1;
public override Type[] IncompatibleMods => new[] { typeof(OsuModFlashlight) };
public override bool Ranked => true;
private DrawableOsuBlinds blinds = null!;

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
{
private const double difficulty_multiplier = 1.35;
public override int Version => 20220902;
public override int Version => 20221107;
public TaikoDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)

View File

@ -31,6 +31,8 @@ namespace osu.Game.Rulesets.Mods
public override bool RequiresConfiguration => false;
public override bool Ranked => true;
public override string SettingDescription => base.SettingDescription.Replace(MinimumAccuracy.ToString(), MinimumAccuracy.Value.ToString("##%", NumberFormatInfo.InvariantInfo));
[SettingSource("Minimum accuracy", "Trigger a failure if your accuracy goes below this value.", SettingControlType = typeof(SettingsPercentageSlider<double>))]

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Mods
public override IconUsage? Icon => OsuIcon.ModDoubleTime;
public override ModType Type => ModType.DifficultyIncrease;
public override LocalisableString Description => "Zoooooooooom...";
public override bool Ranked => UsesDefaultConfiguration;
public override bool Ranked => SpeedChange.IsDefault;
[SettingSource("Speed increase", "The actual increase to apply", SettingControlType = typeof(MultiplierSettingsSlider))]
public override BindableNumber<double> SpeedChange { get; } = new BindableDouble(1.5)

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Mods
public override IconUsage? Icon => OsuIcon.ModHalftime;
public override ModType Type => ModType.DifficultyReduction;
public override LocalisableString Description => "Less zoom...";
public override bool Ranked => UsesDefaultConfiguration;
public override bool Ranked => SpeedChange.IsDefault;
[SettingSource("Speed decrease", "The actual decrease to apply", SettingControlType = typeof(MultiplierSettingsSlider))]
public override BindableNumber<double> SpeedChange { get; } = new BindableDouble(0.75)

View File

@ -22,6 +22,7 @@ namespace osu.Game.Rulesets.Mods
public override ModType Type => ModType.Fun;
public override IconUsage? Icon => FontAwesome.Solid.EyeSlash;
public override double ScoreMultiplier => 1;
public override bool Ranked => true;
/// <summary>
/// Slightly higher than the cutoff for <see cref="Drawable.IsPresent"/>.

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Mods
public override ModType Type => ModType.DifficultyIncrease;
public override double ScoreMultiplier => 1;
public override LocalisableString Description => "SS or quit.";
public override bool Ranked => UsesDefaultConfiguration;
public override bool Ranked => true;
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(ModSuddenDeath), typeof(ModAccuracyChallenge) }).ToArray();

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Mods
public override ModType Type => ModType.DifficultyIncrease;
public override LocalisableString Description => "Miss and fail.";
public override double ScoreMultiplier => 1;
public override bool Ranked => UsesDefaultConfiguration;
public override bool Ranked => true;
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModPerfect)).ToArray();

View File

@ -58,6 +58,9 @@ namespace osu.Game.Skinning
{
}
protected override IResourceStore<TextureUpload> CreateTextureLoaderStore(IStorageResourceProvider resources, IResourceStore<byte[]> storage)
=> new LegacyTextureLoaderStore(base.CreateTextureLoaderStore(resources, storage));
protected override void ParseConfigurationStream(Stream stream)
{
base.ParseConfigurationStream(stream);

View File

@ -0,0 +1,95 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
namespace osu.Game.Skinning
{
public class LegacyTextureLoaderStore : IResourceStore<TextureUpload>
{
private readonly IResourceStore<TextureUpload>? wrappedStore;
public LegacyTextureLoaderStore(IResourceStore<TextureUpload>? wrappedStore)
{
this.wrappedStore = wrappedStore;
}
public TextureUpload Get(string name)
{
var textureUpload = wrappedStore?.Get(name);
if (textureUpload == null)
return null!;
return shouldConvertToGrayscale(name)
? convertToGrayscale(textureUpload)
: textureUpload;
}
public Task<TextureUpload> GetAsync(string name, CancellationToken cancellationToken = new CancellationToken())
{
var textureUpload = wrappedStore?.Get(name);
if (textureUpload == null)
return null!;
return shouldConvertToGrayscale(name)
? Task.Run(() => convertToGrayscale(textureUpload), cancellationToken)
: Task.FromResult(textureUpload);
}
// https://github.com/peppy/osu-stable-reference/blob/013c3010a9d495e3471a9c59518de17006f9ad89/osu!/Graphics/Textures/TextureManager.cs#L91-L96
private static readonly string[] grayscale_sprites =
{
@"taiko-bar-right",
@"taikobigcircle",
@"taikohitcircle",
@"taikohitcircleoverlay"
};
private bool shouldConvertToGrayscale(string name)
{
foreach (string grayscaleSprite in grayscale_sprites)
{
// unfortunately at this level of lookup we can encounter `@2x` scale suffixes in the name,
// so straight equality cannot be used.
if (name.Equals(grayscaleSprite, StringComparison.OrdinalIgnoreCase)
|| name.Equals($@"{grayscaleSprite}@2x", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
private TextureUpload convertToGrayscale(TextureUpload textureUpload)
{
var image = Image.LoadPixelData(textureUpload.Data.ToArray(), textureUpload.Width, textureUpload.Height);
// stable uses `0.299 * r + 0.587 * g + 0.114 * b`
// (https://github.com/peppy/osu-stable-reference/blob/013c3010a9d495e3471a9c59518de17006f9ad89/osu!/Graphics/Textures/pTexture.cs#L138-L153)
// which matches mode BT.601 (https://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems)
image.Mutate(i => i.Grayscale(GrayscaleMode.Bt601));
return new TextureUpload(image);
}
public Stream? GetStream(string name) => wrappedStore?.GetStream(name);
public IEnumerable<string> GetAvailableResources() => wrappedStore?.GetAvailableResources() ?? Array.Empty<string>();
public void Dispose()
{
wrappedStore?.Dispose();
}
}
}