示例#1
0
        public EnterTextState(IStateOwner pOwner, int EntryLength, String PossibleChars = "_ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890")
        {
            EntryLength    = Math.Min(48, EntryLength);
            Owner          = pOwner;
            AvailableChars = PossibleChars;
            NameEntered    = new StringBuilder(new String(Enumerable.Repeat('_', EntryLength).ToArray()));
            var sib = StandardImageBackgroundGDI.GetStandardBackgroundDrawer();

            _BG = sib;
        }
        public String GameOverText = "GAME    OVER"; //+ ShowExtraLines.ToString();

        public override void HandleGameKey(IStateOwner pOwner, GameKeys g)
        {
            if (g == GameKeys.GameKey_RotateCW)
            {
                if (NewScorePosition > -1)
                {
                    if (GameOveredState is GameplayGameState)
                    {
                        var useStats  = ((GameplayGameState)GameOveredState).GameStats;
                        var MenuState = ((GameplayGameState)GameOveredState).MainMenuState;
                        if (useStats is TetrisStatistics)
                        {
                            EnterHighScoreState ehs = new EnterHighScoreState
                                                          (GameOveredState, pOwner, MenuState,
                                                          ((GameplayGameState)GameOveredState).GetLocalScores(), (n, s) => new XMLScoreEntry <TetrisHighScoreData>(n, s, new TetrisHighScoreData(useStats as TetrisStatistics))
                                                          , useStats as TetrisStatistics);
                            pOwner.CurrentState = ehs;
                            TetrisGame.Soundman.PlayMusic("highscoreentry", pOwner.Settings.std.MusicVolume, true);
                        }
                        else
                        {
                        }
                    }
                }
                else if (CompleteSummary)
                {
                    IBackground bg = null;
                    if (pOwner is BASeTris bt)
                    {
                        bg = StandardImageBackgroundGDI.GetStandardBackgroundDrawer();
                    }
                    else if (pOwner is BASeTrisTK)
                    {
                        bg = StandardImageBackgroundSkia.GetStandardBackgroundDrawer();
                    }
                    GenericMenuState TitleMenu = new GenericMenuState(bg, pOwner, new TitleMenuPopulator());
                    pOwner.CurrentState = TitleMenu;
                }
            }
        }