Beispiel #1
0
        /// <summary>
        /// Update the dataset
        /// </summary>
        /// <param name="dsa">The dataset</param>
        /// <param name="actionID">The actionID to update from</param>
        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.MapName, 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.IsDisabledInput(ac.InputList[ilIndex].Input);
                            ar.AcceptChanges( );
                            return;
                        }
                        ilIndex++;
                    }
                } // each Action
            }     // each ActionMap
        }
Beispiel #2
0
        /// <summary>
        /// Query the devices if the input is disabled
        /// </summary>
        /// <param name="input">The input command</param>
        /// <returns>True if disabled input</returns>
        static public bool IsDisabledInput(string input)
        {
            bool disabledInput = false;

            disabledInput = DeviceCls.IsDisabledInput(input); // generic
            if (disabledInput)
            {
                return(disabledInput);
            }

            disabledInput = JoystickCls.IsDisabledInput(input);
            if (disabledInput)
            {
                return(disabledInput);
            }
            disabledInput = GamepadCls.IsDisabledInput(input);
            if (disabledInput)
            {
                return(disabledInput);
            }
            disabledInput = KeyboardCls.IsDisabledInput(input);
            if (disabledInput)
            {
                return(disabledInput);
            }
            disabledInput = MouseCls.IsDisabledInput(input);
            if (disabledInput)
            {
                return(disabledInput);
            }
            // others..
            return(disabledInput);
        }
Beispiel #3
0
        /// <summary>
        /// Converts all maps into a DataSet
        /// </summary>
        /// <param name="dsa">The dataset to populate</param>
        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(SCUiText.Instance.Text(am.MapName), 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.MapName, 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.ActionName;
                        ar.ActionText    = SCUiText.Instance.Text(ac.ActionName);
                        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.IsDisabledInput(ac.InputList[ilIndex].Input);
                        dsa.T_Action.AddT_ActionRow(ar);

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

            // finally
            if (dsa.HasChanges( ))
            {
                dsa.AcceptChanges( );
            }
        }
Beispiel #4
0
        /// <summary>
        /// Disable the input for a specific device - input is a generic Disabled Input
        /// </summary>
        /// <param name="input">An input (generic disable or a valid command)</param>
        /// <param name="aDevice">A valid device</param>
        /// <returns>A device diabled or the original input if it was not a disabled</returns>
        static public string DisableInput(string input, ActionDevice aDevice)
        {
            if (DeviceCls.IsDisabledInput(input))
            {
                // was generic blind - return a device specific disabled input
                switch (aDevice)
                {
                case ActionDevice.AD_Gamepad: return(GamepadCls.DisabledInput);

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

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

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

                default: return("");
                }
            }
            else
            {
                return(input); // not disabled - just return the input
            }
        }