mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 19:22:54 +08:00
Merge branch 'master' into generic-download-model-manager
This commit is contained in:
commit
d65c20bbdc
@ -43,10 +43,13 @@ namespace osu.Game.Rulesets.Catch.Replays
|
||||
float positionChange = Math.Abs(lastPosition - h.X);
|
||||
double timeAvailable = h.StartTime - lastTime;
|
||||
|
||||
//So we can either make it there without a dash or not.
|
||||
double speedRequired = positionChange / timeAvailable;
|
||||
// So we can either make it there without a dash or not.
|
||||
// If positionChange is 0, we don't need to move, so speedRequired should also be 0 (could be NaN if timeAvailable is 0 too)
|
||||
// The case where positionChange > 0 and timeAvailable == 0 results in PositiveInfinity which provides expected beheaviour.
|
||||
double speedRequired = positionChange == 0 ? 0 : positionChange / timeAvailable;
|
||||
|
||||
bool dashRequired = speedRequired > movement_speed && h.StartTime != 0;
|
||||
bool dashRequired = speedRequired > movement_speed;
|
||||
bool impossibleJump = speedRequired > movement_speed * 2;
|
||||
|
||||
// todo: get correct catcher size, based on difficulty CS.
|
||||
const float catcher_width_half = CatcherArea.CATCHER_SIZE / CatchPlayfield.BASE_WIDTH * 0.3f * 0.5f;
|
||||
@ -59,9 +62,8 @@ namespace osu.Game.Rulesets.Catch.Replays
|
||||
return;
|
||||
}
|
||||
|
||||
if (h is Banana)
|
||||
if (impossibleJump)
|
||||
{
|
||||
// auto bananas unrealistically warp to catch 100% combo.
|
||||
Replay.Frames.Add(new CatchReplayFrame(h.StartTime, h.X));
|
||||
}
|
||||
else if (h.HyperDash)
|
||||
|
@ -41,6 +41,9 @@ namespace osu.Game.Tests.Visual.Online
|
||||
typeof(SuccessRate),
|
||||
};
|
||||
|
||||
private RulesetInfo maniaRuleset;
|
||||
private RulesetInfo taikoRuleset;
|
||||
|
||||
public TestSceneBeatmapSetOverlay()
|
||||
{
|
||||
Add(overlay = new BeatmapSetOverlay());
|
||||
@ -49,13 +52,25 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore rulesets)
|
||||
{
|
||||
var mania = rulesets.GetRuleset(3);
|
||||
var taiko = rulesets.GetRuleset(1);
|
||||
maniaRuleset = rulesets.GetRuleset(3);
|
||||
taikoRuleset = rulesets.GetRuleset(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLoading()
|
||||
{
|
||||
AddStep(@"show loading", () => overlay.ShowBeatmapSet(null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOnline()
|
||||
{
|
||||
AddStep(@"show online", () => overlay.FetchAndShowBeatmapSet(55));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLocalBeatmaps()
|
||||
{
|
||||
AddStep(@"show first", () =>
|
||||
{
|
||||
overlay.ShowBeatmapSet(new BeatmapSetInfo
|
||||
@ -87,13 +102,14 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Cover = @"https://assets.ppy.sh/beatmaps/415886/covers/cover.jpg?1465651778",
|
||||
},
|
||||
},
|
||||
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() },
|
||||
Beatmaps = new List<BeatmapInfo>
|
||||
{
|
||||
new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 1.36,
|
||||
Version = @"BASIC",
|
||||
Ruleset = mania,
|
||||
Ruleset = maniaRuleset,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 4,
|
||||
@ -111,16 +127,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 2.22,
|
||||
Version = @"NOVICE",
|
||||
Ruleset = mania,
|
||||
Ruleset = maniaRuleset,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 4,
|
||||
@ -138,16 +153,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 3.49,
|
||||
Version = @"ADVANCED",
|
||||
Ruleset = mania,
|
||||
Ruleset = maniaRuleset,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 4,
|
||||
@ -165,16 +179,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 4.24,
|
||||
Version = @"EXHAUST",
|
||||
Ruleset = mania,
|
||||
Ruleset = maniaRuleset,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 4,
|
||||
@ -192,16 +205,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 5.26,
|
||||
Version = @"GRAVITY",
|
||||
Ruleset = mania,
|
||||
Ruleset = maniaRuleset,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 4,
|
||||
@ -219,9 +231,8 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -258,13 +269,14 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Cover = @"https://assets.ppy.sh/beatmaps/625493/covers/cover.jpg?1499167472",
|
||||
},
|
||||
},
|
||||
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() },
|
||||
Beatmaps = new List<BeatmapInfo>
|
||||
{
|
||||
new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 1.40,
|
||||
Version = @"yzrin's Kantan",
|
||||
Ruleset = taiko,
|
||||
Ruleset = taikoRuleset,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 2,
|
||||
@ -282,16 +294,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 2.23,
|
||||
Version = @"Futsuu",
|
||||
Ruleset = taiko,
|
||||
Ruleset = taikoRuleset,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 2,
|
||||
@ -309,16 +320,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 3.19,
|
||||
Version = @"Muzukashii",
|
||||
Ruleset = taiko,
|
||||
Ruleset = taikoRuleset,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 2,
|
||||
@ -336,16 +346,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 3.97,
|
||||
Version = @"Charlotte's Oni",
|
||||
Ruleset = taiko,
|
||||
Ruleset = taikoRuleset,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 5,
|
||||
@ -363,16 +372,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 5.08,
|
||||
Version = @"Labyrinth Oni",
|
||||
Ruleset = taiko,
|
||||
Ruleset = taikoRuleset,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 5,
|
||||
@ -390,16 +398,24 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHide()
|
||||
{
|
||||
AddStep(@"hide", overlay.Hide);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestShowWithNoReload()
|
||||
{
|
||||
AddStep(@"show without reload", overlay.Show);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,69 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Overlays.BeatmapSet;
|
||||
using osu.Game.Screens.Select.Details;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneBeatmapSetOverlayDetails : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(Details)
|
||||
};
|
||||
|
||||
private RatingsExposingDetails details;
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
Child = details = new RatingsExposingDetails
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
};
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestMetrics()
|
||||
{
|
||||
var firstSet = createSet();
|
||||
var secondSet = createSet();
|
||||
|
||||
AddStep("set first set", () => details.BeatmapSet = firstSet);
|
||||
AddAssert("ratings set", () => details.Ratings.Metrics == firstSet.Metrics);
|
||||
|
||||
AddStep("set second set", () => details.BeatmapSet = secondSet);
|
||||
AddAssert("ratings set", () => details.Ratings.Metrics == secondSet.Metrics);
|
||||
|
||||
BeatmapSetInfo createSet() => new BeatmapSetInfo
|
||||
{
|
||||
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).Select(_ => RNG.Next(10)).ToArray() },
|
||||
Beatmaps = new List<BeatmapInfo>
|
||||
{
|
||||
new BeatmapInfo
|
||||
{
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(_ => RNG.Next(10)).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(_ => RNG.Next(10)).ToArray(),
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private class RatingsExposingDetails : Details
|
||||
{
|
||||
public new UserRatings Ratings => base.Ratings;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Overlays.BeatmapSet;
|
||||
using osu.Game.Screens.Select.Details;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneBeatmapSetOverlaySuccessRate : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(Details)
|
||||
};
|
||||
|
||||
private GraphExposingSuccessRate successRate;
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
Child = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(275, 220),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Gray,
|
||||
},
|
||||
successRate = new GraphExposingSuccessRate
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(275, 220),
|
||||
Padding = new MarginPadding(20)
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestMetrics()
|
||||
{
|
||||
var firstBeatmap = createBeatmap();
|
||||
var secondBeatmap = createBeatmap();
|
||||
|
||||
AddStep("set first set", () => successRate.Beatmap = firstBeatmap);
|
||||
AddAssert("ratings set", () => successRate.Graph.Metrics == firstBeatmap.Metrics);
|
||||
|
||||
AddStep("set second set", () => successRate.Beatmap = secondBeatmap);
|
||||
AddAssert("ratings set", () => successRate.Graph.Metrics == secondBeatmap.Metrics);
|
||||
|
||||
BeatmapInfo createBeatmap() => new BeatmapInfo
|
||||
{
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(_ => RNG.Next(10)).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(_ => RNG.Next(10)).ToArray(),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private class GraphExposingSuccessRate : SuccessRate
|
||||
{
|
||||
public new FailRetryGraph Graph => base.Graph;
|
||||
}
|
||||
}
|
||||
}
|
@ -32,6 +32,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
||||
{
|
||||
BeatmapSetInfo =
|
||||
{
|
||||
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||
},
|
||||
BeatmapInfo =
|
||||
{
|
||||
Version = "All Metrics",
|
||||
@ -50,9 +54,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
StarDifficulty = 5.3f,
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -60,6 +63,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
||||
{
|
||||
BeatmapSetInfo =
|
||||
{
|
||||
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||
},
|
||||
BeatmapInfo =
|
||||
{
|
||||
Version = "All Metrics",
|
||||
@ -77,15 +84,18 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
StarDifficulty = 5.3f,
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
||||
{
|
||||
BeatmapSetInfo =
|
||||
{
|
||||
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||
},
|
||||
BeatmapInfo =
|
||||
{
|
||||
Version = "Only Ratings",
|
||||
@ -101,11 +111,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
OverallDifficulty = 6,
|
||||
ApproachRate = 6,
|
||||
},
|
||||
StarDifficulty = 4.8f,
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
},
|
||||
StarDifficulty = 4.8f
|
||||
}
|
||||
});
|
||||
|
||||
@ -129,8 +135,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
StarDifficulty = 2.91f,
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
}
|
||||
});
|
||||
|
@ -1,28 +1,38 @@
|
||||
// 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.ComponentModel;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Screens.Select;
|
||||
|
||||
namespace osu.Game.Tests.Visual.SongSelect
|
||||
{
|
||||
[Description("PlaySongSelect beatmap details")]
|
||||
[System.ComponentModel.Description("PlaySongSelect beatmap details")]
|
||||
public class TestSceneBeatmapDetails : OsuTestScene
|
||||
{
|
||||
public TestSceneBeatmapDetails()
|
||||
private BeatmapDetails details;
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
BeatmapDetails details;
|
||||
Add(details = new BeatmapDetails
|
||||
Child = details = new BeatmapDetails
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding(150),
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestAllMetrics()
|
||||
{
|
||||
AddStep("all metrics", () => details.Beatmap = new BeatmapInfo
|
||||
{
|
||||
BeatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||
},
|
||||
Version = "All Metrics",
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
@ -39,14 +49,21 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
StarDifficulty = 5.3f,
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAllMetricsExceptSource()
|
||||
{
|
||||
AddStep("all except source", () => details.Beatmap = new BeatmapInfo
|
||||
{
|
||||
BeatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||
},
|
||||
Version = "All Metrics",
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
@ -62,14 +79,21 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
StarDifficulty = 5.3f,
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOnlyRatings()
|
||||
{
|
||||
AddStep("ratings", () => details.Beatmap = new BeatmapInfo
|
||||
{
|
||||
BeatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||
},
|
||||
Version = "Only Ratings",
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
@ -84,12 +108,12 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
ApproachRate = 6,
|
||||
},
|
||||
StarDifficulty = 4.8f,
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOnlyFailsAndRetries()
|
||||
{
|
||||
AddStep("fails retries", () => details.Beatmap = new BeatmapInfo
|
||||
{
|
||||
Version = "Only Retries and Fails",
|
||||
@ -108,11 +132,15 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
StarDifficulty = 2.91f,
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNoMetrics()
|
||||
{
|
||||
AddStep("no metrics", () => details.Beatmap = new BeatmapInfo
|
||||
{
|
||||
Version = "No Metrics",
|
||||
@ -129,10 +157,22 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
ApproachRate = 6.5f,
|
||||
},
|
||||
StarDifficulty = 1.97f,
|
||||
Metrics = new BeatmapMetrics(),
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNullBeatmap()
|
||||
{
|
||||
AddStep("null beatmap", () => details.Beatmap = null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOnlineMetrics()
|
||||
{
|
||||
AddStep("online ratings/retries/fails", () => details.Beatmap = new BeatmapInfo
|
||||
{
|
||||
OnlineBeatmapID = 162,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -270,9 +270,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
},
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -214,37 +214,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("start not requested", () => !startRequested);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddNewBeatmapWhileSelectingRandom()
|
||||
{
|
||||
const int test_count = 10;
|
||||
int beatmapChangedCount = 0;
|
||||
int debounceCount = 0;
|
||||
createSongSelect();
|
||||
AddStep("Setup counters", () =>
|
||||
{
|
||||
beatmapChangedCount = 0;
|
||||
debounceCount = 0;
|
||||
songSelect.Carousel.SelectionChanged += _ => beatmapChangedCount++;
|
||||
});
|
||||
AddRepeatStep($"Create beatmaps {test_count} times", () =>
|
||||
{
|
||||
importForRuleset(0);
|
||||
|
||||
Scheduler.AddDelayed(() =>
|
||||
{
|
||||
// Wait for debounce
|
||||
songSelect.Carousel.SelectNextRandom();
|
||||
++debounceCount;
|
||||
}, 400);
|
||||
}, test_count);
|
||||
|
||||
AddUntilStep("Debounce limit reached", () => debounceCount == test_count);
|
||||
|
||||
// The selected beatmap should have changed an additional 2 times since both initially loading songselect and the first import also triggers selectionChanged
|
||||
AddAssert($"Beatmap changed {test_count + 2} times", () => beatmapChangedCount == test_count + 2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHideSetSelectsCorrectBeatmap()
|
||||
{
|
||||
|
@ -1,31 +1,26 @@
|
||||
// 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 System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Beatmap metrics based on acculumated online data from community plays.
|
||||
/// Beatmap metrics based on accumulated online data from community plays.
|
||||
/// </summary>
|
||||
public class BeatmapMetrics
|
||||
{
|
||||
/// <summary>
|
||||
/// Total vote counts of user ratings on a scale of 0..10 where 0 is unused (probably will be fixed at API?).
|
||||
/// </summary>
|
||||
public IEnumerable<int> Ratings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Points of failure on a relative time scale (usually 0..100).
|
||||
/// </summary>
|
||||
[JsonProperty(@"fail")]
|
||||
public IEnumerable<int> Fails { get; set; }
|
||||
public int[] Fails { get; set; } = Array.Empty<int>();
|
||||
|
||||
/// <summary>
|
||||
/// Points of retry on a relative time scale (usually 0..100).
|
||||
/// </summary>
|
||||
[JsonProperty(@"exit")]
|
||||
public IEnumerable<int> Retries { get; set; }
|
||||
public int[] Retries { get; set; } = Array.Empty<int>();
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,9 @@ namespace osu.Game.Beatmaps
|
||||
[NotMapped]
|
||||
public BeatmapSetOnlineInfo OnlineInfo { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public BeatmapSetMetrics Metrics { get; set; }
|
||||
|
||||
public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarDifficulty) ?? 0;
|
||||
|
||||
[NotMapped]
|
||||
|
17
osu.Game/Beatmaps/BeatmapSetMetrics.cs
Normal file
17
osu.Game/Beatmaps/BeatmapSetMetrics.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;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
public class BeatmapSetMetrics
|
||||
{
|
||||
/// <summary>
|
||||
/// Total vote counts of user ratings on a scale of 0..10 where 0 is unused (probably will be fixed at API?).
|
||||
/// </summary>
|
||||
[JsonProperty("ratings")]
|
||||
public int[] Ratings { get; set; } = Array.Empty<int>();
|
||||
}
|
||||
}
|
@ -17,11 +17,11 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// <summary>
|
||||
/// A button with added default sound effects.
|
||||
/// </summary>
|
||||
public abstract class OsuButton : Button
|
||||
public class OsuButton : Button
|
||||
{
|
||||
private Box hover;
|
||||
|
||||
protected OsuButton()
|
||||
public OsuButton()
|
||||
{
|
||||
Height = 40;
|
||||
|
||||
|
@ -262,8 +262,9 @@ namespace osu.Game.Online.API
|
||||
handleWebException(we);
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex, "Error occurred while handling an API request.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,18 @@ namespace osu.Game.Online.API
|
||||
{
|
||||
private string filename;
|
||||
|
||||
/// <summary>
|
||||
/// Used to set the extension of the file returned by this request.
|
||||
/// </summary>
|
||||
protected virtual string FileExtension { get; } = @".tmp";
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
var request = new FileWebRequest(filename = Path.GetTempFileName(), Uri);
|
||||
var file = Path.GetTempFileName();
|
||||
|
||||
File.Move(file, filename = Path.ChangeExtension(file, FileExtension));
|
||||
|
||||
var request = new FileWebRequest(filename, Uri);
|
||||
request.DownloadProgress += request_Progress;
|
||||
return request;
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetBeatmapDetailsRequest : APIRequest<APIBeatmapMetrics>
|
||||
{
|
||||
private readonly BeatmapInfo beatmap;
|
||||
|
||||
public GetBeatmapDetailsRequest(BeatmapInfo beatmap)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
}
|
||||
|
||||
protected override string Target => $@"beatmaps/{beatmap.OnlineBeatmapID}";
|
||||
}
|
||||
}
|
@ -57,6 +57,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty(@"version")]
|
||||
private string version { get; set; }
|
||||
|
||||
[JsonProperty(@"failtimes")]
|
||||
private BeatmapMetrics metrics { get; set; }
|
||||
|
||||
public BeatmapInfo ToBeatmap(RulesetStore rulesets)
|
||||
{
|
||||
var set = BeatmapSet?.ToBeatmapSet(rulesets);
|
||||
@ -70,6 +73,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
Version = version,
|
||||
Status = Status,
|
||||
BeatmapSet = set,
|
||||
Metrics = metrics,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
DrainRate = drainRate,
|
||||
|
@ -1,29 +0,0 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Beatmaps;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
public class APIBeatmapMetrics : BeatmapMetrics
|
||||
{
|
||||
//the online API returns some metrics as a nested object.
|
||||
[JsonProperty(@"failtimes")]
|
||||
private BeatmapMetrics failTimes
|
||||
{
|
||||
set
|
||||
{
|
||||
Fails = value.Fails;
|
||||
Retries = value.Retries;
|
||||
}
|
||||
}
|
||||
|
||||
//and other metrics in the beatmap set.
|
||||
[JsonProperty(@"beatmapset")]
|
||||
private BeatmapMetrics beatmapSet
|
||||
{
|
||||
set => Ratings = value.Ratings;
|
||||
}
|
||||
}
|
||||
}
|
@ -54,6 +54,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty(@"last_updated")]
|
||||
private DateTimeOffset lastUpdated { get; set; }
|
||||
|
||||
[JsonProperty(@"ratings")]
|
||||
private int[] ratings { get; set; }
|
||||
|
||||
[JsonProperty(@"user_id")]
|
||||
private long creatorId
|
||||
{
|
||||
@ -70,6 +73,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
OnlineBeatmapSetID = OnlineBeatmapSetID,
|
||||
Metadata = this,
|
||||
Status = Status,
|
||||
Metrics = ratings == null ? null : new BeatmapSetMetrics { Ratings = ratings },
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
Covers = covers,
|
||||
|
@ -31,9 +31,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
public List<APIChangelogEntry> ChangelogEntries { get; set; }
|
||||
|
||||
[JsonProperty("versions")]
|
||||
public VersionNatigation Versions { get; set; }
|
||||
public VersionNavigation Versions { get; set; }
|
||||
|
||||
public class VersionNatigation
|
||||
public class VersionNavigation
|
||||
{
|
||||
[JsonProperty("next")]
|
||||
public APIChangelogBuild Next { get; set; }
|
||||
|
@ -30,7 +30,10 @@ namespace osu.Game.Online.API.Requests
|
||||
req.ContentType = "application/json";
|
||||
req.Method = HttpMethod.Put;
|
||||
|
||||
req.AddRaw(JsonConvert.SerializeObject(scoreInfo));
|
||||
req.AddRaw(JsonConvert.SerializeObject(scoreInfo, new JsonSerializerSettings
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||
}));
|
||||
|
||||
return req;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ namespace osu.Game
|
||||
configSkin.ValueChanged += skinId => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == skinId.NewValue) ?? SkinInfo.Default;
|
||||
configSkin.TriggerChange();
|
||||
|
||||
LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust);
|
||||
LocalConfig.BindWith(OsuSetting.VolumeInactive, userInactiveVolume);
|
||||
|
||||
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
|
||||
}
|
||||
@ -686,16 +686,28 @@ namespace osu.Game
|
||||
return false;
|
||||
}
|
||||
|
||||
private readonly BindableDouble inactiveVolumeAdjust = new BindableDouble();
|
||||
#region Inactive audio dimming
|
||||
|
||||
private readonly BindableDouble userInactiveVolume = new BindableDouble();
|
||||
|
||||
private readonly BindableDouble inactiveVolumeFade = new BindableDouble();
|
||||
|
||||
private void updateActiveState(bool isActive)
|
||||
{
|
||||
if (isActive)
|
||||
Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolumeAdjust);
|
||||
{
|
||||
this.TransformBindableTo(inactiveVolumeFade, 1, 500, Easing.OutQuint)
|
||||
.Finally(_ => Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolumeFade)); //wait for the transition to finish to remove the inactive audio adjustment
|
||||
}
|
||||
else
|
||||
Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeAdjust);
|
||||
{
|
||||
Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade);
|
||||
this.TransformBindableTo(inactiveVolumeFade, userInactiveVolume.Value, 1500, Easing.OutSine);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public bool OnReleased(GlobalAction action) => false;
|
||||
|
||||
private Container overlayContent;
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
private void updateDisplay()
|
||||
{
|
||||
bpm.Value = BeatmapSet?.OnlineInfo.BPM.ToString(@"0.##") ?? "-";
|
||||
bpm.Value = BeatmapSet?.OnlineInfo?.BPM.ToString(@"0.##") ?? "-";
|
||||
|
||||
if (beatmap == null)
|
||||
{
|
||||
|
@ -16,10 +16,11 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public class Details : FillFlowContainer
|
||||
{
|
||||
protected readonly UserRatings Ratings;
|
||||
|
||||
private readonly PreviewButton preview;
|
||||
private readonly BasicStats basic;
|
||||
private readonly AdvancedStats advanced;
|
||||
private readonly UserRatings ratings;
|
||||
|
||||
private BeatmapSetInfo beatmapSet;
|
||||
|
||||
@ -33,6 +34,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
beatmapSet = value;
|
||||
|
||||
basic.BeatmapSet = preview.BeatmapSet = BeatmapSet;
|
||||
updateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,13 +48,12 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
if (value == beatmap) return;
|
||||
|
||||
basic.Beatmap = advanced.Beatmap = beatmap = value;
|
||||
updateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDisplay()
|
||||
{
|
||||
ratings.Metrics = Beatmap?.Metrics;
|
||||
Ratings.Metrics = BeatmapSet?.Metrics;
|
||||
}
|
||||
|
||||
public Details()
|
||||
@ -87,7 +88,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
},
|
||||
new DetailBox
|
||||
{
|
||||
Child = ratings = new UserRatings
|
||||
Child = Ratings = new UserRatings
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 95,
|
||||
|
@ -14,11 +14,12 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public class SuccessRate : Container
|
||||
{
|
||||
protected readonly FailRetryGraph Graph;
|
||||
|
||||
private readonly FillFlowContainer header;
|
||||
private readonly OsuSpriteText successRateLabel, successPercent, graphLabel;
|
||||
private readonly Bar successRate;
|
||||
private readonly Container percentContainer;
|
||||
private readonly FailRetryGraph graph;
|
||||
|
||||
private BeatmapInfo beatmap;
|
||||
|
||||
@ -37,15 +38,15 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
private void updateDisplay()
|
||||
{
|
||||
int passCount = beatmap?.OnlineInfo.PassCount ?? 0;
|
||||
int playCount = beatmap?.OnlineInfo.PlayCount ?? 0;
|
||||
int passCount = beatmap?.OnlineInfo?.PassCount ?? 0;
|
||||
int playCount = beatmap?.OnlineInfo?.PlayCount ?? 0;
|
||||
|
||||
var rate = playCount != 0 ? (float)passCount / playCount : 0;
|
||||
successPercent.Text = rate.ToString("P0");
|
||||
successRate.Length = rate;
|
||||
percentContainer.ResizeWidthTo(successRate.Length, 250, Easing.InOutCubic);
|
||||
|
||||
graph.Metrics = beatmap?.Metrics;
|
||||
Graph.Metrics = beatmap?.Metrics;
|
||||
}
|
||||
|
||||
public SuccessRate()
|
||||
@ -94,7 +95,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
},
|
||||
},
|
||||
},
|
||||
graph = new FailRetryGraph
|
||||
Graph = new FailRetryGraph
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
@ -117,7 +118,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
graph.Padding = new MarginPadding { Top = header.DrawHeight };
|
||||
Graph.Padding = new MarginPadding { Top = header.DrawHeight };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,12 +36,11 @@ namespace osu.Game.Screens.Edit.Components
|
||||
playButton = new IconButton
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Scale = new Vector2(1.4f),
|
||||
IconScale = new Vector2(1.4f),
|
||||
Icon = FontAwesome.Regular.PlayCircle,
|
||||
Action = togglePause,
|
||||
Padding = new MarginPadding { Left = 20 }
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using System.Linq;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
@ -18,6 +17,8 @@ using osu.Game.Screens.Select.Details;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -40,6 +41,9 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private ScheduledDelegate pendingBeatmapSwitch;
|
||||
|
||||
[Resolved]
|
||||
private RulesetStore rulesets { get; set; }
|
||||
|
||||
private BeatmapInfo beatmap;
|
||||
|
||||
public BeatmapInfo Beatmap
|
||||
@ -181,57 +185,79 @@ namespace osu.Game.Screens.Select
|
||||
tags.Text = Beatmap?.Metadata?.Tags;
|
||||
|
||||
// metrics may have been previously fetched
|
||||
if (Beatmap?.Metrics != null)
|
||||
if (Beatmap?.BeatmapSet?.Metrics != null && Beatmap?.Metrics != null)
|
||||
{
|
||||
updateMetrics(Beatmap.Metrics);
|
||||
updateMetrics();
|
||||
return;
|
||||
}
|
||||
|
||||
// metrics may not be fetched but can be
|
||||
if (Beatmap?.OnlineBeatmapID != null)
|
||||
// for now, let's early abort if an OnlineBeatmapID is not present (should have been populated at import time).
|
||||
if (Beatmap?.OnlineBeatmapID == null)
|
||||
{
|
||||
var requestedBeatmap = Beatmap;
|
||||
var lookup = new GetBeatmapDetailsRequest(requestedBeatmap);
|
||||
lookup.Success += res =>
|
||||
updateMetrics();
|
||||
return;
|
||||
}
|
||||
|
||||
var requestedBeatmap = Beatmap;
|
||||
|
||||
var lookup = new GetBeatmapRequest(requestedBeatmap);
|
||||
|
||||
lookup.Success += res =>
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
if (beatmap != requestedBeatmap)
|
||||
//the beatmap has been changed since we started the lookup.
|
||||
return;
|
||||
|
||||
requestedBeatmap.Metrics = res;
|
||||
Schedule(() => updateMetrics(res));
|
||||
};
|
||||
lookup.Failure += e => Schedule(() => updateMetrics());
|
||||
api.Queue(lookup);
|
||||
loading.Show();
|
||||
return;
|
||||
}
|
||||
var b = res.ToBeatmap(rulesets);
|
||||
|
||||
updateMetrics();
|
||||
if (requestedBeatmap.BeatmapSet == null)
|
||||
requestedBeatmap.BeatmapSet = b.BeatmapSet;
|
||||
else
|
||||
requestedBeatmap.BeatmapSet.Metrics = b.BeatmapSet.Metrics;
|
||||
|
||||
requestedBeatmap.Metrics = b.Metrics;
|
||||
|
||||
updateMetrics();
|
||||
});
|
||||
};
|
||||
|
||||
lookup.Failure += e =>
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
if (beatmap != requestedBeatmap)
|
||||
//the beatmap has been changed since we started the lookup.
|
||||
return;
|
||||
|
||||
updateMetrics();
|
||||
});
|
||||
};
|
||||
|
||||
api.Queue(lookup);
|
||||
loading.Show();
|
||||
}
|
||||
|
||||
private void updateMetrics(BeatmapMetrics metrics = null)
|
||||
private void updateMetrics()
|
||||
{
|
||||
var hasRatings = metrics?.Ratings?.Any() ?? false;
|
||||
var hasRetriesFails = (metrics?.Retries?.Any() ?? false) && (metrics.Fails?.Any() ?? false);
|
||||
var hasRatings = beatmap?.BeatmapSet?.Metrics?.Ratings?.Any() ?? false;
|
||||
var hasRetriesFails = (beatmap?.Metrics?.Retries?.Any() ?? false) && (beatmap?.Metrics.Fails?.Any() ?? false);
|
||||
|
||||
if (hasRatings)
|
||||
{
|
||||
ratings.Metrics = metrics;
|
||||
ratings.Metrics = beatmap.BeatmapSet.Metrics;
|
||||
ratingsContainer.FadeIn(transition_duration);
|
||||
}
|
||||
else
|
||||
{
|
||||
ratings.Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = new int[10],
|
||||
};
|
||||
ratings.Metrics = new BeatmapSetMetrics { Ratings = new int[10] };
|
||||
ratingsContainer.FadeTo(0.25f, transition_duration);
|
||||
}
|
||||
|
||||
if (hasRetriesFails)
|
||||
{
|
||||
failRetryGraph.Metrics = metrics;
|
||||
failRetryGraph.Metrics = beatmap.Metrics;
|
||||
failRetryContainer.FadeIn(transition_duration);
|
||||
}
|
||||
else
|
||||
|
@ -20,9 +20,9 @@ namespace osu.Game.Screens.Select.Details
|
||||
private readonly Container graphContainer;
|
||||
private readonly BarGraph graph;
|
||||
|
||||
private BeatmapMetrics metrics;
|
||||
private BeatmapSetMetrics metrics;
|
||||
|
||||
public BeatmapMetrics Metrics
|
||||
public BeatmapSetMetrics Metrics
|
||||
{
|
||||
get => metrics;
|
||||
set
|
||||
|
@ -15,7 +15,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.614.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.615.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.23.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
@ -105,8 +105,8 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.614.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.614.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.615.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.615.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user