Beispiel #1
0
        public void SuccCheck()
        {
            foreach (Status statusC in status)
            {
                if (statusC != Status.MATCH)
                {
                    return;
                }
            }

            int score  = 0;
            int winner = 0;

            if (player1Score > player2Score)
            {
                score  = player1Score;
                winner = 1;
            }
            else if (player2Score > player1Score)
            {
                score  = player2Score;
                winner = 2;
            }
            else if (player2Score == player1Score)
            {
                score  = player1Score;
                winner = 3;
            }

            WinForm win = new WinForm(levelTag, score, 2, winner);

            win.ShowDialog();
            this.Close();
        }
Beispiel #2
0
        public void SuccCheck()
        {
            foreach (Status statusC in status)
            {
                if (statusC != Status.MATCH)
                {
                    return;
                }
            }
            string path = "";

            if (levelTag == 1)
            {
                path = Application.StartupPath + @"\ranking.txt";
            }
            else if (levelTag == 2)
            {
                path = Application.StartupPath + @"\ranking1.txt";
            }

            System.IO.FileInfo fl = new FileInfo(path);
            if (!fl.Exists)
            {
                File.Create(path);
                StreamWriter sw = new StreamWriter(path);
                sw.WriteLine(score);
                sw.Close();
            }
            else
            {
                StreamWriter sw = new StreamWriter(path, true);
                sw.WriteLine(score);
                sw.Close();
            }
            WinForm win = new WinForm(levelTag, score, 1, 0);

            win.ShowDialog();
            this.Close();
        }