Пример #1
0
        public void SaveSettings()
        {
            InputActions.Bindings.BasicAttack.Keyboard = newBasicAttack;

            CurrentUserSettings.SetAmbientVolume(newAmbientVolume);
            CurrentUserSettings.SetActionVolume(newActionVolume);
            CurrentUserSettings.SetMusicVolume(newMusicVolume);

            CurrentUserSettings.SetKeyboardJump(newJump.ToString());
            CurrentUserSettings.SetKeyboardDodge(newDodge.ToString());
            CurrentUserSettings.SetKeyboardBasicAttack(newBasicAttack.ToString());
            CurrentUserSettings.SetKeyboardMagnetImpact(newMagnetImpact.ToString());
            CurrentUserSettings.SetKeyboardJumpQuake(newJumpQuake.ToString());

            CurrentUserSettings.SetXbButtonJump(newJumpXbox.ToString());
            CurrentUserSettings.SetXbButtonDodge(newDodgeXbox.ToString());
            CurrentUserSettings.SetXbButtonBasicAttack(newBasicAttackXbox.ToString());
            CurrentUserSettings.SetXbButtonMagnetImpact(newMagnetImpactXbox.ToString());
            CurrentUserSettings.SetXbButtonJumpQuake(newJumpQuakeXbox.ToString());

            CurrentUserSettings.Save();
        }
Пример #2
0
        // Update is called once per frame
        void Update()
        {
            if (InputActions.MenuConfirms)
            {
                CurrentUserSettings.Save();
            }
            foreach (KeyCode kcode in Enum.GetValues(typeof(KeyCode)))
            {
                if (Input.GetKeyDown(kcode))
                {
                    if (!reservedKeyboardInputs.Contains(kcode))
                    {
                        if (Jump.isFocused)
                        {
                            reservedKeyboardInputs.Remove(newJump);
                            newJump   = kcode;
                            Jump.text = newJump.ToString();
                            reservedKeyboardInputs.Add(newJump);
                        }

                        if (Dodge.isFocused)
                        {
                            reservedKeyboardInputs.Remove(newDodge);
                            newDodge   = kcode;
                            Dodge.text = newDodge.ToString();
                            reservedKeyboardInputs.Add(newDodge);
                        }

                        if (BasicAttack.isFocused)
                        {
                            reservedKeyboardInputs.Remove(newBasicAttack);
                            newBasicAttack   = kcode;
                            BasicAttack.text = newBasicAttack.ToString();
                            reservedKeyboardInputs.Add(newBasicAttack);
                        }

                        if (MagnetImpact.isFocused)
                        {
                            reservedKeyboardInputs.Remove(newMagnetImpact);
                            newMagnetImpact   = kcode;
                            MagnetImpact.text = newMagnetImpact.ToString();
                            reservedKeyboardInputs.Add(newMagnetImpact);
                        }

                        if (JumpQuake.isFocused)
                        {
                            reservedKeyboardInputs.Remove(newJumpQuake);
                            newJumpQuake   = kcode;
                            JumpQuake.text = newJumpQuake.ToString();
                            reservedKeyboardInputs.Add(newJumpQuake);
                        }
                    }
                }
            }

            foreach (XbButton button in Enum.GetValues(typeof(XbButton)))
            {
                if (XbInput.GetButtonDown(button))
                {
                    if (!reservedXboxControllerInputs.Contains(button))
                    {
                        if (JumpXbox.isFocused)
                        {
                            reservedXboxControllerInputs.Remove(newJumpXbox);
                            newJumpXbox   = button;
                            JumpXbox.text = newJumpXbox.ToString();
                            reservedXboxControllerInputs.Add(newJumpXbox);
                        }

                        if (DodgeXbox.isFocused)
                        {
                            reservedXboxControllerInputs.Remove(newDodgeXbox);
                            newDodgeXbox   = button;
                            DodgeXbox.text = newDodgeXbox.ToString();
                            reservedXboxControllerInputs.Add(newDodgeXbox);
                        }

                        if (BasicAttackXbox.isFocused)
                        {
                            reservedXboxControllerInputs.Remove(newBasicAttackXbox);
                            newBasicAttackXbox   = button;
                            BasicAttackXbox.text = newBasicAttackXbox.ToString();
                            reservedXboxControllerInputs.Add(newBasicAttackXbox);
                        }

                        if (MagnetImpactXbox.isFocused)
                        {
                            reservedXboxControllerInputs.Remove(newMagnetImpactXbox);
                            newMagnetImpactXbox   = button;
                            MagnetImpactXbox.text = newMagnetImpactXbox.ToString();
                            reservedXboxControllerInputs.Add(newMagnetImpactXbox);
                        }

                        if (JumpQuakeXbox.isFocused)
                        {
                            reservedXboxControllerInputs.Remove(newJumpQuakeXbox);
                            newJumpQuakeXbox   = button;
                            JumpQuakeXbox.text = newJumpQuakeXbox.ToString();
                            reservedXboxControllerInputs.Add(newJumpQuakeXbox);
                        }
                    }
                }
            }
        }