Пример #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();
            CameraPos = _gameInfo.Spinner.Center;
            _gameInfo.Manager = ControlManager.Manager;

            // Set up our konami code callback to give the current player 0xBEEF
            _konami = new InputListener {
                Keys = new List<int> { 38, 38, 40, 40, 37, 39, 37, 39, 66, 65 }.Cast<Keys>().ToArray(),
                Callback = () => {
                    _fsm.Push(new ModifyCash(0xBEEF));
                    ControlManager.Add(new Alert(ControlManager.Manager, "Konami code detected! Acquire 0xBEEF", "Konami Code Activated"));
                }
            };

            _teleport = new InputListener {
                Keys = new[] { Keys.T, Keys.E, Keys.L, Keys.E, Keys.P, Keys.O, Keys.R, Keys.T },
                Callback = () => {
                    _gameInfo.Fsm.Push(new Teleport());
                    ControlManager.Add(new Alert(ControlManager.Manager, "Click the place you want to teleport to!", "Teleport Activated"));
                }
            };

            CreateWelcomeMessage();
        }
Пример #2
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
            };
        }