Files
sbox-public/engine/Sandbox.Engine/Systems/Input/Bindings/InputBinds.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

34 lines
885 B
C#

using NativeEngine;
using System.Diagnostics.CodeAnalysis;
namespace Sandbox.Engine;
internal static partial class InputBinds
{
static CaseInsensitiveDictionary<BindCollection> Collections = new CaseInsensitiveDictionary<BindCollection>();
/// <summary>
/// Find a bind collection by name. The name is generally the ident of the current game.
/// We'll try to load the binds from /config/input/*.json - if we fail then we'll serve
/// the default.
/// </summary>
public static BindCollection FindCollection( string name )
{
ArgumentNullException.ThrowIfNull( name, "name" );
if ( name is not null && Collections.TryGetValue( name, out var collection ) )
return collection;
collection = new BindCollection( name );
Collections[name] = collection;
if ( name != "common" )
{
collection.Base = FindCollection( "common" );
}
return collection;
}
}