Пример #1
0
        public static GameSettingsInfos LoadDatas(GraphicsDevice graphicsDevice, string xmlFile = "gameSettings.xml")
        {
            _xmlManager     = new CXMLManager();
            _xmlFile        = xmlFile;
            _graphicsDevice = graphicsDevice;

            if (File.Exists(xmlFile))
            {
                _gameSettings = _xmlManager.deserializeClass <GameSettingsInfos>(_xmlFile);
            }
            else
            {
                generateDefaultSettings();
            }

            gamepadState = GamePad.GetState(PlayerIndex.One);
            useGamepad   = gamepadState.IsConnected;

            return(_gameSettings);
        }
Пример #2
0
        public static void generateDefaultSettings()
        {
            CInput CInput           = new CInput();
            bool   isKeyboardQwerty = (CInput.getKeyboardType() == "QWERTY");

            _gameSettings = new GameSettingsInfos
            {
                KeyMapping = new KeyMapping
                {
                    MForward         = (isKeyboardQwerty) ? Keys.W : Keys.Z,
                    MLeft            = (isKeyboardQwerty) ? Keys.A : Keys.Q,
                    MRight           = Keys.D,
                    MBackward        = Keys.S,
                    MJump            = Keys.Space,
                    MCrouch          = Keys.C,
                    MSprint          = Keys.LeftShift,
                    Console          = (isKeyboardQwerty) ? Keys.OemTilde : Keys.OemQuotes,
                    Reload           = Keys.R,
                    MouseSensibility = 0.001f,

                    GPSensibility = 0.05f,
                    GPJump        = Buttons.A,
                    GPShot        = Buttons.RightTrigger,
                    GPRun         = Buttons.LeftShoulder,
                    GPCrouch      = Buttons.B,
                    GPReload      = Buttons.X,
                    GPSwitch      = Buttons.Y,
                    GPAim         = Buttons.LeftTrigger,
                },
                Video = new Video
                {
                    ResolutionX = _graphicsDevice.PresentationParameters.BackBufferWidth,
                    ResolutionY = _graphicsDevice.PresentationParameters.BackBufferHeight,
                }
            };

            saveDatas();
        }