mirror of
https://github.com/ppy/osu
synced 2025-03-21 02:17:48 +00:00
Merge pull request #1693 from Aergwyn/fix-beatmap-object-count
Fix BeatmapInfoWedge not counting Circles/Sliders correctly
This commit is contained in:
commit
3bdfe3d60e
@ -1 +1 @@
|
|||||||
Subproject commit 8480ab5009b2b4a7810a817a12433959424d5339
|
Subproject commit dd7dba7212845b780fa50e0aa12b1aaa7155cddb
|
@ -5,7 +5,6 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
|
||||||
using osu.Game.Rulesets.Osu.OsuDifficulty;
|
using osu.Game.Rulesets.Osu.OsuDifficulty;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
@ -18,6 +17,8 @@ using osu.Game.Rulesets.Scoring;
|
|||||||
using osu.Game.Rulesets.Osu.Scoring;
|
using osu.Game.Rulesets.Osu.Scoring;
|
||||||
using osu.Game.Rulesets.Osu.Edit;
|
using osu.Game.Rulesets.Osu.Edit;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu
|
namespace osu.Game.Rulesets.Osu
|
||||||
{
|
{
|
||||||
@ -33,21 +34,28 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
new KeyBinding(InputKey.MouseRight, OsuAction.RightButton),
|
new KeyBinding(InputKey.MouseRight, OsuAction.RightButton),
|
||||||
};
|
};
|
||||||
|
|
||||||
public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new[]
|
public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
new BeatmapStatistic
|
IEnumerable<HitObject> hitObjects = beatmap.Beatmap.HitObjects;
|
||||||
|
IEnumerable<HitObject> circles = hitObjects.Where(d => !(d is IHasEndTime));
|
||||||
|
IEnumerable<HitObject> sliders = hitObjects.Where(s => s is IHasCurve);
|
||||||
|
|
||||||
|
return new[]
|
||||||
{
|
{
|
||||||
Name = @"Circle count",
|
new BeatmapStatistic
|
||||||
Content = beatmap.Beatmap.HitObjects.Count(h => h is HitCircle).ToString(),
|
{
|
||||||
Icon = FontAwesome.fa_dot_circle_o
|
Name = @"Circle Count",
|
||||||
},
|
Content = circles.Count().ToString(),
|
||||||
new BeatmapStatistic
|
Icon = FontAwesome.fa_circle_o
|
||||||
{
|
},
|
||||||
Name = @"Slider count",
|
new BeatmapStatistic
|
||||||
Content = beatmap.Beatmap.HitObjects.Count(h => h is Slider).ToString(),
|
{
|
||||||
Icon = FontAwesome.fa_circle_o
|
Name = @"Slider Count",
|
||||||
}
|
Content = sliders.Count().ToString(),
|
||||||
};
|
Icon = FontAwesome.fa_circle
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public override IEnumerable<Mod> GetModsFor(ModType type)
|
public override IEnumerable<Mod> GetModsFor(ModType type)
|
||||||
{
|
{
|
||||||
|
69
osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs
Normal file
69
osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using OpenTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Screens.Select;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual
|
||||||
|
{
|
||||||
|
public class TestCaseBeatmapInfoWedge : OsuTestCase
|
||||||
|
{
|
||||||
|
private BeatmapManager beatmaps;
|
||||||
|
private readonly Random random;
|
||||||
|
private readonly BeatmapInfoWedge infoWedge;
|
||||||
|
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
|
public TestCaseBeatmapInfoWedge()
|
||||||
|
{
|
||||||
|
random = new Random(0123);
|
||||||
|
|
||||||
|
Add(infoWedge = new BeatmapInfoWedge
|
||||||
|
{
|
||||||
|
Size = new Vector2(0.5f, 245),
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Top = 20,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("show", () =>
|
||||||
|
{
|
||||||
|
Content.FadeInFromZero(250);
|
||||||
|
infoWedge.State = Visibility.Visible;
|
||||||
|
infoWedge.UpdateBeatmap(beatmap);
|
||||||
|
});
|
||||||
|
AddStep("hide", () =>
|
||||||
|
{
|
||||||
|
infoWedge.State = Visibility.Hidden;
|
||||||
|
Content.FadeOut(100);
|
||||||
|
});
|
||||||
|
AddStep("random beatmap", randomBeatmap);
|
||||||
|
AddStep("null beatmap", () => infoWedge.UpdateBeatmap(beatmap.Default));
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuGameBase game, BeatmapManager beatmaps)
|
||||||
|
{
|
||||||
|
this.beatmaps = beatmaps;
|
||||||
|
beatmap.BindTo(game.Beatmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void randomBeatmap()
|
||||||
|
{
|
||||||
|
var sets = beatmaps.GetAllUsableBeatmapSets();
|
||||||
|
if (sets.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var b = sets[random.Next(0, sets.Count)].Beatmaps[0];
|
||||||
|
beatmap.Value = beatmaps.GetWorkingBeatmap(b);
|
||||||
|
infoWedge.UpdateBeatmap(beatmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -90,6 +90,7 @@
|
|||||||
<Compile Include="Beatmaps\Formats\LegacyBeatmapDecoderTest.cs" />
|
<Compile Include="Beatmaps\Formats\LegacyBeatmapDecoderTest.cs" />
|
||||||
<Compile Include="Visual\TestCaseBeatmapDetailArea.cs" />
|
<Compile Include="Visual\TestCaseBeatmapDetailArea.cs" />
|
||||||
<Compile Include="Visual\TestCaseBeatmapDetails.cs" />
|
<Compile Include="Visual\TestCaseBeatmapDetails.cs" />
|
||||||
|
<Compile Include="Visual\TestCaseBeatmapInfoWedge.cs" />
|
||||||
<Compile Include="Visual\TestCaseBeatmapOptionsOverlay.cs" />
|
<Compile Include="Visual\TestCaseBeatmapOptionsOverlay.cs" />
|
||||||
<Compile Include="Visual\TestCaseBeatmapScoresContainer.cs" />
|
<Compile Include="Visual\TestCaseBeatmapScoresContainer.cs" />
|
||||||
<Compile Include="Visual\TestCaseBeatmapSetOverlay.cs" />
|
<Compile Include="Visual\TestCaseBeatmapSetOverlay.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user