mirror of
https://github.com/ppy/osu.git
synced 2025-01-09 02:24:10 +08:00
Add keycount to song select details panel and carousel panels
This commit is contained in:
parent
767d5c8018
commit
b36db3518c
@ -57,10 +57,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
|||||||
|
|
||||||
public static int GetColumnCount(LegacyBeatmapConversionDifficultyInfo difficulty)
|
public static int GetColumnCount(LegacyBeatmapConversionDifficultyInfo difficulty)
|
||||||
{
|
{
|
||||||
if (new ManiaRuleset().RulesetInfo.Equals(difficulty.SourceRuleset))
|
|
||||||
return GetColumnCountForNonConvert(difficulty);
|
|
||||||
|
|
||||||
double roundedCircleSize = Math.Round(difficulty.CircleSize);
|
double roundedCircleSize = Math.Round(difficulty.CircleSize);
|
||||||
|
|
||||||
|
if (new ManiaRuleset().RulesetInfo.Equals(difficulty.SourceRuleset))
|
||||||
|
return (int)Math.Max(1, roundedCircleSize);
|
||||||
|
|
||||||
double roundedOverallDifficulty = Math.Round(difficulty.OverallDifficulty);
|
double roundedOverallDifficulty = Math.Round(difficulty.OverallDifficulty);
|
||||||
|
|
||||||
int countSliderOrSpinner = difficulty.TotalObjectCount - difficulty.CircleCount;
|
int countSliderOrSpinner = difficulty.TotalObjectCount - difficulty.CircleCount;
|
||||||
@ -76,12 +77,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
|||||||
return Math.Max(4, Math.Min((int)roundedOverallDifficulty + 1, 7));
|
return Math.Max(4, Math.Min((int)roundedOverallDifficulty + 1, 7));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetColumnCountForNonConvert(IBeatmapDifficultyInfo difficulty)
|
|
||||||
{
|
|
||||||
double roundedCircleSize = Math.Round(difficulty.CircleSize);
|
|
||||||
return (int)Math.Max(1, roundedCircleSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanConvert() => Beatmap.HitObjects.All(h => h is IHasXPosition);
|
public override bool CanConvert() => Beatmap.HitObjects.All(h => h is IHasXPosition);
|
||||||
|
|
||||||
protected override Beatmap<ManiaHitObject> ConvertBeatmap(IBeatmap original, CancellationToken cancellationToken)
|
protected override Beatmap<ManiaHitObject> ConvertBeatmap(IBeatmap original, CancellationToken cancellationToken)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Filter;
|
using osu.Game.Rulesets.Filter;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Scoring.Legacy;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
using osu.Game.Screens.Select.Filter;
|
using osu.Game.Screens.Select.Filter;
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
|
|
||||||
public bool Matches(BeatmapInfo beatmapInfo)
|
public bool Matches(BeatmapInfo beatmapInfo)
|
||||||
{
|
{
|
||||||
return !keys.HasFilter || (beatmapInfo.Ruleset.OnlineID == new ManiaRuleset().LegacyID && keys.IsInRange(ManiaBeatmapConverter.GetColumnCountForNonConvert(beatmapInfo.Difficulty)));
|
return !keys.HasFilter || keys.IsInRange(ManiaBeatmapConverter.GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmapInfo(beatmapInfo)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryParseCustomKeywordCriteria(string key, Operator op, string value)
|
public bool TryParseCustomKeywordCriteria(string key, Operator op, string value)
|
||||||
|
@ -420,6 +420,9 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
public override RulesetSetupSection CreateEditorSetupSection() => new ManiaSetupSection();
|
public override RulesetSetupSection CreateEditorSetupSection() => new ManiaSetupSection();
|
||||||
|
|
||||||
public override DifficultySection CreateEditorDifficultySection() => new ManiaDifficultySection();
|
public override DifficultySection CreateEditorDifficultySection() => new ManiaDifficultySection();
|
||||||
|
|
||||||
|
public int GetKeyCount(IBeatmapInfo beatmapInfo)
|
||||||
|
=> ManiaBeatmapConverter.GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmapInfo(beatmapInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PlayfieldType
|
public enum PlayfieldType
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Scoring.Legacy;
|
using osu.Game.Rulesets.Scoring.Legacy;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets
|
namespace osu.Game.Rulesets
|
||||||
@ -14,6 +15,12 @@ namespace osu.Game.Rulesets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
int LegacyID { get; }
|
int LegacyID { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the number of mania keys required to play the beatmap.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
int GetKeyCount(IBeatmapInfo beatmapInfo) => 0;
|
||||||
|
|
||||||
ILegacyScoreSimulator CreateLegacyScoreSimulator();
|
ILegacyScoreSimulator CreateLegacyScoreSimulator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Scoring.Legacy
|
namespace osu.Game.Rulesets.Scoring.Legacy
|
||||||
{
|
{
|
||||||
@ -31,9 +29,6 @@ namespace osu.Game.Rulesets.Scoring.Legacy
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The count of hitcircles in the beatmap.
|
/// The count of hitcircles in the beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
|
||||||
/// When converting from osu! ruleset beatmaps, this is equivalent to the sum of sliders and spinners in the beatmap.
|
|
||||||
/// </remarks>
|
|
||||||
public int CircleCount { get; set; }
|
public int CircleCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -47,22 +42,17 @@ namespace osu.Game.Rulesets.Scoring.Legacy
|
|||||||
double IBeatmapDifficultyInfo.SliderTickRate => 0;
|
double IBeatmapDifficultyInfo.SliderTickRate => 0;
|
||||||
int IBeatmapDifficultyInfo.EndTimeObjectCount => TotalObjectCount - CircleCount;
|
int IBeatmapDifficultyInfo.EndTimeObjectCount => TotalObjectCount - CircleCount;
|
||||||
|
|
||||||
public static LegacyBeatmapConversionDifficultyInfo FromAPIBeatmap(APIBeatmap apiBeatmap) => new LegacyBeatmapConversionDifficultyInfo
|
public static LegacyBeatmapConversionDifficultyInfo FromAPIBeatmap(APIBeatmap apiBeatmap) => FromBeatmapInfo(apiBeatmap);
|
||||||
{
|
|
||||||
SourceRuleset = apiBeatmap.Ruleset,
|
|
||||||
CircleSize = apiBeatmap.CircleSize,
|
|
||||||
OverallDifficulty = apiBeatmap.OverallDifficulty,
|
|
||||||
CircleCount = apiBeatmap.CircleCount,
|
|
||||||
TotalObjectCount = apiBeatmap.SliderCount + apiBeatmap.SpinnerCount + apiBeatmap.CircleCount
|
|
||||||
};
|
|
||||||
|
|
||||||
public static LegacyBeatmapConversionDifficultyInfo FromBeatmap(IBeatmap beatmap) => new LegacyBeatmapConversionDifficultyInfo
|
public static LegacyBeatmapConversionDifficultyInfo FromBeatmap(IBeatmap beatmap) => FromBeatmapInfo(beatmap.BeatmapInfo);
|
||||||
|
|
||||||
|
public static LegacyBeatmapConversionDifficultyInfo FromBeatmapInfo(IBeatmapInfo beatmapInfo) => new LegacyBeatmapConversionDifficultyInfo
|
||||||
{
|
{
|
||||||
SourceRuleset = beatmap.BeatmapInfo.Ruleset,
|
SourceRuleset = beatmapInfo.Ruleset,
|
||||||
CircleSize = beatmap.Difficulty.CircleSize,
|
CircleSize = beatmapInfo.Difficulty.CircleSize,
|
||||||
OverallDifficulty = beatmap.Difficulty.OverallDifficulty,
|
OverallDifficulty = beatmapInfo.Difficulty.OverallDifficulty,
|
||||||
CircleCount = beatmap.HitObjects.Count(h => h is not IHasDuration),
|
CircleCount = beatmapInfo.Difficulty.TotalObjectCount - beatmapInfo.Difficulty.EndTimeObjectCount,
|
||||||
TotalObjectCount = beatmap.HitObjects.Count
|
TotalObjectCount = beatmapInfo.Difficulty.TotalObjectCount
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -57,6 +58,8 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
private StarCounter starCounter = null!;
|
private StarCounter starCounter = null!;
|
||||||
private DifficultyIcon difficultyIcon = null!;
|
private DifficultyIcon difficultyIcon = null!;
|
||||||
|
|
||||||
|
private OsuSpriteText keyCountText = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapSetOverlay? beatmapOverlay { get; set; }
|
private BeatmapSetOverlay? beatmapOverlay { get; set; }
|
||||||
|
|
||||||
@ -69,6 +72,9 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private RealmAccess realm { get; set; } = null!;
|
private RealmAccess realm { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IBindable<RulesetInfo> ruleset { get; set; } = null!;
|
||||||
|
|
||||||
private IBindable<StarDifficulty?> starDifficultyBindable = null!;
|
private IBindable<StarDifficulty?> starDifficultyBindable = null!;
|
||||||
private CancellationTokenSource? starDifficultyCancellationSource;
|
private CancellationTokenSource? starDifficultyCancellationSource;
|
||||||
|
|
||||||
@ -133,6 +139,13 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
|
keyCountText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.GetFont(size: 20),
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Alpha = 0,
|
||||||
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = beatmapInfo.DifficultyName,
|
Text = beatmapInfo.DifficultyName,
|
||||||
@ -167,6 +180,13 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
ruleset.BindValueChanged(_ => updateKeyCount());
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Selected()
|
protected override void Selected()
|
||||||
{
|
{
|
||||||
base.Selected();
|
base.Selected();
|
||||||
@ -216,11 +236,28 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
if (d.NewValue != null)
|
if (d.NewValue != null)
|
||||||
difficultyIcon.Current.Value = d.NewValue.Value;
|
difficultyIcon.Current.Value = d.NewValue.Value;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
updateKeyCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
base.ApplyState();
|
base.ApplyState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateKeyCount()
|
||||||
|
{
|
||||||
|
if (ruleset.Value.OnlineID == 3)
|
||||||
|
{
|
||||||
|
// Account for mania differences locally for now.
|
||||||
|
// Eventually this should be handled in a more modular way, allowing rulesets to add more information to the panel.
|
||||||
|
ILegacyRuleset legacyRuleset = (ILegacyRuleset)ruleset.Value.CreateInstance();
|
||||||
|
|
||||||
|
keyCountText.Alpha = 1;
|
||||||
|
keyCountText.Text = $"[{legacyRuleset.GetKeyCount(beatmapInfo)}K]";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
keyCountText.Alpha = 0;
|
||||||
|
}
|
||||||
|
|
||||||
public MenuItem[] ContextMenuItems
|
public MenuItem[] ContextMenuItems
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -126,13 +126,21 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
mod.ApplyToDifficulty(adjustedDifficulty);
|
mod.ApplyToDifficulty(adjustedDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (BeatmapInfo?.Ruleset.OnlineID)
|
switch (gameRuleset.Value.OnlineID)
|
||||||
{
|
{
|
||||||
case 3:
|
case 3:
|
||||||
// Account for mania differences locally for now
|
// Account for mania differences locally for now.
|
||||||
// Eventually this should be handled in a more modular way, allowing rulesets to return arbitrary difficulty attributes
|
// Eventually this should be handled in a more modular way, allowing rulesets to return arbitrary difficulty attributes.
|
||||||
|
ILegacyRuleset legacyRuleset = (ILegacyRuleset)gameRuleset.Value.CreateInstance();
|
||||||
|
|
||||||
|
// For the time being, the key count is static no matter what, because:
|
||||||
|
// a) The method doesn't have knowledge of the active keymods. Doing so may require considerations for filtering.
|
||||||
|
// b) Using the difficulty adjustment mod to adjust OD doesn't have an effect on conversion.
|
||||||
|
int keyCount = baseDifficulty == null ? 0 : legacyRuleset.GetKeyCount(BeatmapInfo);
|
||||||
|
|
||||||
FirstValue.Title = BeatmapsetsStrings.ShowStatsCsMania;
|
FirstValue.Title = BeatmapsetsStrings.ShowStatsCsMania;
|
||||||
FirstValue.Value = (baseDifficulty?.CircleSize ?? 0, null);
|
FirstValue.Value = (keyCount, keyCount);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user