예제 #1
0
        bool InitInternal()
        {
            //register config settings
            EngineApp.Instance.Config.RegisterClassParameters(typeof(GameControlsManager));

            //create items
            {
                int controlKeyCount = 0;
                {
                    foreach (object value in Enum.GetValues(typeof(GameControlKeys)))
                    {
                        GameControlKeys controlKey = (GameControlKeys)value;
                        if ((int)controlKey >= controlKeyCount)
                        {
                            controlKeyCount = (int)controlKey + 1;
                        }
                    }
                }

                items = new GameControlItem[controlKeyCount];
                for (int n = 0; n < controlKeyCount; n++)
                {
                    if (!Enum.IsDefined(typeof(GameControlKeys), n))
                    {
                        Log.Fatal("GameControlsManager: Init: Invalid \"GameControlKeys\" enumeration.");
                        return(false);
                    }
                    GameControlKeys controlKey = (GameControlKeys)n;
                    items[n] = new GameControlItem(controlKey);
                }
            }

            //itemsControlKeysDictionary
            {
                itemsControlKeysDictionary = new Dictionary <GameControlKeys, GameControlItem>();
                foreach (GameControlItem item in items)
                {
                    itemsControlKeysDictionary.Add(item.ControlKey, item);
                }
            }

            return(true);
        }
예제 #2
0
        bool InitInternal()
        {
            //register config settings
            EngineApp.Instance.Config.RegisterClassParameters( typeof( GameControlsManager ) );

            //create items
            {
                int controlKeyCount = 0;
                {
                    foreach( object value in Enum.GetValues( typeof( GameControlKeys ) ) )
                    {
                        GameControlKeys controlKey = (GameControlKeys)value;
                        if( (int)controlKey >= controlKeyCount )
                            controlKeyCount = (int)controlKey + 1;
                    }
                }

                items = new GameControlItem[ controlKeyCount ];
                for( int n = 0; n < controlKeyCount; n++ )
                {
                    if( !Enum.IsDefined( typeof( GameControlKeys ), n ) )
                    {
                        Log.Fatal( "GameControlsManager: Init: Invalid \"GameControlKeys\" enumeration." );
                        return false;
                    }
                    GameControlKeys controlKey = (GameControlKeys)n;
                    items[ n ] = new GameControlItem( controlKey );
                }
            }

            //itemsControlKeysDictionary
            {
                itemsControlKeysDictionary = new Dictionary<GameControlKeys, GameControlItem>();
                foreach( GameControlItem item in items )
                    itemsControlKeysDictionary.Add( item.ControlKey, item );
            }

            return true;
        }
        private bool InitInternal()
        {
            //register config settings
            EngineApp.Instance.Config.RegisterClassParameters(typeof(GameControlsManager));

            //create items
            {
                int controlKeyCount = 0;
                {
                    foreach (object value in Enum.GetValues(typeof(GameControlKeys)))
                    {
                        GameControlKeys controlKey = (GameControlKeys)value;
                        if ((int)controlKey >= controlKeyCount)
                            controlKeyCount = (int)controlKey + 1;
                    }
                }

                items = new GameControlItem[controlKeyCount];
                for (int n = 0; n < controlKeyCount; n++)
                {
                    if (!Enum.IsDefined(typeof(GameControlKeys), n))
                    {
                        Log.Fatal("GameControlsManager: Init: Invalid \"GameControlKeys\" enumeration.");
                        return false;
                    }
                    GameControlKeys controlKey = (GameControlKeys)n;
                    items[n] = new GameControlItem(controlKey);
                }

                string customControlsFile = VirtualFileSystem.GetRealPathByVirtual(keyconfig);
                if (VirtualFile.Exists(customControlsFile))
                {
                    LoadCustomConfig();
                }
                else
                {
                    ResetKeyMouseSettings();
                    ResetJoystickSettings();
                    SaveCustomConfig();
                }
            }

            //itemsControlKeysDictionary
            {
                itemsControlKeysDictionary = new Dictionary<GameControlKeys, GameControlItem>();
                foreach (GameControlItem item in items)
                {
                    itemsControlKeysDictionary.Add(item.ControlKey, item);
                }
            }

            return true;
        }
 public SystemJoystickValue(SystemJoystickValue source)
 {
     type = source.Type;
     button = source.Button;
     axis = source.Axis;
     axisFilter = source.AxisFilter;
     pov = source.POV;
     povDirection = source.POVDirection;
     _parent = source.Parent;
     strength = source.strength;
 }
 public SystemKeyboardMouseValue(SystemKeyboardMouseValue source)
 {
     type = source.Type;
     key = source.Key;
     mouseButton = source.MouseButton;
     scrollDirection = source.scrollDirection;
     strength = source.strength;
     _parent = source.Parent;
 }