Пример #1
0
        public AnagramMagic()
        {
            InitializeComponent();
            gameScore = new GameScore();
            invalidLabels = new List<Label>();
            star = new Star(lblValidStars.Location);
            bmp = new Bitmap(Resources.mute, btnMusic.Size);
            bmp.MakeTransparent();
            btnMusic.BackgroundImage = bmp;
            wallpaper = new Bitmap(Resources.wallpaper, pictureBox1.Size);
            pictureBox1.Image = wallpaper;
            background = new Bitmap(Resources.bukvi, menu.Size);
              //  menu.BackgroundImage = background;
            panel1.BackgroundImage = background;
             //   this.BackgroundImage = background;
            DoubleBuffered = true;
            initTitle();
            down = false;
            broiRandom = 0;
            word = "";
            correctNineLetterWord = "";
            words = new Words();
            randomButtons = new List<Button>();
            currentScore = 0;
            totalScore = 0;
            ChangeLettersPerRound = false;
            used = new LinkedList<char>();
            unused = new LinkedList<char>();
            song = new Song();
            pie = new Pie(100, 70);
            points = new List<Point>();
            buttons = new List<Button>();
            answer = new LinkedList<Point>();
            answerFix = new List<Point>();
            shuffled = new List<string>();
            keyboard = new List<Button>();
            flag = new List<bool>();
            zaNazad = new List<Point>();
            setAnswer();
            initRandomButtons();
            bunn = new Bitmap(Resources.bunny, pictureBox3.Size);
            pictureBox3.Image = bunn;
               // pictureBox3.Visible = false;
            setKeyboard();
            randomLetters = new RandomLetters(keyboard);
            watch = 30;
            round = 0;
            players = new List<Player>();
            bestWord = "";
            bestPlayersString = new StringBuilder();
            bestPlayersString.Append("Best players:\n");

            for (int i = 0; i < 9; i++ )
            {
                flag.Add(false);
            }

            using (CsvFileWriter writer = new CsvFileWriter("Scores.csv", true))
            {
                CsvRow row = new CsvRow();
                row.Add("");
            }
            invalidL();
            timer2.Start();
        }
 //Here we show the players, their scores and the best word they made
 private void bestPlayers_Click(object sender, EventArgs e)
 {
     GameScore gameScore = new GameScore();
     bestPlayersString = new StringBuilder();
     int i = 1;
     players = ReadAllPlayers().OrderByDescending(x => x.Score).ToList();
     foreach (Player p in players)
     {
         bestPlayersString.Append(i + ". " + p.ToString() + "\n");
         i++;
     }
     gameScore.AddScores(bestPlayersString.ToString());
     gameScore.ShowDialog();
 }