예제 #1
0
        public void Write(HighScoreData data)
        {
            byte[] name = new UTF8Encoding(true).GetBytes(data.Name);
            stream.Write(name, 0, name.Length);

            byte[] score = new UTF8Encoding(true).GetBytes(data.Score.ToString());
            stream.Write(score, 0, score.Length);

            byte[] marker = new UTF8Encoding(true).GetBytes(":");
            stream.Write(marker, 0, marker.Length);
        }
예제 #2
0
        void GameOver()
        {
            for (int rank = 0; rank < 10; rank++)
            {
                if (m_TotalScore > m_HighScoreList[rank].Score)
                {
                    if (rank < 9)
                    {
                        // Move High Score at rank list to make room for new High Score.
                        HighScoreData[] oldScores = new HighScoreData[10];

                        for (int oldranks = rank; oldranks < 10; oldranks++)
                        {
                            oldScores[oldranks].Score = m_HighScoreList[oldranks].Score;
                            oldScores[oldranks].Name  = m_HighScoreList[oldranks].Name;
                        }

                        for (int oldranks = rank; oldranks < 9; oldranks++)
                        {
                            m_HighScoreList[oldranks + 1].Score = oldScores[oldranks].Score;
                            m_HighScoreList[oldranks + 1].Name  = oldScores[oldranks].Name;
                        }
                    }

                    m_HighScoreList[rank].Score = m_TotalScore;
                    SaveNewHighScoreList();
                    m_NewHighScoreRank = rank;
                    m_NewHighScore     = true;
                    m_NewHighScoreLettersEntity.Components.Get <Word>().ShowWords();

                    for (int line = 0; line < 4; line++)
                    {
                        m_EnterYourInitialsEntitys[line].Components.Get <Word>().ShowWords();
                    }

                    break;
                }
            }

            if (!m_NewHighScore)
            {
                DisplayHighScoreList();
                m_GameOverEntity.Components.Get <Word>().ShowWords();
            }
        }