Compare commits
77 Commits
4c10d941b3
...
experiment
| Author | SHA1 | Date | |
|---|---|---|---|
| f31d310135 | |||
| 26029de27d | |||
| 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
|
public static class Program
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
private const string base_game_name = @"osu-development";
|
private const string base_game_name = @"jvnkosu-development";
|
||||||
#else
|
#else
|
||||||
private const string base_game_name = @"osu";
|
private const string base_game_name = @"jvnkosu";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private static LegacyTcpIpcProvider? legacyIpc;
|
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]
|
[Resolved]
|
||||||
private OsuConfigManager config { get; set; } = null!;
|
private OsuConfigManager config { get; set; } = null!;
|
||||||
|
|
||||||
private Vector2 screenSpacePosition;
|
private Vector2? screenSpacePosition;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
@@ -65,7 +65,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
Lighting.ResetAnimation();
|
Lighting.ResetAnimation();
|
||||||
Lighting.SetColourFrom(this, Result);
|
Lighting.SetColourFrom(this, Result);
|
||||||
Position = Parent!.ToLocalSpace(screenSpacePosition);
|
|
||||||
|
if (screenSpacePosition != null)
|
||||||
|
Position = Parent!.ToLocalSpace(screenSpacePosition.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplyHitAnimations()
|
protected override void ApplyHitAnimations()
|
||||||
@@ -87,7 +89,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
base.ApplyHitAnimations();
|
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
|
private partial class OsuJudgementPiece : DefaultJudgementPiece
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,17 +16,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
public DrawableSlider DrawableSlider => (DrawableSlider)ParentHitObject;
|
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>();
|
private readonly IBindable<int> pathVersion = new Bindable<int>();
|
||||||
|
|
||||||
protected override OsuSkinComponents CirclePieceComponent => OsuSkinComponents.SliderHeadHitCircle;
|
protected override OsuSkinComponents CirclePieceComponent => OsuSkinComponents.SliderHeadHitCircle;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
if (targetJudgement == null || targetResult == null)
|
if (targetJudgement == null || targetResult == null)
|
||||||
Colour = Color4.White;
|
Colour = Color4.White;
|
||||||
else
|
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)
|
switch (result)
|
||||||
{
|
{
|
||||||
|
case HitResult.LargeTickHit:
|
||||||
|
case HitResult.SliderTailHit:
|
||||||
|
return null;
|
||||||
|
|
||||||
case HitResult.IgnoreMiss:
|
case HitResult.IgnoreMiss:
|
||||||
case HitResult.LargeTickMiss:
|
case HitResult.LargeTickMiss:
|
||||||
return new ArgonJudgementPieceSliderTickMiss(result);
|
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 System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@@ -115,6 +117,39 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
|
|
||||||
return null;
|
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:
|
case OsuSkinComponentLookup osuComponent:
|
||||||
switch (osuComponent.Component)
|
switch (osuComponent.Component)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -232,10 +232,47 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
|||||||
if (pointGrid.Content.Count == 0)
|
if (pointGrid.Content.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double angle1 = Math.Atan2(end.Y - hitPoint.Y, hitPoint.X - end.X); // Angle between the end point and the hit point.
|
Vector2 relativePosition = FindRelativeHitPosition(start, end, hitPoint, radius, rotation);
|
||||||
double angle2 = Math.Atan2(end.Y - start.Y, start.X - end.X); // Angle between the end point and the start point.
|
|
||||||
|
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.
|
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.
|
// 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:
|
// 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.
|
// We also need to apply the anti-clockwise rotation.
|
||||||
double rotatedAngle = finalAngle - float.DegreesToRadians(rotation);
|
double rotatedAngle = finalAngle - float.DegreesToRadians(rotation);
|
||||||
var rotatedCoordinate = -1 * new Vector2((float)Math.Cos(rotatedAngle), (float)Math.Sin(rotatedAngle));
|
return -normalisedDistance * 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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private abstract partial class GridPoint : CompositeDrawable
|
private abstract partial class GridPoint : CompositeDrawable
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
HitResult.Ok,
|
HitResult.Ok,
|
||||||
HitResult.Meh,
|
HitResult.Meh,
|
||||||
HitResult.Miss,
|
HitResult.Miss,
|
||||||
|
HitResult.LargeTickHit,
|
||||||
|
HitResult.SliderTailHit,
|
||||||
HitResult.LargeTickMiss,
|
HitResult.LargeTickMiss,
|
||||||
HitResult.IgnoreMiss,
|
HitResult.IgnoreMiss,
|
||||||
}, onJudgementLoaded));
|
}, 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)
|
private BeatmapVerifierContext getContext(Stream? resourceStream)
|
||||||
{
|
{
|
||||||
var mockWorkingBeatmap = new Mock<TestWorkingBeatmap>(beatmap, null, null);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -92,7 +92,7 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
SetDefault(OsuSetting.ExternalLinkWarning, true);
|
SetDefault(OsuSetting.ExternalLinkWarning, true);
|
||||||
SetDefault(OsuSetting.PreferNoVideo, false);
|
SetDefault(OsuSetting.PreferNoVideo, false);
|
||||||
|
SetDefault(OsuSetting.BackgroundCategory, "Default");
|
||||||
SetDefault(OsuSetting.ShowOnlineExplicitContent, false);
|
SetDefault(OsuSetting.ShowOnlineExplicitContent, false);
|
||||||
|
|
||||||
SetDefault(OsuSetting.NotifyOnUsernameMentioned, true);
|
SetDefault(OsuSetting.NotifyOnUsernameMentioned, true);
|
||||||
@@ -193,7 +193,7 @@ namespace osu.Game.Configuration
|
|||||||
SetDefault(OsuSetting.IntroSequence, IntroSequence.Triangles);
|
SetDefault(OsuSetting.IntroSequence, IntroSequence.Triangles);
|
||||||
|
|
||||||
SetDefault(OsuSetting.MenuBackgroundSource, BackgroundSource.Skin);
|
SetDefault(OsuSetting.MenuBackgroundSource, BackgroundSource.Skin);
|
||||||
SetDefault(OsuSetting.SeasonalBackgroundMode, SeasonalBackgroundMode.Sometimes);
|
SetDefault(OsuSetting.SeasonalBackgroundMode, SeasonalBackgroundMode.Never);
|
||||||
|
|
||||||
SetDefault(OsuSetting.DiscordRichPresence, DiscordRichPresenceMode.Full);
|
SetDefault(OsuSetting.DiscordRichPresence, DiscordRichPresenceMode.Full);
|
||||||
|
|
||||||
@@ -436,6 +436,7 @@ namespace osu.Game.Configuration
|
|||||||
MenuBackgroundSource,
|
MenuBackgroundSource,
|
||||||
GameplayDisableWinKey,
|
GameplayDisableWinKey,
|
||||||
SeasonalBackgroundMode,
|
SeasonalBackgroundMode,
|
||||||
|
BackgroundCategory,
|
||||||
EditorWaveformOpacity,
|
EditorWaveformOpacity,
|
||||||
EditorShowHitMarkers,
|
EditorShowHitMarkers,
|
||||||
EditorAutoSeekOnPlacement,
|
EditorAutoSeekOnPlacement,
|
||||||
|
|||||||
@@ -14,12 +14,6 @@ namespace osu.Game.Configuration
|
|||||||
[LocalisableDescription(typeof(UserInterfaceStrings), nameof(UserInterfaceStrings.AlwaysSeasonalBackground))]
|
[LocalisableDescription(typeof(UserInterfaceStrings), nameof(UserInterfaceStrings.AlwaysSeasonalBackground))]
|
||||||
Always,
|
Always,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Seasonal backgrounds are shown only during their corresponding season.
|
|
||||||
/// </summary>
|
|
||||||
[LocalisableDescription(typeof(UserInterfaceStrings), nameof(UserInterfaceStrings.SometimesSeasonalBackground))]
|
|
||||||
Sometimes,
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Seasonal backgrounds are never shown.
|
/// Seasonal backgrounds are never shown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -204,10 +204,11 @@ namespace osu.Game.Database
|
|||||||
if (!Filename.EndsWith(realm_extension, StringComparison.Ordinal))
|
if (!Filename.EndsWith(realm_extension, StringComparison.Ordinal))
|
||||||
Filename += realm_extension;
|
Filename += realm_extension;
|
||||||
|
|
||||||
#if DEBUG
|
// TODO: fix
|
||||||
|
// #if DEBUG
|
||||||
if (!DebugUtils.IsNUnitRunning)
|
if (!DebugUtils.IsNUnitRunning)
|
||||||
applyFilenameSchemaSuffix(ref Filename);
|
applyFilenameSchemaSuffix(ref Filename);
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
// `prepareFirstRealmAccess()` triggers the first `getRealmInstance` call, which will implicitly run realm migrations and bring the schema up-to-date.
|
// `prepareFirstRealmAccess()` triggers the first `getRealmInstance` call, which will implicitly run realm migrations and bring the schema up-to-date.
|
||||||
using (var realm = prepareFirstRealmAccess())
|
using (var realm = prepareFirstRealmAccess())
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@@ -19,79 +20,120 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
{
|
{
|
||||||
public partial class SeasonalBackgroundLoader : Component
|
public partial class SeasonalBackgroundLoader : Component
|
||||||
{
|
{
|
||||||
|
public event Action<Exception> OnLoadFailure;
|
||||||
|
public event Action BackgroundChanged;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when background should be changed due to receiving backgrounds from API
|
/// Fired when categories have been successfully refreshed from the server.
|
||||||
/// or when the user setting is changed (as it might require unloading the seasonal background).
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action SeasonalBackgroundChanged;
|
public event Action OnCategoriesRefreshed;
|
||||||
|
|
||||||
|
public readonly Bindable<IEnumerable<string>> AvailableCategories = new Bindable<IEnumerable<string>>(new List<string>());
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; }
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
private Bindable<SeasonalBackgroundMode> seasonalBackgroundMode;
|
private Bindable<SeasonalBackgroundMode> backgroundMode;
|
||||||
private Bindable<APISeasonalBackgrounds> seasonalBackgrounds;
|
private Bindable<string> selectedCategory;
|
||||||
|
private Bindable<APISeasonalBackgrounds> currentBackgrounds;
|
||||||
|
|
||||||
private int current;
|
private int currentBackgroundIndex;
|
||||||
|
|
||||||
|
private bool shouldShowCustomBackgrounds => backgroundMode.Value != SeasonalBackgroundMode.Never;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config, SessionStatics sessionStatics)
|
private void load(OsuConfigManager config, SessionStatics sessionStatics)
|
||||||
{
|
{
|
||||||
seasonalBackgroundMode = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode);
|
backgroundMode = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode);
|
||||||
seasonalBackgroundMode.BindValueChanged(_ => SeasonalBackgroundChanged?.Invoke());
|
backgroundMode.BindValueChanged(_ => BackgroundChanged?.Invoke());
|
||||||
|
|
||||||
seasonalBackgrounds = sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds);
|
selectedCategory = config.GetBindable<string>(OsuSetting.BackgroundCategory);
|
||||||
seasonalBackgrounds.BindValueChanged(_ =>
|
selectedCategory.BindValueChanged(_ => fetchBackgroundsForSelectedCategory());
|
||||||
{
|
|
||||||
if (shouldShowSeasonal)
|
|
||||||
SeasonalBackgroundChanged?.Invoke();
|
|
||||||
});
|
|
||||||
|
|
||||||
fetchSeasonalBackgrounds();
|
currentBackgrounds = sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds);
|
||||||
|
|
||||||
|
if (shouldShowCustomBackgrounds)
|
||||||
|
fetchCategories();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchSeasonalBackgrounds()
|
/// <summary>
|
||||||
|
/// Public method to trigger a refresh of categories from the UI.
|
||||||
|
/// </summary>
|
||||||
|
public void RefreshCategories()
|
||||||
{
|
{
|
||||||
if (seasonalBackgrounds.Value != null)
|
fetchCategories();
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
private void fetchCategories()
|
||||||
|
{
|
||||||
|
if (!shouldShowCustomBackgrounds) return;
|
||||||
|
|
||||||
|
var request = new GetBackgroundCategoriesRequest();
|
||||||
|
|
||||||
var request = new GetSeasonalBackgroundsRequest();
|
|
||||||
request.Success += response =>
|
request.Success += response =>
|
||||||
{
|
{
|
||||||
seasonalBackgrounds.Value = response;
|
var serverCategories = response.Categories ?? Enumerable.Empty<string>();
|
||||||
current = RNG.Next(0, response.Backgrounds?.Count ?? 0);
|
|
||||||
|
AvailableCategories.Value = new[] { "Default" }.Concat(serverCategories)
|
||||||
|
.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
|
||||||
|
|
||||||
|
if (!AvailableCategories.Value.Contains(selectedCategory.Value))
|
||||||
|
selectedCategory.Value = "Default";
|
||||||
|
else
|
||||||
|
fetchBackgroundsForSelectedCategory();
|
||||||
|
|
||||||
|
OnCategoriesRefreshed?.Invoke();
|
||||||
|
};
|
||||||
|
|
||||||
|
request.Failure += exception =>
|
||||||
|
{
|
||||||
|
AvailableCategories.Value = new[] { "Íå óäàëîñü çàãðóçèòü..." };
|
||||||
|
OnLoadFailure?.Invoke(exception);
|
||||||
};
|
};
|
||||||
|
|
||||||
api.PerformAsync(request);
|
api.PerformAsync(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SeasonalBackground LoadNextBackground()
|
private void fetchBackgroundsForSelectedCategory()
|
||||||
{
|
{
|
||||||
if (!shouldShowSeasonal)
|
if (!shouldShowCustomBackgrounds) return;
|
||||||
|
|
||||||
|
if (AvailableCategories.Value.Count() == 1 && AvailableCategories.Value.First().Contains("Íå óäàëîñü"))
|
||||||
|
{
|
||||||
|
currentBackgrounds.Value = new APISeasonalBackgrounds { Backgrounds = new List<APISeasonalBackground>() };
|
||||||
|
BackgroundChanged?.Invoke();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string categoryToFetch = selectedCategory.Value == "Default" ? null : selectedCategory.Value;
|
||||||
|
var request = new GetSeasonalBackgroundsRequest(categoryToFetch);
|
||||||
|
|
||||||
|
request.Success += response =>
|
||||||
|
{
|
||||||
|
currentBackgrounds.Value = response;
|
||||||
|
currentBackgroundIndex = RNG.Next(0, response.Backgrounds?.Count ?? 0);
|
||||||
|
BackgroundChanged?.Invoke();
|
||||||
|
};
|
||||||
|
|
||||||
|
request.Failure += exception =>
|
||||||
|
{
|
||||||
|
OnLoadFailure?.Invoke(exception);
|
||||||
|
};
|
||||||
|
|
||||||
|
api.PerformAsync(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Background LoadNextBackground()
|
||||||
|
{
|
||||||
|
if (!shouldShowCustomBackgrounds || currentBackgrounds.Value?.Backgrounds?.Any() != true)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var backgrounds = seasonalBackgrounds.Value.Backgrounds;
|
var backgrounds = currentBackgrounds.Value.Backgrounds;
|
||||||
|
currentBackgroundIndex = (currentBackgroundIndex + 1) % backgrounds.Count;
|
||||||
current = (current + 1) % backgrounds.Count;
|
string url = backgrounds[currentBackgroundIndex].Url;
|
||||||
string url = backgrounds[current].Url;
|
|
||||||
|
|
||||||
return new SeasonalBackground(url);
|
return new SeasonalBackground(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool shouldShowSeasonal
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (seasonalBackgroundMode.Value == SeasonalBackgroundMode.Never)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (seasonalBackgroundMode.Value == SeasonalBackgroundMode.Sometimes && !isInSeason)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return seasonalBackgrounds.Value?.Backgrounds?.Any() == true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool isInSeason => seasonalBackgrounds.Value != null && DateTimeOffset.Now < seasonalBackgrounds.Value.EndDate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[LongRunningLoad]
|
[LongRunningLoad]
|
||||||
|
|||||||
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}";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -69,6 +69,11 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString SeasonalBackgrounds => new TranslatableString(getKey(@"seasonal_backgrounds"), @"Seasonal backgrounds");
|
public static LocalisableString SeasonalBackgrounds => new TranslatableString(getKey(@"seasonal_backgrounds"), @"Seasonal backgrounds");
|
||||||
|
|
||||||
|
/*/// <summary>
|
||||||
|
/// "Seasonal backgrounds"
|
||||||
|
/// </summary>*/
|
||||||
|
/* public static LocalisableString SeasonalBackgroundsCategories => new TranslatableString(getKey(@"seasonal_backgrounds_categories"), @"Seasonal backgrounds categories");
|
||||||
|
*/
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Changes to this setting will only apply with an active osu!supporter tag."
|
/// "Changes to this setting will only apply with an active osu!supporter tag."
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// 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.Online.API.Requests.Responses;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.API.Requests
|
||||||
|
{
|
||||||
|
public class GetBackgroundCategoriesRequest : APIRequest<APIBackgroundCategories>
|
||||||
|
{
|
||||||
|
protected override string Target => @"seasonal-backgrounds-categories";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,33 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
using System.Net;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests
|
namespace osu.Game.Online.API.Requests
|
||||||
{
|
{
|
||||||
public class GetSeasonalBackgroundsRequest : APIRequest<APISeasonalBackgrounds>
|
public class GetSeasonalBackgroundsRequest : APIRequest<APISeasonalBackgrounds>
|
||||||
{
|
{
|
||||||
protected override string Target => @"seasonal-backgrounds";
|
private readonly string? category;
|
||||||
|
|
||||||
|
public GetSeasonalBackgroundsRequest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetSeasonalBackgroundsRequest(string? category)
|
||||||
|
{
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string Target => getPath();
|
||||||
|
|
||||||
|
private string getPath()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(category))
|
||||||
|
return @"seasonal-backgrounds";
|
||||||
|
|
||||||
|
return $@"seasonal-backgrounds?category={WebUtility.UrlEncode(category)}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// 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 Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.API.Requests.Responses
|
||||||
|
{
|
||||||
|
public class APIBackgroundCategories
|
||||||
|
{
|
||||||
|
[JsonProperty("categories")]
|
||||||
|
public List<string>? Categories { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,13 +7,13 @@ namespace osu.Game.Online
|
|||||||
{
|
{
|
||||||
public DevelopmentEndpointConfiguration()
|
public DevelopmentEndpointConfiguration()
|
||||||
{
|
{
|
||||||
WebsiteUrl = APIUrl = @"https://dev.ppy.sh";
|
WebsiteUrl = APIUrl = @"https://osu.jvnko.boats";
|
||||||
APIClientSecret = @"3LP2mhUrV89xxzD1YKNndXHEhWWCRLPNKioZ9ymT";
|
APIClientSecret = @"ijBg9O6aULCYGnvEELYD3IdW7fqrYiFaoMdkzQNA";
|
||||||
APIClientID = "5";
|
APIClientID = "1";
|
||||||
SpectatorUrl = $@"{APIUrl}/signalr/spectator";
|
SpectatorUrl = $@"https://osu-spec.jvnko.boats/spectator";
|
||||||
MultiplayerUrl = $@"{APIUrl}/signalr/multiplayer";
|
MultiplayerUrl = $@"https://osu-spec.jvnko.boats/multiplayer";
|
||||||
MetadataUrl = $@"{APIUrl}/signalr/metadata";
|
MetadataUrl = $@"https://osu-spec.jvnko.boats/metadata";
|
||||||
BeatmapSubmissionServiceUrl = $@"{APIUrl}/beatmap-submission";
|
BeatmapSubmissionServiceUrl = $@"https://osu-bss.jvnko.boats";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ namespace osu.Game.Online
|
|||||||
{
|
{
|
||||||
public ProductionEndpointConfiguration()
|
public ProductionEndpointConfiguration()
|
||||||
{
|
{
|
||||||
WebsiteUrl = APIUrl = @"https://osu.ppy.sh";
|
WebsiteUrl = APIUrl = @"https://osu.jvnko.boats";
|
||||||
APIClientSecret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk";
|
APIClientSecret = @"ijBg9O6aULCYGnvEELYD3IdW7fqrYiFaoMdkzQNA";
|
||||||
APIClientID = "5";
|
APIClientID = "1";
|
||||||
SpectatorUrl = "https://spectator.ppy.sh/spectator";
|
SpectatorUrl = $@"https://osu-spec.jvnko.boats/spectator";
|
||||||
MultiplayerUrl = "https://spectator.ppy.sh/multiplayer";
|
MultiplayerUrl = $@"https://osu-spec.jvnko.boats/multiplayer";
|
||||||
MetadataUrl = "https://spectator.ppy.sh/metadata";
|
MetadataUrl = $@"https://osu-spec.jvnko.boats/metadata";
|
||||||
BeatmapSubmissionServiceUrl = "https://bss.ppy.sh";
|
BeatmapSubmissionServiceUrl = $@"https://osu-bss.jvnko.boats";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace osu.Game.Online
|
|||||||
{
|
{
|
||||||
protected override string GetLookupUrl(string url)
|
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(@".jvnko.boats", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
Logger.Log($@"Blocking resource lookup from external website: {url}", LoggingTarget.Network, LogLevel.Important);
|
Logger.Log($@"Blocking resource lookup from external website: {url}", LoggingTarget.Network, LogLevel.Important);
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ using osu.Game.Configuration;
|
|||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Backgrounds;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
@@ -92,9 +93,9 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// Different port allows running release and debug builds alongside each other.
|
// 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
|
#else
|
||||||
public const string IPC_PIPE_NAME = "osu-lazer";
|
public const string IPC_PIPE_NAME = "jvnkosu";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -169,6 +170,9 @@ namespace osu.Game
|
|||||||
[Cached]
|
[Cached]
|
||||||
private readonly ScreenshotManager screenshotManager = new ScreenshotManager();
|
private readonly ScreenshotManager screenshotManager = new ScreenshotManager();
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private readonly SeasonalBackgroundLoader backgroundLoader;
|
||||||
|
|
||||||
protected SentryLogger SentryLogger;
|
protected SentryLogger SentryLogger;
|
||||||
|
|
||||||
public virtual StableStorage GetStorageForStableInstall() => null;
|
public virtual StableStorage GetStorageForStableInstall() => null;
|
||||||
@@ -249,6 +253,10 @@ namespace osu.Game
|
|||||||
|
|
||||||
public OsuGame(string[] args = null)
|
public OsuGame(string[] args = null)
|
||||||
{
|
{
|
||||||
|
backgroundLoader = new SeasonalBackgroundLoader();
|
||||||
|
backgroundLoader.OnLoadFailure += handleBackgroundLoadFailure;
|
||||||
|
backgroundLoader.OnCategoriesRefreshed += handleCategoriesRefreshed;
|
||||||
|
|
||||||
this.args = args;
|
this.args = args;
|
||||||
|
|
||||||
Logger.NewEntry += forwardGeneralLogToNotifications;
|
Logger.NewEntry += forwardGeneralLogToNotifications;
|
||||||
@@ -401,6 +409,17 @@ namespace osu.Game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void handleCategoriesRefreshed()
|
||||||
|
{
|
||||||
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
Notifications?.Post(new SimpleNotification
|
||||||
|
{
|
||||||
|
Text = "Ñïèñîê êàòåãîðèé ôîíîâ îáíîâëåí.",
|
||||||
|
Icon = FontAwesome.Solid.CheckCircle
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
@@ -1232,6 +1251,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
loadComponentSingleFile(screenshotManager, Add);
|
loadComponentSingleFile(screenshotManager, Add);
|
||||||
|
|
||||||
|
loadComponentSingleFile(backgroundLoader, Add);
|
||||||
|
|
||||||
// dependency on notification overlay, dependent by settings overlay
|
// dependency on notification overlay, dependent by settings overlay
|
||||||
loadComponentSingleFile(CreateUpdateManager(), Add, true);
|
loadComponentSingleFile(CreateUpdateManager(), Add, true);
|
||||||
|
|
||||||
@@ -1333,6 +1354,17 @@ namespace osu.Game
|
|||||||
handleStartupImport();
|
handleStartupImport();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleBackgroundLoadFailure(Exception exception)
|
||||||
|
{
|
||||||
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
Notifications?.Post(new SimpleNotification
|
||||||
|
{
|
||||||
|
Text = "Íå óäàëîñü çàãðóçèòü ôîíû. Ïðîâåðüòå ïîäêëþ÷åíèå ê èíòåðíåòó.",
|
||||||
|
Icon = FontAwesome.Solid.ExclamationTriangle
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
private void handleBackButton()
|
private void handleBackButton()
|
||||||
{
|
{
|
||||||
// TODO: this is SUPER SUPER bad.
|
// TODO: this is SUPER SUPER bad.
|
||||||
@@ -1701,6 +1733,11 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
case IntroScreen intro:
|
case IntroScreen intro:
|
||||||
introScreen = intro;
|
introScreen = intro;
|
||||||
|
SimpleNotification notification = new SimpleNotification
|
||||||
|
{
|
||||||
|
Text = "Welcome to jvnkosu!lazer!",
|
||||||
|
};
|
||||||
|
Notifications?.Post(notification);
|
||||||
devBuildBanner?.Show();
|
devBuildBanner?.Show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -76,12 +76,12 @@ namespace osu.Game
|
|||||||
public partial class OsuGameBase : Framework.Game, ICanAcceptFiles, IBeatSyncProvider
|
public partial class OsuGameBase : Framework.Game, ICanAcceptFiles, IBeatSyncProvider
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public const string GAME_NAME = "osu! (development)";
|
public const string GAME_NAME = "jvnkosu! (development)";
|
||||||
#else
|
#else
|
||||||
public const string GAME_NAME = "osu!";
|
public const string GAME_NAME = "jvnkosu!";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public const string OSU_PROTOCOL = "osu://";
|
public const string OSU_PROTOCOL = "jnvkosu://";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The filename of the main client database.
|
/// The filename of the main client database.
|
||||||
|
|||||||
@@ -30,9 +30,18 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Font = OsuFont.Numeric.With(weight: FontWeight.Bold, size: 12),
|
Font = OsuFont.Torus.With(size: 12),
|
||||||
Colour = colours.YellowDark,
|
Colour = colours.GrayF,
|
||||||
Text = @"DEVELOPER BUILD",
|
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
|
new Sprite
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,9 +8,11 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics.Backgrounds;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
using osu.Game.Overlays.Settings;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
||||||
{
|
{
|
||||||
@@ -18,6 +20,9 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
|||||||
{
|
{
|
||||||
protected override LocalisableString Header => UserInterfaceStrings.MainMenuHeader;
|
protected override LocalisableString Header => UserInterfaceStrings.MainMenuHeader;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private SeasonalBackgroundLoader backgroundLoader { get; set; }
|
||||||
|
|
||||||
private IBindable<APIUser> user;
|
private IBindable<APIUser> user;
|
||||||
|
|
||||||
private SettingsEnumDropdown<BackgroundSource> backgroundSourceDropdown;
|
private SettingsEnumDropdown<BackgroundSource> backgroundSourceDropdown;
|
||||||
@@ -27,6 +32,46 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
|||||||
{
|
{
|
||||||
user = api.LocalUser.GetBoundCopy();
|
user = api.LocalUser.GetBoundCopy();
|
||||||
|
|
||||||
|
var backgroundModeBindable = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode);
|
||||||
|
var enabledProxyBindable = new Bindable<bool>();
|
||||||
|
|
||||||
|
backgroundModeBindable.BindValueChanged(mode => enabledProxyBindable.Value = mode.NewValue == SeasonalBackgroundMode.Always, true);
|
||||||
|
enabledProxyBindable.BindValueChanged(enabled => backgroundModeBindable.Value = enabled.NewValue ? SeasonalBackgroundMode.Always : SeasonalBackgroundMode.Never);
|
||||||
|
|
||||||
|
var backgroundToggle = new SettingsCheckbox
|
||||||
|
{
|
||||||
|
LabelText = "Пользовательские фоны",
|
||||||
|
Current = enabledProxyBindable
|
||||||
|
};
|
||||||
|
|
||||||
|
var categoryDropdown = new SettingsDropdown<string>
|
||||||
|
{
|
||||||
|
LabelText = "Категория фонов",
|
||||||
|
Current = config.GetBindable<string>(OsuSetting.BackgroundCategory)
|
||||||
|
};
|
||||||
|
|
||||||
|
var refreshButton = new SettingsButton
|
||||||
|
{
|
||||||
|
Text = "Обновить список категорий",
|
||||||
|
Action = () => backgroundLoader.RefreshCategories()
|
||||||
|
};
|
||||||
|
|
||||||
|
backgroundLoader.AvailableCategories.BindValueChanged(categories => categoryDropdown.Items = categories.NewValue, true);
|
||||||
|
|
||||||
|
backgroundModeBindable.BindValueChanged(mode =>
|
||||||
|
{
|
||||||
|
if (mode.NewValue == SeasonalBackgroundMode.Always)
|
||||||
|
{
|
||||||
|
categoryDropdown.Show();
|
||||||
|
refreshButton.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
categoryDropdown.Hide();
|
||||||
|
refreshButton.Hide();
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
@@ -56,11 +101,9 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
|||||||
LabelText = UserInterfaceStrings.BackgroundSource,
|
LabelText = UserInterfaceStrings.BackgroundSource,
|
||||||
Current = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource),
|
Current = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource),
|
||||||
},
|
},
|
||||||
new SettingsEnumDropdown<SeasonalBackgroundMode>
|
backgroundToggle,
|
||||||
{
|
categoryDropdown,
|
||||||
LabelText = UserInterfaceStrings.SeasonalBackgrounds,
|
refreshButton,
|
||||||
Current = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode),
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
new CheckDelayedHitsounds(),
|
new CheckDelayedHitsounds(),
|
||||||
new CheckSongFormat(),
|
new CheckSongFormat(),
|
||||||
new CheckHitsoundsFormat(),
|
new CheckHitsoundsFormat(),
|
||||||
|
new CheckInconsistentAudio(),
|
||||||
|
|
||||||
// Files
|
// Files
|
||||||
new CheckZeroByteFiles(),
|
new CheckZeroByteFiles(),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using ManagedBass;
|
|||||||
using osu.Framework.Audio.Callbacks;
|
using osu.Framework.Audio.Callbacks;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
|
using osu.Game.Models;
|
||||||
using osu.Game.Rulesets.Edit.Checks.Components;
|
using osu.Game.Rulesets.Edit.Checks.Components;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit.Checks
|
namespace osu.Game.Rulesets.Edit.Checks
|
||||||
@@ -24,13 +25,22 @@ namespace osu.Game.Rulesets.Edit.Checks
|
|||||||
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
|
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
|
||||||
{
|
{
|
||||||
var beatmapSet = context.CurrentDifficulty.Playable.BeatmapInfo.BeatmapSet;
|
var beatmapSet = context.CurrentDifficulty.Playable.BeatmapInfo.BeatmapSet;
|
||||||
var audioFile = beatmapSet?.GetFile(context.CurrentDifficulty.Playable.Metadata.AudioFile);
|
|
||||||
|
|
||||||
if (beatmapSet == null) yield break;
|
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)
|
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()))
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,7 +62,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
source.ValueChanged += _ => Scheduler.AddOnce(next);
|
source.ValueChanged += _ => Scheduler.AddOnce(next);
|
||||||
beatmap.ValueChanged += _ => Scheduler.AddOnce(next);
|
beatmap.ValueChanged += _ => Scheduler.AddOnce(next);
|
||||||
introSequence.ValueChanged += _ => Scheduler.AddOnce(next);
|
introSequence.ValueChanged += _ => Scheduler.AddOnce(next);
|
||||||
seasonalBackgroundLoader.SeasonalBackgroundChanged += () => Scheduler.AddOnce(next);
|
seasonalBackgroundLoader.BackgroundChanged += () => Scheduler.AddOnce(next);
|
||||||
|
|
||||||
currentDisplay = RNG.Next(0, background_count);
|
currentDisplay = RNG.Next(0, background_count);
|
||||||
Next();
|
Next();
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ namespace osu.Game.Screens.Play
|
|||||||
private SkinnableSound failSample = null!;
|
private SkinnableSound failSample = null!;
|
||||||
private AudioFilter failLowPassFilter = null!;
|
private AudioFilter failLowPassFilter = null!;
|
||||||
private AudioFilter failHighPassFilter = null!;
|
private AudioFilter failHighPassFilter = null!;
|
||||||
|
private Container content = null!;
|
||||||
|
|
||||||
private double? failTime;
|
private double? failTime;
|
||||||
|
|
||||||
@@ -44,7 +45,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public ReplayFailIndicator(GameplayClockContainer gameplayClockContainer)
|
public ReplayFailIndicator(GameplayClockContainer gameplayClockContainer)
|
||||||
{
|
{
|
||||||
AlwaysPresent = true;
|
|
||||||
Clock = this.gameplayClockContainer = gameplayClockContainer;
|
Clock = this.gameplayClockContainer = gameplayClockContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,6 @@ namespace osu.Game.Screens.Play
|
|||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Alpha = 0;
|
|
||||||
|
|
||||||
track = beatmap.Value.Track;
|
track = beatmap.Value.Track;
|
||||||
|
|
||||||
@@ -65,13 +64,14 @@ namespace osu.Game.Screens.Play
|
|||||||
failSample = new SkinnableSound(new SampleInfo(@"Gameplay/failsound")),
|
failSample = new SkinnableSound(new SampleInfo(@"Gameplay/failsound")),
|
||||||
failLowPassFilter = new AudioFilter(audio.TrackMixer),
|
failLowPassFilter = new AudioFilter(audio.TrackMixer),
|
||||||
failHighPassFilter = new AudioFilter(audio.TrackMixer, BQFType.HighPass),
|
failHighPassFilter = new AudioFilter(audio.TrackMixer, BQFType.HighPass),
|
||||||
new Container
|
content = new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
CornerRadius = 20,
|
CornerRadius = 20,
|
||||||
|
Alpha = 0,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@@ -132,7 +132,7 @@ namespace osu.Game.Screens.Play
|
|||||||
// intentionally shorter than the actual fail animation
|
// intentionally shorter than the actual fail animation
|
||||||
const double audio_sweep_duration = 1000;
|
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.ScaleTo(1.1f, audio_sweep_duration, Easing.OutElasticHalf);
|
||||||
this.TransformBindableTo(trackFreq, 0, audio_sweep_duration);
|
this.TransformBindableTo(trackFreq, 0, audio_sweep_duration);
|
||||||
this.TransformBindableTo(volumeAdjustment, 0.5);
|
this.TransformBindableTo(volumeAdjustment, 0.5);
|
||||||
@@ -155,8 +155,11 @@ namespace osu.Game.Screens.Play
|
|||||||
failSample.Play();
|
failSample.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Time.Current < failTime)
|
if (Time.Current < failTime && failSamplePlaybackInitiated)
|
||||||
|
{
|
||||||
failSamplePlaybackInitiated = false;
|
failSamplePlaybackInitiated = false;
|
||||||
|
failSample.Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
|||||||
@@ -197,8 +197,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public override void OnSuspending(ScreenTransitionEvent e)
|
public override void OnSuspending(ScreenTransitionEvent e)
|
||||||
{
|
{
|
||||||
// safety against filters or samples from the indicator playing long after the screen is exited
|
stopAllAudioEffects();
|
||||||
failIndicator.RemoveAndDisposeImmediately();
|
|
||||||
base.OnSuspending(e);
|
base.OnSuspending(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,5 +207,17 @@ namespace osu.Game.Screens.Play
|
|||||||
failIndicator.RemoveAndDisposeImmediately();
|
failIndicator.RemoveAndDisposeImmediately();
|
||||||
return base.OnExiting(e);
|
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.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
@@ -50,6 +51,9 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
|
|
||||||
private TrianglesV2 triangles = null!;
|
private TrianglesV2 triangles = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IRulesetStore rulesets { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OverlayColourProvider colourProvider { get; set; } = null!;
|
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||||
|
|
||||||
@@ -215,7 +219,7 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
Debug.Assert(Item != null);
|
Debug.Assert(Item != null);
|
||||||
var beatmap = (BeatmapInfo)Item.Model;
|
var beatmap = (BeatmapInfo)Item.Model;
|
||||||
|
|
||||||
difficultyIcon.Icon = beatmap.Ruleset.CreateInstance().CreateIcon();
|
difficultyIcon.Icon = getRulesetIcon(beatmap.Ruleset);
|
||||||
|
|
||||||
localRank.Beatmap = beatmap;
|
localRank.Beatmap = beatmap;
|
||||||
difficultyText.Text = beatmap.DifficultyName;
|
difficultyText.Text = beatmap.DifficultyName;
|
||||||
@@ -225,6 +229,16 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
updateKeyCount();
|
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()
|
protected override void FreeAfterUse()
|
||||||
{
|
{
|
||||||
base.FreeAfterUse();
|
base.FreeAfterUse();
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace osu.Game.Users.Drawables
|
|||||||
if (user != null && user.OnlineID > 1)
|
if (user != null && user.OnlineID > 1)
|
||||||
// TODO: The fallback here should not need to exist. Users should be looked up and populated via UserLookupCache or otherwise
|
// TODO: The fallback here should not need to exist. Users should be looked up and populated via UserLookupCache or otherwise
|
||||||
// in remaining cases where this is required (chat tabs, local leaderboard), at which point this should be removed.
|
// in remaining cases where this is required (chat tabs, local leaderboard), at which point this should be removed.
|
||||||
Texture = textures.Get((user as APIUser)?.AvatarUrl ?? $@"https://a.ppy.sh/{user.OnlineID}");
|
Texture = textures.Get((user as APIUser)?.AvatarUrl ?? $@"https://osu.jvnko.boats/uploads-avatar/{user.OnlineID}");
|
||||||
|
|
||||||
Texture ??= textures.Get(@"Online/avatar-guest");
|
Texture ??= textures.Get(@"Online/avatar-guest");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="20.1.0" />
|
<PackageReference Include="Realm" Version="20.1.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2025.808.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" />
|
<PackageReference Include="Sentry" Version="5.1.1" />
|
||||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||||
<PackageReference Include="SharpCompress" Version="0.39.0" />
|
<PackageReference Include="SharpCompress" Version="0.39.0" />
|
||||||
|
|||||||
Reference in New Issue
Block a user