1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-14 03:22:54 +08:00

Merge branch 'master' into kps

This commit is contained in:
Dean Herbert 2022-08-24 18:18:45 +09:00
commit 5129716612
129 changed files with 886 additions and 656 deletions

View File

@ -20,10 +20,13 @@ namespace osu.Game.Rulesets.Pippidon.Beatmaps
public PippidonBeatmapConverter(IBeatmap beatmap, Ruleset ruleset) public PippidonBeatmapConverter(IBeatmap beatmap, Ruleset ruleset)
: base(beatmap, ruleset) : base(beatmap, ruleset)
{
if (beatmap.HitObjects.Any())
{ {
minPosition = beatmap.HitObjects.Min(getUsablePosition); minPosition = beatmap.HitObjects.Min(getUsablePosition);
maxPosition = beatmap.HitObjects.Max(getUsablePosition); maxPosition = beatmap.HitObjects.Max(getUsablePosition);
} }
}
public override bool CanConvert() => Beatmap.HitObjects.All(h => h is IHasXPosition && h is IHasYPosition); public override bool CanConvert() => Beatmap.HitObjects.All(h => h is IHasXPosition && h is IHasYPosition);

View File

@ -23,6 +23,7 @@ using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using System; using System;
using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Catch.Edit; using osu.Game.Rulesets.Catch.Edit;
using osu.Game.Rulesets.Catch.Skinning.Legacy; using osu.Game.Rulesets.Catch.Skinning.Legacy;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
@ -162,7 +163,7 @@ namespace osu.Game.Rulesets.Catch
}; };
} }
public override string GetDisplayNameForHitResult(HitResult result) public override LocalisableString GetDisplayNameForHitResult(HitResult result)
{ {
switch (result) switch (result)
{ {

View File

@ -1,12 +1,13 @@
// 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.Localisation;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Catch.Mods namespace osu.Game.Rulesets.Catch.Mods
{ {
public class CatchModEasy : ModEasyWithExtraLives public class CatchModEasy : ModEasyWithExtraLives
{ {
public override string Description => @"Larger fruits, more forgiving HP drain, less accuracy required, and three lives!"; public override LocalisableString Description => @"Larger fruits, more forgiving HP drain, less accuracy required, and three lives!";
} }
} }

View File

@ -3,6 +3,7 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
@ -14,7 +15,7 @@ namespace osu.Game.Rulesets.Catch.Mods
{ {
public override string Name => "Floating Fruits"; public override string Name => "Floating Fruits";
public override string Acronym => "FF"; public override string Acronym => "FF";
public override string Description => "The fruits are... floating?"; public override LocalisableString Description => "The fruits are... floating?";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override IconUsage? Icon => FontAwesome.Solid.Cloud; public override IconUsage? Icon => FontAwesome.Solid.Cloud;

View File

@ -3,6 +3,7 @@
using System.Linq; using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawables; using osu.Game.Rulesets.Catch.Objects.Drawables;
using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Catch.UI;
@ -14,7 +15,7 @@ namespace osu.Game.Rulesets.Catch.Mods
{ {
public class CatchModHidden : ModHidden, IApplicableToDrawableRuleset<CatchHitObject> public class CatchModHidden : ModHidden, IApplicableToDrawableRuleset<CatchHitObject>
{ {
public override string Description => @"Play with fading fruits."; public override LocalisableString Description => @"Play with fading fruits.";
public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.06 : 1; public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.06 : 1;
private const double fade_out_offset_multiplier = 0.6; private const double fade_out_offset_multiplier = 0.6;

View File

@ -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.Linq; using System.Linq;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Beatmaps; using osu.Game.Rulesets.Catch.Beatmaps;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
@ -14,7 +15,7 @@ namespace osu.Game.Rulesets.Catch.Mods
{ {
public class CatchModMirror : ModMirror, IApplicableToBeatmap public class CatchModMirror : ModMirror, IApplicableToBeatmap
{ {
public override string Description => "Fruits are flipped horizontally."; public override LocalisableString Description => "Fruits are flipped horizontally.";
/// <remarks> /// <remarks>
/// <see cref="IApplicableToBeatmap"/> is used instead of <see cref="IApplicableToHitObject"/>, /// <see cref="IApplicableToBeatmap"/> is used instead of <see cref="IApplicableToHitObject"/>,

View File

@ -3,6 +3,7 @@
using System; using System;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -14,7 +15,7 @@ namespace osu.Game.Rulesets.Catch.Mods
{ {
public class CatchModNoScope : ModNoScope, IUpdatableByPlayfield public class CatchModNoScope : ModNoScope, IUpdatableByPlayfield
{ {
public override string Description => "Where's the catcher?"; public override LocalisableString Description => "Where's the catcher?";
[SettingSource( [SettingSource(
"Hidden at combo", "Hidden at combo",

View File

@ -5,6 +5,7 @@ using osu.Framework.Graphics;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -16,7 +17,7 @@ namespace osu.Game.Rulesets.Catch.Mods
{ {
public class CatchModRelax : ModRelax, IApplicableToDrawableRuleset<CatchHitObject>, IApplicableToPlayer public class CatchModRelax : ModRelax, IApplicableToDrawableRuleset<CatchHitObject>, IApplicableToPlayer
{ {
public override string Description => @"Use the mouse to control the catcher."; public override LocalisableString Description => @"Use the mouse to control the catcher.";
private DrawableRuleset<CatchHitObject> drawableRuleset = null!; private DrawableRuleset<CatchHitObject> drawableRuleset = null!;

View File

@ -15,6 +15,7 @@ using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Mania.Replays; using osu.Game.Rulesets.Mania.Replays;
using osu.Game.Rulesets.Replays.Types; using osu.Game.Rulesets.Replays.Types;
@ -311,7 +312,7 @@ namespace osu.Game.Rulesets.Mania
return Array.Empty<KeyBinding>(); return Array.Empty<KeyBinding>();
} }
public override string GetVariantName(int variant) public override LocalisableString GetVariantName(int variant)
{ {
switch (getPlayfieldType(variant)) switch (getPlayfieldType(variant))
{ {
@ -356,7 +357,7 @@ namespace osu.Game.Rulesets.Mania
}; };
} }
public override string GetDisplayNameForHitResult(HitResult result) public override LocalisableString GetDisplayNameForHitResult(HitResult result)
{ {
switch (result) switch (result)
{ {

View File

@ -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 osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
@ -18,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.Mods
public override double ScoreMultiplier => 0.9; public override double ScoreMultiplier => 0.9;
public override string Description => "No more tricky speed changes!"; public override LocalisableString Description => "No more tricky speed changes!";
public override IconUsage? Icon => FontAwesome.Solid.Equals; public override IconUsage? Icon => FontAwesome.Solid.Equals;

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -11,7 +12,7 @@ namespace osu.Game.Rulesets.Mania.Mods
{ {
public override string Name => "Dual Stages"; public override string Name => "Dual Stages";
public override string Acronym => "DS"; public override string Acronym => "DS";
public override string Description => @"Double the stages, double the fun!"; public override LocalisableString Description => @"Double the stages, double the fun!";
public override ModType Type => ModType.Conversion; public override ModType Type => ModType.Conversion;
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;

View File

@ -1,12 +1,13 @@
// 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.Localisation;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModEasy : ModEasyWithExtraLives public class ManiaModEasy : ModEasyWithExtraLives
{ {
public override string Description => @"More forgiving HP drain, less accuracy required, and three lives!"; public override LocalisableString Description => @"More forgiving HP drain, less accuracy required, and three lives!";
} }
} }

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
@ -11,7 +12,7 @@ namespace osu.Game.Rulesets.Mania.Mods
{ {
public override string Name => "Fade In"; public override string Name => "Fade In";
public override string Acronym => "FI"; public override string Acronym => "FI";
public override string Description => @"Keys appear out of nowhere!"; public override LocalisableString Description => @"Keys appear out of nowhere!";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ManiaModHidden)).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ManiaModHidden)).ToArray();

View File

@ -3,13 +3,14 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModHidden : ManiaModPlayfieldCover public class ManiaModHidden : ManiaModPlayfieldCover
{ {
public override string Description => @"Keys fade out before you hit them!"; public override LocalisableString Description => @"Keys fade out before you hit them!";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ManiaModFadeIn)).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ManiaModFadeIn)).ToArray();

View File

@ -8,6 +8,7 @@ using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
@ -20,7 +21,7 @@ namespace osu.Game.Rulesets.Mania.Mods
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override string Description => @"Replaces all hold notes with normal notes."; public override LocalisableString Description => @"Replaces all hold notes with normal notes.";
public override IconUsage? Icon => FontAwesome.Solid.DotCircle; public override IconUsage? Icon => FontAwesome.Solid.DotCircle;

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps;
@ -20,7 +21,7 @@ namespace osu.Game.Rulesets.Mania.Mods
public override string Acronym => "IN"; public override string Acronym => "IN";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override string Description => "Hold the keys. To the beat."; public override LocalisableString Description => "Hold the keys. To the beat.";
public override IconUsage? Icon => FontAwesome.Solid.YinYang; public override IconUsage? Icon => FontAwesome.Solid.YinYang;

View File

@ -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.Localisation;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModKey1 : ManiaKeyMod public class ManiaModKey1 : ManiaKeyMod
@ -8,6 +10,6 @@ namespace osu.Game.Rulesets.Mania.Mods
public override int KeyCount => 1; public override int KeyCount => 1;
public override string Name => "One Key"; public override string Name => "One Key";
public override string Acronym => "1K"; public override string Acronym => "1K";
public override string Description => @"Play with one key."; public override LocalisableString Description => @"Play with one key.";
} }
} }

View File

@ -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.Localisation;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModKey10 : ManiaKeyMod public class ManiaModKey10 : ManiaKeyMod
@ -8,6 +10,6 @@ namespace osu.Game.Rulesets.Mania.Mods
public override int KeyCount => 10; public override int KeyCount => 10;
public override string Name => "Ten Keys"; public override string Name => "Ten Keys";
public override string Acronym => "10K"; public override string Acronym => "10K";
public override string Description => @"Play with ten keys."; public override LocalisableString Description => @"Play with ten keys.";
} }
} }

View File

@ -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.Localisation;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModKey2 : ManiaKeyMod public class ManiaModKey2 : ManiaKeyMod
@ -8,6 +10,6 @@ namespace osu.Game.Rulesets.Mania.Mods
public override int KeyCount => 2; public override int KeyCount => 2;
public override string Name => "Two Keys"; public override string Name => "Two Keys";
public override string Acronym => "2K"; public override string Acronym => "2K";
public override string Description => @"Play with two keys."; public override LocalisableString Description => @"Play with two keys.";
} }
} }

View File

@ -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.Localisation;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModKey3 : ManiaKeyMod public class ManiaModKey3 : ManiaKeyMod
@ -8,6 +10,6 @@ namespace osu.Game.Rulesets.Mania.Mods
public override int KeyCount => 3; public override int KeyCount => 3;
public override string Name => "Three Keys"; public override string Name => "Three Keys";
public override string Acronym => "3K"; public override string Acronym => "3K";
public override string Description => @"Play with three keys."; public override LocalisableString Description => @"Play with three keys.";
} }
} }

View File

@ -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.Localisation;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModKey4 : ManiaKeyMod public class ManiaModKey4 : ManiaKeyMod
@ -8,6 +10,6 @@ namespace osu.Game.Rulesets.Mania.Mods
public override int KeyCount => 4; public override int KeyCount => 4;
public override string Name => "Four Keys"; public override string Name => "Four Keys";
public override string Acronym => "4K"; public override string Acronym => "4K";
public override string Description => @"Play with four keys."; public override LocalisableString Description => @"Play with four keys.";
} }
} }

View File

@ -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.Localisation;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModKey5 : ManiaKeyMod public class ManiaModKey5 : ManiaKeyMod
@ -8,6 +10,6 @@ namespace osu.Game.Rulesets.Mania.Mods
public override int KeyCount => 5; public override int KeyCount => 5;
public override string Name => "Five Keys"; public override string Name => "Five Keys";
public override string Acronym => "5K"; public override string Acronym => "5K";
public override string Description => @"Play with five keys."; public override LocalisableString Description => @"Play with five keys.";
} }
} }

View File

@ -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.Localisation;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModKey6 : ManiaKeyMod public class ManiaModKey6 : ManiaKeyMod
@ -8,6 +10,6 @@ namespace osu.Game.Rulesets.Mania.Mods
public override int KeyCount => 6; public override int KeyCount => 6;
public override string Name => "Six Keys"; public override string Name => "Six Keys";
public override string Acronym => "6K"; public override string Acronym => "6K";
public override string Description => @"Play with six keys."; public override LocalisableString Description => @"Play with six keys.";
} }
} }

View File

@ -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.Localisation;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModKey7 : ManiaKeyMod public class ManiaModKey7 : ManiaKeyMod
@ -8,6 +10,6 @@ namespace osu.Game.Rulesets.Mania.Mods
public override int KeyCount => 7; public override int KeyCount => 7;
public override string Name => "Seven Keys"; public override string Name => "Seven Keys";
public override string Acronym => "7K"; public override string Acronym => "7K";
public override string Description => @"Play with seven keys."; public override LocalisableString Description => @"Play with seven keys.";
} }
} }

View File

@ -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.Localisation;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModKey8 : ManiaKeyMod public class ManiaModKey8 : ManiaKeyMod
@ -8,6 +10,6 @@ namespace osu.Game.Rulesets.Mania.Mods
public override int KeyCount => 8; public override int KeyCount => 8;
public override string Name => "Eight Keys"; public override string Name => "Eight Keys";
public override string Acronym => "8K"; public override string Acronym => "8K";
public override string Description => @"Play with eight keys."; public override LocalisableString Description => @"Play with eight keys.";
} }
} }

View File

@ -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.Localisation;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModKey9 : ManiaKeyMod public class ManiaModKey9 : ManiaKeyMod
@ -8,6 +10,6 @@ namespace osu.Game.Rulesets.Mania.Mods
public override int KeyCount => 9; public override int KeyCount => 9;
public override string Name => "Nine Keys"; public override string Name => "Nine Keys";
public override string Acronym => "9K"; public override string Acronym => "9K";
public override string Description => @"Play with nine keys."; public override LocalisableString Description => @"Play with nine keys.";
} }
} }

View File

@ -5,6 +5,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using System.Linq; using System.Linq;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps;
@ -12,7 +13,7 @@ namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModMirror : ModMirror, IApplicableToBeatmap public class ManiaModMirror : ModMirror, IApplicableToBeatmap
{ {
public override string Description => "Notes are flipped horizontally."; public override LocalisableString Description => "Notes are flipped horizontally.";
public void ApplyToBeatmap(IBeatmap beatmap) public void ApplyToBeatmap(IBeatmap beatmap)
{ {

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps;
@ -14,7 +15,7 @@ namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModRandom : ModRandom, IApplicableToBeatmap public class ManiaModRandom : ModRandom, IApplicableToBeatmap
{ {
public override string Description => @"Shuffle around the keys!"; public override LocalisableString Description => @"Shuffle around the keys!";
public void ApplyToBeatmap(IBeatmap beatmap) public void ApplyToBeatmap(IBeatmap beatmap)
{ {

View File

@ -12,6 +12,7 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Edit;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
@ -55,9 +56,9 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
{ {
ControlPoints = ControlPoints =
{ {
new PathControlPoint(Vector2.Zero), new PathControlPoint(Vector2.Zero, PathType.PerfectCurve),
new PathControlPoint(OsuPlayfield.BASE_SIZE * 2 / 5), new PathControlPoint(new Vector2(136, 205)),
new PathControlPoint(OsuPlayfield.BASE_SIZE * 3 / 5) new PathControlPoint(new Vector2(-4, 226))
} }
} }
})); }));
@ -99,8 +100,8 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddStep("move mouse to new point location", () => AddStep("move mouse to new point location", () =>
{ {
var firstPiece = this.ChildrenOfType<PathControlPointPiece>().Single(piece => piece.ControlPoint == slider.Path.ControlPoints[0]); var firstPiece = this.ChildrenOfType<PathControlPointPiece>().Single(piece => piece.ControlPoint == slider.Path.ControlPoints[0]);
var secondPiece = this.ChildrenOfType<PathControlPointPiece>().Single(piece => piece.ControlPoint == slider.Path.ControlPoints[1]); var pos = slider.Path.PositionAt(0.25d) + slider.Position;
InputManager.MoveMouseTo((firstPiece.ScreenSpaceDrawQuad.Centre + secondPiece.ScreenSpaceDrawQuad.Centre) / 2); InputManager.MoveMouseTo(firstPiece.Parent.ToScreenSpace(pos));
}); });
AddStep("move slider end", () => AddStep("move slider end", () =>
{ {
@ -175,6 +176,23 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
assertSliderSnapped(false); assertSliderSnapped(false);
} }
[Test]
public void TestRotatingSliderRetainsPerfectControlPointType()
{
OsuSelectionHandler selectionHandler;
AddAssert("first control point perfect", () => slider.Path.ControlPoints[0].Type == PathType.PerfectCurve);
AddStep("select slider", () => EditorBeatmap.SelectedHitObjects.Add(slider));
AddStep("rotate 90 degrees ccw", () =>
{
selectionHandler = this.ChildrenOfType<OsuSelectionHandler>().Single();
selectionHandler.HandleRotation(-90);
});
AddAssert("first control point still perfect", () => slider.Path.ControlPoints[0].Type == PathType.PerfectCurve);
}
[Test] [Test]
public void TestFlippingSliderDoesNotSnap() public void TestFlippingSliderDoesNotSnap()
{ {
@ -200,6 +218,23 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
assertSliderSnapped(false); assertSliderSnapped(false);
} }
[Test]
public void TestFlippingSliderRetainsPerfectControlPointType()
{
OsuSelectionHandler selectionHandler;
AddAssert("first control point perfect", () => slider.Path.ControlPoints[0].Type == PathType.PerfectCurve);
AddStep("select slider", () => EditorBeatmap.SelectedHitObjects.Add(slider));
AddStep("flip slider horizontally", () =>
{
selectionHandler = this.ChildrenOfType<OsuSelectionHandler>().Single();
selectionHandler.OnPressed(new KeyBindingPressEvent<GlobalAction>(InputManager.CurrentState, GlobalAction.EditorFlipVertically));
});
AddAssert("first control point still perfect", () => slider.Path.ControlPoints[0].Type == PathType.PerfectCurve);
}
[Test] [Test]
public void TestReversingSliderDoesNotSnap() public void TestReversingSliderDoesNotSnap()
{ {

View File

@ -127,13 +127,16 @@ namespace osu.Game.Rulesets.Osu.Edit
{ {
didFlip = true; didFlip = true;
foreach (var point in slider.Path.ControlPoints) var controlPoints = slider.Path.ControlPoints.Select(p =>
{ new PathControlPoint(new Vector2(
point.Position = new Vector2( (direction == Direction.Horizontal ? -1 : 1) * p.Position.X,
(direction == Direction.Horizontal ? -1 : 1) * point.Position.X, (direction == Direction.Vertical ? -1 : 1) * p.Position.Y
(direction == Direction.Vertical ? -1 : 1) * point.Position.Y ), p.Type)).ToArray();
);
} // Importantly, update as a single operation so automatic adjustment of control points to different
// curve types does not unexpectedly trigger and change the slider's shape.
slider.Path.ControlPoints.Clear();
slider.Path.ControlPoints.AddRange(controlPoints);
} }
} }
@ -183,8 +186,13 @@ namespace osu.Game.Rulesets.Osu.Edit
if (h is IHasPath path) if (h is IHasPath path)
{ {
foreach (var point in path.Path.ControlPoints) var controlPoints = path.Path.ControlPoints.Select(p =>
point.Position = RotatePointAroundOrigin(point.Position, Vector2.Zero, delta); new PathControlPoint(RotatePointAroundOrigin(p.Position, Vector2.Zero, delta), p.Type)).ToArray();
// Importantly, update as a single operation so automatic adjustment of control points to different
// curve types does not unexpectedly trigger and change the slider's shape.
path.Path.ControlPoints.Clear();
path.Path.ControlPoints.AddRange(controlPoints);
} }
} }

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
namespace osu.Game.Rulesets.Osu.Mods namespace osu.Game.Rulesets.Osu.Mods
{ {
@ -11,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
public override string Name => @"Alternate"; public override string Name => @"Alternate";
public override string Acronym => @"AL"; public override string Acronym => @"AL";
public override string Description => @"Don't use the same key twice in a row!"; public override LocalisableString Description => @"Don't use the same key twice in a row!";
public override IconUsage? Icon => FontAwesome.Solid.Keyboard; public override IconUsage? Icon => FontAwesome.Solid.Keyboard;
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModSingleTap) }).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModSingleTap) }).ToArray();

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
@ -16,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
public override string Name => "Approach Different"; public override string Name => "Approach Different";
public override string Acronym => "AD"; public override string Acronym => "AD";
public override string Description => "Never trust the approach circles..."; public override LocalisableString Description => "Never trust the approach circles...";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override IconUsage? Icon { get; } = FontAwesome.Regular.Circle; public override IconUsage? Icon { get; } = FontAwesome.Regular.Circle;

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.StateChanges; using osu.Framework.Input.StateChanges;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
@ -20,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override string Acronym => "AP"; public override string Acronym => "AP";
public override IconUsage? Icon => OsuIcon.ModAutopilot; public override IconUsage? Icon => OsuIcon.ModAutopilot;
public override ModType Type => ModType.Automation; public override ModType Type => ModType.Automation;
public override string Description => @"Automatic cursor movement - just follow the rhythm."; public override LocalisableString Description => @"Automatic cursor movement - just follow the rhythm.";
public override double ScoreMultiplier => 0.1; public override double ScoreMultiplier => 0.1;
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModFailCondition), typeof(ModNoFail), typeof(ModAutoplay), typeof(OsuModMagnetised), typeof(OsuModRepel) }; public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModFailCondition), typeof(ModNoFail), typeof(ModAutoplay), typeof(OsuModMagnetised), typeof(OsuModRepel) };

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -22,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public class OsuModBlinds : Mod, IApplicableToDrawableRuleset<OsuHitObject>, IApplicableToHealthProcessor public class OsuModBlinds : Mod, IApplicableToDrawableRuleset<OsuHitObject>, IApplicableToHealthProcessor
{ {
public override string Name => "Blinds"; public override string Name => "Blinds";
public override string Description => "Play with blinds on your screen."; public override LocalisableString Description => "Play with blinds on your screen.";
public override string Acronym => "BL"; public override string Acronym => "BL";
public override IconUsage? Icon => FontAwesome.Solid.Adjust; public override IconUsage? Icon => FontAwesome.Solid.Adjust;

View File

@ -3,6 +3,7 @@
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
namespace osu.Game.Rulesets.Osu.Mods namespace osu.Game.Rulesets.Osu.Mods
@ -15,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override IconUsage? Icon => FontAwesome.Solid.CompressArrowsAlt; public override IconUsage? Icon => FontAwesome.Solid.CompressArrowsAlt;
public override string Description => "Hit them at the right size!"; public override LocalisableString Description => "Hit them at the right size!";
[SettingSource("Starting Size", "The initial size multiplier applied to all objects.")] [SettingSource("Starting Size", "The initial size multiplier applied to all objects.")]
public override BindableNumber<float> StartScale { get; } = new BindableFloat public override BindableNumber<float> StartScale { get; } = new BindableFloat

View File

@ -1,12 +1,13 @@
// 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.Localisation;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Osu.Mods namespace osu.Game.Rulesets.Osu.Mods
{ {
public class OsuModEasy : ModEasyWithExtraLives public class OsuModEasy : ModEasyWithExtraLives
{ {
public override string Description => @"Larger circles, more forgiving HP drain, less accuracy required, and three lives!"; public override LocalisableString Description => @"Larger circles, more forgiving HP drain, less accuracy required, and three lives!";
} }
} }

View File

@ -3,6 +3,7 @@
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
namespace osu.Game.Rulesets.Osu.Mods namespace osu.Game.Rulesets.Osu.Mods
@ -15,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override IconUsage? Icon => FontAwesome.Solid.ArrowsAltV; public override IconUsage? Icon => FontAwesome.Solid.ArrowsAltV;
public override string Description => "Hit them at the right size!"; public override LocalisableString Description => "Hit them at the right size!";
[SettingSource("Starting Size", "The initial size multiplier applied to all objects.")] [SettingSource("Starting Size", "The initial size multiplier applied to all objects.")]
public override BindableNumber<float> StartScale { get; } = new BindableFloat public override BindableNumber<float> StartScale { get; } = new BindableFloat

View File

@ -6,6 +6,7 @@ using System.Diagnostics;
using System.Linq; using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -22,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Mods
[SettingSource("Only fade approach circles", "The main object body will not fade when enabled.")] [SettingSource("Only fade approach circles", "The main object body will not fade when enabled.")]
public Bindable<bool> OnlyFadeApproachCircles { get; } = new BindableBool(); public Bindable<bool> OnlyFadeApproachCircles { get; } = new BindableBool();
public override string Description => @"Play with no approach circles and fading circles/sliders."; public override LocalisableString Description => @"Play with no approach circles and fading circles/sliders.";
public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.06 : 1; public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.06 : 1;
public override Type[] IncompatibleMods => new[] { typeof(IRequiresApproachCircles), typeof(OsuModSpinIn) }; public override Type[] IncompatibleMods => new[] { typeof(IRequiresApproachCircles), typeof(OsuModSpinIn) };

View File

@ -4,6 +4,7 @@
using System; using System;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -22,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override string Acronym => "MG"; public override string Acronym => "MG";
public override IconUsage? Icon => FontAwesome.Solid.Magnet; public override IconUsage? Icon => FontAwesome.Solid.Magnet;
public override ModType Type => ModType.Fun; public override ModType Type => ModType.Fun;
public override string Description => "No need to chase the circles your cursor is a magnet!"; public override LocalisableString Description => "No need to chase the circles your cursor is a magnet!";
public override double ScoreMultiplier => 0.5; public override double ScoreMultiplier => 0.5;
public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay), typeof(OsuModRelax), typeof(OsuModRepel) }; public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay), typeof(OsuModRelax), typeof(OsuModRepel) };

View File

@ -3,6 +3,7 @@
using System; using System;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
@ -13,7 +14,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
public class OsuModMirror : ModMirror, IApplicableToHitObject public class OsuModMirror : ModMirror, IApplicableToHitObject
{ {
public override string Description => "Flip objects on the chosen axes."; public override LocalisableString Description => "Flip objects on the chosen axes.";
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) }; public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
[SettingSource("Mirrored axes", "Choose which axes objects are mirrored over.")] [SettingSource("Mirrored axes", "Choose which axes objects are mirrored over.")]

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -17,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
public class OsuModNoScope : ModNoScope, IUpdatableByPlayfield, IApplicableToBeatmap public class OsuModNoScope : ModNoScope, IUpdatableByPlayfield, IApplicableToBeatmap
{ {
public override string Description => "Where's the cursor?"; public override LocalisableString Description => "Where's the cursor?";
private PeriodTracker spinnerPeriods = null!; private PeriodTracker spinnerPeriods = null!;

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -18,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Mods
/// </summary> /// </summary>
public class OsuModRandom : ModRandom, IApplicableToBeatmap public class OsuModRandom : ModRandom, IApplicableToBeatmap
{ {
public override string Description => "It never gets boring!"; public override LocalisableString Description => "It never gets boring!";
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModTarget)).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModTarget)).ToArray();

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
@ -18,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
public class OsuModRelax : ModRelax, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject>, IApplicableToPlayer public class OsuModRelax : ModRelax, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject>, IApplicableToPlayer
{ {
public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things."; public override LocalisableString Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things.";
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModMagnetised), typeof(OsuModAlternate), typeof(OsuModSingleTap) }).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModMagnetised), typeof(OsuModAlternate), typeof(OsuModSingleTap) }).ToArray();
/// <summary> /// <summary>

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -22,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override string Name => "Repel"; public override string Name => "Repel";
public override string Acronym => "RP"; public override string Acronym => "RP";
public override ModType Type => ModType.Fun; public override ModType Type => ModType.Fun;
public override string Description => "Hit objects run away!"; public override LocalisableString Description => "Hit objects run away!";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay), typeof(OsuModMagnetised) }; public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay), typeof(OsuModMagnetised) };

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Localisation;
namespace osu.Game.Rulesets.Osu.Mods namespace osu.Game.Rulesets.Osu.Mods
{ {
@ -10,7 +11,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
public override string Name => @"Single Tap"; public override string Name => @"Single Tap";
public override string Acronym => @"SG"; public override string Acronym => @"SG";
public override string Description => @"You must only use one key!"; public override LocalisableString Description => @"You must only use one key!";
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAlternate) }).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAlternate) }).ToArray();
protected override bool CheckValidNewAction(OsuAction action) => LastAcceptedAction == null || LastAcceptedAction == action; protected override bool CheckValidNewAction(OsuAction action) => LastAcceptedAction == null || LastAcceptedAction == action;

View File

@ -4,6 +4,7 @@
using System; using System;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
@ -18,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override string Acronym => "SI"; public override string Acronym => "SI";
public override IconUsage? Icon => FontAwesome.Solid.Undo; public override IconUsage? Icon => FontAwesome.Solid.Undo;
public override ModType Type => ModType.Fun; public override ModType Type => ModType.Fun;
public override string Description => "Circles spin in. No approach circles."; public override LocalisableString Description => "Circles spin in. No approach circles.";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
// todo: this mod needs to be incompatible with "hidden" due to forcing the circle to remain opaque, // todo: this mod needs to be incompatible with "hidden" due to forcing the circle to remain opaque,

View File

@ -4,6 +4,7 @@
using System; using System;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -18,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override string Acronym => "SO"; public override string Acronym => "SO";
public override IconUsage? Icon => OsuIcon.ModSpunOut; public override IconUsage? Icon => OsuIcon.ModSpunOut;
public override ModType Type => ModType.Automation; public override ModType Type => ModType.Automation;
public override string Description => @"Spinners will be automatically completed."; public override LocalisableString Description => @"Spinners will be automatically completed.";
public override double ScoreMultiplier => 0.9; public override double ScoreMultiplier => 0.9;
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(OsuModAutopilot), typeof(OsuModTarget) }; public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(OsuModAutopilot), typeof(OsuModTarget) };

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -23,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override string Name => @"Strict Tracking"; public override string Name => @"Strict Tracking";
public override string Acronym => @"ST"; public override string Acronym => @"ST";
public override ModType Type => ModType.DifficultyIncrease; public override ModType Type => ModType.DifficultyIncrease;
public override string Description => @"Once you start a slider, follow precisely or get a miss."; public override LocalisableString Description => @"Once you start a slider, follow precisely or get a miss.";
public override double ScoreMultiplier => 1.0; public override double ScoreMultiplier => 1.0;
public override Type[] IncompatibleMods => new[] { typeof(ModClassic), typeof(OsuModTarget) }; public override Type[] IncompatibleMods => new[] { typeof(ModClassic), typeof(OsuModTarget) };

View File

@ -7,6 +7,7 @@ using System.Linq;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
@ -39,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override string Acronym => "TP"; public override string Acronym => "TP";
public override ModType Type => ModType.Conversion; public override ModType Type => ModType.Conversion;
public override IconUsage? Icon => OsuIcon.ModTarget; public override IconUsage? Icon => OsuIcon.ModTarget;
public override string Description => @"Practice keeping up with the beat of the song."; public override LocalisableString Description => @"Practice keeping up with the beat of the song.";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[]

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Osu.Mods namespace osu.Game.Rulesets.Osu.Mods
@ -9,7 +10,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
public override string Name => "Touch Device"; public override string Name => "Touch Device";
public override string Acronym => "TD"; public override string Acronym => "TD";
public override string Description => "Automatically applied to plays on devices with a touchscreen."; public override LocalisableString Description => "Automatically applied to plays on devices with a touchscreen.";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override ModType Type => ModType.System; public override ModType Type => ModType.System;

View File

@ -4,6 +4,7 @@
using System; using System;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables;
@ -16,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override string Name => "Traceable"; public override string Name => "Traceable";
public override string Acronym => "TC"; public override string Acronym => "TC";
public override ModType Type => ModType.Fun; public override ModType Type => ModType.Fun;
public override string Description => "Put your faith in the approach circles..."; public override LocalisableString Description => "Put your faith in the approach circles...";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(IHidesApproachCircles) }; public override Type[] IncompatibleMods => new[] { typeof(IHidesApproachCircles) };

View File

@ -4,6 +4,7 @@
using System; using System;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
@ -18,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override string Acronym => "TR"; public override string Acronym => "TR";
public override IconUsage? Icon => FontAwesome.Solid.ArrowsAlt; public override IconUsage? Icon => FontAwesome.Solid.ArrowsAlt;
public override ModType Type => ModType.Fun; public override ModType Type => ModType.Fun;
public override string Description => "Everything rotates. EVERYTHING."; public override LocalisableString Description => "Everything rotates. EVERYTHING.";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(OsuModWiggle), typeof(OsuModMagnetised), typeof(OsuModRepel) }; public override Type[] IncompatibleMods => new[] { typeof(OsuModWiggle), typeof(OsuModMagnetised), typeof(OsuModRepel) };

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
@ -20,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override string Acronym => "WG"; public override string Acronym => "WG";
public override IconUsage? Icon => FontAwesome.Solid.Certificate; public override IconUsage? Icon => FontAwesome.Solid.Certificate;
public override ModType Type => ModType.Fun; public override ModType Type => ModType.Fun;
public override string Description => "They just won't stay still..."; public override LocalisableString Description => "They just won't stay still...";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(OsuModTransform), typeof(OsuModMagnetised), typeof(OsuModRepel) }; public override Type[] IncompatibleMods => new[] { typeof(OsuModTransform), typeof(OsuModMagnetised), typeof(OsuModRepel) };

View File

@ -32,6 +32,7 @@ using osu.Game.Skinning;
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Osu.Edit.Setup; using osu.Game.Rulesets.Osu.Edit.Setup;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Skinning.Legacy; using osu.Game.Rulesets.Osu.Skinning.Legacy;
@ -253,7 +254,7 @@ namespace osu.Game.Rulesets.Osu
}; };
} }
public override string GetDisplayNameForHitResult(HitResult result) public override LocalisableString GetDisplayNameForHitResult(HitResult result)
{ {
switch (result) switch (result)
{ {

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Osu.UI.Cursor; using osu.Game.Rulesets.Osu.UI.Cursor;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osuTK; using osuTK;
@ -28,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.UI
public override CursorContainer LocalCursor => State.Value == Visibility.Visible ? localCursorContainer : null; public override CursorContainer LocalCursor => State.Value == Visibility.Visible ? localCursorContainer : null;
protected override string Message => "Click the orange cursor to resume"; protected override LocalisableString Message => "Click the orange cursor to resume";
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -8,7 +9,7 @@ namespace osu.Game.Rulesets.Taiko.Mods
{ {
public class TaikoModEasy : ModEasy public class TaikoModEasy : ModEasy
{ {
public override string Description => @"Beats move slower, and less accuracy required!"; public override LocalisableString Description => @"Beats move slower, and less accuracy required!";
/// <summary> /// <summary>
/// Multiplier factor added to the scrolling speed. /// Multiplier factor added to the scrolling speed.

View File

@ -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 osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
@ -15,7 +16,7 @@ namespace osu.Game.Rulesets.Taiko.Mods
{ {
public class TaikoModHidden : ModHidden, IApplicableToDrawableRuleset<TaikoHitObject> public class TaikoModHidden : ModHidden, IApplicableToDrawableRuleset<TaikoHitObject>
{ {
public override string Description => @"Beats fade out before you hit them!"; public override LocalisableString Description => @"Beats fade out before you hit them!";
public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.06 : 1; public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.06 : 1;
/// <summary> /// <summary>

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -13,7 +14,7 @@ namespace osu.Game.Rulesets.Taiko.Mods
{ {
public class TaikoModRandom : ModRandom, IApplicableToBeatmap public class TaikoModRandom : ModRandom, IApplicableToBeatmap
{ {
public override string Description => @"Shuffle around the colours!"; public override LocalisableString Description => @"Shuffle around the colours!";
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(TaikoModSwap)).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(TaikoModSwap)).ToArray();
public void ApplyToBeatmap(IBeatmap beatmap) public void ApplyToBeatmap(IBeatmap beatmap)

View File

@ -1,12 +1,13 @@
// 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.Localisation;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Taiko.Mods namespace osu.Game.Rulesets.Taiko.Mods
{ {
public class TaikoModRelax : ModRelax public class TaikoModRelax : ModRelax
{ {
public override string Description => @"No ninja-like spinners, demanding drumrolls or unexpected katu's."; public override LocalisableString Description => @"No ninja-like spinners, demanding drumrolls or unexpected katu's.";
} }
} }

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Taiko.Beatmaps; using osu.Game.Rulesets.Taiko.Beatmaps;
@ -14,7 +15,7 @@ namespace osu.Game.Rulesets.Taiko.Mods
{ {
public override string Name => "Swap"; public override string Name => "Swap";
public override string Acronym => "SW"; public override string Acronym => "SW";
public override string Description => @"Dons become kats, kats become dons"; public override LocalisableString Description => @"Dons become kats, kats become dons";
public override ModType Type => ModType.Conversion; public override ModType Type => ModType.Conversion;
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModRandom)).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModRandom)).ToArray();

View File

@ -25,6 +25,7 @@ using osu.Game.Scoring;
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Taiko.Edit; using osu.Game.Rulesets.Taiko.Edit;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;
@ -192,7 +193,7 @@ namespace osu.Game.Rulesets.Taiko
}; };
} }
public override string GetDisplayNameForHitResult(HitResult result) public override LocalisableString GetDisplayNameForHitResult(HitResult result)
{ {
switch (result) switch (result)
{ {

View File

@ -5,6 +5,7 @@ using System;
using System.Linq; using System.Linq;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Utils; using osu.Game.Utils;
@ -320,7 +321,7 @@ namespace osu.Game.Tests.Mods
public class InvalidMultiplayerMod : Mod public class InvalidMultiplayerMod : Mod
{ {
public override string Name => string.Empty; public override string Name => string.Empty;
public override string Description => string.Empty; public override LocalisableString Description => string.Empty;
public override string Acronym => string.Empty; public override string Acronym => string.Empty;
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override bool HasImplementation => true; public override bool HasImplementation => true;
@ -331,7 +332,7 @@ namespace osu.Game.Tests.Mods
private class InvalidMultiplayerFreeMod : Mod private class InvalidMultiplayerFreeMod : Mod
{ {
public override string Name => string.Empty; public override string Name => string.Empty;
public override string Description => string.Empty; public override LocalisableString Description => string.Empty;
public override string Acronym => string.Empty; public override string Acronym => string.Empty;
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override bool HasImplementation => true; public override bool HasImplementation => true;

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets; using osu.Game.Rulesets;
@ -60,7 +61,7 @@ namespace osu.Game.Tests.Mods
{ {
public override double ScoreMultiplier => 1.0; public override double ScoreMultiplier => 1.0;
public override string Description => "This is a customisable test mod."; public override LocalisableString Description => "This is a customisable test mod.";
public override ModType Type => ModType.Conversion; public override ModType Type => ModType.Conversion;

View File

@ -7,6 +7,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.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Preprocessing;
@ -160,7 +161,7 @@ namespace osu.Game.Tests.NonVisual
{ {
public override string Name => nameof(ModA); public override string Name => nameof(ModA);
public override string Acronym => nameof(ModA); public override string Acronym => nameof(ModA);
public override string Description => string.Empty; public override LocalisableString Description => string.Empty;
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(ModIncompatibleWithA), typeof(ModIncompatibleWithAAndB) }; public override Type[] IncompatibleMods => new[] { typeof(ModIncompatibleWithA), typeof(ModIncompatibleWithAAndB) };
@ -169,7 +170,7 @@ namespace osu.Game.Tests.NonVisual
private class ModB : Mod private class ModB : Mod
{ {
public override string Name => nameof(ModB); public override string Name => nameof(ModB);
public override string Description => string.Empty; public override LocalisableString Description => string.Empty;
public override string Acronym => nameof(ModB); public override string Acronym => nameof(ModB);
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
@ -180,7 +181,7 @@ namespace osu.Game.Tests.NonVisual
{ {
public override string Name => nameof(ModC); public override string Name => nameof(ModC);
public override string Acronym => nameof(ModC); public override string Acronym => nameof(ModC);
public override string Description => string.Empty; public override LocalisableString Description => string.Empty;
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
} }
@ -188,7 +189,7 @@ namespace osu.Game.Tests.NonVisual
{ {
public override string Name => $"Incompatible With {nameof(ModA)}"; public override string Name => $"Incompatible With {nameof(ModA)}";
public override string Acronym => $"Incompatible With {nameof(ModA)}"; public override string Acronym => $"Incompatible With {nameof(ModA)}";
public override string Description => string.Empty; public override LocalisableString Description => string.Empty;
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(ModA) }; public override Type[] IncompatibleMods => new[] { typeof(ModA) };
@ -207,7 +208,7 @@ namespace osu.Game.Tests.NonVisual
{ {
public override string Name => $"Incompatible With {nameof(ModA)} and {nameof(ModB)}"; public override string Name => $"Incompatible With {nameof(ModA)} and {nameof(ModB)}";
public override string Acronym => $"Incompatible With {nameof(ModA)} and {nameof(ModB)}"; public override string Acronym => $"Incompatible With {nameof(ModA)} and {nameof(ModB)}";
public override string Description => string.Empty; public override LocalisableString Description => string.Empty;
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(ModA), typeof(ModB) }; public override Type[] IncompatibleMods => new[] { typeof(ModA), typeof(ModB) };

View File

@ -9,6 +9,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Online.API; using osu.Game.Online.API;
@ -182,7 +183,7 @@ namespace osu.Game.Tests.Online
{ {
public override string Name => "Test Mod"; public override string Name => "Test Mod";
public override string Acronym => "TM"; public override string Acronym => "TM";
public override string Description => "This is a test mod."; public override LocalisableString Description => "This is a test mod.";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
[SettingSource("Test")] [SettingSource("Test")]
@ -199,7 +200,7 @@ namespace osu.Game.Tests.Online
{ {
public override string Name => "Test Mod"; public override string Name => "Test Mod";
public override string Acronym => "TMTR"; public override string Acronym => "TMTR";
public override string Description => "This is a test mod."; public override LocalisableString Description => "This is a test mod.";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
[SettingSource("Initial rate", "The starting speed of the track")] [SettingSource("Initial rate", "The starting speed of the track")]

View File

@ -7,6 +7,7 @@ using System.Collections.Generic;
using MessagePack; using MessagePack;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Online.API; using osu.Game.Online.API;
@ -102,7 +103,7 @@ namespace osu.Game.Tests.Online
{ {
public override string Name => "Test Mod"; public override string Name => "Test Mod";
public override string Acronym => "TM"; public override string Acronym => "TM";
public override string Description => "This is a test mod."; public override LocalisableString Description => "This is a test mod.";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
[SettingSource("Test")] [SettingSource("Test")]
@ -119,7 +120,7 @@ namespace osu.Game.Tests.Online
{ {
public override string Name => "Test Mod"; public override string Name => "Test Mod";
public override string Acronym => "TMTR"; public override string Acronym => "TMTR";
public override string Description => "This is a test mod."; public override LocalisableString Description => "This is a test mod.";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
[SettingSource("Initial rate", "The starting speed of the track")] [SettingSource("Initial rate", "The starting speed of the track")]
@ -154,7 +155,7 @@ namespace osu.Game.Tests.Online
{ {
public override string Name => "Test Mod"; public override string Name => "Test Mod";
public override string Acronym => "TM"; public override string Acronym => "TM";
public override string Description => "This is a test mod."; public override LocalisableString Description => "This is a test mod.";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
[SettingSource("Test")] [SettingSource("Test")]

View File

@ -4,11 +4,13 @@
#nullable disable #nullable disable
using System; using System;
using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Bindables; using osu.Framework.Graphics;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Screens.OnlinePlay.Multiplayer.Spectate; using osu.Game.Screens.OnlinePlay.Multiplayer.Spectate;
using osu.Game.Screens.Play;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
namespace osu.Game.Tests.OnlinePlay namespace osu.Game.Tests.OnlinePlay
@ -16,20 +18,34 @@ namespace osu.Game.Tests.OnlinePlay
[HeadlessTest] [HeadlessTest]
public class TestSceneCatchUpSyncManager : OsuTestScene public class TestSceneCatchUpSyncManager : OsuTestScene
{ {
private TestManualClock master; private GameplayClockContainer master;
private CatchUpSyncManager syncManager; private SpectatorSyncManager syncManager;
private TestSpectatorPlayerClock player1; private Dictionary<SpectatorPlayerClock, int> clocksById;
private TestSpectatorPlayerClock player2; private SpectatorPlayerClock player1;
private SpectatorPlayerClock player2;
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
syncManager = new CatchUpSyncManager(master = new TestManualClock()); syncManager = new SpectatorSyncManager(master = new GameplayClockContainer(new TestManualClock()));
syncManager.AddPlayerClock(player1 = new TestSpectatorPlayerClock(1)); player1 = syncManager.CreateManagedClock();
syncManager.AddPlayerClock(player2 = new TestSpectatorPlayerClock(2)); player2 = syncManager.CreateManagedClock();
Schedule(() => Child = syncManager); clocksById = new Dictionary<SpectatorPlayerClock, int>
{
{ player1, 1 },
{ player2, 2 }
};
Schedule(() =>
{
Children = new Drawable[]
{
syncManager,
master
};
});
} }
[Test] [Test]
@ -48,7 +64,7 @@ namespace osu.Game.Tests.OnlinePlay
public void TestReadyPlayersStartWhenReadyForMaximumDelayTime() public void TestReadyPlayersStartWhenReadyForMaximumDelayTime()
{ {
setWaiting(() => player1, false); setWaiting(() => player1, false);
AddWaitStep($"wait {CatchUpSyncManager.MAXIMUM_START_DELAY} milliseconds", (int)Math.Ceiling(CatchUpSyncManager.MAXIMUM_START_DELAY / TimePerAction)); AddWaitStep($"wait {SpectatorSyncManager.MAXIMUM_START_DELAY} milliseconds", (int)Math.Ceiling(SpectatorSyncManager.MAXIMUM_START_DELAY / TimePerAction));
assertPlayerClockState(() => player1, true); assertPlayerClockState(() => player1, true);
assertPlayerClockState(() => player2, false); assertPlayerClockState(() => player2, false);
} }
@ -58,7 +74,7 @@ namespace osu.Game.Tests.OnlinePlay
{ {
setAllWaiting(false); setAllWaiting(false);
setMasterTime(CatchUpSyncManager.SYNC_TARGET + 1); setMasterTime(SpectatorSyncManager.SYNC_TARGET + 1);
assertCatchingUp(() => player1, false); assertCatchingUp(() => player1, false);
} }
@ -67,7 +83,7 @@ namespace osu.Game.Tests.OnlinePlay
{ {
setAllWaiting(false); setAllWaiting(false);
setMasterTime(CatchUpSyncManager.MAX_SYNC_OFFSET + 1); setMasterTime(SpectatorSyncManager.MAX_SYNC_OFFSET + 1);
assertCatchingUp(() => player1, true); assertCatchingUp(() => player1, true);
assertCatchingUp(() => player2, true); assertCatchingUp(() => player2, true);
} }
@ -77,8 +93,8 @@ namespace osu.Game.Tests.OnlinePlay
{ {
setAllWaiting(false); setAllWaiting(false);
setMasterTime(CatchUpSyncManager.MAX_SYNC_OFFSET + 1); setMasterTime(SpectatorSyncManager.MAX_SYNC_OFFSET + 1);
setPlayerClockTime(() => player1, CatchUpSyncManager.SYNC_TARGET + 1); setPlayerClockTime(() => player1, SpectatorSyncManager.SYNC_TARGET + 1);
assertCatchingUp(() => player1, true); assertCatchingUp(() => player1, true);
} }
@ -87,8 +103,8 @@ namespace osu.Game.Tests.OnlinePlay
{ {
setAllWaiting(false); setAllWaiting(false);
setMasterTime(CatchUpSyncManager.MAX_SYNC_OFFSET + 2); setMasterTime(SpectatorSyncManager.MAX_SYNC_OFFSET + 2);
setPlayerClockTime(() => player1, CatchUpSyncManager.SYNC_TARGET); setPlayerClockTime(() => player1, SpectatorSyncManager.SYNC_TARGET);
assertCatchingUp(() => player1, false); assertCatchingUp(() => player1, false);
assertCatchingUp(() => player2, true); assertCatchingUp(() => player2, true);
} }
@ -98,7 +114,7 @@ namespace osu.Game.Tests.OnlinePlay
{ {
setAllWaiting(false); setAllWaiting(false);
setPlayerClockTime(() => player1, -CatchUpSyncManager.SYNC_TARGET); setPlayerClockTime(() => player1, -SpectatorSyncManager.SYNC_TARGET);
assertCatchingUp(() => player1, false); assertCatchingUp(() => player1, false);
assertPlayerClockState(() => player1, true); assertPlayerClockState(() => player1, true);
} }
@ -108,7 +124,7 @@ namespace osu.Game.Tests.OnlinePlay
{ {
setAllWaiting(false); setAllWaiting(false);
setPlayerClockTime(() => player1, -CatchUpSyncManager.SYNC_TARGET - 1); setPlayerClockTime(() => player1, -SpectatorSyncManager.SYNC_TARGET - 1);
// This is a silent catchup, where IsCatchingUp = false but IsRunning = false also. // This is a silent catchup, where IsCatchingUp = false but IsRunning = false also.
assertCatchingUp(() => player1, false); assertCatchingUp(() => player1, false);
@ -129,13 +145,13 @@ namespace osu.Game.Tests.OnlinePlay
assertPlayerClockState(() => player1, false); assertPlayerClockState(() => player1, false);
} }
private void setWaiting(Func<TestSpectatorPlayerClock> playerClock, bool waiting) private void setWaiting(Func<SpectatorPlayerClock> playerClock, bool waiting)
=> AddStep($"set player clock {playerClock().Id} waiting = {waiting}", () => playerClock().WaitingOnFrames.Value = waiting); => AddStep($"set player clock {clocksById[playerClock()]} waiting = {waiting}", () => playerClock().WaitingOnFrames = waiting);
private void setAllWaiting(bool waiting) => AddStep($"set all player clocks waiting = {waiting}", () => private void setAllWaiting(bool waiting) => AddStep($"set all player clocks waiting = {waiting}", () =>
{ {
player1.WaitingOnFrames.Value = waiting; player1.WaitingOnFrames = waiting;
player2.WaitingOnFrames.Value = waiting; player2.WaitingOnFrames = waiting;
}); });
private void setMasterTime(double time) private void setMasterTime(double time)
@ -144,51 +160,14 @@ namespace osu.Game.Tests.OnlinePlay
/// <summary> /// <summary>
/// clock.Time = master.Time - offsetFromMaster /// clock.Time = master.Time - offsetFromMaster
/// </summary> /// </summary>
private void setPlayerClockTime(Func<TestSpectatorPlayerClock> playerClock, double offsetFromMaster) private void setPlayerClockTime(Func<SpectatorPlayerClock> playerClock, double offsetFromMaster)
=> AddStep($"set player clock {playerClock().Id} = master - {offsetFromMaster}", () => playerClock().Seek(master.CurrentTime - offsetFromMaster)); => AddStep($"set player clock {clocksById[playerClock()]} = master - {offsetFromMaster}", () => playerClock().Seek(master.CurrentTime - offsetFromMaster));
private void assertCatchingUp(Func<TestSpectatorPlayerClock> playerClock, bool catchingUp) => private void assertCatchingUp(Func<SpectatorPlayerClock> playerClock, bool catchingUp) =>
AddAssert($"player clock {playerClock().Id} {(catchingUp ? "is" : "is not")} catching up", () => playerClock().IsCatchingUp == catchingUp); AddAssert($"player clock {clocksById[playerClock()]} {(catchingUp ? "is" : "is not")} catching up", () => playerClock().IsCatchingUp == catchingUp);
private void assertPlayerClockState(Func<TestSpectatorPlayerClock> playerClock, bool running) private void assertPlayerClockState(Func<SpectatorPlayerClock> playerClock, bool running)
=> AddAssert($"player clock {playerClock().Id} {(running ? "is" : "is not")} running", () => playerClock().IsRunning == running); => AddAssert($"player clock {clocksById[playerClock()]} {(running ? "is" : "is not")} running", () => playerClock().IsRunning == running);
private class TestSpectatorPlayerClock : TestManualClock, ISpectatorPlayerClock
{
public Bindable<bool> WaitingOnFrames { get; } = new Bindable<bool>(true);
public bool IsCatchingUp { get; set; }
public IFrameBasedClock Source
{
set => throw new NotImplementedException();
}
public readonly int Id;
public TestSpectatorPlayerClock(int id)
{
Id = id;
WaitingOnFrames.BindValueChanged(waiting =>
{
if (waiting.NewValue)
Stop();
else
Start();
});
}
public void ProcessFrame()
{
}
public double ElapsedFrameTime => 0;
public double FramesPerSecond => 0;
public FrameTimeInfo TimeInfo => default;
}
private class TestManualClock : ManualClock, IAdjustableClock private class TestManualClock : ManualClock, IAdjustableClock
{ {

View File

@ -13,6 +13,7 @@ using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Framework.Testing; using osu.Framework.Testing;
@ -459,7 +460,7 @@ namespace osu.Game.Tests.Visual.Gameplay
public override string Name => string.Empty; public override string Name => string.Empty;
public override string Acronym => string.Empty; public override string Acronym => string.Empty;
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override string Description => string.Empty; public override LocalisableString Description => string.Empty;
public bool Applied { get; private set; } public bool Applied { get; private set; }

View File

@ -202,7 +202,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
checkPausedInstant(PLAYER_2_ID, true); checkPausedInstant(PLAYER_2_ID, true);
// Wait for the start delay seconds... // Wait for the start delay seconds...
AddWaitStep("wait maximum start delay seconds", (int)(CatchUpSyncManager.MAXIMUM_START_DELAY / TimePerAction)); AddWaitStep("wait maximum start delay seconds", (int)(SpectatorSyncManager.MAXIMUM_START_DELAY / TimePerAction));
// Player 1 should start playing by itself, player 2 should remain paused. // Player 1 should start playing by itself, player 2 should remain paused.
checkPausedInstant(PLAYER_1_ID, false); checkPausedInstant(PLAYER_1_ID, false);
@ -318,7 +318,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
loadSpectateScreen(); loadSpectateScreen();
sendFrames(PLAYER_1_ID, 300); sendFrames(PLAYER_1_ID, 300);
AddWaitStep("wait maximum start delay seconds", (int)(CatchUpSyncManager.MAXIMUM_START_DELAY / TimePerAction)); AddWaitStep("wait maximum start delay seconds", (int)(SpectatorSyncManager.MAXIMUM_START_DELAY / TimePerAction));
checkPaused(PLAYER_1_ID, false); checkPaused(PLAYER_1_ID, false);
sendFrames(PLAYER_2_ID, 300); sendFrames(PLAYER_2_ID, 300);

View File

@ -7,6 +7,7 @@ using NUnit.Framework;
using osu.Framework.Bindables; 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.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osuTK; using osuTK;
@ -39,6 +40,9 @@ namespace osu.Game.Tests.Visual.Settings
[SettingSource("Sample bool", "Clicking this changes a setting")] [SettingSource("Sample bool", "Clicking this changes a setting")]
public BindableBool TickBindable { get; } = new BindableBool(); public BindableBool TickBindable { get; } = new BindableBool();
[SettingSource(typeof(TestStrings), nameof(TestStrings.LocalisableLabel), nameof(TestStrings.LocalisableDescription))]
public BindableBool LocalisableBindable { get; } = new BindableBool(true);
[SettingSource("Sample float", "Change something for a mod")] [SettingSource("Sample float", "Change something for a mod")]
public BindableFloat SliderBindable { get; } = new BindableFloat public BindableFloat SliderBindable { get; } = new BindableFloat
{ {
@ -75,5 +79,11 @@ namespace osu.Game.Tests.Visual.Settings
Value1, Value1,
Value2 Value2
} }
private class TestStrings
{
public static LocalisableString LocalisableLabel => new LocalisableString("Sample localisable label");
public static LocalisableString LocalisableDescription => new LocalisableString("Sample localisable description");
}
} }
} }

View File

@ -1,16 +1,16 @@
// 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.
#nullable disable
using System; 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.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -29,10 +29,18 @@ namespace osu.Game.Tests.Visual.UserInterface
[TestFixture] [TestFixture]
public class TestSceneModSelectOverlay : OsuManualInputManagerTestScene public class TestSceneModSelectOverlay : OsuManualInputManagerTestScene
{ {
[Resolved] protected override bool UseFreshStoragePerRun => true;
private RulesetStore rulesetStore { get; set; }
private UserModSelectOverlay modSelectOverlay; private RulesetStore rulesetStore = null!;
private TestModSelectOverlay modSelectOverlay = null!;
[BackgroundDependencyLoader]
private void load()
{
Dependencies.Cache(rulesetStore = new RealmRulesetStore(Realm));
Dependencies.Cache(Realm);
}
[SetUpSteps] [SetUpSteps]
public void SetUpSteps() public void SetUpSteps()
@ -40,11 +48,31 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("clear contents", Clear); AddStep("clear contents", Clear);
AddStep("reset ruleset", () => Ruleset.Value = rulesetStore.GetRuleset(0)); AddStep("reset ruleset", () => Ruleset.Value = rulesetStore.GetRuleset(0));
AddStep("reset mods", () => SelectedMods.SetDefault()); AddStep("reset mods", () => SelectedMods.SetDefault());
AddStep("set up presets", () =>
{
Realm.Write(r =>
{
r.RemoveAll<ModPreset>();
r.Add(new ModPreset
{
Name = "AR0",
Description = "Too... many... circles...",
Ruleset = r.Find<RulesetInfo>(OsuRuleset.SHORT_NAME),
Mods = new[]
{
new OsuModDifficultyAdjust
{
ApproachRate = { Value = 0 }
}
}
});
});
});
} }
private void createScreen() private void createScreen()
{ {
AddStep("create screen", () => Child = modSelectOverlay = new UserModSelectOverlay AddStep("create screen", () => Child = modSelectOverlay = new TestModSelectOverlay
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
State = { Value = Visibility.Visible }, State = { Value = Visibility.Visible },
@ -137,7 +165,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddUntilStep("any column dimmed", () => this.ChildrenOfType<ModColumn>().Any(column => !column.Active.Value)); AddUntilStep("any column dimmed", () => this.ChildrenOfType<ModColumn>().Any(column => !column.Active.Value));
ModSelectColumn lastColumn = null; ModSelectColumn lastColumn = null!;
AddAssert("last column dimmed", () => !this.ChildrenOfType<ModColumn>().Last().Active.Value); AddAssert("last column dimmed", () => !this.ChildrenOfType<ModColumn>().Last().Active.Value);
AddStep("request scroll to last column", () => AddStep("request scroll to last column", () =>
@ -165,18 +193,22 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("select customisable mod", () => SelectedMods.Value = new[] { new OsuModDoubleTime() }); AddStep("select customisable mod", () => SelectedMods.Value = new[] { new OsuModDoubleTime() });
assertCustomisationToggleState(disabled: false, active: false); assertCustomisationToggleState(disabled: false, active: false);
AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); AddStep("select mod requiring configuration externally", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() });
assertCustomisationToggleState(disabled: false, active: false);
AddStep("reset mods", () => SelectedMods.SetDefault());
AddStep("select difficulty adjust via panel", () => getPanelForMod(typeof(OsuModDifficultyAdjust)).TriggerClick());
assertCustomisationToggleState(disabled: false, active: true); assertCustomisationToggleState(disabled: false, active: true);
AddStep("dismiss mod customisation via toggle", () => AddStep("dismiss mod customisation via toggle", () =>
{ {
InputManager.MoveMouseTo(modSelectOverlay.ChildrenOfType<ShearedToggleButton>().Single()); InputManager.MoveMouseTo(modSelectOverlay.CustomisationButton);
InputManager.Click(MouseButton.Left); InputManager.Click(MouseButton.Left);
}); });
assertCustomisationToggleState(disabled: false, active: false); assertCustomisationToggleState(disabled: false, active: false);
AddStep("reset mods", () => SelectedMods.SetDefault()); AddStep("reset mods", () => SelectedMods.SetDefault());
AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); AddStep("select difficulty adjust via panel", () => getPanelForMod(typeof(OsuModDifficultyAdjust)).TriggerClick());
assertCustomisationToggleState(disabled: false, active: true); assertCustomisationToggleState(disabled: false, active: true);
AddStep("dismiss mod customisation via keyboard", () => InputManager.Key(Key.Escape)); AddStep("dismiss mod customisation via keyboard", () => InputManager.Key(Key.Escape));
@ -188,11 +220,18 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("select mod without configuration", () => SelectedMods.Value = new[] { new OsuModAutoplay() }); AddStep("select mod without configuration", () => SelectedMods.Value = new[] { new OsuModAutoplay() });
assertCustomisationToggleState(disabled: true, active: false); assertCustomisationToggleState(disabled: true, active: false);
AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); AddStep("select difficulty adjust via panel", () => getPanelForMod(typeof(OsuModDifficultyAdjust)).TriggerClick());
assertCustomisationToggleState(disabled: false, active: true); assertCustomisationToggleState(disabled: false, active: true);
AddStep("select mod without configuration", () => SelectedMods.Value = new[] { new OsuModAutoplay() }); AddStep("select mod without configuration", () => SelectedMods.Value = new[] { new OsuModAutoplay() });
assertCustomisationToggleState(disabled: true, active: false); // config was dismissed without explicit user action. assertCustomisationToggleState(disabled: true, active: false); // config was dismissed without explicit user action.
AddStep("select mod preset with mod requiring configuration", () =>
{
InputManager.MoveMouseTo(this.ChildrenOfType<ModPresetPanel>().First());
InputManager.Click(MouseButton.Left);
});
assertCustomisationToggleState(disabled: false, active: false);
} }
[Test] [Test]
@ -201,7 +240,7 @@ namespace osu.Game.Tests.Visual.UserInterface
createScreen(); createScreen();
assertCustomisationToggleState(disabled: true, active: false); assertCustomisationToggleState(disabled: true, active: false);
AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); AddStep("select difficulty adjust via panel", () => getPanelForMod(typeof(OsuModDifficultyAdjust)).TriggerClick());
assertCustomisationToggleState(disabled: false, active: true); assertCustomisationToggleState(disabled: false, active: true);
AddStep("move mouse to settings area", () => InputManager.MoveMouseTo(this.ChildrenOfType<ModSettingsArea>().Single())); AddStep("move mouse to settings area", () => InputManager.MoveMouseTo(this.ChildrenOfType<ModSettingsArea>().Single()));
@ -224,11 +263,11 @@ namespace osu.Game.Tests.Visual.UserInterface
[Test] [Test]
public void TestSettingsNotCrossPolluting() public void TestSettingsNotCrossPolluting()
{ {
Bindable<IReadOnlyList<Mod>> selectedMods2 = null; Bindable<IReadOnlyList<Mod>> selectedMods2 = null!;
ModSelectOverlay modSelectOverlay2 = null; ModSelectOverlay modSelectOverlay2 = null!;
createScreen(); createScreen();
AddStep("select diff adjust", () => SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() }); AddStep("select difficulty adjust via panel", () => getPanelForMod(typeof(OsuModDifficultyAdjust)).TriggerClick());
AddStep("set setting", () => modSelectOverlay.ChildrenOfType<OsuSliderBar<float>>().First().Current.Value = 8); AddStep("set setting", () => modSelectOverlay.ChildrenOfType<OsuSliderBar<float>>().First().Current.Value = 8);
@ -353,7 +392,7 @@ namespace osu.Game.Tests.Visual.UserInterface
public void TestExternallySetModIsReplacedByOverlayInstance() public void TestExternallySetModIsReplacedByOverlayInstance()
{ {
Mod external = new OsuModDoubleTime(); Mod external = new OsuModDoubleTime();
Mod overlayButtonMod = null; Mod overlayButtonMod = null!;
createScreen(); createScreen();
changeRuleset(0); changeRuleset(0);
@ -458,14 +497,14 @@ namespace osu.Game.Tests.Visual.UserInterface
createScreen(); createScreen();
changeRuleset(0); changeRuleset(0);
AddStep("select difficulty adjust", () => SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() }); AddStep("select difficulty adjust via panel", () => getPanelForMod(typeof(OsuModDifficultyAdjust)).TriggerClick());
assertCustomisationToggleState(disabled: false, active: true); assertCustomisationToggleState(disabled: false, active: true);
AddAssert("back button disabled", () => !this.ChildrenOfType<ShearedButton>().First().Enabled.Value); AddAssert("back button disabled", () => !modSelectOverlay.BackButton.Enabled.Value);
AddStep("dismiss customisation area", () => InputManager.Key(Key.Escape)); AddStep("dismiss customisation area", () => InputManager.Key(Key.Escape));
AddStep("click back button", () => AddStep("click back button", () =>
{ {
InputManager.MoveMouseTo(this.ChildrenOfType<ShearedButton>().First()); InputManager.MoveMouseTo(modSelectOverlay.BackButton);
InputManager.Click(MouseButton.Left); InputManager.Click(MouseButton.Left);
}); });
AddAssert("mod select hidden", () => modSelectOverlay.State.Value == Visibility.Hidden); AddAssert("mod select hidden", () => modSelectOverlay.State.Value == Visibility.Hidden);
@ -474,7 +513,7 @@ namespace osu.Game.Tests.Visual.UserInterface
[Test] [Test]
public void TestColumnHiding() public void TestColumnHiding()
{ {
AddStep("create screen", () => Child = modSelectOverlay = new UserModSelectOverlay AddStep("create screen", () => Child = modSelectOverlay = new TestModSelectOverlay
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
State = { Value = Visibility.Visible }, State = { Value = Visibility.Visible },
@ -527,20 +566,26 @@ namespace osu.Game.Tests.Visual.UserInterface
private void assertCustomisationToggleState(bool disabled, bool active) private void assertCustomisationToggleState(bool disabled, bool active)
{ {
ShearedToggleButton getToggle() => modSelectOverlay.ChildrenOfType<ShearedToggleButton>().Single(); AddAssert($"customisation toggle is {(disabled ? "" : "not ")}disabled", () => modSelectOverlay.CustomisationButton.AsNonNull().Active.Disabled == disabled);
AddAssert($"customisation toggle is {(active ? "" : "not ")}active", () => modSelectOverlay.CustomisationButton.AsNonNull().Active.Value == active);
AddAssert($"customisation toggle is {(disabled ? "" : "not ")}disabled", () => getToggle().Active.Disabled == disabled);
AddAssert($"customisation toggle is {(active ? "" : "not ")}active", () => getToggle().Active.Value == active);
} }
private ModPanel getPanelForMod(Type modType) private ModPanel getPanelForMod(Type modType)
=> modSelectOverlay.ChildrenOfType<ModPanel>().Single(panel => panel.Mod.GetType() == modType); => modSelectOverlay.ChildrenOfType<ModPanel>().Single(panel => panel.Mod.GetType() == modType);
private class TestModSelectOverlay : UserModSelectOverlay
{
protected override bool ShowPresets => true;
public new ShearedButton BackButton => base.BackButton;
public new ShearedToggleButton? CustomisationButton => base.CustomisationButton;
}
private class TestUnimplementedMod : Mod private class TestUnimplementedMod : Mod
{ {
public override string Name => "Unimplemented mod"; public override string Name => "Unimplemented mod";
public override string Acronym => "UM"; public override string Acronym => "UM";
public override string Description => "A mod that is not implemented."; public override LocalisableString Description => "A mod that is not implemented.";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override ModType Type => ModType.Conversion; public override ModType Type => ModType.Conversion;
} }

View File

@ -9,6 +9,7 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation; using osu.Framework.Localisation;
@ -43,12 +44,47 @@ namespace osu.Game.Configuration
/// </remarks> /// </remarks>
public Type? SettingControlType { get; set; } public Type? SettingControlType { get; set; }
public SettingSourceAttribute(Type declaringType, string label, string? description = null)
{
Label = getLocalisableStringFromMember(label) ?? string.Empty;
Description = getLocalisableStringFromMember(description) ?? string.Empty;
LocalisableString? getLocalisableStringFromMember(string? member)
{
if (member == null)
return null;
var property = declaringType.GetMember(member, BindingFlags.Static | BindingFlags.Public).FirstOrDefault();
if (property == null)
return null;
switch (property)
{
case FieldInfo f:
return (LocalisableString)f.GetValue(null).AsNonNull();
case PropertyInfo p:
return (LocalisableString)p.GetValue(null).AsNonNull();
default:
throw new InvalidOperationException($"Member \"{member}\" was not found in type {declaringType} (must be a static field or property)");
}
}
}
public SettingSourceAttribute(string? label, string? description = null) public SettingSourceAttribute(string? label, string? description = null)
{ {
Label = label ?? string.Empty; Label = label ?? string.Empty;
Description = description ?? string.Empty; Description = description ?? string.Empty;
} }
public SettingSourceAttribute(Type declaringType, string label, string description, int orderPosition)
: this(declaringType, label, description)
{
OrderPosition = orderPosition;
}
public SettingSourceAttribute(string label, string description, int orderPosition) public SettingSourceAttribute(string label, string description, int orderPosition)
: this(label, description) : this(label, description)
{ {

View File

@ -128,5 +128,13 @@ namespace osu.Game.Online.API
IBindable<UserActivity> IAPIProvider.Activity => Activity; IBindable<UserActivity> IAPIProvider.Activity => Activity;
public void FailNextLogin() => shouldFailNextLogin = true; public void FailNextLogin() => shouldFailNextLogin = true;
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
// Ensure (as much as we can) that any pending tasks are run.
Scheduler.Update();
}
} }
} }

View File

@ -10,6 +10,8 @@ using osuTK;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
@ -126,7 +128,7 @@ namespace osu.Game.Online.Leaderboards
private class HitResultCell : CompositeDrawable private class HitResultCell : CompositeDrawable
{ {
private readonly string displayName; private readonly LocalisableString displayName;
private readonly HitResult result; private readonly HitResult result;
private readonly int count; private readonly int count;
@ -134,7 +136,7 @@ namespace osu.Game.Online.Leaderboards
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
displayName = stat.DisplayName; displayName = stat.DisplayName.ToUpper();
result = stat.Result; result = stat.Result;
count = stat.Count; count = stat.Count;
} }
@ -153,7 +155,7 @@ namespace osu.Game.Online.Leaderboards
new OsuSpriteText new OsuSpriteText
{ {
Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold), Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold),
Text = displayName.ToUpperInvariant(), Text = displayName.ToUpper(),
Colour = colours.ForHitResult(result), Colour = colours.ForHitResult(result),
}, },
new OsuSpriteText new OsuSpriteText

View File

@ -59,7 +59,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
/// <summary> /// <summary>
/// The statistics that appear in the table, in order of appearance. /// The statistics that appear in the table, in order of appearance.
/// </summary> /// </summary>
private readonly List<(HitResult result, string displayName)> statisticResultTypes = new List<(HitResult, string)>(); private readonly List<(HitResult result, LocalisableString displayName)> statisticResultTypes = new List<(HitResult, LocalisableString)>();
private bool showPerformancePoints; private bool showPerformancePoints;
@ -114,7 +114,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
if (result.IsBonus()) if (result.IsBonus())
continue; continue;
string displayName = ruleset.GetDisplayNameForHitResult(result); var displayName = ruleset.GetDisplayNameForHitResult(result);
columns.Add(new TableColumn(displayName, Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 35, maxSize: 60))); columns.Add(new TableColumn(displayName, Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 35, maxSize: 60)));
statisticResultTypes.Add((result, displayName)); statisticResultTypes.Add((result, displayName));

View File

@ -31,10 +31,7 @@ namespace osu.Game.Overlays.Mods
set => current.Current = value; set => current.Current = value;
} }
private readonly BindableNumberWithCurrent<double> current = new BindableNumberWithCurrent<double>(1) private readonly BindableNumberWithCurrent<double> current = new BindableNumberWithCurrent<double>(1);
{
Precision = 0.01
};
private readonly Box underlayBackground; private readonly Box underlayBackground;
private readonly Box contentBackground; private readonly Box contentBackground;

View File

@ -66,7 +66,10 @@ namespace osu.Game.Overlays.Mods
private IModHotkeyHandler hotkeyHandler = null!; private IModHotkeyHandler hotkeyHandler = null!;
private Task? latestLoadTask; private Task? latestLoadTask;
internal bool ItemsLoaded => latestLoadTask?.IsCompleted == true; private ICollection<ModPanel>? latestLoadedPanels;
internal bool ItemsLoaded => latestLoadTask?.IsCompleted == true && latestLoadedPanels?.All(panel => panel.Parent != null) == true;
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
public ModColumn(ModType modType, bool allowIncompatibleSelection) public ModColumn(ModType modType, bool allowIncompatibleSelection)
{ {
@ -130,7 +133,8 @@ namespace osu.Game.Overlays.Mods
{ {
cancellationTokenSource?.Cancel(); cancellationTokenSource?.Cancel();
var panels = availableMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = Vector2.Zero)); var panels = availableMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = Vector2.Zero)).ToArray();
latestLoadedPanels = panels;
latestLoadTask = LoadComponentsAsync(panels, loaded => latestLoadTask = LoadComponentsAsync(panels, loaded =>
{ {

View File

@ -57,6 +57,18 @@ namespace osu.Game.Overlays.Mods
Filtered.BindValueChanged(_ => updateFilterState(), true); Filtered.BindValueChanged(_ => updateFilterState(), true);
} }
protected override void Select()
{
modState.PendingConfiguration = Mod.RequiresConfiguration;
Active.Value = true;
}
protected override void Deselect()
{
modState.PendingConfiguration = false;
Active.Value = false;
}
#region Filtering support #region Filtering support
private void updateFilterState() private void updateFilterState()

View File

@ -37,8 +37,6 @@ namespace osu.Game.Overlays.Mods
Title = preset.Value.Name; Title = preset.Value.Name;
Description = preset.Value.Description; Description = preset.Value.Description;
Action = toggleRequestedByUser;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -54,15 +52,19 @@ namespace osu.Game.Overlays.Mods
selectedMods.BindValueChanged(_ => selectedModsChanged(), true); selectedMods.BindValueChanged(_ => selectedModsChanged(), true);
} }
private void toggleRequestedByUser() protected override void Select()
{
// if the preset is not active at the point of the user click, then set the mods using the preset directly, discarding any previous selections,
// which will also have the side effect of activating the preset (see `updateActiveState()`).
selectedMods.Value = Preset.Value.Mods.ToArray();
}
protected override void Deselect()
{ {
// if the preset is not active at the point of the user click, then set the mods using the preset directly, discarding any previous selections.
// if the preset is active when the user has clicked it, then it means that the set of active mods is exactly equal to the set of mods in the preset // if the preset is active when the user has clicked it, then it means that the set of active mods is exactly equal to the set of mods in the preset
// (there are no other active mods than what the preset specifies, and the mod settings match exactly). // (there are no other active mods than what the preset specifies, and the mod settings match exactly).
// therefore it's safe to just clear selected mods, since it will have the effect of toggling the preset off. // therefore it's safe to just clear selected mods, since it will have the effect of toggling the preset off.
selectedMods.Value = !Active.Value selectedMods.Value = Array.Empty<Mod>();
? Preset.Value.Mods.ToArray()
: Array.Empty<Mod>();
} }
private void selectedModsChanged() private void selectedModsChanged()

View File

@ -159,12 +159,15 @@ namespace osu.Game.Overlays.Mods
int wordIndex = 0; int wordIndex = 0;
headerText.AddText(text, t => ITextPart part = headerText.AddText(text, t =>
{ {
if (wordIndex == 0) if (wordIndex == 0)
t.Font = t.Font.With(weight: FontWeight.SemiBold); t.Font = t.Font.With(weight: FontWeight.SemiBold);
wordIndex += 1; wordIndex += 1;
}); });
// Reset the index so that if the parts are refreshed (e.g. through changes in localisation) the correct word is re-emboldened.
part.DrawablePartsRecreated += _ => wordIndex = 0;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -87,7 +87,7 @@ namespace osu.Game.Overlays.Mods
{ {
if (AllowCustomisation) if (AllowCustomisation)
{ {
yield return customisationButton = new ShearedToggleButton(BUTTON_WIDTH) yield return CustomisationButton = new ShearedToggleButton(BUTTON_WIDTH)
{ {
Text = ModSelectOverlayStrings.ModCustomisation, Text = ModSelectOverlayStrings.ModCustomisation,
Active = { BindTarget = customisationVisible } Active = { BindTarget = customisationVisible }
@ -107,11 +107,11 @@ namespace osu.Game.Overlays.Mods
private ColumnScrollContainer columnScroll = null!; private ColumnScrollContainer columnScroll = null!;
private ColumnFlowContainer columnFlow = null!; private ColumnFlowContainer columnFlow = null!;
private FillFlowContainer<ShearedButton> footerButtonFlow = null!; private FillFlowContainer<ShearedButton> footerButtonFlow = null!;
private ShearedButton backButton = null!;
private DifficultyMultiplierDisplay? multiplierDisplay; private DifficultyMultiplierDisplay? multiplierDisplay;
private ShearedToggleButton? customisationButton; protected ShearedButton BackButton { get; private set; } = null!;
protected ShearedToggleButton? CustomisationButton { get; private set; }
private Sample? columnAppearSample; private Sample? columnAppearSample;
@ -214,7 +214,7 @@ namespace osu.Game.Overlays.Mods
Horizontal = 70 Horizontal = 70
}, },
Spacing = new Vector2(10), Spacing = new Vector2(10),
ChildrenEnumerable = CreateFooterButtons().Prepend(backButton = new ShearedButton(BUTTON_WIDTH) ChildrenEnumerable = CreateFooterButtons().Prepend(BackButton = new ShearedButton(BUTTON_WIDTH)
{ {
Text = CommonStrings.Back, Text = CommonStrings.Back,
Action = Hide, Action = Hide,
@ -247,8 +247,8 @@ namespace osu.Game.Overlays.Mods
modSettingChangeTracker?.Dispose(); modSettingChangeTracker?.Dispose();
updateMultiplier(); updateMultiplier();
updateCustomisation(val);
updateFromExternalSelection(); updateFromExternalSelection();
updateCustomisation();
if (AllowCustomisation) if (AllowCustomisation)
{ {
@ -356,25 +356,26 @@ namespace osu.Game.Overlays.Mods
multiplierDisplay.Current.Value = multiplier; multiplierDisplay.Current.Value = multiplier;
} }
private void updateCustomisation(ValueChangedEvent<IReadOnlyList<Mod>> valueChangedEvent) private void updateCustomisation()
{ {
if (customisationButton == null) if (CustomisationButton == null)
return; return;
bool anyCustomisableMod = false; bool anyCustomisableModActive = false;
bool anyModWithRequiredCustomisationAdded = false; bool anyModPendingConfiguration = false;
foreach (var mod in SelectedMods.Value) foreach (var modState in allAvailableMods)
{ {
anyCustomisableMod |= mod.GetSettingsSourceProperties().Any(); anyCustomisableModActive |= modState.Active.Value && modState.Mod.GetSettingsSourceProperties().Any();
anyModWithRequiredCustomisationAdded |= valueChangedEvent.OldValue.All(m => m.GetType() != mod.GetType()) && mod.RequiresConfiguration; anyModPendingConfiguration |= modState.PendingConfiguration;
modState.PendingConfiguration = false;
} }
if (anyCustomisableMod) if (anyCustomisableModActive)
{ {
customisationVisible.Disabled = false; customisationVisible.Disabled = false;
if (anyModWithRequiredCustomisationAdded && !customisationVisible.Value) if (anyModPendingConfiguration && !customisationVisible.Value)
customisationVisible.Value = true; customisationVisible.Value = true;
} }
else else
@ -394,7 +395,7 @@ namespace osu.Game.Overlays.Mods
foreach (var button in footerButtonFlow) foreach (var button in footerButtonFlow)
{ {
if (button != customisationButton) if (button != CustomisationButton)
button.Enabled.Value = !customisationVisible.Value; button.Enabled.Value = !customisationVisible.Value;
} }
@ -587,14 +588,14 @@ namespace osu.Game.Overlays.Mods
{ {
if (customisationVisible.Value) if (customisationVisible.Value)
{ {
Debug.Assert(customisationButton != null); Debug.Assert(CustomisationButton != null);
customisationButton.TriggerClick(); CustomisationButton.TriggerClick();
if (!immediate) if (!immediate)
return; return;
} }
backButton.TriggerClick(); BackButton.TriggerClick();
} }
} }
@ -708,7 +709,18 @@ namespace osu.Game.Overlays.Mods
FinishTransforms(); FinishTransforms();
} }
protected override bool RequiresChildrenUpdate => base.RequiresChildrenUpdate || (Column as ModColumn)?.SelectionAnimationRunning == true; protected override bool RequiresChildrenUpdate
{
get
{
bool result = base.RequiresChildrenUpdate;
if (Column is ModColumn modColumn)
result |= !modColumn.ItemsLoaded || modColumn.SelectionAnimationRunning;
return result;
}
}
private void updateState() private void updateState()
{ {

View File

@ -143,9 +143,25 @@ namespace osu.Game.Overlays.Mods
} }
}; };
Action = () => Active.Toggle(); Action = () =>
{
if (!Active.Value)
Select();
else
Deselect();
};
} }
/// <summary>
/// Performs all actions necessary to select this <see cref="ModSelectPanel"/>.
/// </summary>
protected abstract void Select();
/// <summary>
/// Performs all actions necessary to deselect this <see cref="ModSelectPanel"/>.
/// </summary>
protected abstract void Deselect();
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, ISamplePlaybackDisabler? samplePlaybackDisabler) private void load(AudioManager audio, ISamplePlaybackDisabler? samplePlaybackDisabler)
{ {

View File

@ -24,6 +24,13 @@ namespace osu.Game.Overlays.Mods
/// </summary> /// </summary>
public BindableBool Active { get; } = new BindableBool(); public BindableBool Active { get; } = new BindableBool();
/// <summary>
/// Whether the mod requires further customisation.
/// This flag is read by the <see cref="ModSelectOverlay"/> to determine if the customisation panel should be opened after a mod change
/// and cleared after reading.
/// </summary>
public bool PendingConfiguration { get; set; }
/// <summary> /// <summary>
/// Whether the mod is currently filtered out due to not matching imposed criteria. /// Whether the mod is currently filtered out due to not matching imposed criteria.
/// </summary> /// </summary>

View File

@ -14,6 +14,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
@ -70,7 +71,11 @@ namespace osu.Game.Overlays.Profile.Header
Masking = true, Masking = true,
CornerRadius = avatar_size * 0.25f, CornerRadius = avatar_size * 0.25f,
}, },
new Container new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Child = new Container
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
@ -154,6 +159,7 @@ namespace osu.Game.Overlays.Profile.Header
} }
} }
} }
}
}, },
userStats = new FillFlowContainer userStats = new FillFlowContainer
{ {

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Rulesets; using osu.Game.Rulesets;

View File

@ -3,6 +3,7 @@
using System; using System;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
namespace osu.Game.Rulesets.Mods namespace osu.Game.Rulesets.Mods
{ {
@ -21,7 +22,7 @@ namespace osu.Game.Rulesets.Mods
/// <summary> /// <summary>
/// The user readable description of this mod. /// The user readable description of this mod.
/// </summary> /// </summary>
string Description { get; } LocalisableString Description { get; }
/// <summary> /// <summary>
/// The type of this mod. /// The type of this mod.

View File

@ -9,6 +9,7 @@ using Newtonsoft.Json;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.Mods
public virtual ModType Type => ModType.Fun; public virtual ModType Type => ModType.Fun;
[JsonIgnore] [JsonIgnore]
public abstract string Description { get; } public abstract LocalisableString Description { get; }
/// <summary> /// <summary>
/// The tooltip to display for this mod when used in a <see cref="ModIcon"/>. /// The tooltip to display for this mod when used in a <see cref="ModIcon"/>.

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -23,7 +24,7 @@ namespace osu.Game.Rulesets.Mods
public override string Acronym => "AS"; public override string Acronym => "AS";
public override string Description => "Let track speed adapt to you."; public override LocalisableString Description => "Let track speed adapt to you.";
public override ModType Type => ModType.Fun; public override ModType Type => ModType.Fun;

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Replays; using osu.Game.Replays;
@ -17,7 +18,7 @@ namespace osu.Game.Rulesets.Mods
public override string Acronym => "AT"; public override string Acronym => "AT";
public override IconUsage? Icon => OsuIcon.ModAuto; public override IconUsage? Icon => OsuIcon.ModAuto;
public override ModType Type => ModType.Automation; public override ModType Type => ModType.Automation;
public override string Description => "Watch a perfect automated play through the song."; public override LocalisableString Description => "Watch a perfect automated play through the song.";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public bool PerformFail() => false; public bool PerformFail() => false;

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions; using osu.Framework.Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.Mods
public override string Name => "Barrel Roll"; public override string Name => "Barrel Roll";
public override string Acronym => "BR"; public override string Acronym => "BR";
public override string Description => "The whole playfield is on a wheel!"; public override LocalisableString Description => "The whole playfield is on a wheel!";
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override string SettingDescription => $"{SpinSpeed.Value:N2} rpm {Direction.Value.GetDescription().ToLowerInvariant()}"; public override string SettingDescription => $"{SpinSpeed.Value:N2} rpm {Direction.Value.GetDescription().ToLowerInvariant()}";

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
@ -27,7 +28,7 @@ namespace osu.Game.Rulesets.Mods
public override string Name => "Cinema"; public override string Name => "Cinema";
public override string Acronym => "CN"; public override string Acronym => "CN";
public override IconUsage? Icon => OsuIcon.ModCinema; public override IconUsage? Icon => OsuIcon.ModCinema;
public override string Description => "Watch the video without visual distractions."; public override LocalisableString Description => "Watch the video without visual distractions.";
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModAutoplay)).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModAutoplay)).ToArray();

View File

@ -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 osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
namespace osu.Game.Rulesets.Mods namespace osu.Game.Rulesets.Mods
{ {
@ -15,7 +16,7 @@ namespace osu.Game.Rulesets.Mods
public override IconUsage? Icon => FontAwesome.Solid.History; public override IconUsage? Icon => FontAwesome.Solid.History;
public override string Description => "Feeling nostalgic?"; public override LocalisableString Description => "Feeling nostalgic?";
public override ModType Type => ModType.Conversion; public override ModType Type => ModType.Conversion;
} }

View File

@ -4,6 +4,7 @@
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
namespace osu.Game.Rulesets.Mods namespace osu.Game.Rulesets.Mods
{ {
@ -12,7 +13,7 @@ namespace osu.Game.Rulesets.Mods
public override string Name => "Daycore"; public override string Name => "Daycore";
public override string Acronym => "DC"; public override string Acronym => "DC";
public override IconUsage? Icon => null; public override IconUsage? Icon => null;
public override string Description => "Whoaaaaa..."; public override LocalisableString Description => "Whoaaaaa...";
private readonly BindableNumber<double> tempoAdjust = new BindableDouble(1); private readonly BindableNumber<double> tempoAdjust = new BindableDouble(1);
private readonly BindableNumber<double> freqAdjust = new BindableDouble(1); private readonly BindableNumber<double> freqAdjust = new BindableDouble(1);

View File

@ -5,6 +5,7 @@ using System;
using System.Linq; using System.Linq;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -14,7 +15,7 @@ namespace osu.Game.Rulesets.Mods
{ {
public override string Name => @"Difficulty Adjust"; public override string Name => @"Difficulty Adjust";
public override string Description => @"Override a beatmap's difficulty settings."; public override LocalisableString Description => @"Override a beatmap's difficulty settings.";
public override string Acronym => "DA"; public override string Acronym => "DA";

View File

@ -3,6 +3,7 @@
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -14,7 +15,7 @@ namespace osu.Game.Rulesets.Mods
public override string Acronym => "DT"; public override string Acronym => "DT";
public override IconUsage? Icon => OsuIcon.ModDoubleTime; public override IconUsage? Icon => OsuIcon.ModDoubleTime;
public override ModType Type => ModType.DifficultyIncrease; public override ModType Type => ModType.DifficultyIncrease;
public override string Description => "Zoooooooooom..."; public override LocalisableString Description => "Zoooooooooom...";
[SettingSource("Speed increase", "The actual increase to apply")] [SettingSource("Speed increase", "The actual increase to apply")]
public override BindableNumber<double> SpeedChange { get; } = new BindableDouble public override BindableNumber<double> SpeedChange { get; } = new BindableDouble

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Rendering;
using osu.Framework.Graphics.Rendering.Vertices; using osu.Framework.Graphics.Rendering.Vertices;
using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Shaders;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Timing;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -30,7 +31,7 @@ namespace osu.Game.Rulesets.Mods
public override string Acronym => "FL"; public override string Acronym => "FL";
public override IconUsage? Icon => OsuIcon.ModFlashlight; public override IconUsage? Icon => OsuIcon.ModFlashlight;
public override ModType Type => ModType.DifficultyIncrease; public override ModType Type => ModType.DifficultyIncrease;
public override string Description => "Restricted view area."; public override LocalisableString Description => "Restricted view area.";
[SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")] [SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")]
public abstract BindableFloat SizeMultiplier { get; } public abstract BindableFloat SizeMultiplier { get; }

View File

@ -3,6 +3,7 @@
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -14,7 +15,7 @@ namespace osu.Game.Rulesets.Mods
public override string Acronym => "HT"; public override string Acronym => "HT";
public override IconUsage? Icon => OsuIcon.ModHalftime; public override IconUsage? Icon => OsuIcon.ModHalftime;
public override ModType Type => ModType.DifficultyReduction; public override ModType Type => ModType.DifficultyReduction;
public override string Description => "Less zoom..."; public override LocalisableString Description => "Less zoom...";
[SettingSource("Speed decrease", "The actual decrease to apply")] [SettingSource("Speed decrease", "The actual decrease to apply")]
public override BindableNumber<double> SpeedChange { get; } = new BindableDouble public override BindableNumber<double> SpeedChange { get; } = new BindableDouble

View File

@ -3,6 +3,7 @@
using System; using System;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -14,7 +15,7 @@ namespace osu.Game.Rulesets.Mods
public override string Acronym => "HR"; public override string Acronym => "HR";
public override IconUsage? Icon => OsuIcon.ModHardRock; public override IconUsage? Icon => OsuIcon.ModHardRock;
public override ModType Type => ModType.DifficultyIncrease; public override ModType Type => ModType.DifficultyIncrease;
public override string Description => "Everything just got a bit harder..."; public override LocalisableString Description => "Everything just got a bit harder...";
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModDifficultyAdjust) }; public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModDifficultyAdjust) };
public void ReadFromDifficulty(IBeatmapDifficultyInfo difficulty) public void ReadFromDifficulty(IBeatmapDifficultyInfo difficulty)

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Mods
public override string Name => "Muted"; public override string Name => "Muted";
public override string Acronym => "MU"; public override string Acronym => "MU";
public override IconUsage? Icon => FontAwesome.Solid.VolumeMute; public override IconUsage? Icon => FontAwesome.Solid.VolumeMute;
public override string Description => "Can you still feel the rhythm without music?"; public override LocalisableString Description => "Can you still feel the rhythm without music?";
public override ModType Type => ModType.Fun; public override ModType Type => ModType.Fun;
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
} }

View File

@ -7,6 +7,7 @@ using osu.Framework.Audio.Track;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Timing;
@ -23,7 +24,7 @@ namespace osu.Game.Rulesets.Mods
public override string Name => "Nightcore"; public override string Name => "Nightcore";
public override string Acronym => "NC"; public override string Acronym => "NC";
public override IconUsage? Icon => OsuIcon.ModNightcore; public override IconUsage? Icon => OsuIcon.ModNightcore;
public override string Description => "Uguuuuuuuu..."; public override LocalisableString Description => "Uguuuuuuuu...";
} }
public abstract class ModNightcore<TObject> : ModNightcore, IApplicableToDrawableRuleset<TObject> public abstract class ModNightcore<TObject> : ModNightcore, IApplicableToDrawableRuleset<TObject>

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