Example #1
0
        public override bool Equals(object obj)
        {
            if (!(obj is FCgInputActionMapping))
            {
                return(false);
            }

            FCgInputActionMapping rhs = (FCgInputActionMapping)obj;

            if (ActionName != rhs.ActionName)
            {
                return(false);
            }
            if (Action != rhs.Action)
            {
                return(false);
            }
            if (KeyName != rhs.KeyName)
            {
                return(false);
            }
            if (Key != rhs.Key)
            {
                return(false);
            }
            if (Scale != rhs.Scale)
            {
                return(false);
            }
            return(true);
        }
Example #2
0
        public void AddMapping(ECgInputDevice device, string actionName, FECgInputAction action, string keyName, KeyCode key)
        {
            FCgInputActionMappings       deviceMapping = DeviceMappings[(byte)device];
            List <FCgInputActionMapping> mappings      = deviceMapping.Mappings;

            int count = mappings.Count;

            mappings.Add(new FCgInputActionMapping());
            FCgInputActionMapping mapping = mappings[count];

            mapping.ActionName = actionName;
            mapping.Action     = action;
            mapping.KeyName    = keyName;
            mapping.Key        = key;
        }
Example #3
0
        public KeyCode GetKey(ECgInputDevice device, FECgInputAction action)
        {
            FCgInputActionMappings       deviceMapping = DeviceMappings[(byte)device];
            List <FCgInputActionMapping> mappings      = deviceMapping.Mappings;

            int count = mappings.Count;

            for (int i = 0; i < count; ++i)
            {
                FCgInputActionMapping mapping = mappings[i];

                if (action == mapping.Action)
                {
                    return(mapping.Key);
                }
            }
            return(KeyCode.None);
        }
Example #4
0
        public FCgInputActionMapping GetMapping(ECgInputDevice device, FECgInputAction action)
        {
            FCgInputActionMappings       deviceMapping = DeviceMappings[(byte)device];
            List <FCgInputActionMapping> mappings      = deviceMapping.Mappings;

            int count = mappings.Count;

            for (int i = 0; i < count; ++i)
            {
                FCgInputActionMapping mapping = mappings[i];

                if (action == mapping.Action)
                {
                    return(deviceMapping.Mappings[i]);
                }
            }
            return(mappings[CgTypes.FIRST]);
        }
Example #5
0
        public void SetKey(ECgInputDevice device, FECgInputAction action, KeyCode key)
        {
            FCgInputActionMappings       deviceMapping = DeviceMappings[(byte)device];
            List <FCgInputActionMapping> mappings      = deviceMapping.Mappings;

            int count = mappings.Count;

            for (int i = 0; i < count; ++i)
            {
                FCgInputActionMapping mapping = mappings[i];

                if (action == mapping.Action)
                {
                    mapping.KeyName = key == KeyCode.None ? "" : key.ToString();
                    mapping.Key     = key;
                    break;
                }
            }
        }