mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +08:00
Update BeatmapAttributesDisplay.cs
This commit is contained in:
parent
2adc8b15e7
commit
cd8ac6a722
@ -19,6 +19,7 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Online.Rooms;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
@ -42,6 +43,9 @@ namespace osu.Game.Overlays.Mods
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private Bindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
|
private Bindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
private IBindable<PlaylistItem>? selectedItem { get; set; }
|
||||||
|
|
||||||
public BindableBool Collapsed { get; } = new BindableBool(true);
|
public BindableBool Collapsed { get; } = new BindableBool(true);
|
||||||
|
|
||||||
private ModSettingChangeTracker? modSettingChangeTracker;
|
private ModSettingChangeTracker? modSettingChangeTracker;
|
||||||
@ -108,6 +112,8 @@ namespace osu.Game.Overlays.Mods
|
|||||||
updateValues();
|
updateValues();
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
selectedItem?.BindValueChanged(_ => mods.TriggerChange());
|
||||||
|
|
||||||
BeatmapInfo.BindValueChanged(_ => updateValues(), true);
|
BeatmapInfo.BindValueChanged(_ => updateValues(), true);
|
||||||
|
|
||||||
Collapsed.BindValueChanged(_ =>
|
Collapsed.BindValueChanged(_ =>
|
||||||
@ -164,10 +170,20 @@ namespace osu.Game.Overlays.Mods
|
|||||||
starRatingDisplay.FinishTransforms(true);
|
starRatingDisplay.FinishTransforms(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Ruleset ruleset = gameRuleset.Value.CreateInstance();
|
||||||
|
|
||||||
double rate = 1;
|
double rate = 1;
|
||||||
foreach (var mod in mods.Value.OfType<IApplicableToRate>())
|
foreach (var mod in mods.Value.OfType<IApplicableToRate>())
|
||||||
rate = mod.ApplyToRate(0, rate);
|
rate = mod.ApplyToRate(0, rate);
|
||||||
|
|
||||||
|
if (selectedItem != null && selectedItem.Value != null)
|
||||||
|
{
|
||||||
|
var globalMods = selectedItem.Value.RequiredMods.Select(m => m.ToMod(ruleset));
|
||||||
|
|
||||||
|
foreach (var mod in globalMods.OfType<IApplicableToRate>())
|
||||||
|
rate = mod.ApplyToRate(0, rate);
|
||||||
|
}
|
||||||
|
|
||||||
bpmDisplay.Current.Value = BeatmapInfo.Value.BPM * rate;
|
bpmDisplay.Current.Value = BeatmapInfo.Value.BPM * rate;
|
||||||
|
|
||||||
BeatmapDifficulty originalDifficulty = new BeatmapDifficulty(BeatmapInfo.Value.Difficulty);
|
BeatmapDifficulty originalDifficulty = new BeatmapDifficulty(BeatmapInfo.Value.Difficulty);
|
||||||
@ -175,7 +191,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
foreach (var mod in mods.Value.OfType<IApplicableToDifficulty>())
|
foreach (var mod in mods.Value.OfType<IApplicableToDifficulty>())
|
||||||
mod.ApplyToDifficulty(originalDifficulty);
|
mod.ApplyToDifficulty(originalDifficulty);
|
||||||
|
|
||||||
Ruleset ruleset = gameRuleset.Value.CreateInstance();
|
|
||||||
BeatmapDifficulty adjustedDifficulty = ruleset.GetRateAdjustedDisplayDifficulty(originalDifficulty, rate);
|
BeatmapDifficulty adjustedDifficulty = ruleset.GetRateAdjustedDisplayDifficulty(originalDifficulty, rate);
|
||||||
|
|
||||||
TooltipContent = new AdjustedAttributesTooltip.Data(originalDifficulty, adjustedDifficulty);
|
TooltipContent = new AdjustedAttributesTooltip.Data(originalDifficulty, adjustedDifficulty);
|
||||||
|
Loading…
Reference in New Issue
Block a user