Ejemplo n.º 1
0
        private static void RegisterNewButton(string name, string key, Button button, Device device)
        {
            var bind = new Tuple <Device, Button, string>(device, button, key);

            if (RegisteredButtons.Contains(bind))
            {
                return;
            }

            RegisteredButtons.Add(bind);
            LanguageHandler.SetLanguageLine($"Option{name}", name);
            Language.main.LoadLanguageFile(Language.main.GetCurrentLanguage());
            GameInput.AddKeyInput(name, KeyCodeUtils.StringToKeyCode(key), device);
            GameInput.instance.Initialize();
            for (int i = 0; i < GameInput.numDevices; i++)
            {
                GameInput.SetupDefaultBindings((GameInput.Device)i);
            }
            foreach (Tuple <Device, Button, string> binding in RegisteredButtons)
            {
                GameInput.SafeSetBinding(binding.Item1, binding.Item2, BindingSet.Primary, binding.Item3);
            }
        }