1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 07:22:54 +08:00

Split classes

This commit is contained in:
smoogipoo 2021-10-01 20:56:03 +09:00
parent d0081908c5
commit a1f880a36a
3 changed files with 30 additions and 16 deletions

View File

@ -222,20 +222,9 @@ namespace osu.Game.Rulesets.Difficulty
/// <returns>The <see cref="Skill"/>s.</returns>
protected abstract Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate);
public class TimedDifficultyAttributes : IComparable<TimedDifficultyAttributes>
{
public readonly double Time;
public readonly DifficultyAttributes Attributes;
public TimedDifficultyAttributes(double time, DifficultyAttributes attributes)
{
Time = time;
Attributes = attributes;
}
public int CompareTo(TimedDifficultyAttributes other) => Time.CompareTo(other.Time);
}
/// <summary>
/// Used to calculate timed difficulty attributes, where only a subset of hitobjects should be visible at any point in time.
/// </summary>
private class ProgressiveCalculationBeatmap : IBeatmap
{
private readonly IBeatmap baseBeatmap;

View File

@ -0,0 +1,25 @@
// 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;
namespace osu.Game.Rulesets.Difficulty
{
/// <summary>
/// Wraps a <see cref="DifficultyAttributes"/> object and adds a time value for which the attribute is valid.
/// Output by <see cref="DifficultyCalculator.CalculateTimed"/>.
/// </summary>
public class TimedDifficultyAttributes : IComparable<TimedDifficultyAttributes>
{
public readonly double Time;
public readonly DifficultyAttributes Attributes;
public TimedDifficultyAttributes(double time, DifficultyAttributes attributes)
{
Time = time;
Attributes = attributes;
}
public int CompareTo(TimedDifficultyAttributes other) => Time.CompareTo(other.Time);
}
}

View File

@ -40,7 +40,7 @@ namespace osu.Game.Screens.Play.HUD
[Resolved(CanBeNull = true)]
private Player player { get; set; }
private DifficultyCalculator.TimedDifficultyAttributes[] timedAttributes;
private TimedDifficultyAttributes[] timedAttributes;
private Ruleset gameplayRuleset;
public DefaultPerformancePointsCounter()
@ -73,7 +73,7 @@ namespace osu.Game.Screens.Play.HUD
if (player == null)
return;
var attribIndex = Array.BinarySearch(timedAttributes, 0, timedAttributes.Length, new DifficultyCalculator.TimedDifficultyAttributes(judgement.HitObject.GetEndTime(), null));
var attribIndex = Array.BinarySearch(timedAttributes, 0, timedAttributes.Length, new TimedDifficultyAttributes(judgement.HitObject.GetEndTime(), null));
if (attribIndex < 0)
attribIndex = ~attribIndex - 1;
attribIndex = Math.Clamp(attribIndex, 0, timedAttributes.Length - 1);