Compare commits
75 Commits
4c10d941b3
...
c37f72f567
| Author | SHA1 | Date | |
|---|---|---|---|
| c37f72f567 | |||
|
|
47fecfb669 | ||
|
|
3b49673e83 | ||
|
|
b1296b0c83 | ||
|
|
33df7dc5e5 | ||
|
|
7c3249c24c | ||
|
|
35ab30e83f | ||
|
|
aba160fb62 | ||
|
|
ceb8a621ff | ||
|
|
cf38bdfb04 | ||
|
|
a337c8bb99 | ||
|
|
807ba111fd | ||
|
|
fde2887068 | ||
|
|
49bb157fb8 | ||
|
|
b2dbd4a9dc | ||
|
|
8dd349fd17 | ||
|
|
df210241fc | ||
|
|
d696ac99d4 | ||
|
|
777ab61143 | ||
|
|
fe612d465b | ||
|
|
d26f31b71d | ||
|
|
59ec6ed2eb | ||
|
|
5b1b22cb66 | ||
|
|
a1fb7acef3 | ||
|
|
e77fb987a9 | ||
|
|
c4163e33e5 | ||
|
|
a96d00a55f | ||
|
|
6a16200314 | ||
|
|
4d1ecab4e3 | ||
|
|
f2839c7b65 | ||
|
|
0bcf29304b | ||
|
|
7b455efe34 | ||
|
|
14530fe894 | ||
|
|
148bc4ac34 | ||
|
|
375da52a34 | ||
|
|
cd7a304640 | ||
|
|
bcc9bc4498 | ||
|
|
5fc5d0bd5f | ||
|
|
18803fbec0 | ||
|
|
9542e77d16 | ||
|
|
0fa0568f13 | ||
|
|
771081b9a7 | ||
|
|
20921577d7 | ||
|
|
84c0bd0052 | ||
|
|
398ac1b98d | ||
|
|
00fd22841d | ||
|
|
e487f20f1b | ||
|
|
33ab00ecd8 | ||
|
|
098ade2cfa | ||
|
|
0b5251fcf4 | ||
|
|
55bc043719 | ||
|
|
bf70552186 | ||
|
|
9e3c7e2ca9 | ||
|
|
d22435b55f | ||
|
|
4e0dca69ed | ||
|
|
5ffb92b638 | ||
|
|
1cd2331d28 | ||
|
|
814f39058e | ||
|
|
f61cb3caa7 | ||
|
|
07d81c0824 | ||
|
|
3195681805 | ||
|
|
77a2ac8f42 | ||
|
|
6eda09aff4 | ||
|
|
380c3d0444 | ||
|
|
ad1fdc631d | ||
|
|
c16ef5eac3 | ||
|
|
f9076183d0 | ||
|
|
6fa6de7c27 | ||
|
|
daff00300a | ||
|
|
72d97f4ad6 | ||
|
|
3e56633882 | ||
|
|
18d3e9154f | ||
|
|
eae4227c5a | ||
|
|
de65e90abf | ||
|
|
01815de675 |
@@ -21,9 +21,9 @@ namespace osu.Desktop
|
||||
public static class Program
|
||||
{
|
||||
#if DEBUG
|
||||
private const string base_game_name = @"osu-development";
|
||||
private const string base_game_name = @"jvnkosu-development";
|
||||
#else
|
||||
private const string base_game_name = @"osu";
|
||||
private const string base_game_name = @"jvnkosu";
|
||||
#endif
|
||||
|
||||
private static LegacyTcpIpcProvider? legacyIpc;
|
||||
|
||||
BIN
osu.Game.Rulesets.Osu.Tests/Resources/old-skin/sliderpoint10.png
Normal file
BIN
osu.Game.Rulesets.Osu.Tests/Resources/old-skin/sliderpoint10.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
BIN
osu.Game.Rulesets.Osu.Tests/Resources/old-skin/sliderpoint30.png
Normal file
BIN
osu.Game.Rulesets.Osu.Tests/Resources/old-skin/sliderpoint30.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
162
osu.Game.Rulesets.Osu.Tests/TestSceneAimErrorMeter.cs
Normal file
162
osu.Game.Rulesets.Osu.Tests/TestSceneAimErrorMeter.cs
Normal file
@@ -0,0 +1,162 @@
|
||||
// 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 osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Rulesets.Osu.HUD;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
public partial class TestSceneAimErrorMeter : OsuManualInputManagerTestScene
|
||||
{
|
||||
private DependencyProvidingContainer dependencyContainer = null!;
|
||||
private ScoreProcessor scoreProcessor = null!;
|
||||
|
||||
private TestAimErrorMeter aimErrorMeter = null!;
|
||||
|
||||
private CircularContainer gameObject = null!;
|
||||
|
||||
private ScheduledDelegate? automaticAdditionDelegate;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
AddSliderStep("Hit marker size", 0f, 12f, 7f, t =>
|
||||
{
|
||||
if (aimErrorMeter.IsNotNull())
|
||||
aimErrorMeter.HitMarkerSize.Value = t;
|
||||
});
|
||||
AddSliderStep("Average position marker size", 1f, 25f, 7f, t =>
|
||||
{
|
||||
if (aimErrorMeter.IsNotNull())
|
||||
aimErrorMeter.AverageMarkerSize.Value = t;
|
||||
});
|
||||
}
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetupSteps() => AddStep("Create components", () =>
|
||||
{
|
||||
automaticAdditionDelegate?.Cancel();
|
||||
automaticAdditionDelegate = null;
|
||||
|
||||
var ruleset = new OsuRuleset();
|
||||
|
||||
scoreProcessor = new ScoreProcessor(ruleset);
|
||||
Child = dependencyContainer = new DependencyProvidingContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
CachedDependencies = new (Type, object)[]
|
||||
{
|
||||
(typeof(ScoreProcessor), scoreProcessor)
|
||||
}
|
||||
};
|
||||
dependencyContainer.Children = new Drawable[]
|
||||
{
|
||||
aimErrorMeter = new TestAimErrorMeter
|
||||
{
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Top = 100
|
||||
},
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Scale = new Vector2(2),
|
||||
},
|
||||
|
||||
gameObject = new CircularContainer
|
||||
{
|
||||
Size = new Vector2(2 * OsuHitObject.OBJECT_RADIUS),
|
||||
Position = new Vector2(256, 192),
|
||||
Colour = Color4.Yellow,
|
||||
Masking = true,
|
||||
BorderThickness = 2,
|
||||
BorderColour = Color4.White,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(4),
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
// the division by 2 is because CS=5 applies a 0.5x (plus fudge) multiplier to `OBJECT_RADIUS`
|
||||
aimErrorMeter.AddPoint((gameObject.ToLocalSpace(e.ScreenSpaceMouseDownPosition) - new Vector2(OsuHitObject.OBJECT_RADIUS)) / 2);
|
||||
return true;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestManyHitPointsAutomatic()
|
||||
{
|
||||
AddStep("add scheduled delegate", () =>
|
||||
{
|
||||
automaticAdditionDelegate = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
var randomPos = new Vector2(
|
||||
RNG.NextSingle(0, 2 * OsuHitObject.OBJECT_RADIUS),
|
||||
RNG.NextSingle(0, 2 * OsuHitObject.OBJECT_RADIUS));
|
||||
|
||||
aimErrorMeter.AddPoint(randomPos - new Vector2(OsuHitObject.OBJECT_RADIUS));
|
||||
InputManager.MoveMouseTo(gameObject.ToScreenSpace(randomPos));
|
||||
}, 1, true);
|
||||
});
|
||||
AddWaitStep("wait for some hit points", 10);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDisplayStyles()
|
||||
{
|
||||
AddStep("Switch hit position marker style to +", () => aimErrorMeter.HitMarkerStyle.Value = AimErrorMeter.MarkerStyle.Plus);
|
||||
AddStep("Switch hit position marker style to x", () => aimErrorMeter.HitMarkerStyle.Value = AimErrorMeter.MarkerStyle.X);
|
||||
AddStep("Switch average position marker style to +", () => aimErrorMeter.AverageMarkerStyle.Value = AimErrorMeter.MarkerStyle.Plus);
|
||||
AddStep("Switch average position marker style to x", () => aimErrorMeter.AverageMarkerStyle.Value = AimErrorMeter.MarkerStyle.X);
|
||||
|
||||
AddStep("Switch position display to absolute", () => aimErrorMeter.PositionDisplayStyle.Value = AimErrorMeter.PositionDisplay.Absolute);
|
||||
AddStep("Switch position display to relative", () => aimErrorMeter.PositionDisplayStyle.Value = AimErrorMeter.PositionDisplay.Normalised);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestManualPlacement()
|
||||
{
|
||||
AddStep("return user input", () => InputManager.UseParentInput = true);
|
||||
}
|
||||
|
||||
private partial class TestAimErrorMeter : AimErrorMeter
|
||||
{
|
||||
public void AddPoint(Vector2 position)
|
||||
{
|
||||
OnNewJudgement(new OsuHitCircleJudgementResult(new HitCircle(), new OsuJudgement())
|
||||
{
|
||||
CursorPositionAtHit = position
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
// 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.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
public partial class TestSceneDrawableJudgementSliderTicks : OsuSkinnableTestScene
|
||||
{
|
||||
private bool classic;
|
||||
private readonly JudgementPooler<DrawableOsuJudgement>[] judgementPools;
|
||||
|
||||
public TestSceneDrawableJudgementSliderTicks()
|
||||
{
|
||||
judgementPools = new JudgementPooler<DrawableOsuJudgement>[Rows * Cols];
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
int cellIndex = 0;
|
||||
|
||||
SetContents(_ =>
|
||||
{
|
||||
var container = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
judgementPools[cellIndex] = new JudgementPooler<DrawableOsuJudgement>(new[]
|
||||
{
|
||||
HitResult.Great,
|
||||
HitResult.Miss,
|
||||
HitResult.LargeTickHit,
|
||||
HitResult.SliderTailHit,
|
||||
HitResult.LargeTickMiss,
|
||||
HitResult.IgnoreMiss,
|
||||
}),
|
||||
new GridContainer
|
||||
{
|
||||
Padding = new MarginPadding { Top = 26f },
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) },
|
||||
ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize) },
|
||||
Content =
|
||||
new[]
|
||||
{
|
||||
new[]
|
||||
{
|
||||
Empty(),
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "hit",
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "miss",
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
},
|
||||
},
|
||||
}.Concat(new[]
|
||||
{
|
||||
"head",
|
||||
"tick",
|
||||
"repeat",
|
||||
"tail",
|
||||
"slider",
|
||||
}.Select(label => new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = label,
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
},
|
||||
new Container<DrawableOsuJudgement> { RelativeSizeAxes = Axes.Both },
|
||||
new Container<DrawableOsuJudgement> { RelativeSizeAxes = Axes.Both },
|
||||
})).ToArray(),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
cellIndex++;
|
||||
|
||||
return container;
|
||||
});
|
||||
|
||||
AddToggleStep("Toggle classic behaviour", c => classic = c);
|
||||
|
||||
AddStep("Show judgements", createAllJudgements);
|
||||
}
|
||||
|
||||
private void createAllJudgements()
|
||||
{
|
||||
for (int cellIndex = 0; cellIndex < Rows * Cols; cellIndex++)
|
||||
{
|
||||
var slider = new Slider { StartTime = Time.Current, ClassicSliderBehaviour = classic };
|
||||
slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||
|
||||
var drawableHitObjects = new DrawableOsuHitObject[]
|
||||
{
|
||||
new DrawableSliderHead(new SliderHeadCircle { StartTime = Time.Current, ClassicSliderBehaviour = classic }),
|
||||
new DrawableSliderTick(new SliderTick { StartTime = Time.Current }),
|
||||
new DrawableSliderRepeat(new SliderRepeat(slider) { StartTime = Time.Current }),
|
||||
new DrawableSliderTail(new SliderTailCircle(slider) { StartTime = Time.Current, ClassicSliderBehaviour = classic }),
|
||||
new DrawableSlider(slider),
|
||||
};
|
||||
|
||||
var containers = Cell(cellIndex).ChildrenOfType<Container<DrawableOsuJudgement>>().ToArray();
|
||||
|
||||
for (int i = 0; i < drawableHitObjects.Length; i++)
|
||||
{
|
||||
createJudgement(judgementPools[cellIndex], containers[i * 2], drawableHitObjects[i], true);
|
||||
createJudgement(judgementPools[cellIndex], containers[i * 2 + 1], drawableHitObjects[i], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createJudgement(JudgementPooler<DrawableOsuJudgement> pool, Container<DrawableOsuJudgement> container, DrawableOsuHitObject drawableHitObject, bool hit)
|
||||
{
|
||||
container.Clear(false);
|
||||
|
||||
if (!drawableHitObject.DisplayResult)
|
||||
return;
|
||||
|
||||
var hitObject = drawableHitObject.HitObject;
|
||||
var result = new OsuJudgementResult(hitObject, hitObject.Judgement)
|
||||
{
|
||||
Type = hit ? hitObject.Judgement.MaxResult : hitObject.Judgement.MinResult,
|
||||
};
|
||||
|
||||
var judgement = pool.Get(result.Type, d =>
|
||||
{
|
||||
d.Anchor = Anchor.Centre;
|
||||
d.Origin = Anchor.Centre;
|
||||
d.Scale = new Vector2(0.7f);
|
||||
d.Apply(result, null);
|
||||
});
|
||||
|
||||
if (judgement != null)
|
||||
container.Add(judgement);
|
||||
}
|
||||
}
|
||||
}
|
||||
475
osu.Game.Rulesets.Osu/HUD/AimErrorMeter.cs
Normal file
475
osu.Game.Rulesets.Osu/HUD/AimErrorMeter.cs
Normal file
@@ -0,0 +1,475 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Pooling;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Localisation.HUD;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects.Legacy;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Statistics;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Play.HUD.HitErrorMeters;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using Container = osu.Framework.Graphics.Containers.Container;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.HUD
|
||||
{
|
||||
[Cached]
|
||||
public partial class AimErrorMeter : HitErrorMeter
|
||||
{
|
||||
[SettingSource(typeof(AimErrorMeterStrings), nameof(AimErrorMeterStrings.HitMarkerSize), nameof(AimErrorMeterStrings.HitMarkerSizeDescription))]
|
||||
public BindableNumber<float> HitMarkerSize { get; } = new BindableNumber<float>(7f)
|
||||
{
|
||||
MinValue = 0f,
|
||||
MaxValue = 12f,
|
||||
Precision = 1f
|
||||
};
|
||||
|
||||
[SettingSource(typeof(AimErrorMeterStrings), nameof(AimErrorMeterStrings.HitMarkerStyle), nameof(AimErrorMeterStrings.HitMarkerStyleDescription))]
|
||||
public Bindable<MarkerStyle> HitMarkerStyle { get; } = new Bindable<MarkerStyle>();
|
||||
|
||||
[SettingSource(typeof(AimErrorMeterStrings), nameof(AimErrorMeterStrings.AverageMarkerSize), nameof(AimErrorMeterStrings.AverageMarkerSizeDescription))]
|
||||
public BindableNumber<float> AverageMarkerSize { get; } = new BindableNumber<float>(12f)
|
||||
{
|
||||
MinValue = 7f,
|
||||
MaxValue = 25f,
|
||||
Precision = 1f
|
||||
};
|
||||
|
||||
[SettingSource(typeof(AimErrorMeterStrings), nameof(AimErrorMeterStrings.AverageMarkerStyle), nameof(AimErrorMeterStrings.AverageMarkerStyleDescription))]
|
||||
public Bindable<MarkerStyle> AverageMarkerStyle { get; } = new Bindable<MarkerStyle>(MarkerStyle.Plus);
|
||||
|
||||
[SettingSource(typeof(AimErrorMeterStrings), nameof(AimErrorMeterStrings.PositionDisplayStyle), nameof(AimErrorMeterStrings.PositionDisplayStyleDescription))]
|
||||
public Bindable<PositionDisplay> PositionDisplayStyle { get; } = new Bindable<PositionDisplay>();
|
||||
|
||||
// used for calculate relative position.
|
||||
private Vector2? lastObjectPosition;
|
||||
|
||||
private Container averagePositionMarker = null!;
|
||||
private Container averagePositionMarkerRotationContainer = null!;
|
||||
private Vector2? averagePosition;
|
||||
|
||||
private readonly DrawablePool<HitPositionMarker> hitPositionPool = new DrawablePool<HitPositionMarker>(30);
|
||||
private Container hitPositionMarkerContainer = null!;
|
||||
|
||||
private Container arrowBackgroundContainer = null!;
|
||||
private UprightAspectMaintainingContainer rotateFixedContainer = null!;
|
||||
private Container mainContainer = null!;
|
||||
|
||||
private float objectRadius;
|
||||
|
||||
private const int max_concurrent_judgements = 30;
|
||||
|
||||
private const float line_thickness = 2;
|
||||
private const float inner_portion = 0.85f;
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; } = null!;
|
||||
|
||||
public AimErrorMeter()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
AlwaysPresent = true;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, ScoreProcessor processor)
|
||||
{
|
||||
InternalChild = new Container
|
||||
{
|
||||
Height = 100,
|
||||
Width = 100,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
hitPositionPool,
|
||||
rotateFixedContainer = new UprightAspectMaintainingContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
mainContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
BorderColour = Colour4.White,
|
||||
Masking = true,
|
||||
BorderThickness = 2,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(inner_portion),
|
||||
Child = new Box
|
||||
{
|
||||
Colour = Colour4.Gray,
|
||||
Alpha = 0.3f,
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
},
|
||||
arrowBackgroundContainer = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Name = "Arrow Background",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Rotation = 45,
|
||||
Alpha = 0f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Circle
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Height = inner_portion + 0.2f,
|
||||
Width = line_thickness / 2,
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
Height = 5f,
|
||||
Width = line_thickness / 2,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding(-line_thickness / 4),
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Y = -(inner_portion + 0.2f) / 2,
|
||||
Rotation = -45
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
Height = 5f,
|
||||
Width = line_thickness / 2,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding(-line_thickness / 4),
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Y = -(inner_portion + 0.2f) / 2,
|
||||
Rotation = 45
|
||||
}
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Name = "Cross Background",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Circle
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0.5f,
|
||||
Width = line_thickness,
|
||||
Height = inner_portion * 0.9f
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0.5f,
|
||||
Width = line_thickness,
|
||||
Height = inner_portion * 0.9f,
|
||||
Rotation = 90
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0.2f,
|
||||
Width = line_thickness / 2,
|
||||
Height = inner_portion * 0.9f,
|
||||
Rotation = 45
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0.2f,
|
||||
Width = line_thickness / 2,
|
||||
Height = inner_portion * 0.9f,
|
||||
Rotation = 135
|
||||
},
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
hitPositionMarkerContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
averagePositionMarker = new UprightAspectMaintainingContainer
|
||||
{
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Child = averagePositionMarkerRotationContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Circle
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Width = 0.25f,
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Width = 0.25f,
|
||||
Rotation = 90
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// handle IApplicableToDifficulty for CS change.
|
||||
BeatmapDifficulty newDifficulty = new BeatmapDifficulty();
|
||||
beatmap.Value.Beatmap.Difficulty.CopyTo(newDifficulty);
|
||||
|
||||
var mods = processor.Mods.Value;
|
||||
|
||||
foreach (var mod in mods.OfType<IApplicableToDifficulty>())
|
||||
mod.ApplyToDifficulty(newDifficulty);
|
||||
|
||||
objectRadius = OsuHitObject.OBJECT_RADIUS * LegacyRulesetExtensions.CalculateScaleFromCircleSize(newDifficulty.CircleSize, true);
|
||||
|
||||
AverageMarkerSize.BindValueChanged(size => averagePositionMarker.Size = new Vector2(size.NewValue), true);
|
||||
AverageMarkerStyle.BindValueChanged(style => averagePositionMarkerRotationContainer.Rotation = style.NewValue == MarkerStyle.Plus ? 0 : 45, true);
|
||||
|
||||
PositionDisplayStyle.BindValueChanged(s =>
|
||||
{
|
||||
Clear();
|
||||
|
||||
if (s.NewValue == PositionDisplay.Normalised)
|
||||
{
|
||||
arrowBackgroundContainer.FadeIn(100);
|
||||
rotateFixedContainer.Remove(mainContainer, false);
|
||||
AddInternal(mainContainer);
|
||||
}
|
||||
else
|
||||
{
|
||||
arrowBackgroundContainer.FadeOut(100);
|
||||
// when in absolute mode, rotation of the aim error meter as a whole should not affect how the component is displayed
|
||||
RemoveInternal(mainContainer, false);
|
||||
rotateFixedContainer.Add(mainContainer);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override void OnNewJudgement(JudgementResult judgement)
|
||||
{
|
||||
if (judgement is not OsuHitCircleJudgementResult circleJudgement) return;
|
||||
|
||||
if (circleJudgement.CursorPositionAtHit == null) return;
|
||||
|
||||
if (hitPositionMarkerContainer.Count > max_concurrent_judgements)
|
||||
{
|
||||
const double quick_fade_time = 300;
|
||||
|
||||
// check with a bit of lenience to avoid precision error in comparison.
|
||||
var old = hitPositionMarkerContainer.FirstOrDefault(j => j.LifetimeEnd > Clock.CurrentTime + quick_fade_time * 1.1);
|
||||
|
||||
if (old != null)
|
||||
{
|
||||
old.ClearTransforms();
|
||||
old.FadeOut(quick_fade_time).Expire();
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 hitPosition;
|
||||
|
||||
if (PositionDisplayStyle.Value == PositionDisplay.Normalised && lastObjectPosition != null)
|
||||
{
|
||||
hitPosition = AccuracyHeatmap.FindRelativeHitPosition(lastObjectPosition.Value, ((OsuHitObject)circleJudgement.HitObject).StackedEndPosition,
|
||||
circleJudgement.CursorPositionAtHit.Value, objectRadius, 45) * 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// get relative position between mouse position and current object.
|
||||
hitPosition = (circleJudgement.CursorPositionAtHit.Value - ((OsuHitObject)circleJudgement.HitObject).StackedPosition) / objectRadius / 2 * inner_portion;
|
||||
}
|
||||
|
||||
hitPosition = Vector2.Clamp(hitPosition, new Vector2(-0.5f), new Vector2(0.5f));
|
||||
|
||||
hitPositionPool.Get(drawableHit =>
|
||||
{
|
||||
drawableHit.X = hitPosition.X;
|
||||
drawableHit.Y = hitPosition.Y;
|
||||
drawableHit.Colour = getColourForPosition(hitPosition);
|
||||
|
||||
hitPositionMarkerContainer.Add(drawableHit);
|
||||
});
|
||||
|
||||
var newAveragePosition = 0.1f * hitPosition + 0.9f * (averagePosition ?? hitPosition);
|
||||
averagePositionMarker.MoveTo(newAveragePosition, 800, Easing.OutQuint);
|
||||
averagePosition = newAveragePosition;
|
||||
lastObjectPosition = ((OsuHitObject)circleJudgement.HitObject).StackedPosition;
|
||||
}
|
||||
|
||||
private Color4 getColourForPosition(Vector2 position)
|
||||
{
|
||||
float distance = Vector2.Distance(position, Vector2.Zero);
|
||||
|
||||
if (distance >= 0.5f * inner_portion)
|
||||
return colours.Red;
|
||||
|
||||
if (distance >= 0.35f * inner_portion)
|
||||
return colours.Yellow;
|
||||
|
||||
if (distance >= 0.2f * inner_portion)
|
||||
return colours.Green;
|
||||
|
||||
return colours.Blue;
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
averagePosition = null;
|
||||
averagePositionMarker.MoveTo(Vector2.Zero, 800, Easing.OutQuint);
|
||||
lastObjectPosition = null;
|
||||
|
||||
foreach (var h in hitPositionMarkerContainer)
|
||||
{
|
||||
h.ClearTransforms();
|
||||
h.Expire();
|
||||
}
|
||||
}
|
||||
|
||||
private partial class HitPositionMarker : PoolableDrawable
|
||||
{
|
||||
[Resolved]
|
||||
private AimErrorMeter aimErrorMeter { get; set; } = null!;
|
||||
|
||||
public readonly BindableNumber<float> MarkerSize = new BindableFloat();
|
||||
public readonly Bindable<MarkerStyle> Style = new Bindable<MarkerStyle>();
|
||||
|
||||
private readonly Container content;
|
||||
|
||||
public HitPositionMarker()
|
||||
{
|
||||
RelativePositionAxes = Axes.Both;
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
InternalChild = new UprightAspectMaintainingContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Child = content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Circle
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Width = 0.25f,
|
||||
Rotation = -45
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Width = 0.25f,
|
||||
Rotation = 45
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
MarkerSize.BindTo(aimErrorMeter.HitMarkerSize);
|
||||
MarkerSize.BindValueChanged(size => Size = new Vector2(size.NewValue), true);
|
||||
Style.BindTo(aimErrorMeter.HitMarkerStyle);
|
||||
Style.BindValueChanged(style => content.Rotation = style.NewValue == MarkerStyle.X ? 0 : 45, true);
|
||||
}
|
||||
|
||||
protected override void PrepareForUse()
|
||||
{
|
||||
base.PrepareForUse();
|
||||
|
||||
const int judgement_fade_in_duration = 100;
|
||||
const int judgement_fade_out_duration = 5000;
|
||||
|
||||
this
|
||||
.ResizeTo(new Vector2(0))
|
||||
.FadeInFromZero(judgement_fade_in_duration, Easing.OutQuint)
|
||||
.ResizeTo(new Vector2(MarkerSize.Value), judgement_fade_in_duration, Easing.OutQuint)
|
||||
.Then()
|
||||
.FadeOut(judgement_fade_out_duration)
|
||||
.Expire();
|
||||
}
|
||||
}
|
||||
|
||||
public enum MarkerStyle
|
||||
{
|
||||
[Description("x")]
|
||||
X,
|
||||
|
||||
[Description("+")]
|
||||
Plus,
|
||||
}
|
||||
|
||||
public enum PositionDisplay
|
||||
{
|
||||
[LocalisableDescription(typeof(AimErrorMeterStrings), nameof(AimErrorMeterStrings.Absolute))]
|
||||
Absolute,
|
||||
|
||||
[LocalisableDescription(typeof(AimErrorMeterStrings), nameof(AimErrorMeterStrings.Normalised))]
|
||||
Normalised,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; } = null!;
|
||||
|
||||
private Vector2 screenSpacePosition;
|
||||
private Vector2? screenSpacePosition;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
@@ -65,7 +65,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
Lighting.ResetAnimation();
|
||||
Lighting.SetColourFrom(this, Result);
|
||||
Position = Parent!.ToLocalSpace(screenSpacePosition);
|
||||
|
||||
if (screenSpacePosition != null)
|
||||
Position = Parent!.ToLocalSpace(screenSpacePosition.Value);
|
||||
}
|
||||
|
||||
protected override void ApplyHitAnimations()
|
||||
@@ -87,7 +89,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
base.ApplyHitAnimations();
|
||||
}
|
||||
|
||||
protected override Drawable CreateDefaultJudgement(HitResult result) => new OsuJudgementPiece(result);
|
||||
protected override Drawable CreateDefaultJudgement(HitResult result) =>
|
||||
// Tick hits don't show a judgement by default
|
||||
result.IsHit() && result.IsTick() ? Empty() : new OsuJudgementPiece(result);
|
||||
|
||||
private partial class OsuJudgementPiece : DefaultJudgementPiece
|
||||
{
|
||||
|
||||
@@ -16,17 +16,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
public DrawableSlider DrawableSlider => (DrawableSlider)ParentHitObject;
|
||||
|
||||
public override bool DisplayResult
|
||||
{
|
||||
get
|
||||
{
|
||||
if (HitObject?.ClassicSliderBehaviour == true)
|
||||
return false;
|
||||
|
||||
return base.DisplayResult;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly IBindable<int> pathVersion = new Bindable<int>();
|
||||
|
||||
protected override OsuSkinComponents CirclePieceComponent => OsuSkinComponents.SliderHeadHitCircle;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@@ -42,7 +43,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
if (targetJudgement == null || targetResult == null)
|
||||
Colour = Color4.White;
|
||||
else
|
||||
Colour = targetResult.IsHit ? targetJudgement.AccentColour : Color4.Transparent;
|
||||
Colour = targetResult.IsHit && !targetResult.Type.IsTick() ? targetJudgement.AccentColour : Color4.Transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case HitResult.LargeTickHit:
|
||||
case HitResult.SliderTailHit:
|
||||
return null;
|
||||
|
||||
case HitResult.IgnoreMiss:
|
||||
case HitResult.LargeTickMiss:
|
||||
return new ArgonJudgementPieceSliderTickMiss(result);
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
{
|
||||
public partial class LegacyJudgementPieceSliderTickHit : Sprite, IAnimatableJudgement
|
||||
{
|
||||
public void PlayAnimation()
|
||||
{
|
||||
// https://github.com/peppy/osu-stable-reference/blob/0e91e49bc83fe8b21c3ba5f1eb2d5d06456eae84/osu!/GameModes/Play/Rulesets/Ruleset.cs#L804-L806
|
||||
this.MoveToOffset(new Vector2(0, -10), 300, Easing.Out)
|
||||
.Then()
|
||||
.FadeOut(60);
|
||||
}
|
||||
|
||||
public Drawable GetAboveHitObjectsProxiedContent() => CreateProxy();
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,9 @@ using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
@@ -115,6 +117,39 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
|
||||
return null;
|
||||
|
||||
case SkinComponentLookup<HitResult> resultComponent:
|
||||
switch (resultComponent.Component)
|
||||
{
|
||||
case HitResult.LargeTickHit:
|
||||
case HitResult.SliderTailHit:
|
||||
if (getSliderPointTexture(resultComponent.Component) is Texture texture)
|
||||
return new LegacyJudgementPieceSliderTickHit { Texture = texture };
|
||||
|
||||
break;
|
||||
|
||||
// If the corresponding hit result displays a judgement and the miss texture isn't provided by this skin, don't look up the miss texture from any further skins.
|
||||
case HitResult.LargeTickMiss:
|
||||
case HitResult.IgnoreMiss:
|
||||
if (getSliderPointTexture(resultComponent.Component == HitResult.LargeTickMiss
|
||||
? HitResult.LargeTickHit
|
||||
: HitResult.SliderTailHit) != null)
|
||||
return base.GetDrawableComponent(lookup) ?? Drawable.Empty();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return base.GetDrawableComponent(lookup);
|
||||
|
||||
Texture? getSliderPointTexture(HitResult result)
|
||||
{
|
||||
// https://github.com/peppy/osu-stable-reference/blob/0e91e49bc83fe8b21c3ba5f1eb2d5d06456eae84/osu!/GameModes/Play/Rulesets/Ruleset.cs#L799
|
||||
if (GetConfig<SkinConfiguration.LegacySetting, decimal>(SkinConfiguration.LegacySetting.Version)?.Value < 2m)
|
||||
// Note that osu!stable used sliderpoint30 for heads and repeats, and sliderpoint10 for ticks, but the mapping is intentionally changed here so that each texture represents one type of HitResult.
|
||||
return GetTexture(result == HitResult.LargeTickHit ? "sliderpoint30" : "sliderpoint10");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
case OsuSkinComponentLookup osuComponent:
|
||||
switch (osuComponent.Component)
|
||||
{
|
||||
|
||||
@@ -232,10 +232,47 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
||||
if (pointGrid.Content.Count == 0)
|
||||
return;
|
||||
|
||||
double angle1 = Math.Atan2(end.Y - hitPoint.Y, hitPoint.X - end.X); // Angle between the end point and the hit point.
|
||||
double angle2 = Math.Atan2(end.Y - start.Y, start.X - end.X); // Angle between the end point and the start point.
|
||||
Vector2 relativePosition = FindRelativeHitPosition(start, end, hitPoint, radius, rotation);
|
||||
|
||||
var localCentre = new Vector2(points_per_dimension - 1) / 2;
|
||||
float localRadius = localCentre.X * inner_portion;
|
||||
var localPoint = localCentre + localRadius * relativePosition;
|
||||
|
||||
// Find the most relevant hit point.
|
||||
int r = (int)Math.Round(localPoint.Y);
|
||||
int c = (int)Math.Round(localPoint.X);
|
||||
|
||||
if (r < 0 || r >= points_per_dimension || c < 0 || c >= points_per_dimension)
|
||||
return;
|
||||
|
||||
PeakValue = Math.Max(PeakValue, ((GridPoint)pointGrid.Content[r][c]).Increment());
|
||||
|
||||
bufferedGrid.ForceRedraw();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Normalises the position of a hit on a circle such that it is relative to the movement that was performed to arrive at said circle.
|
||||
/// </summary>
|
||||
/// <param name="previousObjectPosition">The position of the object prior to the one getting hit.</param>
|
||||
/// <param name="nextObjectPosition">The position of the object which is getting hit.</param>
|
||||
/// <param name="hitPoint">The point at which the user hit.</param>
|
||||
/// <param name="objectRadius">The radius of <paramref name="previousObjectPosition"/> and <paramref name="nextObjectPosition"/>.</param>
|
||||
/// <param name="rotation">
|
||||
/// The rotation of the axis which is to be considered in the same direction as the vector
|
||||
/// leading from <paramref name="previousObjectPosition"/> to <paramref name="nextObjectPosition"/>.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A 2D vector representing the <paramref name="hitPoint"/> as relative to the movement between <paramref name="previousObjectPosition"/> and <paramref name="nextObjectPosition"/>
|
||||
/// and relative to the <paramref name="objectRadius"/>.
|
||||
/// If the object was hit perfectly in the middle, the return value will be <see cref="Vector2.Zero"/>.
|
||||
/// If the object was hit perfectly at its edge, the returned vector will have a magnitude of 1.
|
||||
/// </returns>
|
||||
public static Vector2 FindRelativeHitPosition(Vector2 previousObjectPosition, Vector2 nextObjectPosition, Vector2 hitPoint, float objectRadius, float rotation)
|
||||
{
|
||||
double angle1 = Math.Atan2(nextObjectPosition.Y - hitPoint.Y, hitPoint.X - nextObjectPosition.X); // Angle between the end point and the hit point.
|
||||
double angle2 = Math.Atan2(nextObjectPosition.Y - previousObjectPosition.Y, previousObjectPosition.X - nextObjectPosition.X); // Angle between the end point and the start point.
|
||||
double finalAngle = angle2 - angle1; // Angle between start, end, and hit points.
|
||||
float normalisedDistance = Vector2.Distance(hitPoint, end) / radius;
|
||||
float normalisedDistance = Vector2.Distance(hitPoint, nextObjectPosition) / objectRadius; // Distance between the hit point and the end point.
|
||||
|
||||
// Consider two objects placed horizontally, with the start on the left and the end on the right.
|
||||
// The above calculated the angle between {end, start}, and the angle between {end, hitPoint}, in the form:
|
||||
@@ -254,22 +291,7 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
||||
//
|
||||
// We also need to apply the anti-clockwise rotation.
|
||||
double rotatedAngle = finalAngle - float.DegreesToRadians(rotation);
|
||||
var rotatedCoordinate = -1 * new Vector2((float)Math.Cos(rotatedAngle), (float)Math.Sin(rotatedAngle));
|
||||
|
||||
Vector2 localCentre = new Vector2(points_per_dimension - 1) / 2;
|
||||
float localRadius = localCentre.X * inner_portion * normalisedDistance;
|
||||
Vector2 localPoint = localCentre + localRadius * rotatedCoordinate;
|
||||
|
||||
// Find the most relevant hit point.
|
||||
int r = (int)Math.Round(localPoint.Y);
|
||||
int c = (int)Math.Round(localPoint.X);
|
||||
|
||||
if (r < 0 || r >= points_per_dimension || c < 0 || c >= points_per_dimension)
|
||||
return;
|
||||
|
||||
PeakValue = Math.Max(PeakValue, ((GridPoint)pointGrid.Content[r][c]).Increment());
|
||||
|
||||
bufferedGrid.ForceRedraw();
|
||||
return -normalisedDistance * new Vector2((float)Math.Cos(rotatedAngle), (float)Math.Sin(rotatedAngle));
|
||||
}
|
||||
|
||||
private abstract partial class GridPoint : CompositeDrawable
|
||||
|
||||
@@ -81,6 +81,8 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
HitResult.Ok,
|
||||
HitResult.Meh,
|
||||
HitResult.Miss,
|
||||
HitResult.LargeTickHit,
|
||||
HitResult.SliderTailHit,
|
||||
HitResult.LargeTickMiss,
|
||||
HitResult.IgnoreMiss,
|
||||
}, onJudgementLoaded));
|
||||
|
||||
@@ -117,6 +117,52 @@ namespace osu.Game.Tests.Editing.Checks
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBeatmapAudioTracksExemptedFromCheck()
|
||||
{
|
||||
using (var resourceStream = TestResources.OpenResource("Samples/corrupt.wav"))
|
||||
{
|
||||
var beatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
Files =
|
||||
{
|
||||
CheckTestHelpers.CreateMockFile("wav"),
|
||||
CheckTestHelpers.CreateMockFile("mp3")
|
||||
}
|
||||
};
|
||||
|
||||
var firstPlayable = new Beatmap<HitObject>
|
||||
{
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BeatmapSet = beatmapSet,
|
||||
Metadata = new BeatmapMetadata { AudioFile = beatmapSet.Files[0].Filename }
|
||||
}
|
||||
};
|
||||
var firstWorking = new Mock<TestWorkingBeatmap>(firstPlayable, null, null);
|
||||
firstWorking.Setup(w => w.GetStream(It.IsAny<string>())).Returns(resourceStream);
|
||||
|
||||
var secondPlayable = new Beatmap<HitObject>
|
||||
{
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BeatmapSet = beatmapSet,
|
||||
Metadata = new BeatmapMetadata { AudioFile = beatmapSet.Files[1].Filename }
|
||||
}
|
||||
};
|
||||
var secondWorking = new Mock<TestWorkingBeatmap>(secondPlayable, null, null);
|
||||
secondWorking.Setup(w => w.GetStream(It.IsAny<string>())).Returns(resourceStream);
|
||||
|
||||
var context = new BeatmapVerifierContext(
|
||||
new BeatmapVerifierContext.VerifiedBeatmap(firstWorking.Object, firstPlayable),
|
||||
[new BeatmapVerifierContext.VerifiedBeatmap(secondWorking.Object, secondPlayable)],
|
||||
DifficultyRating.ExpertPlus);
|
||||
|
||||
var issues = check.Run(context).ToList();
|
||||
Assert.That(issues, Is.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private BeatmapVerifierContext getContext(Stream? resourceStream)
|
||||
{
|
||||
var mockWorkingBeatmap = new Mock<TestWorkingBeatmap>(beatmap, null, null);
|
||||
|
||||
151
osu.Game.Tests/Editing/Checks/CheckInconsistentAudioTest.cs
Normal file
151
osu.Game.Tests/Editing/Checks/CheckInconsistentAudioTest.cs
Normal file
@@ -0,0 +1,151 @@
|
||||
// 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.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Models;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Edit.Checks;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
|
||||
namespace osu.Game.Tests.Editing.Checks
|
||||
{
|
||||
[TestFixture]
|
||||
public class CheckInconsistentAudioTest
|
||||
{
|
||||
private CheckInconsistentAudio check = null!;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
check = new CheckInconsistentAudio();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConsistentAudio()
|
||||
{
|
||||
var beatmaps = createBeatmapSetWithAudio("audio.mp3", "audio.mp3");
|
||||
var context = createContextWithMultipleDifficulties(beatmaps.First(), beatmaps);
|
||||
|
||||
Assert.That(check.Run(context), Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInconsistentAudio()
|
||||
{
|
||||
var beatmaps = createBeatmapSetWithAudio("audio1.mp3", "audio2.mp3");
|
||||
var context = createContextWithMultipleDifficulties(beatmaps.First(), beatmaps);
|
||||
|
||||
var issues = check.Run(context).ToList();
|
||||
|
||||
Assert.That(issues, Has.Count.EqualTo(1));
|
||||
Assert.That(issues.Single().Template is CheckInconsistentAudio.IssueTemplateInconsistentAudio);
|
||||
Assert.That(issues.Single().ToString(), Contains.Substring("audio1.mp3"));
|
||||
Assert.That(issues.Single().ToString(), Contains.Substring("audio2.mp3"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInconsistentAudioWithNull()
|
||||
{
|
||||
var beatmaps = createBeatmapSetWithAudio("audio.mp3", null);
|
||||
var context = createContextWithMultipleDifficulties(beatmaps.First(), beatmaps);
|
||||
|
||||
var issues = check.Run(context).ToList();
|
||||
|
||||
Assert.That(issues, Has.Count.EqualTo(1));
|
||||
Assert.That(issues.Single().Template is CheckInconsistentAudio.IssueTemplateInconsistentAudio);
|
||||
Assert.That(issues.Single().ToString(), Contains.Substring("audio.mp3"));
|
||||
Assert.That(issues.Single().ToString(), Contains.Substring("not set"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInconsistentAudioWithEmptyString()
|
||||
{
|
||||
var beatmaps = createBeatmapSetWithAudio("audio.mp3", "");
|
||||
var context = createContextWithMultipleDifficulties(beatmaps.First(), beatmaps);
|
||||
|
||||
var issues = check.Run(context).ToList();
|
||||
|
||||
Assert.That(issues, Has.Count.EqualTo(1));
|
||||
Assert.That(issues.Single().Template is CheckInconsistentAudio.IssueTemplateInconsistentAudio);
|
||||
Assert.That(issues.Single().ToString(), Contains.Substring("audio.mp3"));
|
||||
Assert.That(issues.Single().ToString(), Contains.Substring("not set"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBothAudioNotSet()
|
||||
{
|
||||
var beatmaps = createBeatmapSetWithAudio("", "");
|
||||
var context = createContextWithMultipleDifficulties(beatmaps.First(), beatmaps);
|
||||
|
||||
Assert.That(check.Run(context), Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMultipleInconsistencies()
|
||||
{
|
||||
var beatmaps = createBeatmapSetWithAudio("audio1.mp3", "audio2.mp3", "audio3.mp3");
|
||||
var context = createContextWithMultipleDifficulties(beatmaps.First(), beatmaps);
|
||||
|
||||
var issues = check.Run(context).ToList();
|
||||
|
||||
Assert.That(issues, Has.Count.EqualTo(2));
|
||||
Assert.That(issues.All(issue => issue.Template is CheckInconsistentAudio.IssueTemplateInconsistentAudio));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSingleDifficulty()
|
||||
{
|
||||
var beatmaps = createBeatmapSetWithAudio("audio.mp3");
|
||||
var context = createContextWithMultipleDifficulties(beatmaps.First(), beatmaps);
|
||||
|
||||
Assert.That(check.Run(context), Is.Empty);
|
||||
}
|
||||
|
||||
private IBeatmap createBeatmapWithAudio(string audioFile, RealmNamedFileUsage? file)
|
||||
{
|
||||
var beatmap = new Beatmap<HitObject>
|
||||
{
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
Metadata = new BeatmapMetadata { AudioFile = audioFile },
|
||||
BeatmapSet = new BeatmapSetInfo()
|
||||
}
|
||||
};
|
||||
|
||||
if (file != null)
|
||||
beatmap.BeatmapInfo.BeatmapSet!.Files.Add(file);
|
||||
|
||||
return beatmap;
|
||||
}
|
||||
|
||||
private IBeatmap[] createBeatmapSetWithAudio(params string?[] audioFiles)
|
||||
{
|
||||
var beatmapSet = new BeatmapSetInfo();
|
||||
var beatmaps = new IBeatmap[audioFiles.Length];
|
||||
|
||||
for (int i = 0; i < audioFiles.Length; i++)
|
||||
{
|
||||
string? audioFile = audioFiles[i];
|
||||
var file = !string.IsNullOrEmpty(audioFile) ? CheckTestHelpers.CreateMockFile("mp3") : null;
|
||||
|
||||
beatmaps[i] = createBeatmapWithAudio(audioFile ?? "", file);
|
||||
beatmaps[i].BeatmapInfo.BeatmapSet = beatmapSet;
|
||||
beatmaps[i].BeatmapInfo.DifficultyName = $"Difficulty {i + 1}";
|
||||
beatmapSet.Beatmaps.Add(beatmaps[i].BeatmapInfo);
|
||||
}
|
||||
|
||||
return beatmaps;
|
||||
}
|
||||
|
||||
private BeatmapVerifierContext createContextWithMultipleDifficulties(IBeatmap currentBeatmap, IBeatmap[] allDifficulties)
|
||||
{
|
||||
var verifiedCurrentBeatmap = new BeatmapVerifierContext.VerifiedBeatmap(new TestWorkingBeatmap(currentBeatmap), currentBeatmap);
|
||||
var verifiedOtherBeatmaps = allDifficulties.Select(b => new BeatmapVerifierContext.VerifiedBeatmap(new TestWorkingBeatmap(b), b)).ToList();
|
||||
|
||||
return new BeatmapVerifierContext(verifiedCurrentBeatmap, verifiedOtherBeatmaps, DifficultyRating.ExpertPlus);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,10 +204,11 @@ namespace osu.Game.Database
|
||||
if (!Filename.EndsWith(realm_extension, StringComparison.Ordinal))
|
||||
Filename += realm_extension;
|
||||
|
||||
#if DEBUG
|
||||
// TODO: fix
|
||||
// #if DEBUG
|
||||
if (!DebugUtils.IsNUnitRunning)
|
||||
applyFilenameSchemaSuffix(ref Filename);
|
||||
#endif
|
||||
// #endif
|
||||
|
||||
// `prepareFirstRealmAccess()` triggers the first `getRealmInstance` call, which will implicitly run realm migrations and bring the schema up-to-date.
|
||||
using (var realm = prepareFirstRealmAccess())
|
||||
|
||||
74
osu.Game/Localisation/HUD/AimErrorMeterStrings.cs
Normal file
74
osu.Game/Localisation/HUD/AimErrorMeterStrings.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
// 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.Localisation;
|
||||
|
||||
namespace osu.Game.Localisation.HUD
|
||||
{
|
||||
public static class AimErrorMeterStrings
|
||||
{
|
||||
private const string prefix = @"osu.Game.Resources.Localisation.HUD.AimErrorMeterStrings";
|
||||
|
||||
/// <summary>
|
||||
/// "Hit marker size"
|
||||
/// </summary>
|
||||
public static LocalisableString HitMarkerSize => new TranslatableString(getKey(@"hit_marker_size"), @"Hit marker size");
|
||||
|
||||
/// <summary>
|
||||
/// "Controls the size of the markers displayed after every hit."
|
||||
/// </summary>
|
||||
public static LocalisableString HitMarkerSizeDescription => new TranslatableString(getKey(@"hit_marker_size_description"), @"Controls the size of the markers displayed after every hit.");
|
||||
|
||||
/// <summary>
|
||||
/// "Hit marker style"
|
||||
/// </summary>
|
||||
public static LocalisableString HitMarkerStyle => new TranslatableString(getKey(@"hit_marker_style"), @"Hit marker style");
|
||||
|
||||
/// <summary>
|
||||
/// "The visual style of the hit markers."
|
||||
/// </summary>
|
||||
public static LocalisableString HitMarkerStyleDescription => new TranslatableString(getKey(@"hit_marker_style_description"), @"The visual style of the hit markers.");
|
||||
|
||||
/// <summary>
|
||||
/// "Average position marker size"
|
||||
/// </summary>
|
||||
public static LocalisableString AverageMarkerSize => new TranslatableString(getKey(@"average_marker_size"), @"Average position marker size");
|
||||
|
||||
/// <summary>
|
||||
/// "Controls the size of the marker showing average hit position."
|
||||
/// </summary>
|
||||
public static LocalisableString AverageMarkerSizeDescription => new TranslatableString(getKey(@"average_marker_size_description"), @"Controls the size of the marker showing average hit position.");
|
||||
|
||||
/// <summary>
|
||||
/// "Average position marker style"
|
||||
/// </summary>
|
||||
public static LocalisableString AverageMarkerStyle => new TranslatableString(getKey(@"average_marker_style"), @"Average position marker style");
|
||||
|
||||
/// <summary>
|
||||
/// "The visual style of the average position marker."
|
||||
/// </summary>
|
||||
public static LocalisableString AverageMarkerStyleDescription => new TranslatableString(getKey(@"average_marker_style_description"), @"The visual style of the average position marker.");
|
||||
|
||||
/// <summary>
|
||||
/// "Position display style"
|
||||
/// </summary>
|
||||
public static LocalisableString PositionDisplayStyle => new TranslatableString(getKey(@"position_style"), @"Position display style");
|
||||
|
||||
/// <summary>
|
||||
/// "Controls whether positions displayed on the meter are absolute (as seen on screen) or normalised (relative to the direction of movement from previous object)."
|
||||
/// </summary>
|
||||
public static LocalisableString PositionDisplayStyleDescription => new TranslatableString(getKey(@"position_style_description"), @"Controls whether positions displayed on the meter are absolute (as seen on screen) or normalised (relative to the direction of movement from previous object).");
|
||||
|
||||
/// <summary>
|
||||
/// "Absolute"
|
||||
/// </summary>
|
||||
public static LocalisableString Absolute => new TranslatableString(getKey(@"absolute"), @"Absolute");
|
||||
|
||||
/// <summary>
|
||||
/// "Normalised"
|
||||
/// </summary>
|
||||
public static LocalisableString Normalised => new TranslatableString(getKey(@"normalised"), @"Normalised");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,13 @@ namespace osu.Game.Online
|
||||
{
|
||||
public DevelopmentEndpointConfiguration()
|
||||
{
|
||||
WebsiteUrl = APIUrl = @"https://dev.ppy.sh";
|
||||
APIClientSecret = @"3LP2mhUrV89xxzD1YKNndXHEhWWCRLPNKioZ9ymT";
|
||||
APIClientID = "5";
|
||||
SpectatorUrl = $@"{APIUrl}/signalr/spectator";
|
||||
MultiplayerUrl = $@"{APIUrl}/signalr/multiplayer";
|
||||
MetadataUrl = $@"{APIUrl}/signalr/metadata";
|
||||
BeatmapSubmissionServiceUrl = $@"{APIUrl}/beatmap-submission";
|
||||
WebsiteUrl = APIUrl = @"https://osu.jvnko.boats";
|
||||
APIClientSecret = @"ijBg9O6aULCYGnvEELYD3IdW7fqrYiFaoMdkzQNA";
|
||||
APIClientID = "1";
|
||||
SpectatorUrl = $@"https://osu-spec.jvnko.boats/spectator";
|
||||
MultiplayerUrl = $@"https://osu-spec.jvnko.boats/multiplayer";
|
||||
MetadataUrl = $@"https://osu-spec.jvnko.boats/metadata";
|
||||
BeatmapSubmissionServiceUrl = $@"https://osu-bss.jvnko.boats";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ namespace osu.Game.Online
|
||||
{
|
||||
public ProductionEndpointConfiguration()
|
||||
{
|
||||
WebsiteUrl = APIUrl = @"https://osu.ppy.sh";
|
||||
APIClientSecret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk";
|
||||
APIClientID = "5";
|
||||
SpectatorUrl = "https://spectator.ppy.sh/spectator";
|
||||
MultiplayerUrl = "https://spectator.ppy.sh/multiplayer";
|
||||
MetadataUrl = "https://spectator.ppy.sh/metadata";
|
||||
BeatmapSubmissionServiceUrl = "https://bss.ppy.sh";
|
||||
WebsiteUrl = APIUrl = @"https://osu.jvnko.boats";
|
||||
APIClientSecret = @"ijBg9O6aULCYGnvEELYD3IdW7fqrYiFaoMdkzQNA";
|
||||
APIClientID = "1";
|
||||
SpectatorUrl = $@"https://osu-spec.jvnko.boats/spectator";
|
||||
MultiplayerUrl = $@"https://osu-spec.jvnko.boats/multiplayer";
|
||||
MetadataUrl = $@"https://osu-spec.jvnko.boats/metadata";
|
||||
BeatmapSubmissionServiceUrl = $@"https://osu-bss.jvnko.boats";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,11 @@ namespace osu.Game.Online
|
||||
{
|
||||
protected override string GetLookupUrl(string url)
|
||||
{
|
||||
if (!Uri.TryCreate(url, UriKind.Absolute, out Uri? uri) || !uri.Host.EndsWith(@".ppy.sh", StringComparison.OrdinalIgnoreCase))
|
||||
/* if (!Uri.TryCreate(url, UriKind.Absolute, out Uri? uri) || !uri.Host.EndsWith(@".ppy.sh", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Logger.Log($@"Blocking resource lookup from external website: {url}", LoggingTarget.Network, LogLevel.Important);
|
||||
return string.Empty;
|
||||
}
|
||||
}*/
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -92,9 +92,9 @@ namespace osu.Game
|
||||
{
|
||||
#if DEBUG
|
||||
// Different port allows running release and debug builds alongside each other.
|
||||
public const string IPC_PIPE_NAME = "osu-lazer-debug";
|
||||
public const string IPC_PIPE_NAME = "jvnkosu-debug";
|
||||
#else
|
||||
public const string IPC_PIPE_NAME = "osu-lazer";
|
||||
public const string IPC_PIPE_NAME = "jvnkosu";
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -76,12 +76,12 @@ namespace osu.Game
|
||||
public partial class OsuGameBase : Framework.Game, ICanAcceptFiles, IBeatSyncProvider
|
||||
{
|
||||
#if DEBUG
|
||||
public const string GAME_NAME = "osu! (development)";
|
||||
public const string GAME_NAME = "jvnkosu! (development)";
|
||||
#else
|
||||
public const string GAME_NAME = "osu!";
|
||||
public const string GAME_NAME = "jvnkosu!";
|
||||
#endif
|
||||
|
||||
public const string OSU_PROTOCOL = "osu://";
|
||||
public const string OSU_PROTOCOL = "jnvkosu://";
|
||||
|
||||
/// <summary>
|
||||
/// The filename of the main client database.
|
||||
|
||||
@@ -30,9 +30,18 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Font = OsuFont.Numeric.With(weight: FontWeight.Bold, size: 12),
|
||||
Colour = colours.YellowDark,
|
||||
Text = @"DEVELOPER BUILD",
|
||||
Font = OsuFont.Torus.With(size: 12),
|
||||
Colour = colours.GrayF,
|
||||
Text = "jvnkosu! development build",
|
||||
Y = -12,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 15),
|
||||
Colour = colours.Yellow,
|
||||
Text = "Experimental version",
|
||||
},
|
||||
new Sprite
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
new CheckDelayedHitsounds(),
|
||||
new CheckSongFormat(),
|
||||
new CheckHitsoundsFormat(),
|
||||
new CheckInconsistentAudio(),
|
||||
|
||||
// Files
|
||||
new CheckZeroByteFiles(),
|
||||
|
||||
@@ -7,6 +7,7 @@ using ManagedBass;
|
||||
using osu.Framework.Audio.Callbacks;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Models;
|
||||
using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
@@ -24,13 +25,22 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
|
||||
{
|
||||
var beatmapSet = context.CurrentDifficulty.Playable.BeatmapInfo.BeatmapSet;
|
||||
var audioFile = beatmapSet?.GetFile(context.CurrentDifficulty.Playable.Metadata.AudioFile);
|
||||
|
||||
if (beatmapSet == null) yield break;
|
||||
|
||||
// Collect all audio files from all difficulties to exclude them from the check, as they aren't hitsounds.
|
||||
var audioFiles = new HashSet<RealmNamedFileUsage>(ReferenceEqualityComparer.Instance);
|
||||
|
||||
foreach (var difficulty in context.AllDifficulties)
|
||||
{
|
||||
var audioFile = beatmapSet.GetFile(difficulty.Playable.Metadata.AudioFile);
|
||||
if (audioFile != null)
|
||||
audioFiles.Add(audioFile);
|
||||
}
|
||||
|
||||
foreach (var file in beatmapSet.Files)
|
||||
{
|
||||
if (audioFile != null && ReferenceEquals(file.File, audioFile.File)) continue;
|
||||
if (audioFiles.Contains(file)) continue;
|
||||
|
||||
using (Stream data = context.CurrentDifficulty.Working.GetStream(file.File.GetStoragePath()))
|
||||
{
|
||||
|
||||
53
osu.Game/Rulesets/Edit/Checks/CheckInconsistentAudio.cs
Normal file
53
osu.Game/Rulesets/Edit/Checks/CheckInconsistentAudio.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public class CheckInconsistentAudio : ICheck
|
||||
{
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Audio, "Inconsistent audio files", CheckScope.BeatmapSet);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
new IssueTemplateInconsistentAudio(this)
|
||||
};
|
||||
|
||||
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
|
||||
{
|
||||
if (context.AllDifficulties.Count() <= 1)
|
||||
yield break;
|
||||
|
||||
var referenceBeatmap = context.CurrentDifficulty.Playable;
|
||||
string referenceAudioFile = referenceBeatmap.Metadata.AudioFile;
|
||||
|
||||
foreach (var beatmap in context.OtherDifficulties)
|
||||
{
|
||||
string currentAudioFile = beatmap.Playable.Metadata.AudioFile;
|
||||
|
||||
if (referenceAudioFile != currentAudioFile)
|
||||
{
|
||||
yield return new IssueTemplateInconsistentAudio(this).Create(
|
||||
string.IsNullOrEmpty(referenceAudioFile) ? "not set" : referenceAudioFile,
|
||||
beatmap.Playable.BeatmapInfo.DifficultyName,
|
||||
string.IsNullOrEmpty(currentAudioFile) ? "not set" : currentAudioFile
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class IssueTemplateInconsistentAudio : IssueTemplate
|
||||
{
|
||||
public IssueTemplateInconsistentAudio(ICheck check)
|
||||
: base(check, IssueType.Problem, "Inconsistent audio file between this difficulty ({0}) and \"{1}\" ({2}).")
|
||||
{
|
||||
}
|
||||
|
||||
public Issue Create(string referenceAudio, string otherDifficulty, string otherAudio)
|
||||
=> new Issue(this, referenceAudio, otherDifficulty, otherAudio);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ namespace osu.Game.Screens.Play
|
||||
private SkinnableSound failSample = null!;
|
||||
private AudioFilter failLowPassFilter = null!;
|
||||
private AudioFilter failHighPassFilter = null!;
|
||||
private Container content = null!;
|
||||
|
||||
private double? failTime;
|
||||
|
||||
@@ -44,7 +45,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public ReplayFailIndicator(GameplayClockContainer gameplayClockContainer)
|
||||
{
|
||||
AlwaysPresent = true;
|
||||
Clock = this.gameplayClockContainer = gameplayClockContainer;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ namespace osu.Game.Screens.Play
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Alpha = 0;
|
||||
|
||||
track = beatmap.Value.Track;
|
||||
|
||||
@@ -65,13 +64,14 @@ namespace osu.Game.Screens.Play
|
||||
failSample = new SkinnableSound(new SampleInfo(@"Gameplay/failsound")),
|
||||
failLowPassFilter = new AudioFilter(audio.TrackMixer),
|
||||
failHighPassFilter = new AudioFilter(audio.TrackMixer, BQFType.HighPass),
|
||||
new Container
|
||||
content = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
CornerRadius = 20,
|
||||
Alpha = 0,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
@@ -132,7 +132,7 @@ namespace osu.Game.Screens.Play
|
||||
// intentionally shorter than the actual fail animation
|
||||
const double audio_sweep_duration = 1000;
|
||||
|
||||
this.FadeInFromZero(200, Easing.OutQuint);
|
||||
content.FadeInFromZero(200, Easing.OutQuint);
|
||||
this.ScaleTo(1.1f, audio_sweep_duration, Easing.OutElasticHalf);
|
||||
this.TransformBindableTo(trackFreq, 0, audio_sweep_duration);
|
||||
this.TransformBindableTo(volumeAdjustment, 0.5);
|
||||
@@ -155,8 +155,11 @@ namespace osu.Game.Screens.Play
|
||||
failSample.Play();
|
||||
}
|
||||
|
||||
if (Time.Current < failTime)
|
||||
if (Time.Current < failTime && failSamplePlaybackInitiated)
|
||||
{
|
||||
failSamplePlaybackInitiated = false;
|
||||
failSample.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
||||
@@ -197,8 +197,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public override void OnSuspending(ScreenTransitionEvent e)
|
||||
{
|
||||
// safety against filters or samples from the indicator playing long after the screen is exited
|
||||
failIndicator.RemoveAndDisposeImmediately();
|
||||
stopAllAudioEffects();
|
||||
base.OnSuspending(e);
|
||||
}
|
||||
|
||||
@@ -208,5 +207,17 @@ namespace osu.Game.Screens.Play
|
||||
failIndicator.RemoveAndDisposeImmediately();
|
||||
return base.OnExiting(e);
|
||||
}
|
||||
|
||||
private void stopAllAudioEffects()
|
||||
{
|
||||
// safety against filters or samples from the indicator playing long after the screen is exited
|
||||
failIndicator.RemoveAndDisposeImmediately();
|
||||
|
||||
if (GameplayClockContainer is MasterGameplayClockContainer master)
|
||||
{
|
||||
playbackSettings.UserPlaybackRate.UnbindFrom(master.UserPlaybackRate);
|
||||
master.UserPlaybackRate.SetDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
@@ -50,6 +51,9 @@ namespace osu.Game.Screens.SelectV2
|
||||
|
||||
private TrianglesV2 triangles = null!;
|
||||
|
||||
[Resolved]
|
||||
private IRulesetStore rulesets { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||
|
||||
@@ -215,7 +219,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
Debug.Assert(Item != null);
|
||||
var beatmap = (BeatmapInfo)Item.Model;
|
||||
|
||||
difficultyIcon.Icon = beatmap.Ruleset.CreateInstance().CreateIcon();
|
||||
difficultyIcon.Icon = getRulesetIcon(beatmap.Ruleset);
|
||||
|
||||
localRank.Beatmap = beatmap;
|
||||
difficultyText.Text = beatmap.DifficultyName;
|
||||
@@ -225,6 +229,16 @@ namespace osu.Game.Screens.SelectV2
|
||||
updateKeyCount();
|
||||
}
|
||||
|
||||
private Drawable getRulesetIcon(RulesetInfo rulesetInfo)
|
||||
{
|
||||
var rulesetInstance = rulesets.GetRuleset(rulesetInfo.ShortName)?.CreateInstance();
|
||||
|
||||
if (rulesetInstance is null)
|
||||
return new SpriteIcon { Icon = FontAwesome.Regular.QuestionCircle };
|
||||
|
||||
return rulesetInstance.CreateIcon();
|
||||
}
|
||||
|
||||
protected override void FreeAfterUse()
|
||||
{
|
||||
base.FreeAfterUse();
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="20.1.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2025.808.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2025.815.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2025.819.0" />
|
||||
<PackageReference Include="Sentry" Version="5.1.1" />
|
||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||
<PackageReference Include="SharpCompress" Version="0.39.0" />
|
||||
|
||||
Reference in New Issue
Block a user