Change display text from "difficulty" to "score" multiplier

This commit is contained in:
Dean Herbert 2023-09-13 20:00:06 +09:00
parent 3e1388c73f
commit 32946413de
6 changed files with 23 additions and 38 deletions

View File

@ -115,7 +115,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddAssert("mod multiplier correct", () =>
{
double multiplier = SelectedMods.Value.Aggregate(1d, (m, mod) => m * mod.ScoreMultiplier);
return Precision.AlmostEquals(multiplier, modSelectOverlay.ChildrenOfType<DifficultyMultiplierDisplay>().Single().Current.Value);
return Precision.AlmostEquals(multiplier, modSelectOverlay.ChildrenOfType<ScoreMultiplierDisplay>().Single().Current.Value);
});
assertCustomisationToggleState(disabled: false, active: false);
AddAssert("setting items created", () => modSelectOverlay.ChildrenOfType<ISettingsItem>().Any());
@ -130,7 +130,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddAssert("mod multiplier correct", () =>
{
double multiplier = SelectedMods.Value.Aggregate(1d, (m, mod) => m * mod.ScoreMultiplier);
return Precision.AlmostEquals(multiplier, modSelectOverlay.ChildrenOfType<DifficultyMultiplierDisplay>().Single().Current.Value);
return Precision.AlmostEquals(multiplier, modSelectOverlay.ChildrenOfType<ScoreMultiplierDisplay>().Single().Current.Value);
});
assertCustomisationToggleState(disabled: false, active: false);
AddAssert("setting items created", () => modSelectOverlay.ChildrenOfType<ISettingsItem>().Any());
@ -787,7 +787,7 @@ namespace osu.Game.Tests.Visual.UserInterface
InputManager.MoveMouseTo(this.ChildrenOfType<ModPresetPanel>().Single(preset => preset.Preset.Value.Name == "Half Time 0.5x"));
InputManager.Click(MouseButton.Left);
});
AddAssert("difficulty multiplier display shows correct value", () => modSelectOverlay.ChildrenOfType<DifficultyMultiplierDisplay>().Single().Current.Value, () => Is.EqualTo(0.5));
AddAssert("difficulty multiplier display shows correct value", () => modSelectOverlay.ChildrenOfType<ScoreMultiplierDisplay>().Single().Current.Value, () => Is.EqualTo(0.5));
// this is highly unorthodox in a test, but because the `ModSettingChangeTracker` machinery heavily leans on events and object disposal and re-creation,
// it is instrumental in the reproduction of the failure scenario that this test is supposed to cover.
@ -796,7 +796,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("open customisation area", () => modSelectOverlay.CustomisationButton!.TriggerClick());
AddStep("reset half time speed to default", () => modSelectOverlay.ChildrenOfType<ModSettingsArea>().Single()
.ChildrenOfType<RevertToDefaultButton<double>>().Single().TriggerClick());
AddUntilStep("difficulty multiplier display shows correct value", () => modSelectOverlay.ChildrenOfType<DifficultyMultiplierDisplay>().Single().Current.Value, () => Is.EqualTo(0.7));
AddUntilStep("difficulty multiplier display shows correct value", () => modSelectOverlay.ChildrenOfType<ScoreMultiplierDisplay>().Single().Current.Value, () => Is.EqualTo(0.7));
}
private void waitForColumnLoad() => AddUntilStep("all column content loaded",

View File

@ -1,10 +1,9 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
@ -12,17 +11,17 @@ using osu.Game.Overlays.Mods;
namespace osu.Game.Tests.Visual.UserInterface
{
[TestFixture]
public partial class TestSceneDifficultyMultiplierDisplay : OsuTestScene
public partial class TestSceneScoreMultiplierDisplay : OsuTestScene
{
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
[Test]
public void TestDifficultyMultiplierDisplay()
public void TestBasic()
{
DifficultyMultiplierDisplay multiplierDisplay = null;
ScoreMultiplierDisplay multiplierDisplay = null!;
AddStep("create content", () => Child = multiplierDisplay = new DifficultyMultiplierDisplay
AddStep("create content", () => Child = multiplierDisplay = new ScoreMultiplierDisplay
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
@ -34,7 +33,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddSliderStep("set multiplier", 0, 2, 1d, multiplier =>
{
if (multiplierDisplay != null)
if (multiplierDisplay.IsNotNull())
multiplierDisplay.Current.Value = multiplier;
});
}

View File

@ -1,19 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Localisation;
namespace osu.Game.Localisation
{
public static class DifficultyMultiplierDisplayStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.DifficultyMultiplierDisplay";
/// <summary>
/// "Difficulty Multiplier"
/// </summary>
public static LocalisableString DifficultyMultiplier => new TranslatableString(getKey(@"difficulty_multiplier"), @"Difficulty Multiplier");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -44,6 +44,11 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString TabToSearch => new TranslatableString(getKey(@"tab_to_search"), @"tab to search...");
/// <summary>
/// "Score Multiplier"
/// </summary>
public static LocalisableString ScoreMultiplier => new TranslatableString(getKey(@"score_multiplier"), @"Score Multiplier");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -124,7 +124,7 @@ namespace osu.Game.Overlays.Mods
private DeselectAllModsButton deselectAllModsButton = null!;
private Container aboveColumnsContent = null!;
private DifficultyMultiplierDisplay? multiplierDisplay;
private ScoreMultiplierDisplay? multiplierDisplay;
private BeatmapAttributesDisplay? beatmapAttributesDisplay;
protected ShearedButton BackButton { get; private set; } = null!;
@ -182,7 +182,7 @@ namespace osu.Game.Overlays.Mods
aboveColumnsContent = new Container
{
RelativeSizeAxes = Axes.X,
Height = DifficultyMultiplierDisplay.HEIGHT,
Height = ScoreMultiplierDisplay.HEIGHT,
Padding = new MarginPadding { Horizontal = 100 },
Child = SearchTextBox = new ShearedSearchTextBox
{
@ -197,7 +197,7 @@ namespace osu.Game.Overlays.Mods
{
Padding = new MarginPadding
{
Top = DifficultyMultiplierDisplay.HEIGHT + PADDING,
Top = ScoreMultiplierDisplay.HEIGHT + PADDING,
Bottom = PADDING
},
RelativeSizeAxes = Axes.Both,
@ -266,7 +266,7 @@ namespace osu.Game.Overlays.Mods
},
Children = new Drawable[]
{
multiplierDisplay = new DifficultyMultiplierDisplay
multiplierDisplay = new ScoreMultiplierDisplay
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight

View File

@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Mods
/// <summary>
/// On the mod select overlay, this provides a local updating view of the aggregate score multiplier coming from mods.
/// </summary>
public partial class DifficultyMultiplierDisplay : ModFooterInformationDisplay, IHasCurrentValue<double>
public partial class ScoreMultiplierDisplay : ModFooterInformationDisplay, IHasCurrentValue<double>
{
public const float HEIGHT = 42;
@ -44,7 +44,7 @@ namespace osu.Game.Overlays.Mods
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
public DifficultyMultiplierDisplay()
public ScoreMultiplierDisplay()
{
Current.Default = 1d;
Current.Value = 1d;
@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Mods
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
Text = DifficultyMultiplierDisplayStrings.DifficultyMultiplier,
Text = ModSelectOverlayStrings.ScoreMultiplier,
Font = OsuFont.Default.With(size: 17, weight: FontWeight.SemiBold)
}
});