Пример #1
0
        /// <summary>
        /// Initializes the application.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            bool FSEM = true;

            Graphics.SynchronizeWithVerticalRetrace = true;
            if (FSEM)
            {
                //Getting the maximum supported resolution.
                var maxResolution = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;

                //Setting the game to start in full screen mode.
                Graphics.PreferredBackBufferWidth  = maxResolution.Width;
                Graphics.PreferredBackBufferHeight = maxResolution.Height;
                Graphics.ToggleFullScreen();
            }
            else
            {
                Graphics.PreferredBackBufferWidth  = 1224;
                Graphics.PreferredBackBufferHeight = 550;
            }
            Graphics.ApplyChanges();

            ((CustomManager)Manager).MainWindow = MainWindow;
            MainWindow.Alpha              = 0;
            MainWindow.StayOnBack         = true;
            MainWindow.CloseButtonVisible = false;

            StorageDevice.BeginShowSelector(result => { _storageDevice = StorageDevice.EndShowSelector(result); }, null);
            Persister.DepdencyInjection(_storageDevice);

            WorldLoader.SetInstance(new WorldLoader(this, Content));
            TransportFactory.SetInstance(new TransportFactory(Content));

            InitScreenManager();

            _music          = _backgroundMusic.CreateInstance();
            _music.IsLooped = true;
            _music.Play();


            // Toggles admin mode when 'Admin Please' is typed
            _AdminListener = new InputListener {
                // "Admin please"
                Keys = new[] {
                    Keys.A, Keys.D, Keys.M, Keys.I, Keys.N,
                    Keys.Space,
                    Keys.P, Keys.L, Keys.E, Keys.A, Keys.S, Keys.E
                },
                Callback = ChangeAdminMode
            };
        }