From 27ab8ea404709c11a2839d75781726cf5f4ecbd5 Mon Sep 17 00:00:00 2001 From: Wiktor Kocielski <118038102+Withaust@users.noreply.github.com> Date: Sun, 26 Mar 2023 15:12:53 +0300 Subject: [PATCH] Make InputBindings modifiable --- Source/Editor/Options/InputBinding.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Source/Editor/Options/InputBinding.cs b/Source/Editor/Options/InputBinding.cs index d007be9a7..83789338a 100644 --- a/Source/Editor/Options/InputBinding.cs +++ b/Source/Editor/Options/InputBinding.cs @@ -397,14 +397,17 @@ namespace FlaxEditor.Options } } - private readonly List _bindings; + /// + /// List of all available bindings. + /// + public List Bindings; /// /// Initializes a new instance of the class. /// public InputActionsContainer() { - _bindings = new List(); + Bindings = new List(); } /// @@ -413,7 +416,7 @@ namespace FlaxEditor.Options /// The input bindings collection. public InputActionsContainer(params Binding[] bindings) { - _bindings = new List(bindings); + Bindings = new List(bindings); } /// @@ -422,7 +425,7 @@ namespace FlaxEditor.Options /// The input binding. public void Add(Binding binding) { - _bindings.Add(binding); + Bindings.Add(binding); } /// @@ -432,7 +435,7 @@ namespace FlaxEditor.Options /// The callback to invoke on user input. public void Add(Func binder, Action callback) { - _bindings.Add(new Binding(binder, callback)); + Bindings.Add(new Binding(binder, callback)); } /// @@ -441,7 +444,7 @@ namespace FlaxEditor.Options /// The input bindings collection. public void Add(params Binding[] bindings) { - _bindings.AddRange(bindings); + Bindings.AddRange(bindings); } /// @@ -456,12 +459,12 @@ namespace FlaxEditor.Options var root = control.Root; var options = editor.Options.Options.Input; - for (int i = 0; i < _bindings.Count; i++) + for (int i = 0; i < Bindings.Count; i++) { - var binding = _bindings[i].Binder(options); + var binding = Bindings[i].Binder(options); if (binding.Process(control, key)) { - _bindings[i].Callback(); + Bindings[i].Callback(); return true; } }