/// <summary> Registers a collection of <see cref="Keybind"/>s. </summary> /// <param name="keybinds"> The <see cref="Keybind"/>s to register. </param> /// <seealso cref="Register(Keybind)"/> /// <inheritdoc cref="Register(Keybind)"/> public static void Register(IEnumerable <Keybind> keybinds) { foreach (Keybind keybind in keybinds) { Reg.Register(keybind); } }
/// <summary> Registers a <see cref="Keybind"/>. </summary> /// <param name="keybind"> The <see cref="Keybind"/> to register. </param> /// <exception cref="KeybindInvalidException"> Thrown when <paramref name="keybind"/> has an invalid <see cref="Keybind.Name"/> or <see cref="Keybind.ComesBefore"/>. </exception> /// <exception cref="KeybindRegisteredTooLateException"> Thrown when this method is called after PreLoad. </exception> /// <remarks> Registered keybinds must have a unique <see cref="Keybind.Name"/> and a valid <see cref="Keybind.ComesBefore"/>. </remarks> /// <seealso cref="Register(IEnumerable{Keybind})"/> public static void Register(Keybind keybind) { if (Main.hasPreloaded) { throw new KeybindRegisteredTooLateException(keybind); } Reg.ValidateKeybind(keybind); Reg.registeredNames.Add(keybind.Name); Reg.keybinds.Add(keybind); Reg.AddKeybindPosition(keybind); }
internal static void UpdateAll(vp_FPInput instance) { try { Reg.Update(instance.FPPlayer); foreach (Keybind keybind in KeybindRegistry.keybinds) { keybind.Update(instance.FPPlayer); } } catch (Exception ex) { Log.Write(ex); } }