static void ReadControlDataFromStream(StreamReader sr)
        {
            string text = sr.ReadLine(); // 1

            if (!RUtility.StringStartsWith(text, Controls.CONFIG_KEY))
            {
                Debug.Log("olmod controls config save file has an incorrect key: " + text);
                return;
            }
            int numControllers = int.Parse(sr.ReadLine());

            int[] controllers = new int[numControllers];
            for (int i = 0; i < numControllers; i++)
            {
                string controllerName = sr.ReadLine();
                int    numAxes        = int.Parse(sr.ReadLine());
                for (int j = 0; j < numAxes; j++)
                {
                    Controllers.controllers[i].axes[j].deadzone    = float.Parse(sr.ReadLine(), CultureInfo.InvariantCulture);
                    Controllers.controllers[i].axes[j].sensitivity = float.Parse(sr.ReadLine(), CultureInfo.InvariantCulture);
                    Controllers.SetAxisDeadzone(i, j, Controllers.controllers[i].axes[j].deadzone);
                    Controllers.SetAxisSensitivity(i, j, Controllers.controllers[i].axes[j].sensitivity);
                }
            }
        }
Beispiel #2
0
        static void PatchMenu()
        {
            Controllers.m_menu_sensitivity = Controllers.controllers[MenuManager.m_calibration_current_controller].axes[MenuManager.m_calibration_current_axis].sensitivity;
            Controllers.m_menu_deadzone    = Controllers.controllers[MenuManager.m_calibration_current_controller].axes[MenuManager.m_calibration_current_axis].deadzone;
            switch (UIManager.m_menu_selection)
            {
            case 7:
                if (UIManager.m_menu_use_mouse)
                {
                    if (UIElement.SliderValid)
                    {
                        Controllers.m_menu_sensitivity = (int)((double)UIElement.SliderPos * 100.0);
                        Controllers.controllers[MenuManager.m_calibration_current_controller].axes[MenuManager.m_calibration_current_axis].sensitivity = Controllers.m_menu_sensitivity;
                        Controllers.SetAxisSensitivity(MenuManager.m_calibration_current_controller, MenuManager.m_calibration_current_axis, Controllers.m_menu_sensitivity);
                        if (Input.GetMouseButtonDown(0))
                        {
                            MenuManager.PlayCycleSound(1f, (float)((double)UIElement.SliderPos * 5.0 - 3.0));
                            break;
                        }
                        break;
                    }
                    break;
                }
                Controllers.m_menu_sensitivity = MenuManager.AdjustSensitivity(UIManager.m_select_dir, (int)Controllers.m_menu_sensitivity);
                Controllers.controllers[MenuManager.m_calibration_current_controller].axes[MenuManager.m_calibration_current_axis].sensitivity = Controllers.m_menu_sensitivity;
                Controllers.SetAxisSensitivity(MenuManager.m_calibration_current_controller, MenuManager.m_calibration_current_axis, Controllers.m_menu_sensitivity);
                MenuManager.PlayCycleSound(1f, (float)UIManager.m_select_dir);
                break;

            case 8:
                if (UIManager.m_menu_use_mouse)
                {
                    if (UIElement.SliderValid)
                    {
                        Controllers.m_menu_deadzone = (int)((double)UIElement.SliderPos * 100.0);
                        Controllers.controllers[MenuManager.m_calibration_current_controller].axes[MenuManager.m_calibration_current_axis].deadzone = Controllers.m_menu_deadzone;
                        Controllers.SetAxisDeadzone(MenuManager.m_calibration_current_controller, MenuManager.m_calibration_current_axis, Controllers.m_menu_deadzone);
                        if (Input.GetMouseButtonDown(0))
                        {
                            MenuManager.PlayCycleSound(1f, (float)((double)UIElement.SliderPos * 5.0 - 3.0));
                            break;
                        }
                        break;
                    }
                    break;
                }
                Controllers.m_menu_deadzone = MenuManager.AdjustSensitivity(UIManager.m_select_dir, (int)Controllers.m_menu_deadzone);
                Controllers.controllers[MenuManager.m_calibration_current_controller].axes[MenuManager.m_calibration_current_axis].deadzone = Controllers.m_menu_deadzone;
                Controllers.SetAxisDeadzone(MenuManager.m_calibration_current_controller, MenuManager.m_calibration_current_axis, Controllers.m_menu_deadzone);
                MenuManager.PlayCycleSound(1f, (float)UIManager.m_select_dir);
                break;

            case 6:
                Controllers.SetAxisSensitivity(MenuManager.m_calibration_current_controller, -1, Controllers.m_menu_sensitivity);
                Controllers.SetAxisDeadzone(MenuManager.m_calibration_current_controller, -1, Controllers.m_menu_deadzone);
                break;
            }
        }
Beispiel #3
0
 static void SensitivityHelper(int controller, int axis)
 {
     Controllers.SetAxisSensitivity(controller, axis, Controllers.controllers[controller].axes[axis].sensitivity);
 }
Beispiel #4
0
 static void DeadzoneHelper(int controller, int axis)
 {
     Controllers.SetAxisDeadzone(controller, axis, Controllers.controllers[controller].axes[axis].deadzone);
 }