1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-09 23:54:52 +08:00

Compare commits

..

81 Commits

68 changed files with 736 additions and 447 deletions
+5 -15
View File
@@ -46,22 +46,16 @@ body:
value: |
## Logs
Attaching log files is required for every reported bug. See instructions below on how to find them.
**Logs are reset when you reopen the game.** If the game crashed or has been closed since you found the bug, retrieve the logs using the file explorer instead.
Attaching log files is required for **every** issue, regardless of whether you deem them required or not. See instructions below on how to find them.
### Desktop platforms
If the game has not yet been closed since you found the bug:
1. Head on to game settings and click on "Open osu! folder"
2. Then open the `logs` folder located there
1. Head on to game settings and click on "Export logs"
2. Click the notification to locate the file
3. Drag the generated `.zip` files into the github issue window
The default places to find the logs on desktop platforms are as follows:
- `%AppData%/osu/logs` *on Windows*
- `~/.local/share/osu/logs` *on Linux*
- `~/Library/Application Support/osu/logs` *on macOS*
If you have selected a custom location for the game files, you can find the `logs` folder there.
![export logs button](https://github.com/ppy/osu/assets/191335/cbfa5550-b7ed-4c5c-8dd0-8b87cc90ad9b)
### Mobile platforms
@@ -69,10 +63,6 @@ body:
- *On Android*, navigate to `Android/data/sh.ppy.osulazer/files/logs` using a file browser app.
- *On iOS*, connect your device to a PC and copy the `logs` directory from the app's document storage using iTunes. (https://support.apple.com/en-us/HT201301#copy-to-computer)
---
After locating the `logs` folder, select all log files inside and drag them into the "Logs" box below.
- type: textarea
attributes:
label: Logs
@@ -3,6 +3,7 @@
using System;
using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Rulesets.Catch.Edit.Blueprints.Components;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Edit;
@@ -17,7 +18,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
private double placementStartTime;
private double placementEndTime;
protected override bool IsValidForPlacement => HitObject.Duration > 0;
protected override bool IsValidForPlacement => Precision.DefinitelyBigger(HitObject.Duration, 0);
public BananaShowerPlacementBlueprint()
{
@@ -4,6 +4,7 @@
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Rulesets.Catch.Edit.Blueprints.Components;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Edit;
@@ -24,7 +25,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
private InputManager inputManager = null!;
protected override bool IsValidForPlacement => HitObject.Duration > 0;
protected override bool IsValidForPlacement => Precision.DefinitelyBigger(HitObject.Duration, 0);
public JuiceStreamPlacementBlueprint()
{
@@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Scoring
}
protected override double GetComboScoreChange(JudgementResult result)
=> Judgement.ToNumericResult(result.Type) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(combo_cap, combo_base));
=> GetNumericResultFor(result) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(combo_cap, combo_base));
public override ScoreRank RankFromAccuracy(double accuracy)
{
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Rulesets.Mania.Objects;
@@ -25,8 +26,8 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
public void TestHitWindowWithoutDoubleTime() => CreateModTest(new ModTestData
{
PassCondition = () => Player.ScoreProcessor.JudgedHits > 0
&& Player.ScoreProcessor.Accuracy.Value == 1
&& Player.ScoreProcessor.TotalScore.Value == 1_000_000,
&& Precision.AlmostEquals(Player.ScoreProcessor.Accuracy.Value, 0.9836, 0.01)
&& Player.ScoreProcessor.TotalScore.Value == 946_049,
Autoplay = false,
Beatmap = new Beatmap
{
@@ -53,7 +54,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
Mod = doubleTime,
PassCondition = () => Player.ScoreProcessor.JudgedHits > 0
&& Player.ScoreProcessor.Accuracy.Value == 1
&& Player.ScoreProcessor.TotalScore.Value == (long)(1_000_010 * doubleTime.ScoreMultiplier),
&& Player.ScoreProcessor.TotalScore.Value == (long)(1_000_000 * doubleTime.ScoreMultiplier),
Autoplay = false,
Beatmap = new Beatmap
{
@@ -200,12 +200,10 @@ namespace osu.Game.Rulesets.Mania.Tests
});
assertHeadJudgement(HitResult.Perfect);
// judgement combo offset by perfect bonus judgement. see logic in DrawableNote.CheckForResult.
assertComboAtJudgement(1, 1);
assertComboAtJudgement(0, 1);
assertTailJudgement(HitResult.Meh);
assertComboAtJudgement(2, 0);
// judgement combo offset by perfect bonus judgement. see logic in DrawableNote.CheckForResult.
assertComboAtJudgement(4, 1);
assertComboAtJudgement(1, 0);
assertComboAtJudgement(3, 1);
}
/// <summary>
@@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Mania.Tests
AddAssert("all objects perfectly judged",
() => judgementResults.Select(result => result.Type),
() => Is.EquivalentTo(judgementResults.Select(result => result.Judgement.MaxResult)));
AddAssert("score is correct", () => currentPlayer.ScoreProcessor.TotalScore.Value, () => Is.EqualTo(1_000_030));
AddAssert("score is correct", () => currentPlayer.ScoreProcessor.TotalScore.Value, () => Is.EqualTo(1_000_000));
}
[Test]
@@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Mania.Tests
AddAssert("all objects perfectly judged",
() => judgementResults.Select(result => result.Type),
() => Is.EquivalentTo(judgementResults.Select(result => result.Judgement.MaxResult)));
AddAssert("score is correct", () => currentPlayer.ScoreProcessor.TotalScore.Value, () => Is.EqualTo(1_000_040));
AddAssert("score is correct", () => currentPlayer.ScoreProcessor.TotalScore.Value, () => Is.EqualTo(1_000_000));
}
private void performTest(List<ManiaHitObject> hitObjects, List<ReplayFrame> frames)
@@ -59,23 +59,26 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
{
double roundedCircleSize = Math.Round(difficulty.CircleSize);
if (new ManiaRuleset().RulesetInfo.Equals(difficulty.SourceRuleset))
if (difficulty.SourceRuleset.ShortName == ManiaRuleset.SHORT_NAME)
return (int)Math.Max(1, roundedCircleSize);
double roundedOverallDifficulty = Math.Round(difficulty.OverallDifficulty);
int countSliderOrSpinner = difficulty.EndTimeObjectCount;
if (difficulty.TotalObjectCount > 0 && difficulty.EndTimeObjectCount >= 0)
{
int countSliderOrSpinner = difficulty.EndTimeObjectCount;
// In osu!stable, this division appears as if it happens on floats, but due to release-mode
// optimisations, it actually ends up happening on doubles.
double percentSpecialObjects = (double)countSliderOrSpinner / difficulty.TotalObjectCount;
// In osu!stable, this division appears as if it happens on floats, but due to release-mode
// optimisations, it actually ends up happening on doubles.
double percentSpecialObjects = (double)countSliderOrSpinner / difficulty.TotalObjectCount;
if (percentSpecialObjects < 0.2)
return 7;
if (percentSpecialObjects < 0.3 || roundedCircleSize >= 5)
return roundedOverallDifficulty > 5 ? 7 : 6;
if (percentSpecialObjects > 0.6)
return roundedOverallDifficulty > 4 ? 5 : 4;
if (percentSpecialObjects < 0.2)
return 7;
if (percentSpecialObjects < 0.3 || roundedCircleSize >= 5)
return roundedOverallDifficulty > 5 ? 7 : 6;
if (percentSpecialObjects > 0.6)
return roundedOverallDifficulty > 4 ? 5 : 4;
}
return Math.Max(4, Math.Min((int)roundedOverallDifficulty + 1, 7));
}
@@ -5,6 +5,7 @@ using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
using osu.Game.Rulesets.Mania.Objects;
@@ -23,7 +24,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
[Resolved]
private IScrollingInfo scrollingInfo { get; set; } = null!;
protected override bool IsValidForPlacement => HitObject.Duration > 0;
protected override bool IsValidForPlacement => Precision.DefinitelyBigger(HitObject.Duration, 0);
public HoldNotePlacementBlueprint()
: base(new HoldNote())
@@ -10,5 +10,10 @@ namespace osu.Game.Rulesets.Mania.Mods
public class ManiaModDoubleTime : ModDoubleTime, IManiaRateAdjustmentMod
{
public HitWindows HitWindows { get; set; } = new ManiaHitWindows();
// For now, all rate-increasing mods should be given a 1x multiplier in mania because it doesn't always
// make the map harder and is more of a personal preference.
// In the future, we can consider adjusting this by experimenting with not applying the hitwindow leniency.
public override double ScoreMultiplier => 1;
}
}
@@ -11,5 +11,10 @@ namespace osu.Game.Rulesets.Mania.Mods
public class ManiaModNightcore : ModNightcore<ManiaHitObject>, IManiaRateAdjustmentMod
{
public HitWindows HitWindows { get; set; } = new ManiaHitWindows();
// For now, all rate-increasing mods should be given a 1x multiplier in mania because it doesn't always
// make the map any harder and is more of a personal preference.
// In the future, we can consider adjusting this by experimenting with not applying the hitwindow leniency.
public override double ScoreMultiplier => 1;
}
}
@@ -13,8 +13,6 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.Skinning.Default;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Screens.Edit;
@@ -40,8 +38,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
private Drawable headPiece;
private DrawableNotePerfectBonus perfectBonus;
public DrawableNote()
: this(null)
{
@@ -93,10 +89,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
if (!userTriggered)
{
if (!HitObject.HitWindows.CanBeHit(timeOffset))
{
perfectBonus.TriggerResult(false);
ApplyResult(r => r.Type = r.Judgement.MinResult);
}
return;
}
@@ -107,16 +100,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
result = GetCappedResult(result);
perfectBonus.TriggerResult(result == HitResult.Perfect);
ApplyResult(r => r.Type = result);
}
public override void MissForcefully()
{
perfectBonus.TriggerResult(false);
base.MissForcefully();
}
/// <summary>
/// Some objects in mania may want to limit the max result.
/// </summary>
@@ -137,32 +123,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
}
protected override void AddNestedHitObject(DrawableHitObject hitObject)
{
switch (hitObject)
{
case DrawableNotePerfectBonus bonus:
AddInternal(perfectBonus = bonus);
break;
}
}
protected override void ClearNestedHitObjects()
{
RemoveInternal(perfectBonus, false);
}
protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject)
{
switch (hitObject)
{
case NotePerfectBonus bonus:
return new DrawableNotePerfectBonus(bonus);
}
return base.CreateNestedHitObject(hitObject);
}
private void updateSnapColour()
{
if (beatmap == null || HitObject == null) return;
@@ -1,26 +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.
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
public partial class DrawableNotePerfectBonus : DrawableManiaHitObject<NotePerfectBonus>
{
public override bool DisplayResult => false;
public DrawableNotePerfectBonus()
: this(null!)
{
}
public DrawableNotePerfectBonus(NotePerfectBonus hitObject)
: base(hitObject)
{
}
/// <summary>
/// Apply a judgement result.
/// </summary>
/// <param name="hit">Whether this tick was reached.</param>
internal void TriggerResult(bool hit) => ApplyResult(r => r.Type = hit ? r.Judgement.MaxResult : r.Judgement.MinResult);
}
}
-8
View File
@@ -1,7 +1,6 @@
// 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.Threading;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Judgements;
@@ -13,12 +12,5 @@ namespace osu.Game.Rulesets.Mania.Objects
public class Note : ManiaHitObject
{
public override Judgement CreateJudgement() => new ManiaJudgement();
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
{
base.CreateNestedHitObjects(cancellationToken);
AddNested(new NotePerfectBonus { StartTime = StartTime });
}
}
}
@@ -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.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mania.Objects
{
public class NotePerfectBonus : ManiaHitObject
{
public override Judgement CreateJudgement() => new NotePerfectBonusJudgement();
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
public class NotePerfectBonusJudgement : ManiaJudgement
{
public override HitResult MaxResult => HitResult.SmallBonus;
}
}
}
@@ -26,13 +26,50 @@ namespace osu.Game.Rulesets.Mania.Scoring
protected override double ComputeTotalScore(double comboProgress, double accuracyProgress, double bonusPortion)
{
return 10000 * comboProgress
+ 990000 * Math.Pow(Accuracy.Value, 2 + 2 * Accuracy.Value) * accuracyProgress
return 150000 * comboProgress
+ 850000 * Math.Pow(Accuracy.Value, 2 + 2 * Accuracy.Value) * accuracyProgress
+ bonusPortion;
}
protected override double GetNumericResultFor(JudgementResult result)
{
switch (result.Type)
{
case HitResult.Perfect:
return 305;
}
return base.GetNumericResultFor(result);
}
protected override double GetMaxNumericResultFor(JudgementResult result)
{
switch (result.Judgement.MaxResult)
{
case HitResult.Perfect:
return 305;
}
return base.GetMaxNumericResultFor(result);
}
protected override double GetComboScoreChange(JudgementResult result)
=> Judgement.ToNumericResult(result.Type) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base));
{
double numericResult;
switch (result.Type)
{
case HitResult.Perfect:
numericResult = 300;
break;
default:
numericResult = GetNumericResultFor(result);
break;
}
return numericResult * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base));
}
private class JudgementOrderComparer : IComparer<HitObject>
{
-1
View File
@@ -109,7 +109,6 @@ namespace osu.Game.Rulesets.Mania.UI
TopLevelContainer.Add(HitObjectArea.Explosions.CreateProxy());
RegisterPool<Note, DrawableNote>(10, 50);
RegisterPool<NotePerfectBonus, DrawableNotePerfectBonus>(10, 50);
RegisterPool<HoldNote, DrawableHoldNote>(10, 50);
RegisterPool<HeadNote, DrawableHoldNoteHead>(10, 50);
RegisterPool<TailNote, DrawableHoldNoteTail>(10, 50);
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Screens;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Replays;
using osu.Game.Rulesets.Judgements;
@@ -160,6 +161,10 @@ namespace osu.Game.Rulesets.Osu.Tests
Position = new Vector2(256 - slider_path_length / 2, 192),
TickDistanceMultiplier = 3,
ClassicSliderBehaviour = classic,
Samples = new[]
{
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
},
Path = new SliderPath(PathType.LINEAR, new[]
{
Vector2.Zero,
@@ -16,7 +16,7 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu.Mods
{
public class OsuModAutopilot : Mod, IApplicableFailOverride, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject>
public class OsuModAutopilot : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject>
{
public override string Name => "Autopilot";
public override string Acronym => "AP";
@@ -37,10 +37,6 @@ namespace osu.Game.Rulesets.Osu.Mods
typeof(ModTouchDevice)
};
public bool PerformFail() => false;
public bool RestartOnFail => false;
private OsuInputManager inputManager = null!;
private List<OsuReplayFrame> replayFrames = null!;
@@ -128,8 +128,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
foreach (var drawableHitObject in NestedHitObjects)
drawableHitObject.AccentColour.Value = colour.NewValue;
}, true);
Tracking.BindValueChanged(updateSlidingSample);
}
protected override void OnApply()
@@ -166,14 +164,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
slidingSample?.Stop();
}
private void updateSlidingSample(ValueChangedEvent<bool> tracking)
{
if (tracking.NewValue)
slidingSample?.Play();
else
slidingSample?.Stop();
}
protected override void AddNestedHitObject(DrawableHitObject hitObject)
{
base.AddNestedHitObject(hitObject);
@@ -238,9 +228,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Tracking.Value = SliderInputManager.Tracking;
if (Tracking.Value && slidingSample != null)
// keep the sliding sample playing at the current tracking position
slidingSample.Balance.Value = CalculateSamplePlaybackBalance(CalculateDrawableRelativePosition(Ball));
if (slidingSample != null)
{
if (Tracking.Value && Time.Current >= HitObject.StartTime)
{
// keep the sliding sample playing at the current tracking position
if (!slidingSample.IsPlaying)
slidingSample.Play();
slidingSample.Balance.Value = CalculateSamplePlaybackBalance(CalculateDrawableRelativePosition(Ball));
}
else if (slidingSample.IsPlaying)
slidingSample.Stop();
}
double completionProgress = Math.Clamp((Time.Current - HitObject.StartTime) / HitObject.Duration, 0, 1);
@@ -34,8 +34,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private Drawable scaleContainer;
public override bool DisplayResult => false;
public DrawableSliderRepeat()
: base(null)
{
@@ -24,11 +24,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected DrawableSlider DrawableSlider => (DrawableSlider)ParentHitObject;
/// <summary>
/// The judgement text is provided by the <see cref="DrawableSlider"/>.
/// </summary>
public override bool DisplayResult => false;
/// <summary>
/// Whether the hit samples only play on successful hits.
/// If <c>false</c>, the hit samples will also play on misses.
@@ -20,8 +20,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private const float default_tick_size = 16;
public override bool DisplayResult => false;
protected DrawableSlider DrawableSlider => (DrawableSlider)ParentHitObject;
private SkinnableDrawable scaleContainer;
@@ -62,25 +62,23 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
/// </remarks>
public virtual void PlayAnimation()
{
switch (Result)
if (Result.IsMiss())
{
default:
JudgementText
.FadeInFromZero(300, Easing.OutQuint)
.ScaleTo(Vector2.One)
.ScaleTo(new Vector2(1.2f), 1800, Easing.OutQuint);
break;
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);
case HitResult.Miss:
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);
this.MoveTo(Vector2.Zero);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
this.MoveTo(Vector2.Zero);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
this.RotateTo(0);
this.RotateTo(40, 800, Easing.InQuint);
break;
this.RotateTo(0);
this.RotateTo(40, 800, Easing.InQuint);
}
else
{
JudgementText
.FadeInFromZero(300, Easing.OutQuint)
.ScaleTo(Vector2.One)
.ScaleTo(new Vector2(1.2f), 1800, Easing.OutQuint);
}
this.FadeOutFromOne(800);
+19 -4
View File
@@ -20,7 +20,6 @@ using osu.Game.Rulesets.Osu.Configuration;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Connections;
using osu.Game.Rulesets.Osu.Scoring;
using osu.Game.Rulesets.Osu.UI.Cursor;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
@@ -66,8 +65,21 @@ namespace osu.Game.Rulesets.Osu.UI
HitPolicy = new StartTimeOrderedHitPolicy();
var hitWindows = new OsuHitWindows();
foreach (var result in Enum.GetValues<HitResult>().Where(r => r > HitResult.None && hitWindows.IsHitResultAllowed(r)))
foreach (var result in Enum.GetValues<HitResult>().Where(r =>
{
switch (r)
{
case HitResult.Great:
case HitResult.Ok:
case HitResult.Meh:
case HitResult.Miss:
case HitResult.LargeTickMiss:
case HitResult.IgnoreMiss:
return true;
}
return false;
}))
poolDictionary.Add(result, new DrawableJudgementPool(result, onJudgementLoaded));
AddRangeInternal(poolDictionary.Values);
@@ -170,7 +182,10 @@ namespace osu.Game.Rulesets.Osu.UI
if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
return;
DrawableOsuJudgement explosion = poolDictionary[result.Type].Get(doj => doj.Apply(result, judgedObject));
if (!poolDictionary.TryGetValue(result.Type, out var pool))
return;
DrawableOsuJudgement explosion = pool.Get(doj => doj.Apply(result, judgedObject));
judgementLayer.Add(explosion);
@@ -0,0 +1,41 @@
// 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 NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Judgements;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Scoring;
namespace osu.Game.Rulesets.Taiko.Tests
{
[TestFixture]
public class TaikoScoreProcessorTest
{
[Test]
public void TestInaccurateHitScore()
{
var beatmap = new Beatmap<HitObject>
{
HitObjects =
{
new Hit(),
new Hit { StartTime = 1000 }
}
};
var scoreProcessor = new TaikoScoreProcessor();
scoreProcessor.ApplyBeatmap(beatmap);
// Apply a miss judgement
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new TaikoJudgement()) { Type = HitResult.Great });
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[1], new TaikoJudgement()) { Type = HitResult.Ok });
Assert.That(scoreProcessor.TotalScore.Value, Is.EqualTo(453745));
Assert.That(scoreProcessor.Accuracy.Value, Is.EqualTo(0.75).Within(0.0001));
}
}
}
@@ -6,6 +6,7 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
@@ -25,7 +26,7 @@ namespace osu.Game.Rulesets.Taiko.Edit.Blueprints
private readonly IHasDuration spanPlacementObject;
protected override bool IsValidForPlacement => spanPlacementObject.Duration > 0;
protected override bool IsValidForPlacement => Precision.DefinitelyBigger(spanPlacementObject.Duration, 0);
public TaikoSpanPlacementBlueprint(HitObject hitObject)
: base(hitObject)
@@ -28,11 +28,22 @@ namespace osu.Game.Rulesets.Taiko.Scoring
protected override double GetComboScoreChange(JudgementResult result)
{
return Judgement.ToNumericResult(result.Type)
return GetNumericResultFor(result)
* Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base))
* strongScaleValue(result);
}
protected override double GetNumericResultFor(JudgementResult result)
{
switch (result.Type)
{
case HitResult.Ok:
return 150;
}
return base.GetNumericResultFor(result);
}
private double strongScaleValue(JudgementResult result)
{
if (result.HitObject is StrongNestedHitObject strong)
@@ -127,8 +127,11 @@ namespace osu.Game.Tests.Database
});
}
[TestCase(30000001)]
[TestCase(30000002)]
[TestCase(30000003)]
[TestCase(30000004)]
[TestCase(30000005)]
public void TestScoreUpgradeSuccess(int scoreVersion)
{
ScoreInfo scoreInfo = null!;
@@ -420,6 +420,7 @@ namespace osu.Game.Tests.Visual.SongSelect
}
[Test]
[FlakyTest] // temporary while peppy investigates
public void TestSelectionRetainedOnBeatmapUpdate()
{
createSongSelect();
@@ -464,8 +465,6 @@ namespace osu.Game.Tests.Visual.SongSelect
manager.Import(testBeatmapSetInfo);
}, 10);
AddStep("Force realm refresh", () => Realm.Run(r => r.Refresh()));
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo?.BeatmapSet?.OnlineID, () => Is.EqualTo(originalOnlineSetID));
Task<Live<BeatmapSetInfo>?> updateTask = null!;
@@ -478,8 +477,6 @@ namespace osu.Game.Tests.Visual.SongSelect
});
AddUntilStep("wait for update completion", () => updateTask.IsCompleted);
AddStep("Force realm refresh", () => Realm.Run(r => r.Refresh()));
AddUntilStep("retained selection", () => songSelect!.Carousel.SelectedBeatmapInfo?.BeatmapSet?.OnlineID, () => Is.EqualTo(originalOnlineSetID));
}
@@ -572,7 +572,7 @@ namespace osu.Game.Tests.Visual.UserInterface
[Test]
public void TestTextSearchActiveByDefault()
{
configManager.SetValue(OsuSetting.ModSelectTextSearchStartsActive, true);
AddStep("text search starts active", () => configManager.SetValue(OsuSetting.ModSelectTextSearchStartsActive, true));
createScreen();
AddUntilStep("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
@@ -587,7 +587,7 @@ namespace osu.Game.Tests.Visual.UserInterface
[Test]
public void TestTextSearchNotActiveByDefault()
{
configManager.SetValue(OsuSetting.ModSelectTextSearchStartsActive, false);
AddStep("text search does not start active", () => configManager.SetValue(OsuSetting.ModSelectTextSearchStartsActive, false));
createScreen();
AddUntilStep("search text box not focused", () => !modSelectOverlay.SearchTextBox.HasFocus);
@@ -599,6 +599,31 @@ namespace osu.Game.Tests.Visual.UserInterface
AddAssert("search text box unfocused", () => !modSelectOverlay.SearchTextBox.HasFocus);
}
[Test]
public void TestTextSearchDoesNotBlockCustomisationPanelKeyboardInteractions()
{
AddStep("text search starts active", () => configManager.SetValue(OsuSetting.ModSelectTextSearchStartsActive, true));
createScreen();
AddUntilStep("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
AddStep("select DT", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime() });
AddAssert("DT selected", () => modSelectOverlay.ChildrenOfType<ModPanel>().Count(panel => panel.Active.Value), () => Is.EqualTo(1));
AddStep("open customisation area", () => modSelectOverlay.CustomisationButton!.TriggerClick());
assertCustomisationToggleState(false, true);
AddStep("hover over mod settings slider", () =>
{
var slider = modSelectOverlay.ChildrenOfType<ModSettingsArea>().Single().ChildrenOfType<OsuSliderBar<double>>().First();
InputManager.MoveMouseTo(slider);
});
AddStep("press right arrow", () => InputManager.PressKey(Key.Right));
AddAssert("DT speed changed", () => !SelectedMods.Value.OfType<OsuModDoubleTime>().Single().SpeedChange.IsDefault);
AddStep("close customisation area", () => InputManager.PressKey(Key.Escape));
AddUntilStep("search text box reacquired focus", () => modSelectOverlay.SearchTextBox.HasFocus);
}
[Test]
public void TestDeselectAllViaKey()
{
+2 -3
View File
@@ -196,7 +196,7 @@ namespace osu.Game
realmAccess.Run(r =>
{
foreach (var b in r.All<BeatmapInfo>().Where(b => b.TotalObjectCount == 0))
foreach (var b in r.All<BeatmapInfo>().Where(b => b.TotalObjectCount < 0 || b.EndTimeObjectCount < 0))
beatmapIds.Add(b.ID);
});
@@ -316,8 +316,7 @@ namespace osu.Game
HashSet<Guid> scoreIds = realmAccess.Run(r => new HashSet<Guid>(r.All<ScoreInfo>()
.Where(s => !s.BackgroundReprocessingFailed && s.BeatmapInfo != null
&& (s.TotalScoreVersion == 30000002
|| s.TotalScoreVersion == 30000003))
&& s.TotalScoreVersion < LegacyScoreEncoder.LATEST_VERSION)
.AsEnumerable().Select(s => s.ID)));
Logger.Log($"Found {scoreIds.Count} scores which require total score conversion.");
+2 -2
View File
@@ -120,9 +120,9 @@ namespace osu.Game.Beatmaps
[JsonIgnore]
public bool Hidden { get; set; }
public int EndTimeObjectCount { get; set; }
public int EndTimeObjectCount { get; set; } = -1;
public int TotalObjectCount { get; set; }
public int TotalObjectCount { get; set; } = -1;
/// <summary>
/// Reset any fetched online linking information (and history).
+3
View File
@@ -59,11 +59,13 @@ namespace osu.Game.Beatmaps
/// <summary>
/// The basic star rating for this beatmap (with no mods applied).
/// Defaults to -1 (meaning not-yet-calculated).
/// </summary>
double StarRating { get; }
/// <summary>
/// The number of hitobjects in the beatmap with a distinct end time.
/// Defaults to -1 (meaning not-yet-calculated).
/// </summary>
/// <remarks>
/// Canonically, these are hitobjects are either sliders or spinners.
@@ -72,6 +74,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// The total number of hitobjects in the beatmap.
/// Defaults to -1 (meaning not-yet-calculated).
/// </summary>
int TotalObjectCount { get; }
}
+1 -1
View File
@@ -37,7 +37,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.Ruleset, string.Empty);
SetDefault(OsuSetting.Skin, SkinInfo.ARGON_SKIN.ToString());
SetDefault(OsuSetting.BeatmapDetailTab, PlayBeatmapDetailArea.TabType.Details);
SetDefault(OsuSetting.BeatmapDetailTab, PlayBeatmapDetailArea.TabType.Local);
SetDefault(OsuSetting.BeatmapDetailModsFilter, false);
SetDefault(OsuSetting.ShowConvertedBeatmaps, true);
+16 -1
View File
@@ -89,8 +89,9 @@ namespace osu.Game.Database
/// 35 2023-10-16 Clear key combinations of keybindings that are assigned to more than one action in a given settings section.
/// 36 2023-10-26 Add LegacyOnlineID to ScoreInfo. Move osu_scores_*_high IDs stored in OnlineID to LegacyOnlineID. Reset anomalous OnlineIDs.
/// 38 2023-12-10 Add EndTimeObjectCount and TotalObjectCount to BeatmapInfo.
/// 39 2023-12-19 Migrate any EndTimeObjectCount and TotalObjectCount values of 0 to -1 to better identify non-calculated values.
/// </summary>
private const int schema_version = 38;
private const int schema_version = 39;
/// <summary>
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
@@ -1095,6 +1096,20 @@ namespace osu.Game.Database
break;
}
case 39:
foreach (var b in migration.NewRealm.All<BeatmapInfo>())
{
// Either actually no objects, or processing ran and failed.
// Reset to -1 so the next time they become zero we know that processing was attempted.
if (b.TotalObjectCount == 0 && b.EndTimeObjectCount == 0)
{
b.TotalObjectCount = -1;
b.EndTimeObjectCount = -1;
}
}
break;
}
Logger.Log($"Migration completed in {stopwatch.ElapsedMilliseconds}ms");
@@ -26,7 +26,7 @@ namespace osu.Game.Database
if (score.IsLegacyScore)
return false;
if (score.TotalScoreVersion > 30000004)
if (score.TotalScoreVersion > 30000002)
return false;
// Recalculate the old-style standardised score to see if this was an old lazer score.
@@ -293,13 +293,23 @@ namespace osu.Game.Database
// Roughly corresponds to integrating f(combo) = combo ^ COMBO_EXPONENT (omitting constants)
double maximumAchievableComboPortionInStandardisedScore = Math.Pow(maximumLegacyCombo, 1 + ScoreProcessor.COMBO_EXPONENT);
double comboPortionInScoreV1 = maximumAchievableComboPortionInScoreV1 * comboProportion / score.Accuracy;
// This is - roughly - how much score, in the combo portion, the longest combo on this particular play would gain in score V1.
double comboPortionFromLongestComboInScoreV1 = Math.Pow(score.MaxCombo, 2);
// Same for standardised score.
double comboPortionFromLongestComboInStandardisedScore = Math.Pow(score.MaxCombo, 1 + ScoreProcessor.COMBO_EXPONENT);
// We estimate the combo portion of the score in score V1 terms.
// The division by accuracy is supposed to lessen the impact of accuracy on the combo portion,
// but in some edge cases it cannot sanely undo it.
// Therefore the resultant value is clamped from both sides for sanity.
// The clamp from below to `comboPortionFromLongestComboInScoreV1` targets near-FC scores wherein
// the player had bad accuracy at the end of their longest combo, which causes the division by accuracy
// to underestimate the combo portion.
// Ideally, this would be clamped from above to `maximumAchievableComboPortionInScoreV1` too,
// but in practice this appears to fail for some scores (https://github.com/ppy/osu/pull/25876#issuecomment-1862248413).
// TODO: investigate the above more closely
double comboPortionInScoreV1 = Math.Max(maximumAchievableComboPortionInScoreV1 * comboProportion / score.Accuracy, comboPortionFromLongestComboInScoreV1);
// Calculate how many times the longest combo the user has achieved in the play can repeat
// without exceeding the combo portion in score V1 as achieved by the player.
// This is a pessimistic estimate; it intentionally does not operate on object count and uses only score instead.
@@ -367,8 +377,8 @@ namespace osu.Game.Database
case 3:
return (long)Math.Round((
990000 * comboProportion
+ 10000 * Math.Pow(score.Accuracy, 2 + 2 * score.Accuracy)
850000 * comboProportion
+ 150000 * Math.Pow(score.Accuracy, 2 + 2 * score.Accuracy)
+ bonusProportion) * modMultiplier);
default:
+4 -1
View File
@@ -75,9 +75,12 @@ namespace osu.Game.Graphics
{
switch (result)
{
case HitResult.IgnoreMiss:
case HitResult.SmallTickMiss:
case HitResult.LargeTickMiss:
return Orange1;
case HitResult.Miss:
case HitResult.LargeTickMiss:
case HitResult.ComboBreak:
return Red;
@@ -97,8 +97,11 @@ namespace osu.Game.Online.Metadata
{
if (!connected.NewValue)
{
isWatchingUserPresence.Value = false;
userStates.Clear();
Schedule(() =>
{
isWatchingUserPresence.Value = false;
userStates.Clear();
});
return;
}
@@ -187,13 +190,13 @@ namespace osu.Game.Online.Metadata
public override Task UserPresenceUpdated(int userId, UserPresence? presence)
{
lock (userStates)
Schedule(() =>
{
if (presence != null)
userStates[userId] = presence.Value;
else
userStates.Remove(userId);
}
});
return Task.CompletedTask;
}
@@ -205,7 +208,7 @@ namespace osu.Game.Online.Metadata
Debug.Assert(connection != null);
await connection.InvokeAsync(nameof(IMetadataServer.BeginWatchingUserPresence)).ConfigureAwait(false);
isWatchingUserPresence.Value = true;
Schedule(() => isWatchingUserPresence.Value = true);
}
public override async Task EndWatchingUserPresence()
@@ -215,14 +218,14 @@ namespace osu.Game.Online.Metadata
if (connector?.IsConnected.Value != true)
throw new OperationCanceledException();
// must happen synchronously before any remote calls to avoid misordering.
userStates.Clear();
// must be scheduled before any remote calls to avoid mis-ordering.
Schedule(() => userStates.Clear());
Debug.Assert(connection != null);
await connection.InvokeAsync(nameof(IMetadataServer.EndWatchingUserPresence)).ConfigureAwait(false);
}
finally
{
isWatchingUserPresence.Value = false;
Schedule(() => isWatchingUserPresence.Value = false);
}
}
+2 -2
View File
@@ -1190,7 +1190,7 @@ namespace osu.Game
}
else if (recentLogCount == short_term_display_limit)
{
string logFile = $@"{entry.Target.Value.ToString().ToLowerInvariant()}.log";
string logFile = Logger.GetLogger(entry.Target.Value).Filename;
Schedule(() => Notifications.Post(new SimpleNotification
{
@@ -1198,7 +1198,7 @@ namespace osu.Game
Text = NotificationsStrings.SubsequentMessagesLogged,
Activated = () =>
{
Storage.GetStorageForDirectory(@"logs").PresentFileExternally(logFile);
Logger.Storage.PresentFileExternally(logFile);
return true;
}
}));
+16 -7
View File
@@ -132,6 +132,8 @@ namespace osu.Game.Overlays.Mods
protected ShearedToggleButton? CustomisationButton { get; private set; }
protected SelectAllModsButton? SelectAllModsButton { get; set; }
private bool textBoxShouldFocus;
private Sample? columnAppearSample;
private WorkingBeatmap? beatmap;
@@ -510,9 +512,9 @@ namespace osu.Game.Overlays.Mods
TopLevelContent.MoveToY(-modAreaHeight, transition_duration, Easing.InOutCubic);
if (customisationVisible.Value)
GetContainingInputManager().ChangeFocus(modSettingsArea);
SearchTextBox.KillFocus();
else
Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null));
setTextBoxFocus(textBoxShouldFocus);
}
/// <summary>
@@ -626,8 +628,7 @@ namespace osu.Game.Overlays.Mods
nonFilteredColumnCount += 1;
}
if (textSearchStartsActive.Value)
SearchTextBox.HoldFocus = true;
setTextBoxFocus(textSearchStartsActive.Value);
}
protected override void PopOut()
@@ -766,12 +767,20 @@ namespace osu.Game.Overlays.Mods
return false;
// TODO: should probably eventually support typical platform search shortcuts (`Ctrl-F`, `/`)
SearchTextBox.HoldFocus = !SearchTextBox.HoldFocus;
if (SearchTextBox.HoldFocus)
SearchTextBox.TakeFocus();
setTextBoxFocus(!textBoxShouldFocus);
return true;
}
private void setTextBoxFocus(bool keepFocus)
{
textBoxShouldFocus = keepFocus;
if (textBoxShouldFocus)
SearchTextBox.TakeFocus();
else
SearchTextBox.KillFocus();
}
#endregion
#region Sample playback control
@@ -38,18 +38,16 @@ namespace osu.Game.Rulesets.Judgements
/// </remarks>
public virtual void PlayAnimation()
{
switch (Result)
if (Result != HitResult.None && !Result.IsHit())
{
case HitResult.Miss:
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);
this.MoveTo(Vector2.Zero);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
this.MoveTo(Vector2.Zero);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
this.RotateTo(0);
this.RotateTo(40, 800, Easing.InQuint);
break;
this.RotateTo(0);
this.RotateTo(40, 800, Easing.InQuint);
}
this.FadeOutFromOne(800);
@@ -133,12 +133,11 @@ namespace osu.Game.Rulesets.Judgements
case HitResult.None:
break;
case HitResult.Miss:
ApplyMissAnimations();
break;
default:
ApplyHitAnimations();
if (Result.Type.IsHit())
ApplyHitAnimations();
else
ApplyMissAnimations();
break;
}
-31
View File
@@ -1,31 +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.Framework.Bindables;
using osu.Game.Configuration;
using osu.Game.Screens.Play;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModBlockFail : Mod, IApplicableFailOverride, IApplicableToHUD, IReadFromConfig
{
private readonly Bindable<bool> showHealthBar = new Bindable<bool>();
/// <summary>
/// We never fail, 'yo.
/// </summary>
public bool PerformFail() => false;
public bool RestartOnFail => false;
public void ReadFromConfig(OsuConfigManager config)
{
config.BindWith(OsuSetting.ShowHealthDisplayWhenCantFail, showHealthBar);
}
public void ApplyToHUD(HUDOverlay overlay)
{
overlay.ShowHealthBar.BindTo(showHealthBar);
}
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Mods
public override string Acronym => "CL";
public override double ScoreMultiplier => 0.5;
public override double ScoreMultiplier => 0.96;
public override IconUsage? Icon => FontAwesome.Solid.History;
+1 -1
View File
@@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Mods
{
public abstract class ModFailCondition : Mod, IApplicableToHealthProcessor, IApplicableFailOverride
{
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax) };
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail) };
[SettingSource("Restart on fail", "Automatically restarts when failed.")]
public BindableBool Restart { get; } = new BindableBool();
+24 -2
View File
@@ -2,13 +2,16 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Screens.Play;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModNoFail : ModBlockFail
public abstract class ModNoFail : Mod, IApplicableFailOverride, IApplicableToHUD, IReadFromConfig
{
public override string Name => "No Fail";
public override string Acronym => "NF";
@@ -16,6 +19,25 @@ namespace osu.Game.Rulesets.Mods
public override ModType Type => ModType.DifficultyReduction;
public override LocalisableString Description => "You can't fail, no matter what.";
public override double ScoreMultiplier => 0.5;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModFailCondition) };
public override Type[] IncompatibleMods => new[] { typeof(ModFailCondition) };
private readonly Bindable<bool> showHealthBar = new Bindable<bool>();
/// <summary>
/// We never fail, 'yo.
/// </summary>
public bool PerformFail() => false;
public bool RestartOnFail => false;
public void ReadFromConfig(OsuConfigManager config)
{
config.BindWith(OsuSetting.ShowHealthDisplayWhenCantFail, showHealthBar);
}
public void ApplyToHUD(HUDOverlay overlay)
{
overlay.ShowHealthBar.BindTo(showHealthBar);
}
}
}
+2 -2
View File
@@ -7,13 +7,13 @@ using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModRelax : ModBlockFail
public abstract class ModRelax : Mod
{
public override string Name => "Relax";
public override string Acronym => "RX";
public override IconUsage? Icon => OsuIcon.ModRelax;
public override ModType Type => ModType.Automation;
public override double ScoreMultiplier => 0.1;
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModNoFail), typeof(ModFailCondition) };
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay) };
}
}
+1 -1
View File
@@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Objects
/// </summary>
public readonly Bindable<double?> ExpectedDistance = new Bindable<double?>();
public bool HasValidLength => Distance > 0;
public bool HasValidLength => Precision.DefinitelyBigger(Distance, 0);
/// <summary>
/// The control points of the path.
+21
View File
@@ -86,6 +86,7 @@ namespace osu.Game.Rulesets.Scoring
/// Indicates a large tick miss.
/// </summary>
[EnumMember(Value = "large_tick_miss")]
[Description(@"x")]
[Order(10)]
LargeTickMiss,
@@ -117,6 +118,7 @@ namespace osu.Game.Rulesets.Scoring
/// Indicates a miss that should be ignored for scoring purposes.
/// </summary>
[EnumMember(Value = "ignore_miss")]
[Description("x")]
[Order(13)]
IgnoreMiss,
@@ -267,6 +269,25 @@ namespace osu.Game.Rulesets.Scoring
}
}
/// <summary>
/// Whether a <see cref="HitResult"/> represents a miss of any type.
/// </summary>
public static bool IsMiss(this HitResult result)
{
switch (result)
{
case HitResult.IgnoreMiss:
case HitResult.Miss:
case HitResult.SmallTickMiss:
case HitResult.LargeTickMiss:
case HitResult.ComboBreak:
return true;
default:
return false;
}
}
/// <summary>
/// Whether a <see cref="HitResult"/> represents a successful hit.
/// </summary>
+18 -6
View File
@@ -227,12 +227,12 @@ namespace osu.Game.Rulesets.Scoring
if (result.Judgement.MaxResult.AffectsAccuracy())
{
currentMaximumBaseScore += Judgement.ToNumericResult(result.Judgement.MaxResult);
currentMaximumBaseScore += GetMaxNumericResultFor(result);
currentAccuracyJudgementCount++;
}
if (result.Type.AffectsAccuracy())
currentBaseScore += Judgement.ToNumericResult(result.Type);
currentBaseScore += GetNumericResultFor(result);
if (result.Type.IsBonus())
currentBonusPortion += GetBonusScoreChange(result);
@@ -276,12 +276,12 @@ namespace osu.Game.Rulesets.Scoring
if (result.Judgement.MaxResult.AffectsAccuracy())
{
currentMaximumBaseScore -= Judgement.ToNumericResult(result.Judgement.MaxResult);
currentMaximumBaseScore -= GetMaxNumericResultFor(result);
currentAccuracyJudgementCount--;
}
if (result.Type.AffectsAccuracy())
currentBaseScore -= Judgement.ToNumericResult(result.Type);
currentBaseScore -= GetNumericResultFor(result);
if (result.Type.IsBonus())
currentBonusPortion -= GetBonusScoreChange(result);
@@ -297,9 +297,21 @@ namespace osu.Game.Rulesets.Scoring
updateScore();
}
protected virtual double GetBonusScoreChange(JudgementResult result) => Judgement.ToNumericResult(result.Type);
protected virtual double GetBonusScoreChange(JudgementResult result) => GetNumericResultFor(result);
protected virtual double GetComboScoreChange(JudgementResult result) => Judgement.ToNumericResult(result.Judgement.MaxResult) * Math.Pow(result.ComboAfterJudgement, COMBO_EXPONENT);
protected virtual double GetComboScoreChange(JudgementResult result) => GetMaxNumericResultFor(result) * Math.Pow(result.ComboAfterJudgement, COMBO_EXPONENT);
/// <summary>
/// Retrieves the numeric score representation for a <see cref="JudgementResult"/>.
/// </summary>
/// <param name="result">The <see cref="JudgementResult"/>.</param>
protected virtual double GetNumericResultFor(JudgementResult result) => result.Judgement.NumericResultFor(result);
/// <summary>
/// Retrieves the maximum numeric score representation for a <see cref="JudgementResult"/>.
/// </summary>
/// <param name="result">The <see cref="JudgementResult"/>.</param>
protected virtual double GetMaxNumericResultFor(JudgementResult result) => result.Judgement.MaxNumericResult;
protected virtual void ApplyScoreChange(JudgementResult result)
{
@@ -32,9 +32,11 @@ namespace osu.Game.Scoring.Legacy
/// <item><description>30000003: First version after converting legacy total score to standardised.</description></item>
/// <item><description>30000004: Fixed mod multipliers during legacy score conversion. Reconvert all scores.</description></item>
/// <item><description>30000005: Introduce combo exponent in the osu! gamemode. Reconvert all scores.</description></item>
/// <item><description>30000006: Fix edge cases in conversion after combo exponent introduction that lead to NaNs. Reconvert all scores.</description></item>
/// <item><description>30000007: Adjust osu!mania combo and accuracy portions and judgement scoring values. Reconvert all scores.</description></item>
/// </list>
/// </remarks>
public const int LATEST_VERSION = 30000005;
public const int LATEST_VERSION = 30000007;
/// <summary>
/// The first stable-compatible YYYYMMDD format version given to lazer usage of replays.
@@ -409,7 +409,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
double lengthOfOneRepeat = repeatHitObject.Duration / (repeatHitObject.RepeatCount + 1);
int proposedCount = Math.Max(0, (int)Math.Round(proposedDuration / lengthOfOneRepeat) - 1);
if (proposedCount == repeatHitObject.RepeatCount || lengthOfOneRepeat == 0)
if (proposedCount == repeatHitObject.RepeatCount || Precision.AlmostEquals(lengthOfOneRepeat, 0))
return;
repeatHitObject.RepeatCount = proposedCount;
+131 -79
View File
@@ -269,8 +269,30 @@ namespace osu.Game.Screens.Select
if (changes == null)
return;
foreach (int i in changes.InsertedIndices)
removeBeatmapSet(sender[i].ID);
var removeableSets = changes.InsertedIndices.Select(i => sender[i].ID).ToHashSet();
// This schedule is required to retain selection of beatmaps over an ImportAsUpdate operation.
// This is covered by TestPlaySongSelect.TestSelectionRetainedOnBeatmapUpdate.
//
// In short, we have specialised logic in `beatmapSetsChanged` (directly below) to infer that an
// update operation has occurred. For this to work, we need to confirm the `DeletePending` flag
// of the current selection.
//
// If we don't schedule the following code, it is possible for the `deleteBeatmapSetsChanged` handler
// to be invoked before the `beatmapSetsChanged` handler (realm call order seems non-deterministic)
// which will lead to the currently selected beatmap changing via `CarouselGroupEagerSelect`.
//
// We need a better path forward here. A few ideas:
// - Avoid the necessity of having realm subscriptions on deleted/hidden items, maybe by storing all guids in realm
// to a local list so we can better look them up on receiving `DeletedIndices`.
// - Add a new property on `BeatmapSetInfo` to link to the pre-update set, and use that to handle the update case.
Schedule(() =>
{
foreach (var set in removeableSets)
removeBeatmapSet(set);
invalidateAfterChange();
});
}
private void beatmapSetsChanged(IRealmCollection<BeatmapSetInfo> sender, ChangeSet? changes)
@@ -279,6 +301,9 @@ namespace osu.Game.Screens.Select
if (loadedTestBeatmaps)
return;
var setsRequiringUpdate = new HashSet<BeatmapSetInfo>();
var setsRequiringRemoval = new HashSet<Guid>();
if (changes == null)
{
// During initial population, we must manually account for the fact that our original query was done on an async thread.
@@ -292,67 +317,80 @@ namespace osu.Game.Screens.Select
foreach (var id in realmSets)
{
if (!root.BeatmapSetsByID.ContainsKey(id))
updateBeatmapSet(realm.Realm.Find<BeatmapSetInfo>(id)!.Detach());
setsRequiringUpdate.Add(realm.Realm.Find<BeatmapSetInfo>(id)!.Detach());
}
foreach (var id in root.BeatmapSetsByID.Keys)
{
if (!realmSets.Contains(id))
removeBeatmapSet(id);
setsRequiringRemoval.Add(id);
}
}
else
{
foreach (int i in changes.NewModifiedIndices)
setsRequiringUpdate.Add(sender[i].Detach());
invalidateAfterChange();
BeatmapSetsLoaded = true;
return;
foreach (int i in changes.InsertedIndices)
setsRequiringUpdate.Add(sender[i].Detach());
}
foreach (int i in changes.NewModifiedIndices)
updateBeatmapSet(sender[i].Detach());
foreach (int i in changes.InsertedIndices)
updateBeatmapSet(sender[i].Detach());
if (changes.DeletedIndices.Length > 0 && SelectedBeatmapInfo != null)
// All local operations must be scheduled.
//
// If we don't schedule, beatmaps getting changed while song select is suspended (ie. last played being updated)
// will cause unexpected sounds and operations to occur in the background.
Schedule(() =>
{
// If SelectedBeatmapInfo is non-null, the set should also be non-null.
Debug.Assert(SelectedBeatmapSet != null);
// To handle the beatmap update flow, attempt to track selection changes across delete-insert transactions.
// When an update occurs, the previous beatmap set is either soft or hard deleted.
// Check if the current selection was potentially deleted by re-querying its validity.
bool selectedSetMarkedDeleted = realm.Run(r => r.Find<BeatmapSetInfo>(SelectedBeatmapSet.ID))?.DeletePending != false;
int[] modifiedAndInserted = changes.NewModifiedIndices.Concat(changes.InsertedIndices).ToArray();
if (selectedSetMarkedDeleted && modifiedAndInserted.Any())
try
{
// If it is no longer valid, make the bold assumption that an updated version will be available in the modified/inserted indices.
// This relies on the full update operation being in a single transaction, so please don't change that.
foreach (int i in modifiedAndInserted)
foreach (var set in setsRequiringRemoval)
removeBeatmapSet(set);
foreach (var set in setsRequiringUpdate)
updateBeatmapSet(set);
if (changes?.DeletedIndices.Length > 0 && SelectedBeatmapInfo != null)
{
var beatmapSetInfo = sender[i];
// If SelectedBeatmapInfo is non-null, the set should also be non-null.
Debug.Assert(SelectedBeatmapSet != null);
foreach (var beatmapInfo in beatmapSetInfo.Beatmaps)
// To handle the beatmap update flow, attempt to track selection changes across delete-insert transactions.
// When an update occurs, the previous beatmap set is either soft or hard deleted.
// Check if the current selection was potentially deleted by re-querying its validity.
bool selectedSetMarkedDeleted = realm.Run(r => r.Find<BeatmapSetInfo>(SelectedBeatmapSet.ID)?.DeletePending != false);
if (selectedSetMarkedDeleted && setsRequiringUpdate.Any())
{
if (!((IBeatmapMetadataInfo)beatmapInfo.Metadata).Equals(SelectedBeatmapInfo.Metadata))
continue;
// Best effort matching. We can't use ID because in the update flow a new version will get its own GUID.
if (beatmapInfo.DifficultyName == SelectedBeatmapInfo.DifficultyName)
// If it is no longer valid, make the bold assumption that an updated version will be available in the modified/inserted indices.
// This relies on the full update operation being in a single transaction, so please don't change that.
foreach (var set in setsRequiringUpdate)
{
SelectBeatmap(beatmapInfo);
return;
foreach (var beatmapInfo in set.Beatmaps)
{
if (!((IBeatmapMetadataInfo)beatmapInfo.Metadata).Equals(SelectedBeatmapInfo.Metadata))
continue;
// Best effort matching. We can't use ID because in the update flow a new version will get its own GUID.
if (beatmapInfo.DifficultyName == SelectedBeatmapInfo.DifficultyName)
{
SelectBeatmap(beatmapInfo);
return;
}
}
}
// If a direct selection couldn't be made, it's feasible that the difficulty name (or beatmap metadata) changed.
// Let's attempt to follow set-level selection anyway.
SelectBeatmap(setsRequiringUpdate.First().Beatmaps.First());
}
}
// If a direct selection couldn't be made, it's feasible that the difficulty name (or beatmap metadata) changed.
// Let's attempt to follow set-level selection anyway.
SelectBeatmap(sender[modifiedAndInserted.First()].Beatmaps.First());
}
}
invalidateAfterChange();
finally
{
BeatmapSetsLoaded = true;
invalidateAfterChange();
}
});
}
private void beatmapsChanged(IRealmCollection<BeatmapInfo> sender, ChangeSet? changes)
@@ -417,30 +455,13 @@ namespace osu.Game.Screens.Select
private void updateBeatmapSet(BeatmapSetInfo beatmapSet)
{
Guid? previouslySelectedID = null;
originalBeatmapSetsDetached.RemoveAll(set => set.ID == beatmapSet.ID);
originalBeatmapSetsDetached.Add(beatmapSet.Detach());
// If the selected beatmap is about to be removed, store its ID so it can be re-selected if required
if (selectedBeatmapSet?.BeatmapSet.ID == beatmapSet.ID)
previouslySelectedID = selectedBeatmap?.BeatmapInfo.ID;
var removedSets = root.RemoveItemsByID(beatmapSet.ID);
foreach (var removedSet in removedSets)
{
// If we don't remove this here, it may remain in a hidden state until scrolled off screen.
// Doesn't really affect anything during actual user interaction, but makes testing annoying.
var removedDrawable = Scroll.FirstOrDefault(c => c.Item == removedSet);
if (removedDrawable != null)
expirePanelImmediately(removedDrawable);
}
var newSets = new List<CarouselBeatmapSet>();
if (beatmapsSplitOut)
{
var newSets = new List<CarouselBeatmapSet>();
foreach (var beatmap in beatmapSet.Beatmaps)
{
var newSet = createCarouselSet(new BeatmapSetInfo(new[] { beatmap })
@@ -451,18 +472,7 @@ namespace osu.Game.Screens.Select
});
if (newSet != null)
{
newSets.Add(newSet);
root.AddItem(newSet);
}
}
// check if we can/need to maintain our current selection.
if (previouslySelectedID != null)
{
var toSelect = newSets.FirstOrDefault(s => s.Beatmaps.Any(b => b.BeatmapInfo.ID == previouslySelectedID))
?? newSets.FirstOrDefault();
select(toSelect);
}
}
else
@@ -470,13 +480,18 @@ namespace osu.Game.Screens.Select
var newSet = createCarouselSet(beatmapSet);
if (newSet != null)
{
root.AddItem(newSet);
newSets.Add(newSet);
}
// check if we can/need to maintain our current selection.
if (previouslySelectedID != null)
select((CarouselItem?)newSet.Beatmaps.FirstOrDefault(b => b.BeatmapInfo.ID == previouslySelectedID) ?? newSet);
}
var removedSets = root.ReplaceItem(beatmapSet, newSets);
// If we don't remove these here, it may remain in a hidden state until scrolled off screen.
// Doesn't really affect anything during actual user interaction, but makes testing annoying.
foreach (var removedSet in removedSets)
{
var removedDrawable = Scroll.FirstOrDefault(c => c.Item == removedSet);
if (removedDrawable != null)
expirePanelImmediately(removedDrawable);
}
}
@@ -1169,6 +1184,43 @@ namespace osu.Game.Screens.Select
base.AddItem(i);
}
/// <summary>
/// A special method to handle replace operations (general for updating a beatmap).
/// Avoids event-driven selection flip-flopping during the remove/add process.
/// </summary>
/// <param name="oldItem">The beatmap set to be replaced.</param>
/// <param name="newItems">All new items to replace the removed beatmap set.</param>
/// <returns>All removed items, for any further processing.</returns>
public IEnumerable<CarouselBeatmapSet> ReplaceItem(BeatmapSetInfo oldItem, List<CarouselBeatmapSet> newItems)
{
var previousSelection = (LastSelected as CarouselBeatmapSet)?.Beatmaps
.FirstOrDefault(s => s.State.Value == CarouselItemState.Selected)
?.BeatmapInfo;
bool wasSelected = previousSelection?.BeatmapSet?.ID == oldItem.ID;
// Without doing this, the removal of the old beatmap will cause carousel's eager selection
// logic to invoke, causing one unnecessary selection.
DisableSelection = true;
var removedSets = RemoveItemsByID(oldItem.ID);
DisableSelection = false;
foreach (var set in newItems)
AddItem(set);
// Check if we can/need to maintain our current selection.
if (wasSelected)
{
CarouselBeatmap? matchingBeatmap = newItems.SelectMany(s => s.Beatmaps)
.FirstOrDefault(b => b.BeatmapInfo.ID == previousSelection?.ID);
if (matchingBeatmap != null)
matchingBeatmap.State.Value = CarouselItemState.Selected;
}
return removedSets;
}
public IEnumerable<CarouselBeatmapSet> RemoveItemsByID(Guid beatmapSetID)
{
if (BeatmapSetsByID.TryGetValue(beatmapSetID, out var carouselBeatmapSets))
+6 -17
View File
@@ -3,7 +3,6 @@
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@@ -19,7 +18,6 @@ using osu.Game.Overlays.BeatmapSet;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Screens.Select.Details;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Select
{
@@ -28,7 +26,6 @@ namespace osu.Game.Screens.Select
private const float spacing = 10;
private const float transition_duration = 250;
private readonly AdvancedStats advanced;
private readonly UserRatings ratingsDisplay;
private readonly MetadataSection description, source, tags;
private readonly Container failRetryContainer;
@@ -68,12 +65,15 @@ namespace osu.Game.Screens.Select
public BeatmapDetails()
{
CornerRadius = 10;
Masking = true;
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0.5f),
Colour = Colour4.Black.Opacity(0.3f),
},
new Container
{
@@ -109,12 +109,6 @@ namespace osu.Game.Screens.Select
Padding = new MarginPadding { Right = spacing / 2 },
Children = new[]
{
new DetailBox().WithChild(advanced = new AdvancedStats
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = spacing, Top = spacing * 2, Bottom = spacing },
}),
new DetailBox().WithChild(new OnlineViewContainer(string.Empty)
{
RelativeSizeAxes = Axes.X,
@@ -129,7 +123,8 @@ namespace osu.Game.Screens.Select
},
new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.X,
Height = 250,
Width = 0.5f,
ScrollbarVisible = false,
Padding = new MarginPadding { Left = spacing / 2 },
@@ -180,7 +175,6 @@ namespace osu.Game.Screens.Select
private void updateStatistics()
{
advanced.BeatmapInfo = BeatmapInfo;
description.Metadata = BeatmapInfo?.DifficultyName ?? string.Empty;
source.Metadata = BeatmapInfo?.Metadata.Source ?? string.Empty;
tags.Metadata = BeatmapInfo?.Metadata.Tags ?? string.Empty;
@@ -279,11 +273,6 @@ namespace osu.Game.Screens.Select
InternalChildren = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0.5f),
},
content = new Container
{
RelativeSizeAxes = Axes.X,
+2 -2
View File
@@ -61,7 +61,7 @@ namespace osu.Game.Screens.Select
{
Type = EdgeEffectType.Glow,
Colour = new Color4(130, 204, 255, 150),
Radius = 20,
Radius = 15,
Roundness = 15,
};
}
@@ -305,7 +305,7 @@ namespace osu.Game.Screens.Select
},
infoLabelContainer = new FillFlowContainer
{
Margin = new MarginPadding { Top = 20 },
Margin = new MarginPadding { Top = 8 },
Spacing = new Vector2(20, 0),
AutoSizeAxes = Axes.Both,
}
@@ -45,7 +45,7 @@ namespace osu.Game.Screens.Select.Carousel
.ForEach(AddItem);
}
protected override CarouselItem? GetNextToSelect()
public override CarouselItem? GetNextToSelect()
{
if (LastSelected == null || LastSelected.Filtered.Value)
{
@@ -102,7 +102,7 @@ namespace osu.Game.Screens.Select.Carousel
}
// Sorting is expensive, so only perform if it's actually changed.
if (lastCriteria?.Sort != criteria.Sort)
if (lastCriteria?.RequiresSorting(criteria) != false)
{
criteriaComparer = Comparer<CarouselItem>.Create((x, y) =>
{
@@ -36,13 +36,13 @@ namespace osu.Game.Screens.Select.Carousel
/// items have been filtered. This bool will be true during the base <see cref="Filter(FilterCriteria)"/>
/// operation.
/// </summary>
private bool filteringItems;
protected bool DisableSelection;
public override void Filter(FilterCriteria criteria)
{
filteringItems = true;
DisableSelection = true;
base.Filter(criteria);
filteringItems = false;
DisableSelection = false;
attemptSelection();
}
@@ -95,7 +95,7 @@ namespace osu.Game.Screens.Select.Carousel
private void attemptSelection()
{
if (filteringItems) return;
if (DisableSelection) return;
// we only perform eager selection if we are a currently selected group.
if (State.Value != CarouselItemState.Selected) return;
@@ -110,7 +110,7 @@ namespace osu.Game.Screens.Select.Carousel
/// Finds the item this group would select next if it attempted selection
/// </summary>
/// <returns>An unfiltered item nearest to the last selected one or null if all items are filtered</returns>
protected virtual CarouselItem? GetNextToSelect()
public virtual CarouselItem? GetNextToSelect()
{
if (Items.Count == 0)
return null;
@@ -91,7 +91,7 @@ namespace osu.Game.Screens.Select.Carousel
if (songSelect != null)
{
mainMenuItems = songSelect.CreateForwardNavigationMenuItemsForBeatmap(beatmapInfo);
mainMenuItems = songSelect.CreateForwardNavigationMenuItemsForBeatmap(() => beatmapInfo);
selectRequested = b => songSelect.FinaliseSelection(b);
}
@@ -44,6 +44,8 @@ namespace osu.Game.Screens.Select.Carousel
private Task? beatmapsLoadTask;
private MenuItem[]? mainMenuItems;
[Resolved]
private BeatmapManager manager { get; set; } = null!;
@@ -57,8 +59,11 @@ namespace osu.Game.Screens.Select.Carousel
}
[BackgroundDependencyLoader]
private void load(BeatmapSetOverlay? beatmapOverlay)
private void load(BeatmapSetOverlay? beatmapOverlay, SongSelect? songSelect)
{
if (songSelect != null)
mainMenuItems = songSelect.CreateForwardNavigationMenuItemsForBeatmap(() => (((CarouselBeatmapSet)Item!).GetNextToSelect() as CarouselBeatmap)!.BeatmapInfo);
restoreHiddenRequested = s =>
{
foreach (var b in s.Beatmaps)
@@ -222,6 +227,9 @@ namespace osu.Game.Screens.Select.Carousel
if (Item?.State.Value == CarouselItemState.NotSelected)
items.Add(new OsuMenuItem("Expand", MenuItemType.Highlighted, () => Item.State.Value = CarouselItemState.Selected));
if (mainMenuItems != null)
items.AddRange(mainMenuItems);
if (beatmapSet.OnlineID > 0 && viewDetails != null)
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => viewDetails(beatmapSet.OnlineID)));
@@ -64,21 +64,67 @@ namespace osu.Game.Screens.Select.Details
}
}
public AdvancedStats()
public AdvancedStats(int columns = 1)
{
Child = new FillFlowContainer
switch (columns)
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
{
FirstValue = new StatisticRow(), // circle size/key amount
HpDrain = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsDrain },
Accuracy = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAccuracy },
ApproachRate = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAr },
starDifficulty = new StatisticRow(10, true) { Title = BeatmapsetsStrings.ShowStatsStars },
},
};
case 1:
Child = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
{
FirstValue = new StatisticRow(), // circle size/key amount
HpDrain = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsDrain },
Accuracy = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAccuracy },
ApproachRate = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAr },
starDifficulty = new StatisticRow(10, true) { Title = BeatmapsetsStrings.ShowStatsStars },
},
};
break;
case 2:
Child = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Full,
Children = new[]
{
FirstValue = new StatisticRow
{
Width = 0.5f,
Padding = new MarginPadding { Right = 5, Vertical = 2.5f },
}, // circle size/key amount
HpDrain = new StatisticRow
{
Title = BeatmapsetsStrings.ShowStatsDrain,
Width = 0.5f,
Padding = new MarginPadding { Left = 5, Vertical = 2.5f },
},
Accuracy = new StatisticRow
{
Title = BeatmapsetsStrings.ShowStatsAccuracy,
Width = 0.5f,
Padding = new MarginPadding { Right = 5, Vertical = 2.5f },
},
ApproachRate = new StatisticRow
{
Title = BeatmapsetsStrings.ShowStatsAr,
Width = 0.5f,
Padding = new MarginPadding { Left = 5, Vertical = 2.5f },
},
starDifficulty = new StatisticRow(10, true)
{
Title = BeatmapsetsStrings.ShowStatsStars,
Width = 0.5f,
Padding = new MarginPadding { Right = 5, Vertical = 2.5f },
},
},
};
break;
}
}
[BackgroundDependencyLoader]
@@ -289,23 +335,36 @@ namespace osu.Game.Screens.Select.Details
Font = OsuFont.GetFont(size: 12)
},
},
bar = new Bar
new Container
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Height = 5,
BackgroundColour = Color4.White.Opacity(0.5f),
Padding = new MarginPadding { Left = name_width + 10, Right = value_width + 10 },
},
ModBar = new Bar
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Alpha = 0.5f,
Height = 5,
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = name_width + 10, Right = value_width + 10 },
Children = new Drawable[]
{
new Container
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Height = 5,
CornerRadius = 2,
Masking = true,
Children = new Drawable[]
{
bar = new Bar
{
RelativeSizeAxes = Axes.Both,
BackgroundColour = Color4.White.Opacity(0.5f),
},
ModBar = new Bar
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.5f,
},
}
},
}
},
new Container
{
+38
View File
@@ -219,6 +219,44 @@ namespace osu.Game.Screens.Select
public bool Equals(OptionalTextFilter other) => SearchTerm == other.SearchTerm;
}
/// <summary>
/// Given a new filter criteria, decide whether a full sort needs to be performed.
/// </summary>
/// <param name="newCriteria"></param>
/// <returns></returns>
public bool RequiresSorting(FilterCriteria newCriteria)
{
if (Sort != newCriteria.Sort)
return true;
switch (Sort)
{
// Some sorts are stable across all other changes.
// Running these sorts will sort all items, including currently hidden items.
case SortMode.Artist:
case SortMode.Author:
case SortMode.DateSubmitted:
case SortMode.DateAdded:
case SortMode.DateRanked:
case SortMode.Source:
case SortMode.Title:
return false;
// Some sorts use aggregate max comparisons, which will change based on filtered items.
// These sorts generally ignore items hidden by filtered state, so we must force a sort under all circumstances here.
//
// This makes things very slow when typing a text search, and we probably want to consider a way to optimise things going forward.
case SortMode.LastPlayed:
case SortMode.BPM:
case SortMode.Length:
case SortMode.Difficulty:
return true;
default:
throw new ArgumentOutOfRangeException(nameof(Sort), Sort, "Unknown sort mode");
}
}
public enum MatchMode
{
/// <summary>
+4 -3
View File
@@ -1,6 +1,7 @@
// 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 osu.Framework.Allocation;
@@ -34,10 +35,10 @@ namespace osu.Game.Screens.Select
public override bool AllowExternalScreenChange => true;
public override MenuItem[] CreateForwardNavigationMenuItemsForBeatmap(BeatmapInfo beatmap) => new MenuItem[]
public override MenuItem[] CreateForwardNavigationMenuItemsForBeatmap(Func<BeatmapInfo> getBeatmap) => new MenuItem[]
{
new OsuMenuItem(ButtonSystemStrings.Play.ToSentence(), MenuItemType.Highlighted, () => FinaliseSelection(beatmap)),
new OsuMenuItem(ButtonSystemStrings.Edit.ToSentence(), MenuItemType.Standard, () => Edit(beatmap))
new OsuMenuItem(ButtonSystemStrings.Play.ToSentence(), MenuItemType.Highlighted, () => FinaliseSelection(getBeatmap())),
new OsuMenuItem(ButtonSystemStrings.Edit.ToSentence(), MenuItemType.Standard, () => Edit(getBeatmap()))
};
protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap();
+48 -6
View File
@@ -13,6 +13,7 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Bindings;
@@ -35,6 +36,7 @@ using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play;
using osu.Game.Screens.Select.Details;
using osu.Game.Screens.Select.Options;
using osu.Game.Skinning;
using osuTK;
@@ -45,7 +47,7 @@ namespace osu.Game.Screens.Select
{
public abstract partial class SongSelect : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>
{
public static readonly float WEDGE_HEIGHT = 245;
public static readonly float WEDGE_HEIGHT = 200;
protected const float BACKGROUND_BLUR = 20;
private const float left_area_padding = 20;
@@ -89,11 +91,11 @@ namespace osu.Game.Screens.Select
/// Creates any "action" menu items for the provided beatmap (ie. "Select", "Play", "Edit").
/// These will always be placed at the top of the context menu, with common items added below them.
/// </summary>
/// <param name="beatmap">The beatmap to create items for.</param>
/// <param name="getBeatmap">The beatmap to create items for.</param>
/// <returns>The menu items.</returns>
public virtual MenuItem[] CreateForwardNavigationMenuItemsForBeatmap(BeatmapInfo beatmap) => new MenuItem[]
public virtual MenuItem[] CreateForwardNavigationMenuItemsForBeatmap(Func<BeatmapInfo> getBeatmap) => new MenuItem[]
{
new OsuMenuItem(@"Select", MenuItemType.Highlighted, () => FinaliseSelection(beatmap))
new OsuMenuItem(@"Select", MenuItemType.Highlighted, () => FinaliseSelection(getBeatmap()))
};
[Resolved]
@@ -132,6 +134,8 @@ namespace osu.Game.Screens.Select
private IDisposable? modSelectOverlayRegistration;
private AdvancedStats advancedStats = null!;
[Resolved]
private MusicController music { get; set; } = null!;
@@ -235,7 +239,7 @@ namespace osu.Game.Screens.Select
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = left_area_padding },
Padding = new MarginPadding { Top = 5 },
Children = new Drawable[]
{
new LeftSideInteractionContainer(() => Carousel.ScrollToSelected())
@@ -253,12 +257,48 @@ namespace osu.Game.Screens.Select
},
},
new Container
{
RelativeSizeAxes = Axes.X,
Height = 90,
Padding = new MarginPadding(10)
{
Left = left_area_padding,
Right = left_area_padding * 2 + 5,
},
Y = WEDGE_HEIGHT,
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 10,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Colour4.Black.Opacity(0.3f),
},
advancedStats = new AdvancedStats(2)
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Padding = new MarginPadding(10)
},
}
},
}
},
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding
{
Bottom = Footer.HEIGHT,
Top = WEDGE_HEIGHT,
Top = WEDGE_HEIGHT + 70,
Left = left_area_padding,
Right = left_area_padding * 2,
},
@@ -797,6 +837,8 @@ namespace osu.Game.Screens.Select
ModSelect.Beatmap = beatmap;
advancedStats.BeatmapInfo = beatmap.BeatmapInfo;
bool beatmapSelected = beatmap is not DummyWorkingBeatmap;
if (beatmapSelected)
+1 -1
View File
@@ -50,7 +50,7 @@ namespace osu.Game.Skinning
});
}
if (result != HitResult.Miss)
if (!result.IsMiss())
{
//new judgement shows old as a temporary effect
AddInternal(temporaryOldStyle = new LegacyJudgementPieceOld(result, createMainDrawable, 1.05f, true)
+22 -16
View File
@@ -52,9 +52,17 @@ namespace osu.Game.Skinning
if (animation?.FrameCount > 1 && !forceTransforms)
return;
switch (result)
if (result.IsMiss())
{
case HitResult.Miss:
bool isTick = result != HitResult.Miss;
if (isTick)
{
this.ScaleTo(0.6f);
this.ScaleTo(0.3f, 100, Easing.In);
}
else
{
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);
@@ -71,20 +79,18 @@ namespace osu.Game.Skinning
this.RotateTo(0);
this.RotateTo(rotation, fade_in_length)
.Then().RotateTo(rotation * 2, fade_out_delay + fade_out_length - fade_in_length, Easing.In);
break;
default:
this.ScaleTo(0.6f).Then()
.ScaleTo(1.1f, fade_in_length * 0.8f).Then() // t = 0.8
.Delay(fade_in_length * 0.2f) // t = 1.0
.ScaleTo(0.9f, fade_in_length * 0.2f).Then() // t = 1.2
// stable dictates scale of 0.9->1 over time 1.0 to 1.4, but we are already at 1.2.
// so we need to force the current value to be correct at 1.2 (0.95) then complete the
// second half of the transform.
.ScaleTo(0.95f).ScaleTo(finalScale, fade_in_length * 0.2f); // t = 1.4
break;
}
}
else
{
this.ScaleTo(0.6f).Then()
.ScaleTo(1.1f, fade_in_length * 0.8f).Then() // t = 0.8
.Delay(fade_in_length * 0.2f) // t = 1.0
.ScaleTo(0.9f, fade_in_length * 0.2f).Then() // t = 1.2
// stable dictates scale of 0.9->1 over time 1.0 to 1.4, but we are already at 1.2.
// so we need to force the current value to be correct at 1.2 (0.95) then complete the
// second half of the transform.
.ScaleTo(0.95f).ScaleTo(finalScale, fade_in_length * 0.2f); // t = 1.4
}
}
+3 -3
View File
@@ -453,11 +453,11 @@ namespace osu.Game.Skinning
private Drawable? getJudgementAnimation(HitResult result)
{
if (result.IsMiss())
return this.GetAnimation("hit0", true, false);
switch (result)
{
case HitResult.Miss:
return this.GetAnimation("hit0", true, false);
case HitResult.Meh:
return this.GetAnimation("hit50", true, false);