Merge branch 'master' into custom-data-directory

This commit is contained in:
Dean Herbert 2020-05-08 10:05:11 +09:00 committed by GitHub
commit abb32b3256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 378 additions and 154 deletions

View File

@ -16,9 +16,9 @@
<EmbeddedResource Include="Resources\**\*.*" /> <EmbeddedResource Include="Resources\**\*.*" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Code Analysis"> <ItemGroup Label="Code Analysis">
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="2.9.8" PrivateAssets="All" /> <PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.0.0" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CodeAnalysis\BannedSymbols.txt" /> <AdditionalFiles Include="$(MSBuildThisFileDirectory)CodeAnalysis\BannedSymbols.txt" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" /> <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Code Analysis"> <PropertyGroup Label="Code Analysis">
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodeAnalysis\osu.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodeAnalysis\osu.ruleset</CodeAnalysisRuleSet>

View File

@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{ {
protected override string ResourceAssembly => "osu.Game.Rulesets.Catch"; protected override string ResourceAssembly => "osu.Game.Rulesets.Catch";
[TestCase(4.2058561036909863d, "diffcalc-test")] [TestCase(4.050601681491468d, "diffcalc-test")]
public void Test(double expected, string name) public void Test(double expected, string name)
=> base.Test(expected, name); => base.Test(expected, name);

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
{ {
public class CatchDifficultyCalculator : DifficultyCalculator public class CatchDifficultyCalculator : DifficultyCalculator
{ {
private const double star_scaling_factor = 0.145; private const double star_scaling_factor = 0.153;
protected override int SectionLength => 750; protected override int SectionLength => 750;
@ -73,6 +73,9 @@ namespace osu.Game.Rulesets.Catch.Difficulty
{ {
halfCatcherWidth = Catcher.CalculateCatchWidth(beatmap.BeatmapInfo.BaseDifficulty) * 0.5f; halfCatcherWidth = Catcher.CalculateCatchWidth(beatmap.BeatmapInfo.BaseDifficulty) * 0.5f;
// For circle sizes above 5.5, reduce the catcher width further to simulate imperfect gameplay.
halfCatcherWidth *= 1 - (Math.Max(0, beatmap.BeatmapInfo.BaseDifficulty.CircleSize - 5.5f) * 0.0625f);
return new Skill[] return new Skill[]
{ {
new Movement(halfCatcherWidth), new Movement(halfCatcherWidth),

View File

@ -52,8 +52,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty
// Longer maps are worth more // Longer maps are worth more
double lengthBonus = double lengthBonus =
0.95 + 0.4 * Math.Min(1.0, numTotalHits / 3000.0) + 0.95f + 0.3f * Math.Min(1.0f, numTotalHits / 2500.0f) +
(numTotalHits > 3000 ? Math.Log10(numTotalHits / 3000.0) * 0.5 : 0.0); (numTotalHits > 2500 ? (float)Math.Log10(numTotalHits / 2500.0f) * 0.475f : 0.0f);
// Longer maps are worth more // Longer maps are worth more
value *= lengthBonus; value *= lengthBonus;
@ -63,19 +63,28 @@ namespace osu.Game.Rulesets.Catch.Difficulty
// Combo scaling // Combo scaling
if (Attributes.MaxCombo > 0) if (Attributes.MaxCombo > 0)
value *= Math.Min(Math.Pow(Attributes.MaxCombo, 0.8) / Math.Pow(Attributes.MaxCombo, 0.8), 1.0); value *= Math.Min(Math.Pow(Score.MaxCombo, 0.8) / Math.Pow(Attributes.MaxCombo, 0.8), 1.0);
double approachRateFactor = 1.0; float approachRate = (float)Attributes.ApproachRate;
if (Attributes.ApproachRate > 9.0) float approachRateFactor = 1.0f;
approachRateFactor += 0.1 * (Attributes.ApproachRate - 9.0); // 10% for each AR above 9 if (approachRate > 9.0f)
else if (Attributes.ApproachRate < 8.0) approachRateFactor += 0.1f * (approachRate - 9.0f); // 10% for each AR above 9
approachRateFactor += 0.025 * (8.0 - Attributes.ApproachRate); // 2.5% for each AR below 8 if (approachRate > 10.0f)
approachRateFactor += 0.1f * (approachRate - 10.0f); // Additional 10% at AR 11, 30% total
else if (approachRate < 8.0f)
approachRateFactor += 0.025f * (8.0f - approachRate); // 2.5% for each AR below 8
value *= approachRateFactor; value *= approachRateFactor;
if (mods.Any(m => m is ModHidden)) if (mods.Any(m => m is ModHidden))
// Hiddens gives nothing on max approach rate, and more the lower it is {
value *= 1.05 + 0.075 * (10.0 - Math.Min(10.0, Attributes.ApproachRate)); // 7.5% for each AR below 10 value *= 1.05 + 0.075 * (10.0 - Math.Min(10.0, Attributes.ApproachRate)); // 7.5% for each AR below 10
// Hiddens gives almost nothing on max approach rate, and more the lower it is
if (approachRate <= 10.0f)
value *= 1.05f + 0.075f * (10.0f - approachRate); // 7.5% for each AR below 10
else if (approachRate > 10.0f)
value *= 1.01f + 0.04f * (11.0f - Math.Min(11.0f, approachRate)); // 5% at AR 10, 1% at AR 11
}
if (mods.Any(m => m is ModFlashlight)) if (mods.Any(m => m is ModFlashlight))
// Apply length bonus again if flashlight is on simply because it becomes a lot harder on longer maps. // Apply length bonus again if flashlight is on simply because it becomes a lot harder on longer maps.

View File

@ -21,10 +21,12 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing
public readonly float LastNormalizedPosition; public readonly float LastNormalizedPosition;
/// <summary> /// <summary>
/// Milliseconds elapsed since the start time of the previous <see cref="CatchDifficultyHitObject"/>, with a minimum of 25ms. /// Milliseconds elapsed since the start time of the previous <see cref="CatchDifficultyHitObject"/>, with a minimum of 40ms.
/// </summary> /// </summary>
public readonly double StrainTime; public readonly double StrainTime;
public readonly double ClockRate;
public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth) public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth)
: base(hitObject, lastObject, clockRate) : base(hitObject, lastObject, clockRate)
{ {
@ -34,8 +36,9 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing
NormalizedPosition = BaseObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor; NormalizedPosition = BaseObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor;
LastNormalizedPosition = LastObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor; LastNormalizedPosition = LastObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor;
// Every strain interval is hard capped at the equivalent of 600 BPM streaming speed as a safety measure // Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure
StrainTime = Math.Max(25, DeltaTime); StrainTime = Math.Max(40, DeltaTime);
ClockRate = clockRate;
} }
} }
} }

View File

@ -13,9 +13,9 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Skills
{ {
private const float absolute_player_positioning_error = 16f; private const float absolute_player_positioning_error = 16f;
private const float normalized_hitobject_radius = 41.0f; private const float normalized_hitobject_radius = 41.0f;
private const double direction_change_bonus = 12.5; private const double direction_change_bonus = 21.0;
protected override double SkillMultiplier => 850; protected override double SkillMultiplier => 900;
protected override double StrainDecayBase => 0.2; protected override double StrainDecayBase => 0.2;
protected override double DecayWeight => 0.94; protected override double DecayWeight => 0.94;
@ -24,6 +24,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Skills
private float? lastPlayerPosition; private float? lastPlayerPosition;
private float lastDistanceMoved; private float lastDistanceMoved;
private double lastStrainTime;
public Movement(float halfCatcherWidth) public Movement(float halfCatcherWidth)
{ {
@ -45,47 +46,47 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Skills
float distanceMoved = playerPosition - lastPlayerPosition.Value; float distanceMoved = playerPosition - lastPlayerPosition.Value;
double distanceAddition = Math.Pow(Math.Abs(distanceMoved), 1.3) / 500; double weightedStrainTime = catchCurrent.StrainTime + 13 + (3 / catchCurrent.ClockRate);
double sqrtStrain = Math.Sqrt(catchCurrent.StrainTime);
double bonus = 0; double distanceAddition = (Math.Pow(Math.Abs(distanceMoved), 1.3) / 510);
double sqrtStrain = Math.Sqrt(weightedStrainTime);
// Direction changes give an extra point! double edgeDashBonus = 0;
// Direction change bonus.
if (Math.Abs(distanceMoved) > 0.1) if (Math.Abs(distanceMoved) > 0.1)
{ {
if (Math.Abs(lastDistanceMoved) > 0.1 && Math.Sign(distanceMoved) != Math.Sign(lastDistanceMoved)) if (Math.Abs(lastDistanceMoved) > 0.1 && Math.Sign(distanceMoved) != Math.Sign(lastDistanceMoved))
{ {
double bonusFactor = Math.Min(absolute_player_positioning_error, Math.Abs(distanceMoved)) / absolute_player_positioning_error; double bonusFactor = Math.Min(50, Math.Abs(distanceMoved)) / 50;
double antiflowFactor = Math.Max(Math.Min(70, Math.Abs(lastDistanceMoved)) / 70, 0.38);
distanceAddition += direction_change_bonus / sqrtStrain * bonusFactor; distanceAddition += direction_change_bonus / Math.Sqrt(lastStrainTime + 16) * bonusFactor * antiflowFactor * Math.Max(1 - Math.Pow(weightedStrainTime / 1000, 3), 0);
// Bonus for tougher direction switches and "almost" hyperdashes at this point
if (catchCurrent.LastObject.DistanceToHyperDash <= 10 / CatchPlayfield.BASE_WIDTH)
bonus = 0.3 * bonusFactor;
} }
// Base bonus for every movement, giving some weight to streams. // Base bonus for every movement, giving some weight to streams.
distanceAddition += 7.5 * Math.Min(Math.Abs(distanceMoved), normalized_hitobject_radius * 2) / (normalized_hitobject_radius * 6) / sqrtStrain; distanceAddition += 12.5 * Math.Min(Math.Abs(distanceMoved), normalized_hitobject_radius * 2) / (normalized_hitobject_radius * 6) / sqrtStrain;
} }
// Bonus for "almost" hyperdashes at corner points // Bonus for edge dashes.
if (catchCurrent.LastObject.DistanceToHyperDash <= 10.0f / CatchPlayfield.BASE_WIDTH) if (catchCurrent.LastObject.DistanceToHyperDash <= 20.0f / CatchPlayfield.BASE_WIDTH)
{ {
if (!catchCurrent.LastObject.HyperDash) if (!catchCurrent.LastObject.HyperDash)
bonus += 1.0; edgeDashBonus += 5.7;
else else
{ {
// After a hyperdash we ARE in the correct position. Always! // After a hyperdash we ARE in the correct position. Always!
playerPosition = catchCurrent.NormalizedPosition; playerPosition = catchCurrent.NormalizedPosition;
} }
distanceAddition *= 1.0 + bonus * ((10 - catchCurrent.LastObject.DistanceToHyperDash * CatchPlayfield.BASE_WIDTH) / 10); distanceAddition *= 1.0 + edgeDashBonus * ((20 - catchCurrent.LastObject.DistanceToHyperDash * CatchPlayfield.BASE_WIDTH) / 20) * Math.Pow((Math.Min(catchCurrent.StrainTime * catchCurrent.ClockRate, 265) / 265), 1.5); // Edge Dashes are easier at lower ms values
} }
lastPlayerPosition = playerPosition; lastPlayerPosition = playerPosition;
lastDistanceMoved = distanceMoved; lastDistanceMoved = distanceMoved;
lastStrainTime = catchCurrent.StrainTime;
return distanceAddition / catchCurrent.StrainTime; return distanceAddition / weightedStrainTime;
} }
} }
} }

View File

@ -24,10 +24,12 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Taiko; using osu.Game.Rulesets.Taiko;
using osu.Game.Scoring;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Screens.Select; using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Carousel; using osu.Game.Screens.Select.Carousel;
using osu.Game.Screens.Select.Filter; using osu.Game.Screens.Select.Filter;
using osu.Game.Users;
using osuTK.Input; using osuTK.Input;
namespace osu.Game.Tests.Visual.SongSelect namespace osu.Game.Tests.Visual.SongSelect
@ -769,6 +771,70 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("Check first item in group selected", () => Beatmap.Value.BeatmapInfo == groupIcon.Items.First().Beatmap); AddAssert("Check first item in group selected", () => Beatmap.Value.BeatmapInfo == groupIcon.Items.First().Beatmap);
} }
[Test]
public void TestChangeRulesetWhilePresentingScore()
{
BeatmapInfo getPresentBeatmap() => manager.QueryBeatmap(b => !b.BeatmapSet.DeletePending && b.RulesetID == 0);
BeatmapInfo getSwitchBeatmap() => manager.QueryBeatmap(b => !b.BeatmapSet.DeletePending && b.RulesetID == 1);
changeRuleset(0);
createSongSelect();
addRulesetImportStep(0);
addRulesetImportStep(1);
AddStep("present score", () =>
{
// this ruleset change should be overridden by the present.
Ruleset.Value = getSwitchBeatmap().Ruleset;
songSelect.PresentScore(new ScoreInfo
{
User = new User { Username = "woo" },
Beatmap = getPresentBeatmap(),
Ruleset = getPresentBeatmap().Ruleset
});
});
AddUntilStep("wait for results screen presented", () => !songSelect.IsCurrentScreen());
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.Equals(getPresentBeatmap()));
AddAssert("check ruleset is correct for score", () => Ruleset.Value.ID == 0);
}
[Test]
public void TestChangeBeatmapWhilePresentingScore()
{
BeatmapInfo getPresentBeatmap() => manager.QueryBeatmap(b => !b.BeatmapSet.DeletePending && b.RulesetID == 0);
BeatmapInfo getSwitchBeatmap() => manager.QueryBeatmap(b => !b.BeatmapSet.DeletePending && b.RulesetID == 1);
changeRuleset(0);
addRulesetImportStep(0);
addRulesetImportStep(1);
createSongSelect();
AddStep("present score", () =>
{
// this beatmap change should be overridden by the present.
Beatmap.Value = manager.GetWorkingBeatmap(getSwitchBeatmap());
songSelect.PresentScore(new ScoreInfo
{
User = new User { Username = "woo" },
Beatmap = getPresentBeatmap(),
Ruleset = getPresentBeatmap().Ruleset
});
});
AddUntilStep("wait for results screen presented", () => !songSelect.IsCurrentScreen());
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.Equals(getPresentBeatmap()));
AddAssert("check ruleset is correct for score", () => Ruleset.Value.ID == 0);
}
private void waitForInitialSelection() private void waitForInitialSelection()
{ {
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault); AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
@ -882,6 +948,8 @@ namespace osu.Game.Tests.Visual.SongSelect
public WorkingBeatmap CurrentBeatmapDetailsBeatmap => BeatmapDetails.Beatmap; public WorkingBeatmap CurrentBeatmapDetailsBeatmap => BeatmapDetails.Beatmap;
public new BeatmapCarousel Carousel => base.Carousel; public new BeatmapCarousel Carousel => base.Carousel;
public new void PresentScore(ScoreInfo score) => base.PresentScore(score);
protected override bool OnStart() protected override bool OnStart()
{ {
StartRequested?.Invoke(); StartRequested?.Invoke();

View File

@ -32,5 +32,11 @@ namespace osu.Game.Tournament.Models
MinValue = 640, MinValue = 640,
MaxValue = 1366, MaxValue = 1366,
}; };
public Bindable<int> PlayersPerTeam = new BindableInt(4)
{
MinValue = 3,
MaxValue = 4,
};
} }
} }

View File

@ -36,7 +36,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
[Resolved] [Resolved]
private TournamentMatchChatDisplay chat { get; set; } private TournamentMatchChatDisplay chat { get; set; }
private Box chroma; private Drawable chroma;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(LadderInfo ladder, MatchIPCInfo ipc, Storage storage) private void load(LadderInfo ladder, MatchIPCInfo ipc, Storage storage)
@ -61,16 +61,30 @@ namespace osu.Game.Tournament.Screens.Gameplay
Y = 110, Y = 110,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Children = new Drawable[] Children = new[]
{ {
chroma = new Box chroma = new Container
{ {
// chroma key area for stable gameplay
Name = "chroma",
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Height = 512, Height = 512,
Colour = new Color4(0, 255, 0, 255), Children = new Drawable[]
{
new ChromaArea
{
Name = "Left chroma",
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
},
new ChromaArea
{
Name = "Right chroma",
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Width = 0.5f,
}
}
}, },
} }
}, },
@ -98,9 +112,15 @@ namespace osu.Game.Tournament.Screens.Gameplay
}, },
new SettingsSlider<int> new SettingsSlider<int>
{ {
LabelText = "Chroma Width", LabelText = "Chroma width",
Bindable = LadderInfo.ChromaKeyWidth, Bindable = LadderInfo.ChromaKeyWidth,
KeyboardStep = 1, KeyboardStep = 1,
},
new SettingsSlider<int>
{
LabelText = "Players per team",
Bindable = LadderInfo.PlayersPerTeam,
KeyboardStep = 1,
} }
} }
} }
@ -201,5 +221,54 @@ namespace osu.Game.Tournament.Screens.Gameplay
lastState = state.NewValue; lastState = state.NewValue;
} }
} }
private class ChromaArea : CompositeDrawable
{
[Resolved]
private LadderInfo ladder { get; set; }
[BackgroundDependencyLoader]
private void load()
{
// chroma key area for stable gameplay
Colour = new Color4(0, 255, 0, 255);
ladder.PlayersPerTeam.BindValueChanged(performLayout, true);
}
private void performLayout(ValueChangedEvent<int> playerCount)
{
switch (playerCount.NewValue)
{
case 3:
InternalChildren = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
Height = 0.5f,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new Box
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Height = 0.5f,
},
};
break;
default:
InternalChild = new Box
{
RelativeSizeAxes = Axes.Both,
};
break;
}
}
}
} }
} }

View File

@ -149,6 +149,11 @@ namespace osu.Game.Beatmaps
} }
} }
public string[] SearchableTerms => new[]
{
Version
}.Concat(Metadata?.SearchableTerms ?? Enumerable.Empty<string>()).Where(s => !string.IsNullOrEmpty(s)).ToArray();
public override string ToString() public override string ToString()
{ {
string version = string.IsNullOrEmpty(Version) ? string.Empty : $"[{Version}]"; string version = string.IsNullOrEmpty(Version) ? string.Empty : $"[{Version}]";

View File

@ -139,7 +139,7 @@ namespace osu.Game.Graphics
return false; return false;
dateText.Text = $"{date:d MMMM yyyy} "; dateText.Text = $"{date:d MMMM yyyy} ";
timeText.Text = $"{date:hh:mm:ss \"UTC\"z}"; timeText.Text = $"{date:HH:mm:ss \"UTC\"z}";
return true; return true;
} }

View File

@ -61,7 +61,7 @@ namespace osu.Game.Online.Chat
/// </summary> /// </summary>
public event Action<Message> MessageRemoved; public event Action<Message> MessageRemoved;
public bool ReadOnly => false; //todo not yet used. public bool ReadOnly => false; // todo: not yet used.
public override string ToString() => Name; public override string ToString() => Name;

View File

@ -91,6 +91,8 @@ namespace osu.Game.Overlays.SearchableList
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {
base.Dispose(isDisposing);
bindable.ValueChanged -= Bindable_ValueChanged; bindable.ValueChanged -= Bindable_ValueChanged;
} }
} }

View File

@ -43,5 +43,25 @@ namespace osu.Game.Rulesets.Scoring
/// </summary> /// </summary>
[Description(@"Perfect")] [Description(@"Perfect")]
Perfect, Perfect,
/// <summary>
/// Indicates small tick miss.
/// </summary>
SmallTickMiss,
/// <summary>
/// Indicates a small tick hit.
/// </summary>
SmallTickHit,
/// <summary>
/// Indicates a large tick miss.
/// </summary>
LargeTickMiss,
/// <summary>
/// Indicates a large tick hit.
/// </summary>
LargeTickHit
} }
} }

View File

@ -12,7 +12,7 @@ namespace osu.Game.Scoring.Legacy
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID) switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
{ {
case 3: case 3:
return scoreInfo.Statistics[HitResult.Perfect]; return getCount(scoreInfo, HitResult.Perfect);
} }
return null; return null;
@ -35,10 +35,10 @@ namespace osu.Game.Scoring.Legacy
case 0: case 0:
case 1: case 1:
case 3: case 3:
return scoreInfo.Statistics[HitResult.Great]; return getCount(scoreInfo, HitResult.Great);
case 2: case 2:
return scoreInfo.Statistics[HitResult.Perfect]; return getCount(scoreInfo, HitResult.Perfect);
} }
return null; return null;
@ -65,7 +65,10 @@ namespace osu.Game.Scoring.Legacy
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID) switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
{ {
case 3: case 3:
return scoreInfo.Statistics[HitResult.Good]; return getCount(scoreInfo, HitResult.Good);
case 2:
return getCount(scoreInfo, HitResult.SmallTickMiss);
} }
return null; return null;
@ -78,6 +81,10 @@ namespace osu.Game.Scoring.Legacy
case 3: case 3:
scoreInfo.Statistics[HitResult.Good] = value; scoreInfo.Statistics[HitResult.Good] = value;
break; break;
case 2:
scoreInfo.Statistics[HitResult.SmallTickMiss] = value;
break;
} }
} }
@ -87,10 +94,13 @@ namespace osu.Game.Scoring.Legacy
{ {
case 0: case 0:
case 1: case 1:
return scoreInfo.Statistics[HitResult.Good]; return getCount(scoreInfo, HitResult.Good);
case 3: case 3:
return scoreInfo.Statistics[HitResult.Ok]; return getCount(scoreInfo, HitResult.Ok);
case 2:
return getCount(scoreInfo, HitResult.LargeTickHit);
} }
return null; return null;
@ -108,6 +118,10 @@ namespace osu.Game.Scoring.Legacy
case 3: case 3:
scoreInfo.Statistics[HitResult.Ok] = value; scoreInfo.Statistics[HitResult.Ok] = value;
break; break;
case 2:
scoreInfo.Statistics[HitResult.LargeTickHit] = value;
break;
} }
} }
@ -117,7 +131,10 @@ namespace osu.Game.Scoring.Legacy
{ {
case 0: case 0:
case 3: case 3:
return scoreInfo.Statistics[HitResult.Meh]; return getCount(scoreInfo, HitResult.Meh);
case 2:
return getCount(scoreInfo, HitResult.SmallTickHit);
} }
return null; return null;
@ -131,13 +148,25 @@ namespace osu.Game.Scoring.Legacy
case 3: case 3:
scoreInfo.Statistics[HitResult.Meh] = value; scoreInfo.Statistics[HitResult.Meh] = value;
break; break;
case 2:
scoreInfo.Statistics[HitResult.SmallTickHit] = value;
break;
} }
} }
public static int? GetCountMiss(this ScoreInfo scoreInfo) => public static int? GetCountMiss(this ScoreInfo scoreInfo) =>
scoreInfo.Statistics[HitResult.Miss]; getCount(scoreInfo, HitResult.Miss);
public static void SetCountMiss(this ScoreInfo scoreInfo, int value) => public static void SetCountMiss(this ScoreInfo scoreInfo, int value) =>
scoreInfo.Statistics[HitResult.Miss] = value; scoreInfo.Statistics[HitResult.Miss] = value;
private static int? getCount(ScoreInfo scoreInfo, HitResult result)
{
if (scoreInfo.Statistics.TryGetValue(result, out var existing))
return existing;
return null;
}
} }
} }

View File

@ -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 System.Linq; using System.Linq;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Screens.Select.Filter; using osu.Game.Screens.Select.Filter;
@ -55,10 +54,7 @@ namespace osu.Game.Screens.Select.Carousel
if (match) if (match)
{ {
var terms = new List<string>(); var terms = Beatmap.SearchableTerms;
terms.AddRange(Beatmap.Metadata.SearchableTerms);
terms.Add(Beatmap.Version);
foreach (var criteriaTerm in criteria.SearchTerms) foreach (var criteriaTerm in criteria.SearchTerms)
match &= terms.Any(term => term.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0); match &= terms.Any(term => term.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0);

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Scoring;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking; using osu.Game.Screens.Ranking;
using osu.Game.Users; using osu.Game.Users;
@ -32,9 +33,12 @@ namespace osu.Game.Screens.Select
Edit(); Edit();
}, Key.Number4); }, Key.Number4);
((PlayBeatmapDetailArea)BeatmapDetails).Leaderboard.ScoreSelected += score => this.Push(new ResultsScreen(score)); ((PlayBeatmapDetailArea)BeatmapDetails).Leaderboard.ScoreSelected += PresentScore;
} }
protected void PresentScore(ScoreInfo score) =>
FinaliseSelection(score.Beatmap, score.Ruleset, () => this.Push(new ResultsScreen(score)));
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea(); protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea();
public override void OnResuming(IScreen last) public override void OnResuming(IScreen last)

View File

@ -342,13 +342,17 @@ namespace osu.Game.Screens.Select
/// Call to make a selection and perform the default action for this SongSelect. /// Call to make a selection and perform the default action for this SongSelect.
/// </summary> /// </summary>
/// <param name="beatmap">An optional beatmap to override the current carousel selection.</param> /// <param name="beatmap">An optional beatmap to override the current carousel selection.</param>
/// <param name="performStartAction">Whether to trigger <see cref="OnStart"/>.</param> /// <param name="ruleset">An optional ruleset to override the current carousel selection.</param>
public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true) /// <param name="customStartAction">An optional custom action to perform instead of <see cref="OnStart"/>.</param>
public void FinaliseSelection(BeatmapInfo beatmap = null, RulesetInfo ruleset = null, Action customStartAction = null)
{ {
// This is very important as we have not yet bound to screen-level bindables before the carousel load is completed. // This is very important as we have not yet bound to screen-level bindables before the carousel load is completed.
if (!Carousel.BeatmapSetsLoaded) if (!Carousel.BeatmapSetsLoaded)
return; return;
if (ruleset != null)
Ruleset.Value = ruleset;
transferRulesetValue(); transferRulesetValue();
// while transferRulesetValue will flush, it only does so if the ruleset changes. // while transferRulesetValue will flush, it only does so if the ruleset changes.
@ -369,7 +373,12 @@ namespace osu.Game.Screens.Select
selectionChangedDebounce = null; selectionChangedDebounce = null;
} }
if (performStartAction && OnStart()) if (customStartAction != null)
{
customStartAction();
Carousel.AllowSelection = false;
}
else if (OnStart())
Carousel.AllowSelection = false; Carousel.AllowSelection = false;
} }

View File

@ -20,7 +20,7 @@
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Dapper" Version="2.0.35" /> <PackageReference Include="Dapper" Version="2.0.35" />
<PackageReference Include="DiffPlex" Version="1.6.1" /> <PackageReference Include="DiffPlex" Version="1.6.1" />
<PackageReference Include="Humanizer" Version="2.8.2" /> <PackageReference Include="Humanizer" Version="2.8.11" />
<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" />

View File

@ -76,7 +76,7 @@
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. --> <!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
<ItemGroup Label="Transitive Dependencies"> <ItemGroup Label="Transitive Dependencies">
<PackageReference Include="DiffPlex" Version="1.6.1" /> <PackageReference Include="DiffPlex" Version="1.6.1" />
<PackageReference Include="Humanizer" Version="2.8.2" /> <PackageReference Include="Humanizer" Version="2.8.11" />
<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" />