Пример #1
0
        public void updateDataSet(DS_ActionMaps dsa, string actionID)
        {
            foreach (ActionMapCls am in this)
            {
                DS_ActionMaps.T_ActionMapRow amr = dsa.T_ActionMap.NewT_ActionMapRow();

                foreach (ActionCls ac in am)
                {
                    int ilIndex = 0;
                    while (ac.inputList.Count > ilIndex)
                    {
                        if (actionID == DS_ActionMap.ActionID(am.name, ac.key, ac.inputList[ilIndex].NodeIndex))
                        {
                            DS_ActionMaps.T_ActionRow ar = dsa.T_Action.FindByID_Action(actionID);
                            ar.Usr_Binding  = ac.inputList[ilIndex].DevInput;
                            ar.Usr_Modifier = ac.inputList[ilIndex].ActivationMode.Name;
                            ar.Disabled     = DeviceCls.IsBlendedInput(ac.inputList[ilIndex].Input);
                            ar.AcceptChanges( );
                            return;
                        }
                        ilIndex++;
                    }
                } // each Action
            }     // each ActionMap
        }
Пример #2
0
        /// <summary>
        /// Query the devices if the input is blended
        /// </summary>
        /// <param name="input">The input command</param>
        /// <returns>True if blended input</returns>
        static public Boolean IsBlendedInput(String input)
        {
            Boolean blendedInput = false;

            blendedInput = DeviceCls.IsBlendedInput(input); // generic
            if (blendedInput)
            {
                return(blendedInput);
            }

            blendedInput = JoystickCls.IsBlendedInput(input);
            if (blendedInput)
            {
                return(blendedInput);
            }
            blendedInput = GamepadCls.IsBlendedInput(input);
            if (blendedInput)
            {
                return(blendedInput);
            }
            blendedInput = KeyboardCls.IsBlendedInput(input);
            if (blendedInput)
            {
                return(blendedInput);
            }
            blendedInput = MouseCls.IsBlendedInput(input);
            if (blendedInput)
            {
                return(blendedInput);
            }
            // others..
            return(blendedInput);
        }
Пример #3
0
        public void toDataSet(DS_ActionMaps dsa)
        {
            dsa.Clear( );
            if (dsa.HasChanges( ))
            {
                dsa.T_ActionMap.AcceptChanges( );
            }

            int AMcount = 1;

            foreach (ActionMapCls am in this)
            {
                DS_ActionMaps.T_ActionMapRow amr = dsa.T_ActionMap.NewT_ActionMapRow();
                string amShown = DS_ActionMap.ActionMapShown(am.name, AMcount++);

                amr.ID_ActionMap = amShown;
                dsa.T_ActionMap.AddT_ActionMapRow(amr);

                foreach (ActionCls ac in am)
                {
                    int ilIndex = 0;
                    while (ac.inputList.Count > ilIndex)
                    {
                        DS_ActionMaps.T_ActionRow ar = dsa.T_Action.NewT_ActionRow();
                        ar.ID_Action     = DS_ActionMap.ActionID(am.name, ac.key, ac.inputList[ilIndex].NodeIndex); // make a unique key
                        ar.AddBind       = (ilIndex > 0);                                                           // all but the first are addbinds
                        ar.REF_ActionMap = amShown;
                        ar.ActionName    = ac.name;
                        ar.Device        = ac.device;
                        ar.Def_Binding   = ac.defBinding;
                        ar.Def_Modifier  = ac.defActivationMode.Name;
                        ar.Usr_Binding   = ac.inputList[ilIndex].DevInput;
                        ar.Usr_Modifier  = ac.inputList[ilIndex].ActivationMode.Name;
                        ar.Disabled      = DeviceCls.IsBlendedInput(ac.inputList[ilIndex].Input);
                        dsa.T_Action.AddT_ActionRow(ar);

                        ilIndex++;
                    }
                } // each Action
            }     // each ActionMap

            // finally
            if (dsa.HasChanges( ))
            {
                dsa.AcceptChanges( );
            }
        }
Пример #4
0
        /// <summary>
        /// Blend the input using the device specific format of the input is generic Blind
        /// </summary>
        /// <param name="input">An input (generic blend or a valid command)</param>
        /// <param name="aDevice">A valid device</param>
        /// <returns>A device blend or the original input if it was not a blend</returns>
        static public String BlendInput(String input, ActionDevice aDevice)
        {
            if (DeviceCls.IsBlendedInput(input))
            {
                // was generic blind
                switch (aDevice)
                {
                case ActionDevice.AD_Gamepad: return(GamepadCls.BlendedInput);

                case ActionDevice.AD_Joystick: return(JoystickCls.BlendedInput);

                case ActionDevice.AD_Keyboard: return(KeyboardCls.BlendedInput);

                case ActionDevice.AD_Mouse: return(MouseCls.BlendedInput);

                default: return("");
                }
            }
            else
            {
                return(input); // just return
            }
        }