mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 12:42:54 +08:00
Basic rate-adjust tooltip
This commit is contained in:
parent
57170501cd
commit
440d57fb48
@ -9,6 +9,7 @@ using osu.Framework.Extensions.LocalisationExtensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -23,6 +24,7 @@ using osuTK.Graphics;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets.Difficulty;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
@ -30,7 +32,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
/// On the mod select overlay, this provides a local updating view of BPM, star rating and other
|
/// On the mod select overlay, this provides a local updating view of BPM, star rating and other
|
||||||
/// difficulty attributes so the user can have a better insight into what mods are changing.
|
/// difficulty attributes so the user can have a better insight into what mods are changing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class BeatmapAttributesDisplay : CompositeDrawable
|
public partial class BeatmapAttributesDisplay : CompositeDrawable, IHasTooltip
|
||||||
{
|
{
|
||||||
private Container content = null!;
|
private Container content = null!;
|
||||||
private Container innerContent = null!;
|
private Container innerContent = null!;
|
||||||
@ -71,6 +73,10 @@ namespace osu.Game.Overlays.Mods
|
|||||||
private CancellationTokenSource? cancellationSource;
|
private CancellationTokenSource? cancellationSource;
|
||||||
private IBindable<StarDifficulty?> starDifficulty = null!;
|
private IBindable<StarDifficulty?> starDifficulty = null!;
|
||||||
|
|
||||||
|
private BeatmapDifficulty? baseDifficultyAttributes = null;
|
||||||
|
|
||||||
|
private bool haveRateChangedValues = false;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -256,9 +262,13 @@ namespace osu.Game.Overlays.Mods
|
|||||||
foreach (var mod in mods.Value.OfType<IApplicableToDifficulty>())
|
foreach (var mod in mods.Value.OfType<IApplicableToDifficulty>())
|
||||||
mod.ApplyToDifficulty(moddedDifficulty);
|
mod.ApplyToDifficulty(moddedDifficulty);
|
||||||
|
|
||||||
|
baseDifficultyAttributes = moddedDifficulty;
|
||||||
|
|
||||||
Ruleset ruleset = gameRuleset.Value.CreateInstance();
|
Ruleset ruleset = gameRuleset.Value.CreateInstance();
|
||||||
var rateAdjustedDifficulty = ruleset.GetRateAdjustedDifficulty(moddedDifficulty, rate);
|
var rateAdjustedDifficulty = ruleset.GetRateAdjustedDifficulty(moddedDifficulty, rate);
|
||||||
|
|
||||||
|
haveRateChangedValues = !haveEqualDifficulties(rateAdjustedDifficulty, moddedDifficulty);
|
||||||
|
|
||||||
approachRateDisplay.AdjustType.Value = VerticalAttributeDisplay.CalculateEffect(moddedDifficulty.ApproachRate, rateAdjustedDifficulty.ApproachRate);
|
approachRateDisplay.AdjustType.Value = VerticalAttributeDisplay.CalculateEffect(moddedDifficulty.ApproachRate, rateAdjustedDifficulty.ApproachRate);
|
||||||
overallDifficultyDisplay.AdjustType.Value = VerticalAttributeDisplay.CalculateEffect(moddedDifficulty.OverallDifficulty, rateAdjustedDifficulty.OverallDifficulty);
|
overallDifficultyDisplay.AdjustType.Value = VerticalAttributeDisplay.CalculateEffect(moddedDifficulty.OverallDifficulty, rateAdjustedDifficulty.OverallDifficulty);
|
||||||
|
|
||||||
@ -268,6 +278,19 @@ namespace osu.Game.Overlays.Mods
|
|||||||
overallDifficultyDisplay.Current.Value = rateAdjustedDifficulty.OverallDifficulty;
|
overallDifficultyDisplay.Current.Value = rateAdjustedDifficulty.OverallDifficulty;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
private bool haveEqualDifficulties(BeatmapDifficulty? a, BeatmapDifficulty? b)
|
||||||
|
{
|
||||||
|
if (a == null && b == null) return true;
|
||||||
|
if (a == null || b == null) return false;
|
||||||
|
|
||||||
|
if (a.ApproachRate != b.ApproachRate) return false;
|
||||||
|
if (a.OverallDifficulty != b.OverallDifficulty) return false;
|
||||||
|
if (a.DrainRate != b.DrainRate) return false;
|
||||||
|
if (a.CircleSize != b.CircleSize) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateCollapsedState()
|
private void updateCollapsedState()
|
||||||
{
|
{
|
||||||
outerContent.FadeTo(Collapsed.Value && !IsHovered ? 0 : 1, transition_duration, Easing.OutQuint);
|
outerContent.FadeTo(Collapsed.Value && !IsHovered ? 0 : 1, transition_duration, Easing.OutQuint);
|
||||||
@ -285,5 +308,17 @@ namespace osu.Game.Overlays.Mods
|
|||||||
UseFullGlyphHeight = false,
|
UseFullGlyphHeight = false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LocalisableString TooltipText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (haveRateChangedValues)
|
||||||
|
{
|
||||||
|
return "Some of the values are Rate-Adjusted.";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user