1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:43:01 +08:00

Nest classes + make private

This commit is contained in:
smoogipoo 2020-09-24 14:33:43 +09:00
parent 600b823a30
commit 62c2dbc310

View File

@ -87,87 +87,87 @@ namespace osu.Game.Rulesets.UI
} }
#endregion #endregion
}
/// <summary> /// <summary>
/// A sample store which adds a fallback source and prevents disposal of the fallback source. /// A sample store which adds a fallback source and prevents disposal of the fallback source.
/// </summary> /// </summary>
public class FallbackSampleStore : ISampleStore private class FallbackSampleStore : ISampleStore
{
private readonly ISampleStore primary;
private readonly ISampleStore fallback;
public FallbackSampleStore(ISampleStore primary, ISampleStore fallback)
{ {
this.primary = primary; private readonly ISampleStore primary;
this.fallback = fallback; private readonly ISampleStore fallback;
public FallbackSampleStore(ISampleStore primary, ISampleStore fallback)
{
this.primary = primary;
this.fallback = fallback;
}
public SampleChannel Get(string name) => primary.Get(name) ?? fallback.Get(name);
public Task<SampleChannel> GetAsync(string name) => primary.GetAsync(name) ?? fallback.GetAsync(name);
public Stream GetStream(string name) => primary.GetStream(name) ?? fallback.GetStream(name);
public IEnumerable<string> GetAvailableResources() => throw new NotSupportedException();
public void AddAdjustment(AdjustableProperty type, BindableNumber<double> adjustBindable) => throw new NotSupportedException();
public void RemoveAdjustment(AdjustableProperty type, BindableNumber<double> adjustBindable) => throw new NotSupportedException();
public void RemoveAllAdjustments(AdjustableProperty type) => throw new NotSupportedException();
public BindableNumber<double> Volume => throw new NotSupportedException();
public BindableNumber<double> Balance => throw new NotSupportedException();
public BindableNumber<double> Frequency => throw new NotSupportedException();
public BindableNumber<double> Tempo => throw new NotSupportedException();
public IBindable<double> GetAggregate(AdjustableProperty type) => throw new NotSupportedException();
public IBindable<double> AggregateVolume => throw new NotSupportedException();
public IBindable<double> AggregateBalance => throw new NotSupportedException();
public IBindable<double> AggregateFrequency => throw new NotSupportedException();
public IBindable<double> AggregateTempo => throw new NotSupportedException();
public int PlaybackConcurrency
{
get => throw new NotSupportedException();
set => throw new NotSupportedException();
}
public void Dispose()
{
primary?.Dispose();
}
} }
public SampleChannel Get(string name) => primary.Get(name) ?? fallback.Get(name); /// <summary>
/// A texture store which adds a fallback source and prevents disposal of the fallback source.
public Task<SampleChannel> GetAsync(string name) => primary.GetAsync(name) ?? fallback.GetAsync(name); /// </summary>
private class FallbackTextureStore : TextureStore
public Stream GetStream(string name) => primary.GetStream(name) ?? fallback.GetStream(name);
public IEnumerable<string> GetAvailableResources() => throw new NotSupportedException();
public void AddAdjustment(AdjustableProperty type, BindableNumber<double> adjustBindable) => throw new NotSupportedException();
public void RemoveAdjustment(AdjustableProperty type, BindableNumber<double> adjustBindable) => throw new NotSupportedException();
public void RemoveAllAdjustments(AdjustableProperty type) => throw new NotSupportedException();
public BindableNumber<double> Volume => throw new NotSupportedException();
public BindableNumber<double> Balance => throw new NotSupportedException();
public BindableNumber<double> Frequency => throw new NotSupportedException();
public BindableNumber<double> Tempo => throw new NotSupportedException();
public IBindable<double> GetAggregate(AdjustableProperty type) => throw new NotSupportedException();
public IBindable<double> AggregateVolume => throw new NotSupportedException();
public IBindable<double> AggregateBalance => throw new NotSupportedException();
public IBindable<double> AggregateFrequency => throw new NotSupportedException();
public IBindable<double> AggregateTempo => throw new NotSupportedException();
public int PlaybackConcurrency
{ {
get => throw new NotSupportedException(); private readonly TextureStore primary;
set => throw new NotSupportedException(); private readonly TextureStore fallback;
}
public void Dispose() public FallbackTextureStore(TextureStore primary, TextureStore fallback)
{ {
primary?.Dispose(); this.primary = primary;
} this.fallback = fallback;
} }
/// <summary> public override Texture Get(string name, WrapMode wrapModeS, WrapMode wrapModeT)
/// A texture store which adds a fallback source and prevents disposal of the fallback source. => primary.Get(name, wrapModeS, wrapModeT) ?? fallback.Get(name, wrapModeS, wrapModeT);
/// </summary>
public class FallbackTextureStore : TextureStore
{
private readonly TextureStore primary;
private readonly TextureStore fallback;
public FallbackTextureStore(TextureStore primary, TextureStore fallback) protected override void Dispose(bool disposing)
{ {
this.primary = primary; base.Dispose(disposing);
this.fallback = fallback; primary?.Dispose();
} }
public override Texture Get(string name, WrapMode wrapModeS, WrapMode wrapModeT)
=> primary.Get(name, wrapModeS, wrapModeT) ?? fallback.Get(name, wrapModeS, wrapModeT);
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
primary?.Dispose();
} }
} }
} }