Skip to content

Commit

Permalink
Merge branch 'master' into player-loader-star-rating
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy authored May 15, 2021
2 parents 7c2fc9b + 94b7e89 commit dc56250
Show file tree
Hide file tree
Showing 200 changed files with 6,296 additions and 1,223 deletions.
2 changes: 1 addition & 1 deletion osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.422.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.507.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.513.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public LegacyCatchComboCounter(ISkin skin)

InternalChildren = new Drawable[]
{
explosion = new LegacyRollingCounter(skin, LegacyFont.Combo)
explosion = new LegacyRollingCounter(LegacyFont.Combo)
{
Alpha = 0.65f,
Blending = BlendingParameters.Additive,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(1.5f),
},
counter = new LegacyRollingCounter(skin, LegacyFont.Combo)
counter = new LegacyRollingCounter(LegacyFont.Combo)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Mania/ManiaRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class ManiaRuleset : Ruleset, ILegacyRuleset

public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor();

public override HealthProcessor CreateHealthProcessor(double drainStartTime) => new DrainingHealthProcessor(drainStartTime, 0.2);
public override HealthProcessor CreateHealthProcessor(double drainStartTime) => new DrainingHealthProcessor(drainStartTime, 0.5);

public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap, this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Audio;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.Mania.UI;
Expand All @@ -24,6 +25,11 @@ public abstract class DrawableManiaHitObject : DrawableHitObject<ManiaHitObject>
[Resolved(canBeNull: true)]
private ManiaPlayfield playfield { get; set; }

/// <summary>
/// Gets the samples that are played by this object during gameplay.
/// </summary>
public ISampleInfo[] GetGameplaySamples() => Samples.Samples;

protected override float SamplePlaybackPosition
{
get
Expand Down
25 changes: 24 additions & 1 deletion osu.Game.Rulesets.Mania/UI/Column.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ public class Column : ScrollingPlayfield, IKeyBindingHandler<ManiaAction>, IHasA
public const float COLUMN_WIDTH = 80;
public const float SPECIAL_COLUMN_WIDTH = 70;

/// <summary>
/// For hitsounds played by this <see cref="Column"/> (i.e. not as a result of hitting a hitobject),
/// a certain number of samples are allowed to be played concurrently so that it feels better when spam-pressing the key.
/// </summary>
private const int max_concurrent_hitsounds = OsuGameBase.SAMPLE_CONCURRENCY;

/// <summary>
/// The index of this column as part of the whole playfield.
/// </summary>
Expand All @@ -38,6 +44,7 @@ public class Column : ScrollingPlayfield, IKeyBindingHandler<ManiaAction>, IHasA
internal readonly Container TopLevelContainer;
private readonly DrawablePool<PoolableHitExplosion> hitExplosionPool;
private readonly OrderedHitPolicy hitPolicy;
private readonly Container<SkinnableSound> hitSounds;

public Container UnderlayElements => HitObjectArea.UnderlayElements;

Expand All @@ -64,6 +71,12 @@ public Column(int index)
RelativeSizeAxes = Axes.Both
},
background,
hitSounds = new Container<SkinnableSound>
{
Name = "Column samples pool",
RelativeSizeAxes = Axes.Both,
Children = Enumerable.Range(0, max_concurrent_hitsounds).Select(_ => new SkinnableSound()).ToArray()
},
TopLevelContainer = new Container { RelativeSizeAxes = Axes.Both }
};

Expand Down Expand Up @@ -120,6 +133,8 @@ internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result
HitObjectArea.Explosions.Add(hitExplosionPool.Get(e => e.Apply(result)));
}

private int nextHitSoundIndex;

public bool OnPressed(ManiaAction action)
{
if (action != Action.Value)
Expand All @@ -131,7 +146,15 @@ public bool OnPressed(ManiaAction action)
HitObjectContainer.Objects.FirstOrDefault(h => h.HitObject.StartTime > Time.Current) ??
HitObjectContainer.Objects.LastOrDefault();

nextObject?.PlaySamples();
if (nextObject is DrawableManiaHitObject maniaObject)
{
var hitSound = hitSounds[nextHitSoundIndex];

hitSound.Samples = maniaObject.GetGameplaySamples();
hitSound.Play();

nextHitSoundIndex = (nextHitSoundIndex + 1) % max_concurrent_hitsounds;
}

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Edit.Checks;
Expand Down Expand Up @@ -224,20 +225,23 @@ public void TestSliderOffscreenPath()

private void assertOk(IBeatmap beatmap)
{
Assert.That(check.Run(beatmap, new TestWorkingBeatmap(beatmap)), Is.Empty);
var context = new BeatmapVerifierContext(beatmap, new TestWorkingBeatmap(beatmap));
Assert.That(check.Run(context), Is.Empty);
}

private void assertOffscreenCircle(IBeatmap beatmap)
{
var issues = check.Run(beatmap, new TestWorkingBeatmap(beatmap)).ToList();
var context = new BeatmapVerifierContext(beatmap, new TestWorkingBeatmap(beatmap));
var issues = check.Run(context).ToList();

Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckOffscreenObjects.IssueTemplateOffscreenCircle);
}

private void assertOffscreenSlider(IBeatmap beatmap)
{
var issues = check.Run(beatmap, new TestWorkingBeatmap(beatmap)).ToList();
var context = new BeatmapVerifierContext(beatmap, new TestWorkingBeatmap(beatmap));
var issues = check.Run(context).ToList();

Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckOffscreenObjects.IssueTemplateOffscreenSlider);
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void SetUp() => Schedule(() =>

hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());

Child = new SkinProvidingContainer(new DefaultSkin())
Child = new SkinProvidingContainer(new DefaultSkin(null))
{
RelativeSizeAxes = Axes.Both,
Child = drawableHitCircle = new DrawableHitCircle(hitCircle)
Expand Down
6 changes: 3 additions & 3 deletions osu.Game.Rulesets.Osu/Edit/Checks/CheckOffscreenObjects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.

using System.Collections.Generic;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks.Components;
using osu.Game.Rulesets.Osu.Objects;
using osuTK;
Expand Down Expand Up @@ -31,9 +31,9 @@ public class CheckOffscreenObjects : ICheck
new IssueTemplateOffscreenSlider(this)
};

public IEnumerable<Issue> Run(IBeatmap playableBeatmap, IWorkingBeatmap workingBeatmap)
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
{
foreach (var hitobject in playableBeatmap.HitObjects)
foreach (var hitobject in context.Beatmap.HitObjects)
{
switch (hitobject)
{
Expand Down
5 changes: 2 additions & 3 deletions osu.Game.Rulesets.Osu/Edit/OsuBeatmapVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks.Components;
using osu.Game.Rulesets.Osu.Edit.Checks;
Expand All @@ -17,9 +16,9 @@ public class OsuBeatmapVerifier : IBeatmapVerifier
new CheckOffscreenObjects()
};

public IEnumerable<Issue> Run(IBeatmap playableBeatmap, WorkingBeatmap workingBeatmap)
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
{
return checks.SelectMany(check => check.Run(playableBeatmap, workingBeatmap));
return checks.SelectMany(check => check.Run(context));
}
}
}
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySpinner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private void load(DrawableHitObject drawableHitObject, ISkinSource source)
Scale = new Vector2(SPRITE_SCALE),
Y = SPINNER_TOP_OFFSET + 115,
},
bonusCounter = new LegacySpriteText(source, LegacyFont.Score)
bonusCounter = new LegacySpriteText(LegacyFont.Score)
{
Alpha = 0f,
Anchor = Anchor.TopCentre,
Expand All @@ -92,7 +92,7 @@ private void load(DrawableHitObject drawableHitObject, ISkinSource source)
Scale = new Vector2(SPRITE_SCALE),
Position = new Vector2(-87, 445 + spm_hide_offset),
},
spmCounter = new LegacySpriteText(source, LegacyFont.Score)
spmCounter = new LegacySpriteText(LegacyFont.Score)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopRight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public override Drawable GetDrawableComponent(ISkinComponent component)
if (!this.HasFont(LegacyFont.HitCircle))
return null;

return new LegacySpriteText(Source, LegacyFont.HitCircle)
return new LegacySpriteText(LegacyFont.HitCircle)
{
// stable applies a blanket 0.8x scale to hitcircle fonts
Scale = new Vector2(0.8f),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using osu.Framework.Testing;
using osu.Framework.Timing;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Skinning.Legacy;
using osu.Game.Skinning;
Expand All @@ -27,7 +28,7 @@ public TestSceneTaikoScroller()
}));

AddToggleStep("Toggle passing", passing => this.ChildrenOfType<LegacyTaikoScroller>().ForEach(s => s.LastResult.Value =
new JudgementResult(null, new Judgement()) { Type = passing ? HitResult.Great : HitResult.Miss }));
new JudgementResult(new HitObject(), new Judgement()) { Type = passing ? HitResult.Great : HitResult.Miss }));

AddToggleStep("toggle playback direction", reversed => this.reversed = reversed);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected override void Update()
base.Update();

// store X before checking wide enough so if we perform layout there is no positional discrepancy.
float currentX = (InternalChildren?.FirstOrDefault()?.X ?? 0) - (float)Clock.ElapsedFrameTime * 0.1f;
float currentX = (InternalChildren.FirstOrDefault()?.X ?? 0) - (float)Clock.ElapsedFrameTime * 0.1f;

// ensure we have enough sprites
if (!InternalChildren.Any()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace osu.Game.Tests.Beatmaps
{
[TestFixture]
public class BeatmapDifficultyManagerTest
public class BeatmapDifficultyCacheTest
{
[Test]
public void TestKeyEqualsWithDifferentModInstances()
Expand Down
3 changes: 2 additions & 1 deletion osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using osu.Game.IPC;
using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Logging;
using osu.Game.Beatmaps;
using osu.Game.Database;
Expand Down Expand Up @@ -264,7 +265,7 @@ public async Task TestImportThenImportWithDifferentFilename()

// change filename
var firstFile = new FileInfo(Directory.GetFiles(extractedFolder).First());
firstFile.MoveTo(Path.Combine(firstFile.DirectoryName, $"{firstFile.Name}-changed{firstFile.Extension}"));
firstFile.MoveTo(Path.Combine(firstFile.DirectoryName.AsNonNull(), $"{firstFile.Name}-changed{firstFile.Extension}"));

using (var zip = ZipArchive.Create())
{
Expand Down
28 changes: 17 additions & 11 deletions osu.Game.Tests/Editing/Checks/CheckAudioQualityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using NUnit.Framework;
using osu.Framework.Audio.Track;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks;
using osu.Game.Rulesets.Objects;

Expand Down Expand Up @@ -40,23 +41,23 @@ public void TestMissing()
mock.SetupGet(w => w.Beatmap).Returns(beatmap);
mock.SetupGet(w => w.Track).Returns((Track)null);

Assert.That(check.Run(beatmap, mock.Object), Is.Empty);
Assert.That(check.Run(new BeatmapVerifierContext(beatmap, mock.Object)), Is.Empty);
}

[Test]
public void TestAcceptable()
{
var mock = getMockWorkingBeatmap(192);
var context = getContext(192);

Assert.That(check.Run(beatmap, mock.Object), Is.Empty);
Assert.That(check.Run(context), Is.Empty);
}

[Test]
public void TestNullBitrate()
{
var mock = getMockWorkingBeatmap(null);
var context = getContext(null);

var issues = check.Run(beatmap, mock.Object).ToList();
var issues = check.Run(context).ToList();

Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckAudioQuality.IssueTemplateNoBitrate);
Expand All @@ -65,9 +66,9 @@ public void TestNullBitrate()
[Test]
public void TestZeroBitrate()
{
var mock = getMockWorkingBeatmap(0);
var context = getContext(0);

var issues = check.Run(beatmap, mock.Object).ToList();
var issues = check.Run(context).ToList();

Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckAudioQuality.IssueTemplateNoBitrate);
Expand All @@ -76,9 +77,9 @@ public void TestZeroBitrate()
[Test]
public void TestTooHighBitrate()
{
var mock = getMockWorkingBeatmap(320);
var context = getContext(320);

var issues = check.Run(beatmap, mock.Object).ToList();
var issues = check.Run(context).ToList();

Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckAudioQuality.IssueTemplateTooHighBitrate);
Expand All @@ -87,14 +88,19 @@ public void TestTooHighBitrate()
[Test]
public void TestTooLowBitrate()
{
var mock = getMockWorkingBeatmap(64);
var context = getContext(64);

var issues = check.Run(beatmap, mock.Object).ToList();
var issues = check.Run(context).ToList();

Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckAudioQuality.IssueTemplateTooLowBitrate);
}

private BeatmapVerifierContext getContext(int? audioBitrate)
{
return new BeatmapVerifierContext(beatmap, getMockWorkingBeatmap(audioBitrate).Object);
}

/// <summary>
/// Returns the mock of the working beatmap with the given audio properties.
/// </summary>
Expand Down
Loading

0 comments on commit dc56250

Please sign in to comment.