mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-19 05:48:07 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
44 lines
855 B
C#
44 lines
855 B
C#
using Sandbox.Audio;
|
|
|
|
namespace Editor;
|
|
|
|
/// <summary>
|
|
/// Dropdown selection for DspPresetHandle
|
|
/// </summary>
|
|
[CustomEditor( typeof( MixerHandle ) )]
|
|
sealed class MixerHandleControlWidget : DropdownControlWidget<MixerHandle>
|
|
{
|
|
public override bool SupportsMultiEdit => true;
|
|
|
|
public MixerHandleControlWidget( SerializedProperty property ) : base( property )
|
|
{
|
|
}
|
|
|
|
protected override IEnumerable<object> GetDropdownValues()
|
|
{
|
|
foreach ( var mixer in IterateMixerTree( Mixer.Master ) )
|
|
{
|
|
var e = new Entry
|
|
{
|
|
Value = (MixerHandle)mixer,
|
|
Label = mixer.Name,
|
|
};
|
|
|
|
yield return e;
|
|
}
|
|
}
|
|
|
|
IEnumerable<Mixer> IterateMixerTree( Mixer parent )
|
|
{
|
|
yield return parent;
|
|
|
|
foreach ( var child in parent.GetChildren() )
|
|
{
|
|
foreach ( var childEntry in IterateMixerTree( child ) )
|
|
{
|
|
yield return childEntry;
|
|
}
|
|
}
|
|
}
|
|
}
|