예제 #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();
        }
예제 #2
0
        /*Here we reset everything
         * Make the second panel visible so the new player can choose nine letters for the first round
         * Stop the first timer
         * Stop the third timer if needed
         * use the whenNextRound method for seting the answer buttons on the original location
         */
        public void NewGame()
        {
            btnRandom.Enabled = true;
            lastW.Visible = false;
            iAmDone.Enabled = true;
            timer1.Stop();
            pie = new Pie(100, 70);
            scoreTxt.Text = "0";
            valid.Text = "";
            totalScore = 0;
            ChangeLettersPerRound = false;
            round = 0;
            watch = 30;
            label13.Text = "1/5";
            label14.Text = "00:00";
            nextRound.Enabled = true;
            bestWord = "";
            wordTxt.Text = bestWord;
            foreach (Button b in randomButtons)
            {
                b.Visible = false;
            }
            shuffled = new List<string>();
            randomLetters = new RandomLetters(keyboard);
            panel1.Visible = true;
            button1.Enabled = true;
            button2.Enabled = true;
            whenNextRound();

            timer3.Stop();
            sec = 8;
            lblValidStars.Visible = false;
            invalidL();

            foreach (Point p in answerFix)
            {
                show(p);
            }
            answer = new LinkedList<Point>();
            foreach (Point p in answerFix)
            {
                answer.AddLast(p);
            }
            foreach (Button b in buttons)
                b.Enabled = true;
            buttons = new List<Button>();
        }