Example #1
0
        //Zachuvuvanje vo fajl na momentalniot igrach
        public void SaveCurrentPlayer()
        {
            bool dubs = false;

            players = SerializeList <Player> .BinaryDeserialize();

            if (players == null)
            {
                players = new LinkedList <Player>();
            }
            foreach (Player p in players)
            {
                if (player.GetHashCode() == p.GetHashCode())
                {
                    p.score1 = player.score1;
                    p.score2 = player.score2;
                    dubs     = true;
                }
            }
            if (!dubs)
            {
                players.AddLast(player);
            }

            SerializeList <Player> .BinarySerialize(players);
        }
Example #2
0
        private void Game1Highscores_Click(object sender, EventArgs e)
        {
            players = SerializeList <Player> .BinaryDeserialize();

            if (players != null)
            {
                List <Player> p = players.ToList <Player>();
                p = p.OrderByDescending(x => x.score1).ToList();

                HighScoreGame1 hsg = new HighScoreGame1(p);
                hsg.ShowDialog();
            }
        }
Example #3
0
        private void Game2Highscore_Click(object sender, EventArgs e)
        {
            players = SerializeList <Player> .BinaryDeserialize();

            if (players != null)
            {
                List <Player> p = players.ToList <Player>();
                p = p.OrderByDescending(x => x.score2).ToList();
                StringBuilder sb = new StringBuilder();

                HighscoreGame2 hsg = new HighscoreGame2(p);
                hsg.ShowDialog();
            }
        }