Fix skinning support for combobreak

This commit is contained in:
Dean Herbert
2019-06-30 21:58:30 +09:00
parent bd54b34538
commit 60ea3d4e1a
29 changed files with 222 additions and 165 deletions

View File

@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
protected SkinnableSound Samples;
protected virtual IEnumerable<SampleInfo> GetSamples() => HitObject.Samples;
protected virtual IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples;
private readonly Lazy<List<DrawableHitObject>> nestedHitObjects = new Lazy<List<DrawableHitObject>>();
public IEnumerable<DrawableHitObject> NestedHitObjects => nestedHitObjects.IsValueCreated ? nestedHitObjects.Value : Enumerable.Empty<DrawableHitObject>();
@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
var samples = GetSamples().ToArray();
if (samples.Any())
if (samples.Length > 0)
{
if (HitObject.SampleControlPoint == null)
throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}."

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Objects
/// </summary>
public virtual double StartTime { get; set; }
private List<SampleInfo> samples;
private List<HitSampleInfo> samples;
/// <summary>
/// The samples to be played when this hit object is hit.
@ -38,9 +38,9 @@ namespace osu.Game.Rulesets.Objects
/// and can be treated as the default samples for the hit object.
/// </para>
/// </summary>
public List<SampleInfo> Samples
public List<HitSampleInfo> Samples
{
get => samples ?? (samples = new List<SampleInfo>());
get => samples ?? (samples = new List<HitSampleInfo>());
set => samples = value;
}

View File

@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<SampleInfo>> nodeSamples)
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<HitSampleInfo>> nodeSamples)
{
newCombo |= forceNewCombo;
comboOffset += extraComboOffset;

View File

@ -180,7 +180,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
}
// Generate the final per-node samples
var nodeSamples = new List<List<SampleInfo>>(nodes);
var nodeSamples = new List<List<HitSampleInfo>>(nodes);
for (int i = 0; i < nodes; i++)
nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i]));
@ -291,7 +291,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
/// <param name="repeatCount">The slider repeat count.</param>
/// <param name="nodeSamples">The samples to be played when the slider nodes are hit. This includes the head and tail of the slider.</param>
/// <returns>The hit object.</returns>
protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<SampleInfo>> nodeSamples);
protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<HitSampleInfo>> nodeSamples);
/// <summary>
/// Creates a legacy Spinner-type hit object.
@ -312,14 +312,14 @@ namespace osu.Game.Rulesets.Objects.Legacy
/// <param name="endTime">The hold end time.</param>
protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime);
private List<SampleInfo> convertSoundType(LegacySoundType type, SampleBankInfo bankInfo)
private List<HitSampleInfo> convertSoundType(LegacySoundType type, SampleBankInfo bankInfo)
{
// Todo: This should return the normal SampleInfos if the specified sample file isn't found, but that's a pretty edge-case scenario
if (!string.IsNullOrEmpty(bankInfo.Filename))
{
return new List<SampleInfo>
return new List<HitSampleInfo>
{
new FileSampleInfo
new FileHitSampleInfo
{
Filename = bankInfo.Filename,
Volume = bankInfo.Volume
@ -327,12 +327,12 @@ namespace osu.Game.Rulesets.Objects.Legacy
};
}
var soundTypes = new List<SampleInfo>
var soundTypes = new List<HitSampleInfo>
{
new LegacySampleInfo
new LegacyHitSampleInfo
{
Bank = bankInfo.Normal,
Name = SampleInfo.HIT_NORMAL,
Name = HitSampleInfo.HIT_NORMAL,
Volume = bankInfo.Volume,
CustomSampleBank = bankInfo.CustomSampleBank
}
@ -340,10 +340,10 @@ namespace osu.Game.Rulesets.Objects.Legacy
if (type.HasFlag(LegacySoundType.Finish))
{
soundTypes.Add(new LegacySampleInfo
soundTypes.Add(new LegacyHitSampleInfo
{
Bank = bankInfo.Add,
Name = SampleInfo.HIT_FINISH,
Name = HitSampleInfo.HIT_FINISH,
Volume = bankInfo.Volume,
CustomSampleBank = bankInfo.CustomSampleBank
});
@ -351,10 +351,10 @@ namespace osu.Game.Rulesets.Objects.Legacy
if (type.HasFlag(LegacySoundType.Whistle))
{
soundTypes.Add(new LegacySampleInfo
soundTypes.Add(new LegacyHitSampleInfo
{
Bank = bankInfo.Add,
Name = SampleInfo.HIT_WHISTLE,
Name = HitSampleInfo.HIT_WHISTLE,
Volume = bankInfo.Volume,
CustomSampleBank = bankInfo.CustomSampleBank
});
@ -362,10 +362,10 @@ namespace osu.Game.Rulesets.Objects.Legacy
if (type.HasFlag(LegacySoundType.Clap))
{
soundTypes.Add(new LegacySampleInfo
soundTypes.Add(new LegacyHitSampleInfo
{
Bank = bankInfo.Add,
Name = SampleInfo.HIT_CLAP,
Name = HitSampleInfo.HIT_CLAP,
Volume = bankInfo.Volume,
CustomSampleBank = bankInfo.CustomSampleBank
});
@ -387,7 +387,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
public SampleBankInfo Clone() => (SampleBankInfo)MemberwiseClone();
}
private class LegacySampleInfo : SampleInfo
private class LegacyHitSampleInfo : HitSampleInfo
{
public int CustomSampleBank
{
@ -399,7 +399,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
}
}
private class FileSampleInfo : SampleInfo
private class FileHitSampleInfo : HitSampleInfo
{
public string Filename;

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
public double Distance => Path.Distance;
public List<List<SampleInfo>> NodeSamples { get; set; }
public List<List<HitSampleInfo>> NodeSamples { get; set; }
public int RepeatCount { get; set; }
public double EndTime => StartTime + this.SpanCount() * Distance / Velocity;

View File

@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<SampleInfo>> nodeSamples)
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<HitSampleInfo>> nodeSamples)
{
return new ConvertSlider
{

View File

@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<SampleInfo>> nodeSamples)
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<HitSampleInfo>> nodeSamples)
{
newCombo |= forceNewCombo;
comboOffset += extraComboOffset;

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
return new ConvertHit();
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<SampleInfo>> nodeSamples)
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<HitSampleInfo>> nodeSamples)
{
return new ConvertSlider
{

View File

@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Objects.Types
/// n-1: The last repeat.<br />
/// n: The last node.
/// </summary>
List<List<SampleInfo>> NodeSamples { get; }
List<List<HitSampleInfo>> NodeSamples { get; }
}
public static class HasRepeatsExtensions