Example #1
0
        private void ClearControllerMapXml(Player player, ControllerType controllerType, int categoryId, int layoutId, Controller controller)
        {
            string text = this.GetBasePlayerPrefsKey(player);

            text += "&dataType=ControllerMap";
            text  = text + "&controllerMapType=" + controller.mapTypeString;
            string text2 = text;

            text = string.Concat(new object[]
            {
                text2,
                "&categoryId=",
                categoryId,
                "&layoutId=",
                layoutId
            });
            text = text + "&hardwareIdentifier=" + controller.hardwareIdentifier;
            if (controllerType == ControllerType.Joystick)
            {
                Rewired.Joystick joystick = (Rewired.Joystick)controller;
                text = text + "&hardwareGuid=" + joystick.hardwareTypeGuid.ToString();
            }
            if (PlayerPrefs.HasKey(text))
            {
                PlayerPrefs.DeleteKey(text);
            }
        }
Example #2
0
        private void AddDeviceRow(Controller controller)
        {
            Rewired.Joystick joystick       = controller as Rewired.Joystick;
            InputDeviceRow   inputDeviceRow = UnityEngine.Object.Instantiate <InputDeviceRow>(this._row);

            inputDeviceRow.transform.parent        = this._table.transform;
            inputDeviceRow.transform.localPosition = Vector3.zero;
            inputDeviceRow.transform.localScale    = Vector3.one;
            inputDeviceRow._label.text             = ((joystick == null) ? controller.name : joystick.name);
            if (!this._allDevicesCheckbox.value && controller.type == ControllerType.Joystick)
            {
                inputDeviceRow._checkbox.value = InputDeviceManager.UseDevice(controller.hardwareIdentifier);
                EventDelegate eventDelegate = new EventDelegate();
                eventDelegate.target        = this;
                eventDelegate.methodName    = "ToggleDevice";
                eventDelegate.parameters[0] = new EventDelegate.Parameter(inputDeviceRow._checkbox);
                eventDelegate.parameters[1] = new EventDelegate.Parameter(controller.id);
                eventDelegate.parameters[2] = new EventDelegate.Parameter(controller.hardwareIdentifier);
                inputDeviceRow._checkbox.onChange.Add(eventDelegate);
            }
            else
            {
                UnityEngine.Object.Destroy(inputDeviceRow._checkbox.gameObject);
            }
        }
Example #3
0
        private void ClearJoystickCalibrationMapXml(Rewired.Joystick joystick)
        {
            string text = "UserRemapping_v3";

            text += "&dataType=CalibrationMap";
            text  = text + "&controllerType=" + joystick.type.ToString();
            text  = text + "&hardwareIdentifier=" + joystick.hardwareIdentifier;
            text  = text + "&hardwareGuid=" + joystick.hardwareTypeGuid.ToString();
            if (PlayerPrefs.HasKey(text))
            {
                PlayerPrefs.DeleteKey(text);
            }
        }
Example #4
0
        private string GetJoystickCalibrationMapXml(Rewired.Joystick joystick)
        {
            string text = "UserRemapping_v3";

            text += "&dataType=CalibrationMap";
            text  = text + "&controllerType=" + joystick.type.ToString();
            text  = text + "&hardwareIdentifier=" + joystick.hardwareIdentifier;
            text  = text + "&hardwareGuid=" + joystick.hardwareTypeGuid.ToString();
            if (!PlayerPrefs.HasKey(text))
            {
                return(string.Empty);
            }
            return(PlayerPrefs.GetString(text));
        }