mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 19:43:22 +08:00
Merge branch 'master' into add-spinner-clear
This commit is contained in:
commit
5d7fa42d90
@ -52,6 +52,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1030.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1030.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.1029.1" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.1105.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -17,9 +17,11 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
private const double fade_out_offset_multiplier = 0.6;
|
private const double fade_out_offset_multiplier = 0.6;
|
||||||
private const double fade_out_duration_multiplier = 0.44;
|
private const double fade_out_duration_multiplier = 0.44;
|
||||||
|
|
||||||
protected override void ApplyHiddenState(DrawableHitObject drawable, ArmedState state)
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
if (!(drawable is DrawableCatchHitObject catchDrawable))
|
base.ApplyNormalVisibilityState(hitObject, state);
|
||||||
|
|
||||||
|
if (!(hitObject is DrawableCatchHitObject catchDrawable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (catchDrawable.NestedHitObjects.Any())
|
if (catchDrawable.NestedHitObjects.Any())
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -23,28 +22,38 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
private const double fade_in_duration_multiplier = 0.4;
|
private const double fade_in_duration_multiplier = 0.4;
|
||||||
private const double fade_out_duration_multiplier = 0.3;
|
private const double fade_out_duration_multiplier = 0.3;
|
||||||
|
|
||||||
protected override bool IsFirstHideableObject(DrawableHitObject hitObject) => !(hitObject is DrawableSpinner);
|
protected override bool IsFirstAdjustableObject(HitObject hitObject) => !(hitObject is Spinner);
|
||||||
|
|
||||||
public override void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public override void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||||
{
|
{
|
||||||
static void adjustFadeIn(OsuHitObject h) => h.TimeFadeIn = h.TimePreempt * fade_in_duration_multiplier;
|
foreach (var d in drawables)
|
||||||
|
d.ApplyCustomUpdateState += applyFadeInAdjustment;
|
||||||
foreach (var d in drawables.OfType<DrawableOsuHitObject>())
|
|
||||||
{
|
|
||||||
adjustFadeIn(d.HitObject);
|
|
||||||
foreach (var h in d.HitObject.NestedHitObjects.OfType<OsuHitObject>())
|
|
||||||
adjustFadeIn(h);
|
|
||||||
}
|
|
||||||
|
|
||||||
base.ApplyToDrawableHitObjects(drawables);
|
base.ApplyToDrawableHitObjects(drawables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyFadeInAdjustment(DrawableHitObject hitObject, ArmedState state)
|
||||||
|
{
|
||||||
|
if (!(hitObject is DrawableOsuHitObject d))
|
||||||
|
return;
|
||||||
|
|
||||||
|
d.HitObject.TimeFadeIn = d.HitObject.TimePreempt * fade_in_duration_multiplier;
|
||||||
|
}
|
||||||
|
|
||||||
private double lastSliderHeadFadeOutStartTime;
|
private double lastSliderHeadFadeOutStartTime;
|
||||||
private double lastSliderHeadFadeOutDuration;
|
private double lastSliderHeadFadeOutDuration;
|
||||||
|
|
||||||
protected override void ApplyFirstObjectIncreaseVisibilityState(DrawableHitObject drawable, ArmedState state) => applyState(drawable, true);
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
|
{
|
||||||
|
base.ApplyIncreasedVisibilityState(hitObject, state);
|
||||||
|
applyState(hitObject, true);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void ApplyHiddenState(DrawableHitObject drawable, ArmedState state) => applyState(drawable, false);
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
|
{
|
||||||
|
base.ApplyNormalVisibilityState(hitObject, state);
|
||||||
|
applyState(hitObject, false);
|
||||||
|
}
|
||||||
|
|
||||||
private void applyState(DrawableHitObject drawable, bool increaseVisibility)
|
private void applyState(DrawableHitObject drawable, bool increaseVisibility)
|
||||||
{
|
{
|
||||||
|
@ -2,11 +2,8 @@
|
|||||||
// 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;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
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;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
@ -17,7 +14,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adjusts the size of hit objects during their fade in animation.
|
/// Adjusts the size of hit objects during their fade in animation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class OsuModObjectScaleTween : Mod, IReadFromConfig, IApplicableToDrawableHitObjects
|
public abstract class OsuModObjectScaleTween : ModWithVisibilityAdjustment
|
||||||
{
|
{
|
||||||
public override ModType Type => ModType.Fun;
|
public override ModType Type => ModType.Fun;
|
||||||
|
|
||||||
@ -27,33 +24,19 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
protected virtual float EndScale => 1;
|
protected virtual float EndScale => 1;
|
||||||
|
|
||||||
private Bindable<bool> increaseFirstObjectVisibility = new Bindable<bool>();
|
|
||||||
|
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpinIn), typeof(OsuModTraceable) };
|
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpinIn), typeof(OsuModTraceable) };
|
||||||
|
|
||||||
public void ReadFromConfig(OsuConfigManager config)
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
increaseFirstObjectVisibility = config.GetBindable<bool>(OsuSetting.IncreaseFirstObjectVisibility);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyCustomState(hitObject, state);
|
||||||
{
|
|
||||||
foreach (var drawable in drawables.Skip(increaseFirstObjectVisibility.Value ? 1 : 0))
|
|
||||||
{
|
|
||||||
switch (drawable)
|
|
||||||
{
|
|
||||||
case DrawableSpinner _:
|
|
||||||
continue;
|
|
||||||
|
|
||||||
default:
|
private void applyCustomState(DrawableHitObject drawable, ArmedState state)
|
||||||
drawable.ApplyCustomUpdateState += ApplyCustomState;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void ApplyCustomState(DrawableHitObject drawable, ArmedState state)
|
|
||||||
{
|
{
|
||||||
|
if (drawable is DrawableSpinner)
|
||||||
|
return;
|
||||||
|
|
||||||
var h = (OsuHitObject)drawable.HitObject;
|
var h = (OsuHitObject)drawable.HitObject;
|
||||||
|
|
||||||
// apply grow effect
|
// apply grow effect
|
||||||
|
@ -2,12 +2,8 @@
|
|||||||
// 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;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
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;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
@ -16,7 +12,7 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
public class OsuModSpinIn : Mod, IApplicableToDrawableHitObjects, IReadFromConfig
|
public class OsuModSpinIn : ModWithVisibilityAdjustment
|
||||||
{
|
{
|
||||||
public override string Name => "Spin In";
|
public override string Name => "Spin In";
|
||||||
public override string Acronym => "SI";
|
public override string Acronym => "SI";
|
||||||
@ -31,31 +27,17 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
private const int rotate_offset = 360;
|
private const int rotate_offset = 360;
|
||||||
private const float rotate_starting_width = 2;
|
private const float rotate_starting_width = 2;
|
||||||
|
|
||||||
private Bindable<bool> increaseFirstObjectVisibility = new Bindable<bool>();
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
|
|
||||||
public void ReadFromConfig(OsuConfigManager config)
|
|
||||||
{
|
{
|
||||||
increaseFirstObjectVisibility = config.GetBindable<bool>(OsuSetting.IncreaseFirstObjectVisibility);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyZoomState(hitObject, state);
|
||||||
{
|
|
||||||
foreach (var drawable in drawables.Skip(increaseFirstObjectVisibility.Value ? 1 : 0))
|
|
||||||
{
|
|
||||||
switch (drawable)
|
|
||||||
{
|
|
||||||
case DrawableSpinner _:
|
|
||||||
continue;
|
|
||||||
|
|
||||||
default:
|
|
||||||
drawable.ApplyCustomUpdateState += applyZoomState;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void applyZoomState(DrawableHitObject drawable, ArmedState state)
|
private void applyZoomState(DrawableHitObject drawable, ArmedState state)
|
||||||
{
|
{
|
||||||
|
if (drawable is DrawableSpinner)
|
||||||
|
return;
|
||||||
|
|
||||||
var h = (OsuHitObject)drawable.HitObject;
|
var h = (OsuHitObject)drawable.HitObject;
|
||||||
|
|
||||||
switch (drawable)
|
switch (drawable)
|
||||||
|
@ -2,12 +2,8 @@
|
|||||||
// 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;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
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;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
@ -15,7 +11,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
internal class OsuModTraceable : Mod, IReadFromConfig, IApplicableToDrawableHitObjects
|
internal class OsuModTraceable : ModWithVisibilityAdjustment
|
||||||
{
|
{
|
||||||
public override string Name => "Traceable";
|
public override string Name => "Traceable";
|
||||||
public override string Acronym => "TC";
|
public override string Acronym => "TC";
|
||||||
@ -24,20 +20,14 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
|
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModHidden), typeof(OsuModSpinIn), typeof(OsuModObjectScaleTween) };
|
public override Type[] IncompatibleMods => new[] { typeof(OsuModHidden), typeof(OsuModSpinIn), typeof(OsuModObjectScaleTween) };
|
||||||
private Bindable<bool> increaseFirstObjectVisibility = new Bindable<bool>();
|
|
||||||
|
|
||||||
public void ReadFromConfig(OsuConfigManager config)
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
increaseFirstObjectVisibility = config.GetBindable<bool>(OsuSetting.IncreaseFirstObjectVisibility);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyTraceableState(hitObject, state);
|
||||||
{
|
|
||||||
foreach (var drawable in drawables.Skip(increaseFirstObjectVisibility.Value ? 1 : 0))
|
|
||||||
drawable.ApplyCustomUpdateState += ApplyTraceableState;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void ApplyTraceableState(DrawableHitObject drawable, ArmedState state)
|
private void applyTraceableState(DrawableHitObject drawable, ArmedState state)
|
||||||
{
|
{
|
||||||
if (!(drawable is DrawableOsuHitObject))
|
if (!(drawable is DrawableOsuHitObject))
|
||||||
return;
|
return;
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// 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;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -13,7 +12,7 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
internal class OsuModTransform : Mod, IApplicableToDrawableHitObjects
|
internal class OsuModTransform : ModWithVisibilityAdjustment
|
||||||
{
|
{
|
||||||
public override string Name => "Transform";
|
public override string Name => "Transform";
|
||||||
public override string Acronym => "TR";
|
public override string Acronym => "TR";
|
||||||
@ -25,11 +24,9 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
private float theta;
|
private float theta;
|
||||||
|
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyTransform(hitObject, state);
|
||||||
{
|
|
||||||
foreach (var drawable in drawables)
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyTransform(hitObject, state);
|
||||||
drawable.ApplyCustomUpdateState += applyTransform;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void applyTransform(DrawableHitObject drawable, ArmedState state)
|
private void applyTransform(DrawableHitObject drawable, ArmedState state)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// 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;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -13,7 +12,7 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
internal class OsuModWiggle : Mod, IApplicableToDrawableHitObjects
|
internal class OsuModWiggle : ModWithVisibilityAdjustment
|
||||||
{
|
{
|
||||||
public override string Name => "Wiggle";
|
public override string Name => "Wiggle";
|
||||||
public override string Acronym => "WG";
|
public override string Acronym => "WG";
|
||||||
@ -26,11 +25,9 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
private const int wiggle_duration = 90; // (ms) Higher = fewer wiggles
|
private const int wiggle_duration = 90; // (ms) Higher = fewer wiggles
|
||||||
private const int wiggle_strength = 10; // Higher = stronger wiggles
|
private const int wiggle_strength = 10; // Higher = stronger wiggles
|
||||||
|
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) => drawableOnApplyCustomUpdateState(hitObject, state);
|
||||||
{
|
|
||||||
foreach (var drawable in drawables)
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => drawableOnApplyCustomUpdateState(hitObject, state);
|
||||||
drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state)
|
private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state)
|
||||||
{
|
{
|
||||||
|
@ -14,8 +14,8 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestKeyEqualsWithDifferentModInstances()
|
public void TestKeyEqualsWithDifferentModInstances()
|
||||||
{
|
{
|
||||||
var key1 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
||||||
var key2 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
||||||
|
|
||||||
Assert.That(key1, Is.EqualTo(key2));
|
Assert.That(key1, Is.EqualTo(key2));
|
||||||
}
|
}
|
||||||
@ -23,8 +23,8 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestKeyEqualsWithDifferentModOrder()
|
public void TestKeyEqualsWithDifferentModOrder()
|
||||||
{
|
{
|
||||||
var key1 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
||||||
var key2 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHidden(), new OsuModHardRock() });
|
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHidden(), new OsuModHardRock() });
|
||||||
|
|
||||||
Assert.That(key1, Is.EqualTo(key2));
|
Assert.That(key1, Is.EqualTo(key2));
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
[TestCase(8.3, DifficultyRating.ExpertPlus)]
|
[TestCase(8.3, DifficultyRating.ExpertPlus)]
|
||||||
public void TestDifficultyRatingMapping(double starRating, DifficultyRating expectedBracket)
|
public void TestDifficultyRatingMapping(double starRating, DifficultyRating expectedBracket)
|
||||||
{
|
{
|
||||||
var actualBracket = BeatmapDifficultyManager.GetDifficultyRating(starRating);
|
var actualBracket = BeatmapDifficultyCache.GetDifficultyRating(starRating);
|
||||||
|
|
||||||
Assert.AreEqual(expectedBracket, actualBracket);
|
Assert.AreEqual(expectedBracket, actualBracket);
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
public void EndPlay(int beatmapId)
|
public void EndPlay(int beatmapId)
|
||||||
{
|
{
|
||||||
((ISpectatorClient)this).UserFinishedPlaying((int)StreamingUser.Id, new SpectatorState
|
((ISpectatorClient)this).UserFinishedPlaying(StreamingUser.Id, new SpectatorState
|
||||||
{
|
{
|
||||||
BeatmapID = beatmapId,
|
BeatmapID = beatmapId,
|
||||||
RulesetID = 0,
|
RulesetID = 0,
|
||||||
@ -273,7 +273,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
}
|
}
|
||||||
|
|
||||||
var bundle = new FrameDataBundle(frames);
|
var bundle = new FrameDataBundle(frames);
|
||||||
((ISpectatorClient)this).UserSentFrames((int)StreamingUser.Id, bundle);
|
((ISpectatorClient)this).UserSentFrames(StreamingUser.Id, bundle);
|
||||||
|
|
||||||
if (!sentState)
|
if (!sentState)
|
||||||
sendState(beatmapId);
|
sendState(beatmapId);
|
||||||
@ -293,7 +293,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
private void sendState(int beatmapId)
|
private void sendState(int beatmapId)
|
||||||
{
|
{
|
||||||
sentState = true;
|
sentState = true;
|
||||||
((ISpectatorClient)this).UserBeganPlaying((int)StreamingUser.Id, new SpectatorState
|
((ISpectatorClient)this).UserBeganPlaying(StreamingUser.Id, new SpectatorState
|
||||||
{
|
{
|
||||||
BeatmapID = beatmapId,
|
BeatmapID = beatmapId,
|
||||||
RulesetID = 0,
|
RulesetID = 0,
|
||||||
|
@ -277,7 +277,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
userId.Value = user.Id.ToString();
|
userId.Value = user.Id.ToString();
|
||||||
userId.BindValueChanged(idString =>
|
userId.BindValueChanged(idString =>
|
||||||
{
|
{
|
||||||
long.TryParse(idString.NewValue, out var parsed);
|
int.TryParse(idString.NewValue, out var parsed);
|
||||||
|
|
||||||
user.Id = parsed;
|
user.Id = parsed;
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// 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;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -11,25 +10,25 @@ using System.Threading.Tasks;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Difficulty;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
public class BeatmapDifficultyManager : CompositeDrawable
|
/// <summary>
|
||||||
|
/// A component which performs and acts as a central cache for difficulty calculations of beatmap/ruleset/mod combinations.
|
||||||
|
/// Currently not persisted between game sessions.
|
||||||
|
/// </summary>
|
||||||
|
public class BeatmapDifficultyCache : MemoryCachingComponent<BeatmapDifficultyCache.DifficultyCacheLookup, StarDifficulty>
|
||||||
{
|
{
|
||||||
// Too many simultaneous updates can lead to stutters. One thread seems to work fine for song select display purposes.
|
// Too many simultaneous updates can lead to stutters. One thread seems to work fine for song select display purposes.
|
||||||
private readonly ThreadedTaskScheduler updateScheduler = new ThreadedTaskScheduler(1, nameof(BeatmapDifficultyManager));
|
private readonly ThreadedTaskScheduler updateScheduler = new ThreadedTaskScheduler(1, nameof(BeatmapDifficultyCache));
|
||||||
|
|
||||||
// A permanent cache to prevent re-computations.
|
|
||||||
private readonly ConcurrentDictionary<DifficultyCacheLookup, StarDifficulty> difficultyCache = new ConcurrentDictionary<DifficultyCacheLookup, StarDifficulty>();
|
|
||||||
|
|
||||||
// All bindables that should be updated along with the current ruleset + mods.
|
// All bindables that should be updated along with the current ruleset + mods.
|
||||||
private readonly LockedWeakList<BindableStarDifficulty> trackedBindables = new LockedWeakList<BindableStarDifficulty>();
|
private readonly LockedWeakList<BindableStarDifficulty> trackedBindables = new LockedWeakList<BindableStarDifficulty>();
|
||||||
@ -239,7 +238,7 @@ namespace osu.Game.Beatmaps
|
|||||||
var calculator = ruleset.CreateDifficultyCalculator(beatmapManager.GetWorkingBeatmap(beatmapInfo));
|
var calculator = ruleset.CreateDifficultyCalculator(beatmapManager.GetWorkingBeatmap(beatmapInfo));
|
||||||
var attributes = calculator.Calculate(key.Mods);
|
var attributes = calculator.Calculate(key.Mods);
|
||||||
|
|
||||||
return difficultyCache[key] = new StarDifficulty(attributes);
|
return Cache[key] = new StarDifficulty(attributes);
|
||||||
}
|
}
|
||||||
catch (BeatmapInvalidForRulesetException e)
|
catch (BeatmapInvalidForRulesetException e)
|
||||||
{
|
{
|
||||||
@ -250,7 +249,7 @@ namespace osu.Game.Beatmaps
|
|||||||
if (rulesetInfo.Equals(beatmapInfo.Ruleset))
|
if (rulesetInfo.Equals(beatmapInfo.Ruleset))
|
||||||
{
|
{
|
||||||
Logger.Error(e, $"Failed to convert {beatmapInfo.OnlineBeatmapID} to the beatmap's default ruleset ({beatmapInfo.Ruleset}).");
|
Logger.Error(e, $"Failed to convert {beatmapInfo.OnlineBeatmapID} to the beatmap's default ruleset ({beatmapInfo.Ruleset}).");
|
||||||
return difficultyCache[key] = new StarDifficulty();
|
return Cache[key] = new StarDifficulty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the cache first because this is now a different ruleset than the one previously guarded against.
|
// Check the cache first because this is now a different ruleset than the one previously guarded against.
|
||||||
@ -261,7 +260,7 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return difficultyCache[key] = new StarDifficulty();
|
return Cache[key] = new StarDifficulty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +289,7 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
|
|
||||||
key = new DifficultyCacheLookup(beatmapInfo.ID, rulesetInfo.ID.Value, mods);
|
key = new DifficultyCacheLookup(beatmapInfo.ID, rulesetInfo.ID.Value, mods);
|
||||||
return difficultyCache.TryGetValue(key, out existingDifficulty);
|
return Cache.TryGetValue(key, out existingDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
@ -344,49 +343,4 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly struct StarDifficulty
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The star difficulty rating for the given beatmap.
|
|
||||||
/// </summary>
|
|
||||||
public readonly double Stars;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The maximum combo achievable on the given beatmap.
|
|
||||||
/// </summary>
|
|
||||||
public readonly int MaxCombo;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The difficulty attributes computed for the given beatmap.
|
|
||||||
/// Might not be available if the star difficulty is associated with a beatmap that's not locally available.
|
|
||||||
/// </summary>
|
|
||||||
[CanBeNull]
|
|
||||||
public readonly DifficultyAttributes Attributes;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a <see cref="StarDifficulty"/> structure based on <see cref="DifficultyAttributes"/> computed
|
|
||||||
/// by a <see cref="DifficultyCalculator"/>.
|
|
||||||
/// </summary>
|
|
||||||
public StarDifficulty([NotNull] DifficultyAttributes attributes)
|
|
||||||
{
|
|
||||||
Stars = attributes.StarRating;
|
|
||||||
MaxCombo = attributes.MaxCombo;
|
|
||||||
Attributes = attributes;
|
|
||||||
// Todo: Add more members (BeatmapInfo.DifficultyRating? Attributes? Etc...)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a <see cref="StarDifficulty"/> structure with a pre-populated star difficulty and max combo
|
|
||||||
/// in scenarios where computing <see cref="DifficultyAttributes"/> is not feasible (i.e. when working with online sources).
|
|
||||||
/// </summary>
|
|
||||||
public StarDifficulty(double starDifficulty, int maxCombo)
|
|
||||||
{
|
|
||||||
Stars = starDifficulty;
|
|
||||||
MaxCombo = maxCombo;
|
|
||||||
Attributes = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DifficultyRating DifficultyRating => BeatmapDifficultyManager.GetDifficultyRating(Stars);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -136,7 +136,7 @@ namespace osu.Game.Beatmaps
|
|||||||
public List<ScoreInfo> Scores { get; set; }
|
public List<ScoreInfo> Scores { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public DifficultyRating DifficultyRating => BeatmapDifficultyManager.GetDifficultyRating(StarDifficulty);
|
public DifficultyRating DifficultyRating => BeatmapDifficultyCache.GetDifficultyRating(StarDifficulty);
|
||||||
|
|
||||||
public string[] SearchableTerms => new[]
|
public string[] SearchableTerms => new[]
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
private CancellationTokenSource difficultyCancellation;
|
private CancellationTokenSource difficultyCancellation;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapDifficultyManager difficultyManager { get; set; }
|
private BeatmapDifficultyCache difficultyCache { get; set; }
|
||||||
|
|
||||||
public DifficultyRetriever(BeatmapInfo beatmap, RulesetInfo ruleset, IReadOnlyList<Mod> mods)
|
public DifficultyRetriever(BeatmapInfo beatmap, RulesetInfo ruleset, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
@ -158,8 +158,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
{
|
{
|
||||||
difficultyCancellation = new CancellationTokenSource();
|
difficultyCancellation = new CancellationTokenSource();
|
||||||
localStarDifficulty = ruleset != null
|
localStarDifficulty = ruleset != null
|
||||||
? difficultyManager.GetBindableDifficulty(beatmap, ruleset, mods, difficultyCancellation.Token)
|
? difficultyCache.GetBindableDifficulty(beatmap, ruleset, mods, difficultyCancellation.Token)
|
||||||
: difficultyManager.GetBindableDifficulty(beatmap, difficultyCancellation.Token);
|
: difficultyCache.GetBindableDifficulty(beatmap, difficultyCancellation.Token);
|
||||||
localStarDifficulty.BindValueChanged(difficulty => StarDifficulty.Value = difficulty.NewValue);
|
localStarDifficulty.BindValueChanged(difficulty => StarDifficulty.Value = difficulty.NewValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
53
osu.Game/Beatmaps/StarDifficulty.cs
Normal file
53
osu.Game/Beatmaps/StarDifficulty.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
// 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 JetBrains.Annotations;
|
||||||
|
using osu.Game.Rulesets.Difficulty;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps
|
||||||
|
{
|
||||||
|
public readonly struct StarDifficulty
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The star difficulty rating for the given beatmap.
|
||||||
|
/// </summary>
|
||||||
|
public readonly double Stars;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum combo achievable on the given beatmap.
|
||||||
|
/// </summary>
|
||||||
|
public readonly int MaxCombo;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The difficulty attributes computed for the given beatmap.
|
||||||
|
/// Might not be available if the star difficulty is associated with a beatmap that's not locally available.
|
||||||
|
/// </summary>
|
||||||
|
[CanBeNull]
|
||||||
|
public readonly DifficultyAttributes Attributes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a <see cref="StarDifficulty"/> structure based on <see cref="DifficultyAttributes"/> computed
|
||||||
|
/// by a <see cref="DifficultyCalculator"/>.
|
||||||
|
/// </summary>
|
||||||
|
public StarDifficulty([NotNull] DifficultyAttributes attributes)
|
||||||
|
{
|
||||||
|
Stars = attributes.StarRating;
|
||||||
|
MaxCombo = attributes.MaxCombo;
|
||||||
|
Attributes = attributes;
|
||||||
|
// Todo: Add more members (BeatmapInfo.DifficultyRating? Attributes? Etc...)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a <see cref="StarDifficulty"/> structure with a pre-populated star difficulty and max combo
|
||||||
|
/// in scenarios where computing <see cref="DifficultyAttributes"/> is not feasible (i.e. when working with online sources).
|
||||||
|
/// </summary>
|
||||||
|
public StarDifficulty(double starDifficulty, int maxCombo)
|
||||||
|
{
|
||||||
|
Stars = starDifficulty;
|
||||||
|
MaxCombo = maxCombo;
|
||||||
|
Attributes = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DifficultyRating DifficultyRating => BeatmapDifficultyCache.GetDifficultyRating(Stars);
|
||||||
|
}
|
||||||
|
}
|
17
osu.Game/Database/MemoryCachingComponent.cs
Normal file
17
osu.Game/Database/MemoryCachingComponent.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// 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 System.Collections.Concurrent;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Database
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A component which performs lookups (or calculations) and caches the results.
|
||||||
|
/// Currently not persisted between game sessions.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class MemoryCachingComponent<TLookup, TValue> : Component
|
||||||
|
{
|
||||||
|
protected readonly ConcurrentDictionary<TLookup, TValue> Cache = new ConcurrentDictionary<TLookup, TValue>();
|
||||||
|
}
|
||||||
|
}
|
@ -61,7 +61,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
private int[] ratings { get; set; }
|
private int[] ratings { get; set; }
|
||||||
|
|
||||||
[JsonProperty(@"user_id")]
|
[JsonProperty(@"user_id")]
|
||||||
private long creatorId
|
private int creatorId
|
||||||
{
|
{
|
||||||
set => Author.Id = value;
|
set => Author.Id = value;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
public string OsuUsername { get; set; }
|
public string OsuUsername { get; set; }
|
||||||
|
|
||||||
[JsonProperty("user_id")]
|
[JsonProperty("user_id")]
|
||||||
public long? UserId { get; set; }
|
public int? UserId { get; set; }
|
||||||
|
|
||||||
[JsonProperty("user_url")]
|
[JsonProperty("user_url")]
|
||||||
public string UserUrl { get; set; }
|
public string UserUrl { get; set; }
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Online.Chat
|
|||||||
public readonly ObservableCollection<User> Users = new ObservableCollection<User>();
|
public readonly ObservableCollection<User> Users = new ObservableCollection<User>();
|
||||||
|
|
||||||
[JsonProperty(@"users")]
|
[JsonProperty(@"users")]
|
||||||
private long[] userIds
|
private int[] userIds
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
@ -278,7 +278,7 @@ namespace osu.Game
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LinkAction.OpenUserProfile:
|
case LinkAction.OpenUserProfile:
|
||||||
if (long.TryParse(link.Argument, out long userId))
|
if (int.TryParse(link.Argument, out int userId))
|
||||||
ShowUser(userId);
|
ShowUser(userId);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ namespace osu.Game
|
|||||||
/// Show a user's profile as an overlay.
|
/// Show a user's profile as an overlay.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">The user to display.</param>
|
/// <param name="userId">The user to display.</param>
|
||||||
public void ShowUser(long userId) => waitForReady(() => userProfile, _ => userProfile.ShowUser(userId));
|
public void ShowUser(int userId) => waitForReady(() => userProfile, _ => userProfile.ShowUser(userId));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show a beatmap's set as an overlay, displaying the given beatmap.
|
/// Show a beatmap's set as an overlay, displaying the given beatmap.
|
||||||
|
@ -59,7 +59,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
protected ScoreManager ScoreManager;
|
protected ScoreManager ScoreManager;
|
||||||
|
|
||||||
protected BeatmapDifficultyManager DifficultyManager;
|
protected BeatmapDifficultyCache DifficultyCache;
|
||||||
|
|
||||||
protected SkinManager SkinManager;
|
protected SkinManager SkinManager;
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ namespace osu.Game
|
|||||||
dependencies.Cache(FileStore = new FileStore(contextFactory, Storage));
|
dependencies.Cache(FileStore = new FileStore(contextFactory, Storage));
|
||||||
|
|
||||||
// ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup()
|
// ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup()
|
||||||
dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, API, contextFactory, Host, () => DifficultyManager, LocalConfig));
|
dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, API, contextFactory, Host, () => DifficultyCache, LocalConfig));
|
||||||
dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, contextFactory, RulesetStore, API, Audio, Host, defaultBeatmap, true));
|
dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, contextFactory, RulesetStore, API, Audio, Host, defaultBeatmap, true));
|
||||||
|
|
||||||
// this should likely be moved to ArchiveModelManager when another case appers where it is necessary
|
// this should likely be moved to ArchiveModelManager when another case appers where it is necessary
|
||||||
@ -226,10 +226,10 @@ namespace osu.Game
|
|||||||
ScoreManager.Undelete(getBeatmapScores(item), true);
|
ScoreManager.Undelete(getBeatmapScores(item), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
dependencies.Cache(DifficultyManager = new BeatmapDifficultyManager());
|
dependencies.Cache(DifficultyCache = new BeatmapDifficultyCache());
|
||||||
AddInternal(DifficultyManager);
|
AddInternal(DifficultyCache);
|
||||||
|
|
||||||
var scorePerformanceManager = new ScorePerformanceManager();
|
var scorePerformanceManager = new ScorePerformanceCache();
|
||||||
dependencies.Cache(scorePerformanceManager);
|
dependencies.Cache(scorePerformanceManager);
|
||||||
AddInternal(scorePerformanceManager);
|
AddInternal(scorePerformanceManager);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Dashboard
|
|||||||
var request = new GetUserRequest(u);
|
var request = new GetUserRequest(u);
|
||||||
request.Success += user => Schedule(() =>
|
request.Success += user => Schedule(() =>
|
||||||
{
|
{
|
||||||
if (playingUsers.Contains((int)user.Id))
|
if (playingUsers.Contains(user.Id))
|
||||||
userFlow.Add(createUserPanel(user));
|
userFlow.Add(createUserPanel(user));
|
||||||
});
|
});
|
||||||
api.Queue(request);
|
api.Queue(request);
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowUser(long userId) => ShowUser(new User { Id = userId });
|
public void ShowUser(int userId) => ShowUser(new User { Id = userId });
|
||||||
|
|
||||||
public void ShowUser(User user, bool fetchOnline = true)
|
public void ShowUser(User user, bool fetchOnline = true)
|
||||||
{
|
{
|
||||||
|
@ -1,19 +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.
|
||||||
|
|
||||||
using osu.Game.Configuration;
|
using System;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
public abstract class ModHidden : Mod, IReadFromConfig, IApplicableToDrawableHitObjects, IApplicableToScoreProcessor
|
public abstract class ModHidden : ModWithVisibilityAdjustment, IApplicableToScoreProcessor
|
||||||
{
|
{
|
||||||
public override string Name => "Hidden";
|
public override string Name => "Hidden";
|
||||||
public override string Acronym => "HD";
|
public override string Acronym => "HD";
|
||||||
@ -21,37 +18,14 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override ModType Type => ModType.DifficultyIncrease;
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
|
|
||||||
protected Bindable<bool> IncreaseFirstObjectVisibility = new Bindable<bool>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check whether the provided hitobject should be considered the "first" hideable object.
|
/// Check whether the provided hitobject should be considered the "first" hideable object.
|
||||||
/// Can be used to skip spinners, for instance.
|
/// Can be used to skip spinners, for instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObject">The hitobject to check.</param>
|
/// <param name="hitObject">The hitobject to check.</param>
|
||||||
|
[Obsolete("Use IsFirstAdjustableObject() instead.")] // Can be removed 20210506
|
||||||
protected virtual bool IsFirstHideableObject(DrawableHitObject hitObject) => true;
|
protected virtual bool IsFirstHideableObject(DrawableHitObject hitObject) => true;
|
||||||
|
|
||||||
public void ReadFromConfig(OsuConfigManager config)
|
|
||||||
{
|
|
||||||
IncreaseFirstObjectVisibility = config.GetBindable<bool>(OsuSetting.IncreaseFirstObjectVisibility);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
|
||||||
{
|
|
||||||
if (IncreaseFirstObjectVisibility.Value)
|
|
||||||
{
|
|
||||||
drawables = drawables.SkipWhile(h => !IsFirstHideableObject(h));
|
|
||||||
|
|
||||||
var firstObject = drawables.FirstOrDefault();
|
|
||||||
if (firstObject != null)
|
|
||||||
firstObject.ApplyCustomUpdateState += ApplyFirstObjectIncreaseVisibilityState;
|
|
||||||
|
|
||||||
drawables = drawables.Skip(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var dho in drawables)
|
|
||||||
dho.ApplyCustomUpdateState += ApplyHiddenState;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
||||||
{
|
{
|
||||||
// Default value of ScoreProcessor's Rank in Hidden Mod should be SS+
|
// Default value of ScoreProcessor's Rank in Hidden Mod should be SS+
|
||||||
@ -73,11 +47,26 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
|
{
|
||||||
|
#pragma warning disable 618
|
||||||
|
ApplyFirstObjectIncreaseVisibilityState(hitObject, state);
|
||||||
|
#pragma warning restore 618
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
|
{
|
||||||
|
#pragma warning disable 618
|
||||||
|
ApplyHiddenState(hitObject, state);
|
||||||
|
#pragma warning restore 618
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Apply a special visibility state to the first object in a beatmap, if the user chooses to turn on the "increase first object visibility" setting.
|
/// Apply a special visibility state to the first object in a beatmap, if the user chooses to turn on the "increase first object visibility" setting.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObject">The hit object to apply the state change to.</param>
|
/// <param name="hitObject">The hit object to apply the state change to.</param>
|
||||||
/// <param name="state">The state of the hit object.</param>
|
/// <param name="state">The state of the hit object.</param>
|
||||||
|
[Obsolete("Use ApplyIncreasedVisibilityState() instead.")] // Can be removed 20210506
|
||||||
protected virtual void ApplyFirstObjectIncreaseVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
protected virtual void ApplyFirstObjectIncreaseVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -87,6 +76,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObject">The hit object to apply the state change to.</param>
|
/// <param name="hitObject">The hit object to apply the state change to.</param>
|
||||||
/// <param name="state">The state of the hit object.</param>
|
/// <param name="state">The state of the hit object.</param>
|
||||||
|
[Obsolete("Use ApplyNormalVisibilityState() instead.")] // Can be removed 20210506
|
||||||
protected virtual void ApplyHiddenState(DrawableHitObject hitObject, ArmedState state)
|
protected virtual void ApplyHiddenState(DrawableHitObject hitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
114
osu.Game/Rulesets/Mods/ModWithVisibilityAdjustment.cs
Normal file
114
osu.Game/Rulesets/Mods/ModWithVisibilityAdjustment.cs
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
// 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 System.Collections.Generic;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mods
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="Mod"/> which applies visibility adjustments to <see cref="DrawableHitObject"/>s
|
||||||
|
/// with an optional increased visibility adjustment depending on the user's "increase first object visibility" setting.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class ModWithVisibilityAdjustment : Mod, IReadFromConfig, IApplicableToBeatmap, IApplicableToDrawableHitObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The first adjustable object.
|
||||||
|
/// </summary>
|
||||||
|
protected HitObject FirstObject { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the visibility of <see cref="FirstObject"/> should be increased.
|
||||||
|
/// </summary>
|
||||||
|
protected readonly Bindable<bool> IncreaseFirstObjectVisibility = new Bindable<bool>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check whether the provided hitobject should be considered the "first" adjustable object.
|
||||||
|
/// Can be used to skip spinners, for instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The hitobject to check.</param>
|
||||||
|
protected virtual bool IsFirstAdjustableObject(HitObject hitObject) => true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Apply a special increased-visibility state to the first adjustable object.
|
||||||
|
/// Only applicable if the user chooses to turn on the "increase first object visibility" setting.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The hit object to apply the state change to.</param>
|
||||||
|
/// <param name="state">The state of the hitobject.</param>
|
||||||
|
protected abstract void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Apply a normal visibility state adjustment to an object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The hit object to apply the state change to.</param>
|
||||||
|
/// <param name="state">The state of the hitobject.</param>
|
||||||
|
protected abstract void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state);
|
||||||
|
|
||||||
|
public virtual void ReadFromConfig(OsuConfigManager config)
|
||||||
|
{
|
||||||
|
config.BindWith(OsuSetting.IncreaseFirstObjectVisibility, IncreaseFirstObjectVisibility);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void ApplyToBeatmap(IBeatmap beatmap)
|
||||||
|
{
|
||||||
|
FirstObject = getFirstAdjustableObjectRecursive(beatmap.HitObjects);
|
||||||
|
|
||||||
|
HitObject getFirstAdjustableObjectRecursive(IReadOnlyList<HitObject> hitObjects)
|
||||||
|
{
|
||||||
|
foreach (var h in hitObjects)
|
||||||
|
{
|
||||||
|
if (IsFirstAdjustableObject(h))
|
||||||
|
return h;
|
||||||
|
|
||||||
|
var nestedResult = getFirstAdjustableObjectRecursive(h.NestedHitObjects);
|
||||||
|
if (nestedResult != null)
|
||||||
|
return nestedResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||||
|
{
|
||||||
|
foreach (var dho in drawables)
|
||||||
|
{
|
||||||
|
dho.ApplyCustomUpdateState += (o, state) =>
|
||||||
|
{
|
||||||
|
// Increased visibility is applied to the entire first object, including all of its nested hitobjects.
|
||||||
|
if (IncreaseFirstObjectVisibility.Value && isObjectEqualToOrNestedIn(o.HitObject, FirstObject))
|
||||||
|
ApplyIncreasedVisibilityState(o, state);
|
||||||
|
else
|
||||||
|
ApplyNormalVisibilityState(o, state);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks whether a given object is nested within a target.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="toCheck">The <see cref="HitObject"/> to check.</param>
|
||||||
|
/// <param name="target">The <see cref="HitObject"/> which may be equal to or contain <paramref name="toCheck"/> as a nested object.</param>
|
||||||
|
/// <returns>Whether <paramref name="toCheck"/> is equal to or nested within <paramref name="target"/>.</returns>
|
||||||
|
private bool isObjectEqualToOrNestedIn(HitObject toCheck, HitObject target)
|
||||||
|
{
|
||||||
|
if (target == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (toCheck == target)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
foreach (var h in target.NestedHitObjects)
|
||||||
|
{
|
||||||
|
if (isObjectEqualToOrNestedIn(toCheck, h))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -123,7 +123,7 @@ namespace osu.Game.Scoring
|
|||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[Column("UserID")]
|
[Column("UserID")]
|
||||||
public long? UserID
|
public int? UserID
|
||||||
{
|
{
|
||||||
get => User?.Id ?? 1;
|
get => User?.Id ?? 1;
|
||||||
set
|
set
|
||||||
|
@ -37,13 +37,13 @@ namespace osu.Game.Scoring
|
|||||||
private readonly Func<BeatmapManager> beatmaps;
|
private readonly Func<BeatmapManager> beatmaps;
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private readonly Func<BeatmapDifficultyManager> difficulties;
|
private readonly Func<BeatmapDifficultyCache> difficulties;
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private readonly OsuConfigManager configManager;
|
private readonly OsuConfigManager configManager;
|
||||||
|
|
||||||
public ScoreManager(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, IAPIProvider api, IDatabaseContextFactory contextFactory, IIpcHost importHost = null,
|
public ScoreManager(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, IAPIProvider api, IDatabaseContextFactory contextFactory, IIpcHost importHost = null,
|
||||||
Func<BeatmapDifficultyManager> difficulties = null, OsuConfigManager configManager = null)
|
Func<BeatmapDifficultyCache> difficulties = null, OsuConfigManager configManager = null)
|
||||||
: base(storage, contextFactory, api, new ScoreStore(contextFactory, storage), importHost)
|
: base(storage, contextFactory, api, new ScoreStore(contextFactory, storage), importHost)
|
||||||
{
|
{
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
@ -121,14 +121,14 @@ namespace osu.Game.Scoring
|
|||||||
public readonly Bindable<ScoringMode> ScoringMode = new Bindable<ScoringMode>();
|
public readonly Bindable<ScoringMode> ScoringMode = new Bindable<ScoringMode>();
|
||||||
|
|
||||||
private readonly ScoreInfo score;
|
private readonly ScoreInfo score;
|
||||||
private readonly Func<BeatmapDifficultyManager> difficulties;
|
private readonly Func<BeatmapDifficultyCache> difficulties;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="TotalScoreBindable"/>.
|
/// Creates a new <see cref="TotalScoreBindable"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="score">The <see cref="ScoreInfo"/> to provide the total score of.</param>
|
/// <param name="score">The <see cref="ScoreInfo"/> to provide the total score of.</param>
|
||||||
/// <param name="difficulties">A function to retrieve the <see cref="BeatmapDifficultyManager"/>.</param>
|
/// <param name="difficulties">A function to retrieve the <see cref="BeatmapDifficultyCache"/>.</param>
|
||||||
public TotalScoreBindable(ScoreInfo score, Func<BeatmapDifficultyManager> difficulties)
|
public TotalScoreBindable(ScoreInfo score, Func<BeatmapDifficultyCache> difficulties)
|
||||||
{
|
{
|
||||||
this.score = score;
|
this.score = score;
|
||||||
this.difficulties = difficulties;
|
this.difficulties = difficulties;
|
||||||
|
@ -2,27 +2,23 @@
|
|||||||
// 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;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Database;
|
||||||
|
|
||||||
namespace osu.Game.Scoring
|
namespace osu.Game.Scoring
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A global component which calculates and caches results of performance calculations for locally databased scores.
|
/// A component which performs and acts as a central cache for performance calculations of locally databased scores.
|
||||||
|
/// Currently not persisted between game sessions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ScorePerformanceManager : Component
|
public class ScorePerformanceCache : MemoryCachingComponent<ScorePerformanceCache.PerformanceCacheLookup, double>
|
||||||
{
|
{
|
||||||
// this cache will grow indefinitely per session and should be considered temporary.
|
|
||||||
// this whole component should likely be replaced with database persistence.
|
|
||||||
private readonly ConcurrentDictionary<PerformanceCacheLookup, double> performanceCache = new ConcurrentDictionary<PerformanceCacheLookup, double>();
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapDifficultyManager difficultyManager { get; set; }
|
private BeatmapDifficultyCache difficultyCache { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculates performance for the given <see cref="ScoreInfo"/>.
|
/// Calculates performance for the given <see cref="ScoreInfo"/>.
|
||||||
@ -33,7 +29,7 @@ namespace osu.Game.Scoring
|
|||||||
{
|
{
|
||||||
var lookupKey = new PerformanceCacheLookup(score);
|
var lookupKey = new PerformanceCacheLookup(score);
|
||||||
|
|
||||||
if (performanceCache.TryGetValue(lookupKey, out double performance))
|
if (Cache.TryGetValue(lookupKey, out double performance))
|
||||||
return Task.FromResult((double?)performance);
|
return Task.FromResult((double?)performance);
|
||||||
|
|
||||||
return computePerformanceAsync(score, lookupKey, token);
|
return computePerformanceAsync(score, lookupKey, token);
|
||||||
@ -41,7 +37,7 @@ namespace osu.Game.Scoring
|
|||||||
|
|
||||||
private async Task<double?> computePerformanceAsync(ScoreInfo score, PerformanceCacheLookup lookupKey, CancellationToken token = default)
|
private async Task<double?> computePerformanceAsync(ScoreInfo score, PerformanceCacheLookup lookupKey, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var attributes = await difficultyManager.GetDifficultyAsync(score.Beatmap, score.Ruleset, score.Mods, token);
|
var attributes = await difficultyCache.GetDifficultyAsync(score.Beatmap, score.Ruleset, score.Mods, token);
|
||||||
|
|
||||||
// Performance calculation requires the beatmap and ruleset to be locally available. If not, return a default value.
|
// Performance calculation requires the beatmap and ruleset to be locally available. If not, return a default value.
|
||||||
if (attributes.Attributes == null)
|
if (attributes.Attributes == null)
|
||||||
@ -53,7 +49,7 @@ namespace osu.Game.Scoring
|
|||||||
var total = calculator?.Calculate();
|
var total = calculator?.Calculate();
|
||||||
|
|
||||||
if (total.HasValue)
|
if (total.HasValue)
|
||||||
performanceCache[lookupKey] = total.Value;
|
Cache[lookupKey] = total.Value;
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
@ -182,7 +182,7 @@ namespace osu.Game.Screens.Play
|
|||||||
spectatorStreaming.OnUserFinishedPlaying += userFinishedPlaying;
|
spectatorStreaming.OnUserFinishedPlaying += userFinishedPlaying;
|
||||||
spectatorStreaming.OnNewFrames += userSentFrames;
|
spectatorStreaming.OnNewFrames += userSentFrames;
|
||||||
|
|
||||||
spectatorStreaming.WatchUser((int)targetUser.Id);
|
spectatorStreaming.WatchUser(targetUser.Id);
|
||||||
|
|
||||||
managerUpdated = beatmaps.ItemUpdated.GetBoundCopy();
|
managerUpdated = beatmaps.ItemUpdated.GetBoundCopy();
|
||||||
managerUpdated.BindValueChanged(beatmapUpdated);
|
managerUpdated.BindValueChanged(beatmapUpdated);
|
||||||
@ -353,7 +353,7 @@ namespace osu.Game.Screens.Play
|
|||||||
spectatorStreaming.OnUserFinishedPlaying -= userFinishedPlaying;
|
spectatorStreaming.OnUserFinishedPlaying -= userFinishedPlaying;
|
||||||
spectatorStreaming.OnNewFrames -= userSentFrames;
|
spectatorStreaming.OnNewFrames -= userSentFrames;
|
||||||
|
|
||||||
spectatorStreaming.StopWatchingUser((int)targetUser.Id);
|
spectatorStreaming.StopWatchingUser(targetUser.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
managerUpdated?.UnbindAll();
|
managerUpdated?.UnbindAll();
|
||||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(BeatmapDifficultyManager beatmapDifficultyManager)
|
private void load(BeatmapDifficultyCache beatmapDifficultyCache)
|
||||||
{
|
{
|
||||||
var beatmap = score.Beatmap;
|
var beatmap = score.Beatmap;
|
||||||
var metadata = beatmap.BeatmapSet?.Metadata ?? beatmap.Metadata;
|
var metadata = beatmap.BeatmapSet?.Metadata ?? beatmap.Metadata;
|
||||||
@ -143,7 +143,7 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
Spacing = new Vector2(5, 0),
|
Spacing = new Vector2(5, 0),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new StarRatingDisplay(beatmapDifficultyManager.GetDifficulty(beatmap, score.Ruleset, score.Mods))
|
new StarRatingDisplay(beatmapDifficultyCache.GetDifficulty(beatmap, score.Ruleset, score.Mods))
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft
|
Origin = Anchor.CentreLeft
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, BeatmapDifficultyManager difficultyManager)
|
private void load(OsuColour colours, BeatmapDifficultyCache difficultyCache)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ScorePerformanceManager performanceManager)
|
private void load(ScorePerformanceCache performanceCache)
|
||||||
{
|
{
|
||||||
if (score.PP.HasValue)
|
if (score.PP.HasValue)
|
||||||
{
|
{
|
||||||
@ -36,7 +36,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
performanceManager.CalculatePerformanceAsync(score, cancellationTokenSource.Token)
|
performanceCache.CalculatePerformanceAsync(score, cancellationTokenSource.Token)
|
||||||
.ContinueWith(t => Schedule(() => setPerformanceValue(t.Result)), cancellationTokenSource.Token);
|
.ContinueWith(t => Schedule(() => setPerformanceValue(t.Result)), cancellationTokenSource.Token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Screens.Select
|
|||||||
private readonly IBindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
private readonly IBindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapDifficultyManager difficultyManager { get; set; }
|
private BeatmapDifficultyCache difficultyCache { get; set; }
|
||||||
|
|
||||||
private IBindable<StarDifficulty> beatmapDifficulty;
|
private IBindable<StarDifficulty> beatmapDifficulty;
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ namespace osu.Game.Screens.Select
|
|||||||
cancellationSource = new CancellationTokenSource();
|
cancellationSource = new CancellationTokenSource();
|
||||||
|
|
||||||
beatmapDifficulty?.UnbindAll();
|
beatmapDifficulty?.UnbindAll();
|
||||||
beatmapDifficulty = difficultyManager.GetBindableDifficulty(beatmap.BeatmapInfo, cancellationSource.Token);
|
beatmapDifficulty = difficultyCache.GetBindableDifficulty(beatmap.BeatmapInfo, cancellationSource.Token);
|
||||||
beatmapDifficulty.BindValueChanged(_ => updateDisplay());
|
beatmapDifficulty.BindValueChanged(_ => updateDisplay());
|
||||||
|
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
|
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
private BeatmapSetOverlay beatmapOverlay { get; set; }
|
private BeatmapSetOverlay beatmapOverlay { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapDifficultyManager difficultyManager { get; set; }
|
private BeatmapDifficultyCache difficultyCache { get; set; }
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private CollectionManager collectionManager { get; set; }
|
private CollectionManager collectionManager { get; set; }
|
||||||
@ -216,7 +216,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
if (Item.State.Value != CarouselItemState.Collapsed)
|
if (Item.State.Value != CarouselItemState.Collapsed)
|
||||||
{
|
{
|
||||||
// We've potentially cancelled the computation above so a new bindable is required.
|
// We've potentially cancelled the computation above so a new bindable is required.
|
||||||
starDifficultyBindable = difficultyManager.GetBindableDifficulty(beatmap, (starDifficultyCancellationSource = new CancellationTokenSource()).Token);
|
starDifficultyBindable = difficultyCache.GetBindableDifficulty(beatmap, (starDifficultyCancellationSource = new CancellationTokenSource()).Token);
|
||||||
starDifficultyBindable.BindValueChanged(d => starCounter.Current = (float)d.NewValue.Stars, true);
|
starDifficultyBindable.BindValueChanged(d => starCounter.Current = (float)d.NewValue.Stars, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapDifficultyManager difficultyManager { get; set; }
|
private BeatmapDifficultyCache difficultyCache { get; set; }
|
||||||
|
|
||||||
protected readonly StatisticRow FirstValue, HpDrain, Accuracy, ApproachRate;
|
protected readonly StatisticRow FirstValue, HpDrain, Accuracy, ApproachRate;
|
||||||
private readonly StatisticRow starDifficulty;
|
private readonly StatisticRow starDifficulty;
|
||||||
@ -161,8 +161,8 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
|
|
||||||
starDifficultyCancellationSource = new CancellationTokenSource();
|
starDifficultyCancellationSource = new CancellationTokenSource();
|
||||||
|
|
||||||
normalStarDifficulty = difficultyManager.GetBindableDifficulty(Beatmap, ruleset.Value, null, starDifficultyCancellationSource.Token);
|
normalStarDifficulty = difficultyCache.GetBindableDifficulty(Beatmap, ruleset.Value, null, starDifficultyCancellationSource.Token);
|
||||||
moddedStarDifficulty = difficultyManager.GetBindableDifficulty(Beatmap, ruleset.Value, mods.Value, starDifficultyCancellationSource.Token);
|
moddedStarDifficulty = difficultyCache.GetBindableDifficulty(Beatmap, ruleset.Value, mods.Value, starDifficultyCancellationSource.Token);
|
||||||
|
|
||||||
normalStarDifficulty.BindValueChanged(_ => updateDisplay());
|
normalStarDifficulty.BindValueChanged(_ => updateDisplay());
|
||||||
moddedStarDifficulty.BindValueChanged(_ => updateDisplay(), true);
|
moddedStarDifficulty.BindValueChanged(_ => updateDisplay(), true);
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Users
|
|||||||
public class User : IEquatable<User>
|
public class User : IEquatable<User>
|
||||||
{
|
{
|
||||||
[JsonProperty(@"id")]
|
[JsonProperty(@"id")]
|
||||||
public long Id = 1;
|
public int Id = 1;
|
||||||
|
|
||||||
[JsonProperty(@"join_date")]
|
[JsonProperty(@"join_date")]
|
||||||
public DateTimeOffset JoinDate;
|
public DateTimeOffset JoinDate;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2020.1029.1" />
|
<PackageReference Include="ppy.osu.Framework" Version="2020.1105.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1030.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1030.0" />
|
||||||
<PackageReference Include="Sentry" Version="2.1.6" />
|
<PackageReference Include="Sentry" Version="2.1.6" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.1029.1" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.1105.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1030.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1030.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
||||||
@ -88,7 +88,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2020.1029.1" />
|
<PackageReference Include="ppy.osu.Framework" Version="2020.1105.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user