Exemple #1
0
        private static void Update(GameTime time)
        {
            // As an example, we'll use the F5 key to make the game full screen
            if (Global.KeyboardState.IsKeyReleased(Keys.F5))
            {
                Settings.ToggleFullScreen();
            }
            else if (Global.KeyboardState.IsKeyReleased(Keys.Escape))
            {
                Game.Instance.Exit();
            }

            //return;

            // Called each logic update.
            switch (_state)
            {
            case SadGuiState.Start:
                _state = LoadBlocksAsync();
                return;

            case SadGuiState.Action:
                return;

            case SadGuiState.Login:
                _state = !_controller.IsWalletCreated ? CreateWallet() : Unlock();
                return;

            case SadGuiState.Mnemoic:
                _state = ShowMnemonic();
                break;

            case SadGuiState.Selection:
                if (_selectionScreen == null)
                {
                    if (_playScreen != null)
                    {
                        _playScreen.IsVisible = false;
                    }
                    _playScreen = null;
                    SelectionScreen();
                    break;
                }
                _selectionScreen.ProcessKeyboard(Global.KeyboardState);
                _state = _selectionScreen.GetState();
                break;

            case SadGuiState.Play:
                if (_playScreen == null)
                {
                    if (_selectionScreen != null)
                    {
                        _selectionScreen.IsVisible = false;
                    }
                    _selectionScreen = null;
                    PlayScreen();
                    break;
                }
                _playScreen.ProcessKeyboard(Global.KeyboardState);
                _state = _playScreen.GetState();
                break;

            case SadGuiState.Fatalerror:
                _state = Warning("A fatal error happend!", true);
                break;

            case SadGuiState.Quit:
                Game.Instance.Exit();
                break;
            }
        }
Exemple #2
0
        private static void Update(GameTime time)
        {
            // As an example, we'll use the F5 key to make the game full screen
            if (Global.KeyboardState.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.F5))
            {
                Settings.ToggleFullScreen();
            }
            else if (Global.KeyboardState.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.Escape))
            {
                SadConsole.Game.Instance.Exit();
            }

            //return;

            // Called each logic update.
            switch (_state)
            {
            case SadGuiState.START:
                _state = LoadBlocksAsync();
                return;

            case SadGuiState.ACTION:
                return;

            case SadGuiState.LOGIN:
                if (!_controller.IsWalletCreated)
                {
                    _state = CreateWallet();
                }
                else
                {
                    _state = Unlock();
                }
                return;

            case SadGuiState.MNEMOIC:
                _state = ShowMnemoic();
                break;

            case SadGuiState.SELECTION:
                if (_selectionScreen == null)
                {
                    _playScreen = null;
                    SelectionScreen();
                    _selectionScreen.Init();
                    break;
                }
                _selectionScreen.ProcessKeyboard(Global.KeyboardState);
                _state = _selectionScreen.GetState();
                break;

            case SadGuiState.PLAY:
                if (_playScreen == null)
                {
                    _selectionScreen = null;
                    PlayScreen();
                    break;
                }
                _playScreen.ProcessKeyboard(Global.KeyboardState);
                _state = _playScreen.GetState();
                break;

            case SadGuiState.FATALERROR:
                _state = Warning("A fatal error happend!", true);
                break;

            case SadGuiState.QUIT:
                SadConsole.Game.Instance.Exit();
                break;
            }
        }