mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Implement RepeatSamples in IHasRepeats.
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects
|
||||
@ -19,7 +20,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
/// <summary>
|
||||
/// The time at which the HitObject starts.
|
||||
/// </summary>
|
||||
public double StartTime { get; set; }
|
||||
public double StartTime;
|
||||
|
||||
/// <summary>
|
||||
/// The samples to be played when this hit object is hit.
|
||||
@ -36,17 +37,25 @@ namespace osu.Game.Rulesets.Objects
|
||||
ControlPoint overridePoint;
|
||||
ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint);
|
||||
|
||||
foreach (var sample in Samples)
|
||||
{
|
||||
if (sample.Volume == 0)
|
||||
sample.Volume = (overridePoint ?? timingPoint)?.SampleVolume ?? 0;
|
||||
ControlPoint samplePoint = overridePoint ?? timingPoint;
|
||||
|
||||
// If the bank is not assigned a name, assign it from the control point
|
||||
if (!string.IsNullOrEmpty(sample.Bank))
|
||||
continue;
|
||||
// Initialize first sample
|
||||
foreach (SampleInfo sample in Samples)
|
||||
initializeSampleInfo(sample, samplePoint);
|
||||
|
||||
sample.Bank = (overridePoint ?? timingPoint)?.SampleBank ?? @"normal";
|
||||
}
|
||||
// Initialize any repeat samples
|
||||
var repeatData = this as IHasRepeats;
|
||||
repeatData?.RepeatSamples?.ForEach(r => r.ForEach(s => initializeSampleInfo(s, samplePoint)));
|
||||
}
|
||||
|
||||
private void initializeSampleInfo(SampleInfo sample, ControlPoint controlPoint)
|
||||
{
|
||||
if (sample.Volume == 0)
|
||||
sample.Volume = controlPoint?.SampleVolume ?? 0;
|
||||
|
||||
// If the bank is not assigned a name, assign it from the control point
|
||||
if (string.IsNullOrEmpty(sample.Bank))
|
||||
sample.Bank = controlPoint?.SampleBank ?? @"normal";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user