Пример #1
0
        /// <summary>
        /// Resets the Action Tree
        /// </summary>
        private void InitActionTree( Boolean addDefaultBinding )
        {
            log.Debug( "InitActionTree - Entry" );

              // build TreeView and the ActionMaps
              m_AT = new ActionTree( m_AppSettings.BlendUnmapped, m_AppSettings.BlendUnmappedGP, m_Joystick, m_Gamepad );
              m_AT.Ctrl = treeView1;  // the ActionTree owns the TreeView control
              m_AT.IgnoreMaps = m_AppSettings.IgnoreActionmaps;
              // provide the display items (init)
              m_AT.DefineShowOptions( cbxShowJoystick.Checked, cbxShowGamepad.Checked, cbxShowKeyboard.Checked, cbxShowMappedOnly.Checked );
              // Init with default profile filepath
              m_AT.LoadProfileTree( m_AppSettings.DefProfileName, addDefaultBinding );
              // provide an array of checkboxes to Options (all is handled there)
              List<CheckBox> inversions = new List<CheckBox>( );
              inversions.Add( cbxInvAimPitch ); inversions.Add( cbxInvViewPitch );
              inversions.Add( cbxInvAimYaw ); inversions.Add( cbxInvViewYaw );
              inversions.Add( cbxInvThrottle );
              inversions.Add( cbxInvStrafeVert ); inversions.Add( cbxInvStrafeLat ); inversions.Add( cbxInvStrafeLon );
              m_AT.InvertCheckList = inversions;

              // apply a default JS to Joystick mapping - can be changed and reloaded from XML mappings
              // must take care of Gamepads if there are (but we take care of one only...)

              int joyStickIndex = 0; // Joystick List Index
              for ( int deviceTabIndex=0; deviceTabIndex < JoystickCls.JSnum_MAX; deviceTabIndex++ ) {
            if ( tc1.TabPages.Count > deviceTabIndex ) {
              // valid Device Tab
              if ( IsGamepadTab( tc1.TabPages[deviceTabIndex] ) ) {
            ; // ignore gamepads
              }
              else if ( m_Joystick.Count > joyStickIndex ) {
            // there is a joystick device left..
            m_Joystick[joyStickIndex].JSAssignment = joyStickIndex + 1; // assign number 1..
            m_AT.ActionMaps.jsN[deviceTabIndex] = m_Joystick[joyStickIndex].DevName;
            m_AT.ActionMaps.jsNGUID[deviceTabIndex] = m_Joystick[joyStickIndex].DevInstanceGUID;
            joyStickIndex++;
              }
            }
              }
        }