mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 07:42:55 +08:00
Make HitObject.Samples non-nullable
This commit is contained in:
parent
d288d8a51f
commit
0fb620a8d3
@ -84,10 +84,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
if (HitObject.Samples != null)
|
if (Samples.Count > 0)
|
||||||
{
|
{
|
||||||
if (HitObject.SampleControlPoint == null)
|
if (HitObject.SampleControlPoint == null)
|
||||||
throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)} must always have an attached {nameof(HitObject.SampleControlPoint)}.");
|
throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}."
|
||||||
|
+ $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}.");
|
||||||
|
|
||||||
foreach (SampleInfo s in HitObject.Samples)
|
foreach (SampleInfo s in HitObject.Samples)
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,8 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual double StartTime { get; set; }
|
public virtual double StartTime { get; set; }
|
||||||
|
|
||||||
|
private List<SampleInfo> samples;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The samples to be played when this hit object is hit.
|
/// The samples to be played when this hit object is hit.
|
||||||
/// <para>
|
/// <para>
|
||||||
@ -32,7 +34,11 @@ 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 List<SampleInfo> Samples;
|
public List<SampleInfo> Samples
|
||||||
|
{
|
||||||
|
get => samples ?? (samples = new List<SampleInfo>());
|
||||||
|
set => samples = value;
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public SampleControlPoint SampleControlPoint;
|
public SampleControlPoint SampleControlPoint;
|
||||||
|
Loading…
Reference in New Issue
Block a user