public DeviceSlot Clone() { var clone = new DeviceSlot(); clone.m_Key = m_Key; clone.m_TagIndex = m_TagIndex; clone.m_Type = m_Type; return(clone); }
public static string GetDeviceControlName(DeviceSlot deviceSlot, InputControlDescriptor source) { if (deviceSlot != null) { string[] names = GetDeviceControlNames(deviceSlot.type); if (source.controlIndex >= 0 && source.controlIndex < names.Length) { return(names[source.controlIndex]); } } return("None"); }
private InputState GetDeviceStateForDeviceSlot(DeviceSlot deviceSlot) { for (int i = 0; i < deviceStates.Count; i++) { var deviceState = deviceStates[i]; var inputDevice = deviceState.controlProvider as InputDevice; // If this isn't an input device, simply make sure that the types match if (inputDevice == null && deviceSlot.type.value.IsInstanceOfType(deviceState.controlProvider)) { return(deviceState); } if (inputDevice != null && (deviceSlot.tagIndex == -1 || inputDevice.tagIndex == deviceSlot.tagIndex)) { return(deviceState); } } throw new ArgumentException("deviceType"); }
public static string GetDeviceNameWithTag(DeviceSlot deviceSlot) { string deviceName = "No-Device"; if (deviceSlot != null && (Type)deviceSlot.type != null) { if (deviceSlot.tagIndex == -1) { deviceName = deviceSlot.type.Name; } else { string[] tags = GetDeviceTags(deviceSlot.type); deviceName = string.Format("{0}.{1}", deviceSlot.type.Name, tags[deviceSlot.tagIndex]); } } return(deviceName); }
public static string GetDeviceName(DeviceSlot deviceSlot) { return((Type)deviceSlot.type == null ? "No-Device" : deviceSlot.type.Name); }