Пример #1
0
        public DeviceSlot Clone()
        {
            var clone = new DeviceSlot();

            clone.m_Key      = m_Key;
            clone.m_TagIndex = m_TagIndex;
            clone.m_Type     = m_Type;

            return(clone);
        }
Пример #2
0
        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");
        }
Пример #3
0
        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");
        }
Пример #4
0
        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);
        }
Пример #5
0
 public static string GetDeviceName(DeviceSlot deviceSlot)
 {
     return((Type)deviceSlot.type == null ? "No-Device" : deviceSlot.type.Name);
 }