mirror of
https://github.com/ppy/osu.git
synced 2025-02-28 21:45:37 +08:00
Make Samples null by default and prepopulate in mania
This commit is contained in:
parent
298ac5468f
commit
aeafa5645a
@ -50,7 +50,10 @@ namespace osu.Game.Rulesets.Mania.Objects
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The head note of the hold.
|
/// The head note of the hold.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly Note Head = new Note();
|
public readonly Note Head = new Note
|
||||||
|
{
|
||||||
|
Samples = new Audio.SampleInfoList()
|
||||||
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The tail note of the hold.
|
/// The tail note of the hold.
|
||||||
|
@ -84,24 +84,27 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
if (HitObject.SampleControlPoint == null)
|
if (HitObject.Samples != null)
|
||||||
throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)} must always have an attached {nameof(HitObject.SampleControlPoint)}.");
|
|
||||||
|
|
||||||
foreach (SampleInfo s in HitObject.Samples)
|
|
||||||
{
|
{
|
||||||
SampleInfo localSampleInfo = new SampleInfo
|
if (HitObject.SampleControlPoint == null)
|
||||||
|
throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)} must always have an attached {nameof(HitObject.SampleControlPoint)}.");
|
||||||
|
|
||||||
|
foreach (SampleInfo s in HitObject.Samples)
|
||||||
{
|
{
|
||||||
Bank = s.Bank ?? HitObject.SampleControlPoint.SampleBank,
|
SampleInfo localSampleInfo = new SampleInfo
|
||||||
Name = s.Name,
|
{
|
||||||
Volume = s.Volume > 0 ? s.Volume : HitObject.SampleControlPoint.SampleVolume
|
Bank = s.Bank ?? HitObject.SampleControlPoint.SampleBank,
|
||||||
};
|
Name = s.Name,
|
||||||
|
Volume = s.Volume > 0 ? s.Volume : HitObject.SampleControlPoint.SampleVolume
|
||||||
|
};
|
||||||
|
|
||||||
SampleChannel channel = localSampleInfo.GetChannel(audio.Sample);
|
SampleChannel channel = localSampleInfo.GetChannel(audio.Sample);
|
||||||
|
|
||||||
if (channel == null)
|
if (channel == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Samples.Add(channel);
|
Samples.Add(channel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
/// and can be treated as the default samples for the hit object.
|
/// and can be treated as the default samples for the hit object.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SampleInfoList Samples = new SampleInfoList();
|
public SampleInfoList Samples;
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public SampleControlPoint SampleControlPoint;
|
public SampleControlPoint SampleControlPoint;
|
||||||
|
Loading…
Reference in New Issue
Block a user