diff --git a/.github/workflows/diffcalc.yml b/.github/workflows/diffcalc.yml
index 9f129a697c..7fb0709dec 100644
--- a/.github/workflows/diffcalc.yml
+++ b/.github/workflows/diffcalc.yml
@@ -361,8 +361,7 @@ jobs:
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
with:
comment_tag: ${{ env.EXECUTION_ID }}
- mode: upsert
- create_if_not_exists: false
+ mode: recreate
message: |
Target: ${{ needs.generator.outputs.TARGET }}
Spreadsheet: ${{ needs.generator.outputs.SPREADSHEET_LINK }}
@@ -372,8 +371,7 @@ jobs:
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
with:
comment_tag: ${{ env.EXECUTION_ID }}
- mode: upsert
- create_if_not_exists: false
+ mode: recreate
message: |
Difficulty calculation failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
index 17b51085da..efda3fa369 100644
--- a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
+++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
@@ -15,21 +15,21 @@ public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest
{
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu.Tests";
- [TestCase(6.7154251995274938d, 239, "diffcalc-test")]
- [TestCase(1.4430610657612626d, 54, "zero-length-sliders")]
+ [TestCase(6.7171144000821119d, 239, "diffcalc-test")]
+ [TestCase(1.4485749025771304d, 54, "zero-length-sliders")]
[TestCase(0.42630400627180914d, 4, "very-fast-slider")]
[TestCase(0.14143808967817237d, 2, "nan-slider")]
public void Test(double expectedStarRating, int expectedMaxCombo, string name)
=> base.Test(expectedStarRating, expectedMaxCombo, name);
- [TestCase(8.9808183779700208d, 239, "diffcalc-test")]
- [TestCase(1.7483507893412422d, 54, "zero-length-sliders")]
+ [TestCase(8.9825709931204205d, 239, "diffcalc-test")]
+ [TestCase(1.7550169162648608d, 54, "zero-length-sliders")]
[TestCase(0.55231632896800109d, 4, "very-fast-slider")]
public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name)
=> Test(expectedStarRating, expectedMaxCombo, name, new OsuModDoubleTime());
- [TestCase(6.7154251995274938d, 239, "diffcalc-test")]
- [TestCase(1.4430610657612626d, 54, "zero-length-sliders")]
+ [TestCase(6.7171144000821119d, 239, "diffcalc-test")]
+ [TestCase(1.4485749025771304d, 54, "zero-length-sliders")]
[TestCase(0.42630400627180914d, 4, "very-fast-slider")]
public void TestClassicMod(double expectedStarRating, int expectedMaxCombo, string name)
=> Test(expectedStarRating, expectedMaxCombo, name, new OsuModClassic());
diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs
index f2218a89a7..d10d2c5c05 100644
--- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs
+++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs
@@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using System;
+using System.Collections.Generic;
+using System.Linq;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
using osu.Game.Rulesets.Osu.Objects;
@@ -10,8 +12,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
{
public static class RhythmEvaluator
{
- private const int history_time_max = 5000; // 5 seconds of calculatingRhythmBonus max.
- private const double rhythm_multiplier = 0.75;
+ private const int history_time_max = 5 * 1000; // 5 seconds
+ private const int history_objects_max = 32;
+ private const double rhythm_overall_multiplier = 0.95;
+ private const double rhythm_ratio_multiplier = 12.0;
///
/// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current .
@@ -21,15 +25,22 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current)
if (current.BaseObject is Spinner)
return 0;
- int previousIslandSize = 0;
-
double rhythmComplexitySum = 0;
- int islandSize = 1;
+
+ double deltaDifferenceEpsilon = ((OsuDifficultyHitObject)current).HitWindowGreat * 0.3;
+
+ var island = new Island(deltaDifferenceEpsilon);
+ var previousIsland = new Island(deltaDifferenceEpsilon);
+
+ // we can't use dictionary here because we need to compare island with a tolerance
+ // which is impossible to pass into the hash comparer
+ var islandCounts = new List<(Island Island, int Count)>();
+
double startRatio = 0; // store the ratio of the current start of an island to buff for tighter rhythms
bool firstDeltaSwitch = false;
- int historicalNoteCount = Math.Min(current.Index, 32);
+ int historicalNoteCount = Math.Min(current.Index, history_objects_max);
int rhythmStart = 0;
@@ -39,74 +50,177 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current)
OsuDifficultyHitObject prevObj = (OsuDifficultyHitObject)current.Previous(rhythmStart);
OsuDifficultyHitObject lastObj = (OsuDifficultyHitObject)current.Previous(rhythmStart + 1);
+ // we go from the furthest object back to the current one
for (int i = rhythmStart; i > 0; i--)
{
OsuDifficultyHitObject currObj = (OsuDifficultyHitObject)current.Previous(i - 1);
- double currHistoricalDecay = (history_time_max - (current.StartTime - currObj.StartTime)) / history_time_max; // scales note 0 to 1 from history to now
+ // scales note 0 to 1 from history to now
+ double timeDecay = (history_time_max - (current.StartTime - currObj.StartTime)) / history_time_max;
+ double noteDecay = (double)(historicalNoteCount - i) / historicalNoteCount;
- currHistoricalDecay = Math.Min((double)(historicalNoteCount - i) / historicalNoteCount, currHistoricalDecay); // either we're limited by time or limited by object count.
+ double currHistoricalDecay = Math.Min(noteDecay, timeDecay); // either we're limited by time or limited by object count.
double currDelta = currObj.StrainTime;
double prevDelta = prevObj.StrainTime;
double lastDelta = lastObj.StrainTime;
- double currRatio = 1.0 + 6.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses.
- double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - currObj.HitWindowGreat * 0.3) / (currObj.HitWindowGreat * 0.3));
+ // calculate how much current delta difference deserves a rhythm bonus
+ // this function is meant to reduce rhythm bonus for deltas that are multiples of each other (i.e 100 and 200)
+ double deltaDifferenceRatio = Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta);
+ double currRatio = 1.0 + rhythm_ratio_multiplier * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / deltaDifferenceRatio), 2));
- windowPenalty = Math.Min(1, windowPenalty);
+ // reduce ratio bonus if delta difference is too big
+ double fraction = Math.Max(prevDelta / currDelta, currDelta / prevDelta);
+ double fractionMultiplier = Math.Clamp(2.0 - fraction / 8.0, 0.0, 1.0);
- double effectiveRatio = windowPenalty * currRatio;
+ double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon);
+
+ double effectiveRatio = windowPenalty * currRatio * fractionMultiplier;
if (firstDeltaSwitch)
{
- if (!(prevDelta > 1.25 * currDelta || prevDelta * 1.25 < currDelta))
+ if (Math.Abs(prevDelta - currDelta) < deltaDifferenceEpsilon)
{
- if (islandSize < 7)
- islandSize++; // island is still progressing, count size.
+ // island is still progressing
+ island.AddDelta((int)currDelta);
}
else
{
- if (currObj.BaseObject is Slider) // bpm change is into slider, this is easy acc window
+ // bpm change is into slider, this is easy acc window
+ if (currObj.BaseObject is Slider)
effectiveRatio *= 0.125;
- if (prevObj.BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle
- effectiveRatio *= 0.25;
+ // bpm change was from a slider, this is easier typically than circle -> circle
+ // unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty than bursts without sliders
+ if (prevObj.BaseObject is Slider)
+ effectiveRatio *= 0.3;
- if (previousIslandSize == islandSize) // repeated island size (ex: triplet -> triplet)
- effectiveRatio *= 0.25;
+ // repeated island polarity (2 -> 4, 3 -> 5)
+ if (island.IsSimilarPolarity(previousIsland))
+ effectiveRatio *= 0.5;
- if (previousIslandSize % 2 == islandSize % 2) // repeated island polartiy (2 -> 4, 3 -> 5)
- effectiveRatio *= 0.50;
-
- if (lastDelta > prevDelta + 10 && prevDelta > currDelta + 10) // previous increase happened a note ago, 1/1->1/2-1/4, dont want to buff this.
+ // previous increase happened a note ago, 1/1->1/2-1/4, dont want to buff this.
+ if (lastDelta > prevDelta + deltaDifferenceEpsilon && prevDelta > currDelta + deltaDifferenceEpsilon)
effectiveRatio *= 0.125;
- rhythmComplexitySum += Math.Sqrt(effectiveRatio * startRatio) * currHistoricalDecay * Math.Sqrt(4 + islandSize) / 2 * Math.Sqrt(4 + previousIslandSize) / 2;
+ // repeated island size (ex: triplet -> triplet)
+ // TODO: remove this nerf since its staying here only for balancing purposes because of the flawed ratio calculation
+ if (previousIsland.DeltaCount == island.DeltaCount)
+ effectiveRatio *= 0.5;
+
+ var islandCount = islandCounts.FirstOrDefault(x => x.Island.Equals(island));
+
+ if (islandCount != default)
+ {
+ int countIndex = islandCounts.IndexOf(islandCount);
+
+ // only add island to island counts if they're going one after another
+ if (previousIsland.Equals(island))
+ islandCount.Count++;
+
+ // repeated island (ex: triplet -> triplet)
+ double power = logistic(island.Delta, 2.75, 0.24, 14);
+ effectiveRatio *= Math.Min(3.0 / islandCount.Count, Math.Pow(1.0 / islandCount.Count, power));
+
+ islandCounts[countIndex] = (islandCount.Island, islandCount.Count);
+ }
+ else
+ {
+ islandCounts.Add((island, 1));
+ }
+
+ // scale down the difficulty if the object is doubletappable
+ double doubletapness = prevObj.GetDoubletapness(currObj);
+ effectiveRatio *= 1 - doubletapness * 0.75;
+
+ rhythmComplexitySum += Math.Sqrt(effectiveRatio * startRatio) * currHistoricalDecay;
startRatio = effectiveRatio;
- previousIslandSize = islandSize; // log the last island size.
+ previousIsland = island;
- if (prevDelta * 1.25 < currDelta) // we're slowing down, stop counting
- firstDeltaSwitch = false; // if we're speeding up, this stays true and we keep counting island size.
+ if (prevDelta + deltaDifferenceEpsilon < currDelta) // we're slowing down, stop counting
+ firstDeltaSwitch = false; // if we're speeding up, this stays true and we keep counting island size.
- islandSize = 1;
+ island = new Island((int)currDelta, deltaDifferenceEpsilon);
}
}
- else if (prevDelta > 1.25 * currDelta) // we want to be speeding up.
+ else if (prevDelta > currDelta + deltaDifferenceEpsilon) // we're speeding up
{
// Begin counting island until we change speed again.
firstDeltaSwitch = true;
+
+ // bpm change is into slider, this is easy acc window
+ if (currObj.BaseObject is Slider)
+ effectiveRatio *= 0.6;
+
+ // bpm change was from a slider, this is easier typically than circle -> circle
+ // unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty than bursts without sliders
+ if (prevObj.BaseObject is Slider)
+ effectiveRatio *= 0.6;
+
startRatio = effectiveRatio;
- islandSize = 1;
+
+ island = new Island((int)currDelta, deltaDifferenceEpsilon);
}
lastObj = prevObj;
prevObj = currObj;
}
- return Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier) / 2; //produces multiplier that can be applied to strain. range [1, infinity) (not really though)
+ return Math.Sqrt(4 + rhythmComplexitySum * rhythm_overall_multiplier) / 2.0; // produces multiplier that can be applied to strain. range [1, infinity) (not really though)
+ }
+
+ private static double logistic(double x, double maxValue, double multiplier, double offset) => (maxValue / (1 + Math.Pow(Math.E, offset - (multiplier * x))));
+
+ private class Island : IEquatable
+ {
+ private readonly double deltaDifferenceEpsilon;
+
+ public Island(double epsilon)
+ {
+ deltaDifferenceEpsilon = epsilon;
+ }
+
+ public Island(int delta, double epsilon)
+ {
+ deltaDifferenceEpsilon = epsilon;
+ Delta = Math.Max(delta, OsuDifficultyHitObject.MIN_DELTA_TIME);
+ DeltaCount++;
+ }
+
+ public int Delta { get; private set; } = int.MaxValue;
+ public int DeltaCount { get; private set; }
+
+ public void AddDelta(int delta)
+ {
+ if (Delta == int.MaxValue)
+ Delta = Math.Max(delta, OsuDifficultyHitObject.MIN_DELTA_TIME);
+
+ DeltaCount++;
+ }
+
+ public bool IsSimilarPolarity(Island other)
+ {
+ // TODO: consider islands to be of similar polarity only if they're having the same average delta (we don't want to consider 3 singletaps similar to a triple)
+ // naively adding delta check here breaks _a lot_ of maps because of the flawed ratio calculation
+ return DeltaCount % 2 == other.DeltaCount % 2;
+ }
+
+ public bool Equals(Island? other)
+ {
+ if (other == null)
+ return false;
+
+ return Math.Abs(Delta - other.Delta) < deltaDifferenceEpsilon &&
+ DeltaCount == other.DeltaCount;
+ }
+
+ public override string ToString()
+ {
+ return $"{Delta}x{DeltaCount}";
+ }
}
}
}
diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs
index da1cb4b3b3..c220352ee0 100644
--- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs
+++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs
@@ -31,21 +31,9 @@ public static double EvaluateDifficultyOf(DifficultyHitObject current)
// derive strainTime for calculation
var osuCurrObj = (OsuDifficultyHitObject)current;
var osuPrevObj = current.Index > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null;
- var osuNextObj = (OsuDifficultyHitObject?)current.Next(0);
double strainTime = osuCurrObj.StrainTime;
- double doubletapness = 1;
-
- // Nerf doubletappable doubles.
- if (osuNextObj != null)
- {
- double currDeltaTime = Math.Max(1, osuCurrObj.DeltaTime);
- double nextDeltaTime = Math.Max(1, osuNextObj.DeltaTime);
- double deltaDifference = Math.Abs(nextDeltaTime - currDeltaTime);
- double speedRatio = currDeltaTime / Math.Max(currDeltaTime, deltaDifference);
- double windowRatio = Math.Pow(Math.Min(1, currDeltaTime / osuCurrObj.HitWindowGreat), 2);
- doubletapness = Math.Pow(speedRatio, 1 - windowRatio);
- }
+ double doubletapness = 1.0 - osuCurrObj.GetDoubletapness((OsuDifficultyHitObject?)osuCurrObj.Next(0));
// Cap deltatime to the OD 300 hitwindow.
// 0.93 is derived from making sure 260bpm OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap.
diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs
index 1fea5ef8cc..435e8452d3 100644
--- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs
+++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs
@@ -16,6 +16,8 @@ public class OsuPerformanceCalculator : PerformanceCalculator
{
public const double PERFORMANCE_BASE_MULTIPLIER = 1.15; // This is being adjusted to keep the final pp value scaled around what it used to be when changing things.
+ private bool usingClassicSliderAccuracy;
+
private double accuracy;
private int scoreMaxCombo;
private int countGreat;
@@ -34,6 +36,8 @@ protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo s
{
var osuAttributes = (OsuDifficultyAttributes)attributes;
+ usingClassicSliderAccuracy = score.Mods.OfType().Any(m => m.NoSliderHeadAccuracy.Value);
+
accuracy = score.Accuracy;
scoreMaxCombo = score.MaxCombo;
countGreat = score.Statistics.GetValueOrDefault(HitResult.Great);
@@ -193,6 +197,8 @@ private double computeAccuracyValue(ScoreInfo score, OsuDifficultyAttributes att
// This percentage only considers HitCircles of any value - in this part of the calculation we focus on hitting the timing hit window.
double betterAccuracyPercentage;
int amountHitObjectsWithAccuracy = attributes.HitCircleCount;
+ if (!usingClassicSliderAccuracy)
+ amountHitObjectsWithAccuracy += attributes.SliderCount;
if (amountHitObjectsWithAccuracy > 0)
betterAccuracyPercentage = ((countGreat - (totalHits - amountHitObjectsWithAccuracy)) * 6 + countOk * 2 + countMeh) / (double)(amountHitObjectsWithAccuracy * 6);
diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs
index 0e537632b1..3eaf500ad7 100644
--- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs
+++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs
@@ -20,7 +20,8 @@ public class OsuDifficultyHitObject : DifficultyHitObject
///
public const int NORMALISED_RADIUS = 50; // Change radius to 50 to make 100 the diameter. Easier for mental maths.
- private const int min_delta_time = 25;
+ public const int MIN_DELTA_TIME = 25;
+
private const float maximum_slider_radius = NORMALISED_RADIUS * 2.4f;
private const float assumed_slider_radius = NORMALISED_RADIUS * 1.8f;
@@ -93,7 +94,7 @@ public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObje
this.lastObject = (OsuHitObject)lastObject;
// Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects.
- StrainTime = Math.Max(DeltaTime, min_delta_time);
+ StrainTime = Math.Max(DeltaTime, MIN_DELTA_TIME);
if (BaseObject is Slider sliderObject)
{
@@ -136,6 +137,24 @@ public double OpacityAt(double time, bool hidden)
return Math.Clamp((time - fadeInStartTime) / fadeInDuration, 0.0, 1.0);
}
+ ///
+ /// Returns how possible is it to doubletap this object together with the next one and get perfect judgement in range from 0 to 1
+ ///
+ public double GetDoubletapness(OsuDifficultyHitObject? osuNextObj)
+ {
+ if (osuNextObj != null)
+ {
+ double currDeltaTime = Math.Max(1, DeltaTime);
+ double nextDeltaTime = Math.Max(1, osuNextObj.DeltaTime);
+ double deltaDifference = Math.Abs(nextDeltaTime - currDeltaTime);
+ double speedRatio = currDeltaTime / Math.Max(currDeltaTime, deltaDifference);
+ double windowRatio = Math.Pow(Math.Min(1, currDeltaTime / HitWindowGreat), 2);
+ return 1.0 - Math.Pow(speedRatio, 1 - windowRatio);
+ }
+
+ return 0;
+ }
+
private void setDistances(double clockRate)
{
if (BaseObject is Slider currentSlider)
@@ -143,7 +162,7 @@ private void setDistances(double clockRate)
computeSliderCursorPosition(currentSlider);
// Bonus for repeat sliders until a better per nested object strain system can be achieved.
TravelDistance = currentSlider.LazyTravelDistance * (float)Math.Pow(1 + currentSlider.RepeatCount / 2.5, 1.0 / 2.5);
- TravelTime = Math.Max(currentSlider.LazyTravelTime / clockRate, min_delta_time);
+ TravelTime = Math.Max(currentSlider.LazyTravelTime / clockRate, MIN_DELTA_TIME);
}
// We don't need to calculate either angle or distance when one of the last->curr objects is a spinner
@@ -167,8 +186,8 @@ private void setDistances(double clockRate)
if (lastObject is Slider lastSlider)
{
- double lastTravelTime = Math.Max(lastSlider.LazyTravelTime / clockRate, min_delta_time);
- MinimumJumpTime = Math.Max(StrainTime - lastTravelTime, min_delta_time);
+ double lastTravelTime = Math.Max(lastSlider.LazyTravelTime / clockRate, MIN_DELTA_TIME);
+ MinimumJumpTime = Math.Max(StrainTime - lastTravelTime, MIN_DELTA_TIME);
//
// There are two types of slider-to-object patterns to consider in order to better approximate the real movement a player will take to jump between the hitobjects.
diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs
index 48e421211f..faf91e4652 100644
--- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs
+++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs
@@ -23,7 +23,7 @@ public Aim(Mod[] mods, bool withSliders)
private double currentStrain;
- private double skillMultiplier => 24.983;
+ private double skillMultiplier => 25.18;
private double strainDecayBase => 0.15;
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);
diff --git a/osu.Game.Tournament/Screens/Editors/Components/DeleteRoundDialog.cs b/osu.Game.Tournament/Screens/Editors/Components/DeleteRoundDialog.cs
index 769412bf94..6fff5111bd 100644
--- a/osu.Game.Tournament/Screens/Editors/Components/DeleteRoundDialog.cs
+++ b/osu.Game.Tournament/Screens/Editors/Components/DeleteRoundDialog.cs
@@ -2,18 +2,16 @@
// See the LICENCE file in the repository root for full licence text.
using System;
-using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Dialog;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Screens.Editors.Components
{
- public partial class DeleteRoundDialog : DangerousActionDialog
+ public partial class DeleteRoundDialog : DeletionDialog
{
public DeleteRoundDialog(TournamentRound round, Action action)
{
HeaderText = round.Name.Value.Length > 0 ? $@"Delete round ""{round.Name.Value}""?" : @"Delete unnamed round?";
- Icon = FontAwesome.Solid.Trash;
DangerousAction = action;
}
}
diff --git a/osu.Game.Tournament/Screens/Editors/Components/DeleteTeamDialog.cs b/osu.Game.Tournament/Screens/Editors/Components/DeleteTeamDialog.cs
index 65fb47cf94..cf1dffba0c 100644
--- a/osu.Game.Tournament/Screens/Editors/Components/DeleteTeamDialog.cs
+++ b/osu.Game.Tournament/Screens/Editors/Components/DeleteTeamDialog.cs
@@ -2,20 +2,18 @@
// See the LICENCE file in the repository root for full licence text.
using System;
-using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Dialog;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Screens.Editors.Components
{
- public partial class DeleteTeamDialog : DangerousActionDialog
+ public partial class DeleteTeamDialog : DeletionDialog
{
public DeleteTeamDialog(TournamentTeam team, Action action)
{
HeaderText = team.FullName.Value.Length > 0 ? $@"Delete team ""{team.FullName.Value}""?" :
team.Acronym.Value.Length > 0 ? $@"Delete team ""{team.Acronym.Value}""?" :
@"Delete unnamed team?";
- Icon = FontAwesome.Solid.Trash;
DangerousAction = action;
}
}
diff --git a/osu.Game/Collections/DeleteCollectionDialog.cs b/osu.Game/Collections/DeleteCollectionDialog.cs
index 9edc213077..80a7fa4bc0 100644
--- a/osu.Game/Collections/DeleteCollectionDialog.cs
+++ b/osu.Game/Collections/DeleteCollectionDialog.cs
@@ -8,7 +8,7 @@
namespace osu.Game.Collections
{
- public partial class DeleteCollectionDialog : DangerousActionDialog
+ public partial class DeleteCollectionDialog : DeletionDialog
{
public DeleteCollectionDialog(Live collection, Action deleteAction)
{
diff --git a/osu.Game/Localisation/DialogStrings.cs b/osu.Game/Localisation/DialogStrings.cs
index 043a3f5b4c..a7634575b8 100644
--- a/osu.Game/Localisation/DialogStrings.cs
+++ b/osu.Game/Localisation/DialogStrings.cs
@@ -12,7 +12,12 @@ public static class DialogStrings
///
/// "Caution"
///
- public static LocalisableString Caution => new TranslatableString(getKey(@"header_text"), @"Caution");
+ public static LocalisableString CautionHeaderText => new TranslatableString(getKey(@"header_text"), @"Caution");
+
+ ///
+ /// "Are you sure you want to delete the following:"
+ ///
+ public static LocalisableString DeletionHeaderText => new TranslatableString(getKey(@"deletion_header_text"), @"Are you sure you want to delete the following:");
///
/// "Yes. Go for it."
diff --git a/osu.Game/Online/Chat/ExternalLinkOpener.cs b/osu.Game/Online/Chat/ExternalLinkOpener.cs
index 90fec5fafd..1c48a4fe6d 100644
--- a/osu.Game/Online/Chat/ExternalLinkOpener.cs
+++ b/osu.Game/Online/Chat/ExternalLinkOpener.cs
@@ -46,7 +46,7 @@ public partial class ExternalLinkDialog : PopupDialog
{
public ExternalLinkDialog(string url, Action openExternalLinkAction, Action copyExternalLinkAction)
{
- HeaderText = DialogStrings.Caution;
+ HeaderText = DialogStrings.CautionHeaderText;
BodyText = $"Are you sure you want to open the following link in a web browser?\n\n{url}";
Icon = FontAwesome.Solid.ExclamationTriangle;
diff --git a/osu.Game/Overlays/Dialog/DangerousActionDialog.cs b/osu.Game/Overlays/Dialog/DangerousActionDialog.cs
index 31160d1832..287b0fa2c6 100644
--- a/osu.Game/Overlays/Dialog/DangerousActionDialog.cs
+++ b/osu.Game/Overlays/Dialog/DangerousActionDialog.cs
@@ -30,9 +30,9 @@ public abstract partial class DangerousActionDialog : PopupDialog
protected DangerousActionDialog()
{
- HeaderText = DialogStrings.Caution;
+ HeaderText = DialogStrings.CautionHeaderText;
- Icon = FontAwesome.Regular.TrashAlt;
+ Icon = FontAwesome.Solid.ExclamationTriangle;
Buttons = new PopupDialogButton[]
{
diff --git a/osu.Game/Overlays/Dialog/DeletionDialog.cs b/osu.Game/Overlays/Dialog/DeletionDialog.cs
new file mode 100644
index 0000000000..26a29068a9
--- /dev/null
+++ b/osu.Game/Overlays/Dialog/DeletionDialog.cs
@@ -0,0 +1,20 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Graphics.Sprites;
+using osu.Game.Localisation;
+
+namespace osu.Game.Overlays.Dialog
+{
+ ///
+ /// A dialog which provides confirmation for deletion of something.
+ ///
+ public abstract partial class DeletionDialog : DangerousActionDialog
+ {
+ protected DeletionDialog()
+ {
+ HeaderText = DialogStrings.DeletionHeaderText;
+ Icon = FontAwesome.Solid.Trash;
+ }
+ }
+}
diff --git a/osu.Game/Overlays/Mods/DeleteModPresetDialog.cs b/osu.Game/Overlays/Mods/DeleteModPresetDialog.cs
index 9788764453..5651ecb34c 100644
--- a/osu.Game/Overlays/Mods/DeleteModPresetDialog.cs
+++ b/osu.Game/Overlays/Mods/DeleteModPresetDialog.cs
@@ -7,7 +7,7 @@
namespace osu.Game.Overlays.Mods
{
- public partial class DeleteModPresetDialog : DangerousActionDialog
+ public partial class DeleteModPresetDialog : DeletionDialog
{
public DeleteModPresetDialog(Live modPreset)
{
diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs
index 7ead815fe9..a7a7ee2590 100644
--- a/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs
+++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
+using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Overlays.Dialog;
@@ -12,6 +13,7 @@ public partial class MassDeleteConfirmationDialog : DangerousActionDialog
public MassDeleteConfirmationDialog(Action deleteAction, LocalisableString deleteContent)
{
BodyText = deleteContent;
+ Icon = FontAwesome.Solid.Trash;
DangerousAction = deleteAction;
}
}
diff --git a/osu.Game/Screens/Edit/DeleteDifficultyConfirmationDialog.cs b/osu.Game/Screens/Edit/DeleteDifficultyConfirmationDialog.cs
index 8556949528..1aeb1d8a40 100644
--- a/osu.Game/Screens/Edit/DeleteDifficultyConfirmationDialog.cs
+++ b/osu.Game/Screens/Edit/DeleteDifficultyConfirmationDialog.cs
@@ -7,7 +7,7 @@
namespace osu.Game.Screens.Edit
{
- public partial class DeleteDifficultyConfirmationDialog : DangerousActionDialog
+ public partial class DeleteDifficultyConfirmationDialog : DeletionDialog
{
public DeleteDifficultyConfirmationDialog(BeatmapInfo beatmapInfo, Action deleteAction)
{
diff --git a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs
index e98af8cca2..8bc40dbd9e 100644
--- a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs
+++ b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs
@@ -7,7 +7,7 @@
namespace osu.Game.Screens.Select
{
- public partial class BeatmapDeleteDialog : DangerousActionDialog
+ public partial class BeatmapDeleteDialog : DeletionDialog
{
private readonly BeatmapSetInfo beatmapSet;
diff --git a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs
index cd98872b65..ec2b8437e1 100644
--- a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs
+++ b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs
@@ -4,11 +4,10 @@
using osu.Framework.Allocation;
using osu.Game.Overlays.Dialog;
using osu.Game.Scoring;
-using osu.Framework.Graphics.Sprites;
namespace osu.Game.Screens.Select
{
- public partial class LocalScoreDeleteDialog : DangerousActionDialog
+ public partial class LocalScoreDeleteDialog : DeletionDialog
{
private readonly ScoreInfo score;
@@ -21,8 +20,6 @@ public LocalScoreDeleteDialog(ScoreInfo score)
private void load(ScoreManager scoreManager)
{
BodyText = $"{score.User} ({score.DisplayAccuracy}, {score.Rank})";
-
- Icon = FontAwesome.Regular.TrashAlt;
DangerousAction = () => scoreManager.Delete(score);
}
}
diff --git a/osu.Game/Screens/Select/SkinDeleteDialog.cs b/osu.Game/Screens/Select/SkinDeleteDialog.cs
index 6612ae837a..cd14b5b6d2 100644
--- a/osu.Game/Screens/Select/SkinDeleteDialog.cs
+++ b/osu.Game/Screens/Select/SkinDeleteDialog.cs
@@ -7,7 +7,7 @@
namespace osu.Game.Screens.Select
{
- public partial class SkinDeleteDialog : DangerousActionDialog
+ public partial class SkinDeleteDialog : DeletionDialog
{
private readonly Skin skin;