/// <summary>
        /// Derive values from a command (e.g. v_pitch - js1_x)
        /// </summary>
        private void DecomposeCommand( )
        {
            // populate from input
            // something like "v_pitch - js1_x" OR "v_pitch - xi_thumbl" OR "v_pitch - ximod+xi_thumbl+xi_mod"
            string cmd = ActionTreeNode.CommandFromNodeText(NodeText);

            m_action  = ActionTreeNode.ActionFromNodeText(NodeText);
            m_cmdCtrl = "";
            if (!string.IsNullOrWhiteSpace(cmd))
            {
                // decomp gamepad entries - could have modifiers so check for contains...
                if (cmd.Contains("xi_thumblx"))
                {
                    // gamepad
                    m_cmdCtrl    = "xi_thumblx";
                    m_deviceName = m_device.DevName;
                }
                else if (cmd.Contains("xi_thumbly"))
                {
                    // gamepad
                    m_cmdCtrl    = "xi_thumbly";
                    m_deviceName = m_device.DevName;
                }
                else if (cmd.Contains("xi_thumbrx"))
                {
                    // gamepad
                    m_cmdCtrl    = "xi_thumbrx";
                    m_deviceName = m_device.DevName;
                }
                else if (cmd.Contains("xi_thumbry"))
                {
                    // gamepad
                    m_cmdCtrl    = "xi_thumbry";
                    m_deviceName = m_device.DevName;
                }
                // assume joystick
                else
                {
                    // get parts
                    m_cmdCtrl    = JoystickCls.ActionFromJsCommand(cmd); //js1_x -> x; js2_rotz -> rotz
                    m_deviceName = m_device.DevName;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Derive values from a command (e.g. v_pitch - js1_x)
        /// </summary>
        private void DecomposeCommand( )
        {
            // populate from input
            // something like "v_pitch - js1_x" OR "v_pitch - xi_thumbl" OR "v_pitch - ximod+xi_thumbl+xi_mod"
            string cmd    = ActionTreeNode.CommandFromNodeText(Action);
            string action = ActionTreeNode.ActionFromNodeText(Action);

            m_cmdCtrl = "";
            if (!string.IsNullOrWhiteSpace(cmd))
            {
                // decomp gamepad entries - could have modifiers so check for contains...
                if (cmd.Contains("xi_thumblx"))
                {
                    // gamepad
                    m_cmdCtrl    = "xi_thumblx";
                    m_deviceName = m_device.DevName;
                    if (action.Contains("pitch"))
                    {
                        m_option = string.Format("flight_move_pitch");
                    }
                    else
                    {
                        m_option = string.Format("flight_move_yaw");
                    }
                }
                else if (cmd.Contains("xi_thumbly"))
                {
                    // gamepad
                    m_cmdCtrl    = "xi_thumbly";
                    m_deviceName = m_device.DevName;
                    if (action.Contains("pitch"))
                    {
                        m_option = string.Format("flight_move_pitch");
                    }
                    else
                    {
                        m_option = string.Format("flight_move_yaw");
                    }
                }
                else if (cmd.Contains("xi_thumbrx"))
                {
                    // gamepad
                    m_cmdCtrl    = "xi_thumbrx";
                    m_deviceName = m_device.DevName;
                    if (action.Contains("pitch"))
                    {
                        m_option = string.Format("flight_move_pitch");
                    }
                    else
                    {
                        m_option = string.Format("flight_move_yaw");
                    }
                }
                else if (cmd.Contains("xi_thumbry"))
                {
                    // gamepad
                    m_cmdCtrl    = "xi_thumbry";
                    m_deviceName = m_device.DevName;
                    if (action.Contains("pitch"))
                    {
                        m_option = string.Format("flight_move_pitch");
                    }
                    else
                    {
                        m_option = string.Format("flight_move_yaw");
                    }
                }
                // assume joystick
                else
                {
                    // get parts
                    m_cmdCtrl    = JoystickCls.ActionFromJsCommand(cmd); //js1_x -> x; js2_rotz -> rotz
                    m_deviceName = m_device.DevName;
                    if (action.Contains("pitch"))
                    {
                        m_option = string.Format("flight_move_pitch"); m_isStrafe = false;
                    }
                    else if (action.Contains("yaw"))
                    {
                        m_option = string.Format("flight_move_yaw"); m_isStrafe = false;
                    }
                    else if (action.Contains("roll"))
                    {
                        m_option = string.Format("flight_move_roll"); m_isStrafe = false;
                    }
                    // strafes
                    else if (action.Contains("vertical"))
                    {
                        m_option = string.Format("flight_move_strafe_vertical"); m_isStrafe = true;
                    }
                    else if (action.Contains("lateral"))
                    {
                        m_option = string.Format("flight_move_strafe_lateral"); m_isStrafe = true;
                    }
                    else if (action.Contains("longitudinal"))
                    {
                        m_option = string.Format("flight_move_strafe_longitudinal"); m_isStrafe = true;
                    }
                    else
                    {
                        m_option = string.Format("????"); // don't know what it is ...
                    }
                }
            }
        }