void AddKeyboardDeviceWithConfig(InputDeviceConfig config) { GameObject deviceObj = new GameObject(config.name); deviceObj.transform.parent = transform; InputDevice device = deviceObj.AddComponent<InputDevice>(); device.config = config; inputDevices.Add(device); }
void AddKeyboardDeviceWithConfig(InputDeviceConfig config) { GameObject deviceObj = new GameObject(config.name); deviceObj.transform.parent = transform; InputDevice device = deviceObj.AddComponent <InputDevice>(); device.config = config; inputDevices.Add(device); }
void RefreshJoystickDevicesWithConfig(InputDeviceConfig config) { string[] joystickNames = Input.GetJoystickNames(); for (int i = 0; i < joystickNames.Length; i++) { bool nameOk = false; for (int j = 0; j < config.joystickNames.Count; j++) { if (joystickNames[i] == config.joystickNames[j]) { nameOk = true; break; } else { #if DEBUG_INPUT_DEVICE_MAPPING Debug.Log(joystickNames[i]); Debug.Log(config.joystickNames[j]); #endif } } if (nameOk) { foreach (InputDevice d in inputDevices) { if (d.config == config && d.deviceId - 1 == i) { return; // already existing } } GameObject deviceObj = new GameObject(config.name + "(id = " + (i + 1) + ")"); deviceObj.transform.parent = transform; InputDevice device = deviceObj.AddComponent <InputDevice>(); device.config = config; device.deviceId = i + 1; Debug.Log("InputDeviceConfig loaded: " + joystickNames[i]); inputDevices.Add(device); continue; } Debug.Log("No InputDeviceConfig found: " + joystickNames[i]); } }
void RefreshJoystickDevicesWithConfig(InputDeviceConfig config) { string[] joystickNames = Input.GetJoystickNames(); for(int i = 0; i < joystickNames.Length; i++) { bool nameOk = false; for(int j = 0; j < config.joystickNames.Count; j++) { if(joystickNames[i] == config.joystickNames[j]) { nameOk = true; break; } } if(nameOk) { foreach(InputDevice d in inputDevices) { if( d.config == config && d.deviceId-1 == i) return; // already existing } GameObject deviceObj = new GameObject(config.name + "(id = "+(i+1)+")"); deviceObj.transform.parent = transform; InputDevice device = deviceObj.AddComponent<InputDevice>(); device.config = config; device.deviceId = i+1; inputDevices.Add(device); } } }