public RandomLetters( List<Button> keyboard) { k = 0; sec = 0; this.keyboard = new List<Button>(keyboard); pie = new Pie(152, 330); cNum = 0; vNum = 0; consNum = 0; vowNum = 0; char[] c = { 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z' }; char[] v = { 'A', 'E', 'I', 'O', 'U' }; Consonants = new List<char>(c); Vowels = new List<char>(v); randomConsonants = new List<char>(pickConsonants()); randomVowels = new List<char>(pickVowels()); randomC = new List<char>(pickConsonants()); randomV = new List<char>(pickVowels()); }
/* * We check if the nineLetter word is valid or invalid * in the fifth round we use actual nine letter words which are shuffled * we use a bouncing bunny which tells you if your word is invalid * or stars to tell you that you've done a good job * also use another method done() for the other 4 rounds which will be explained * start the timer3 */ private void iAmDone_Click(object sender, EventArgs e) { iAmDone.Enabled = false; timer1.Stop(); KeyPreview = false; pie = new Pie(100, 70); label14.Text = "00:00"; shuffle.Enabled = false; if (round == 5) { lastW.Visible = false; Invalidate(); StringBuilder sb = new StringBuilder(); if (buttons.Count == 9) { for (int i = 0; i < 9; i++) { sb.Append(buttons.ElementAt(i).Text); } if (correctNineLetterWord.Trim() == sb.ToString().Trim()) { //MessageBox.Show("Congrats, you guessed the nine letter word"); currentScore += 9; //Тука додај го скорот wordTxt.Text = sb.ToString(); scoreTxt.Text = currentScore.ToString(); valid.Text = "valid"; timer3.Start(); } else { valid.Text = "invalid"; // MessageBox.Show("The correct nine letter word is " + correctNineLetterWord); bunnyPanel.Visible = true; timer3.Start(); } } else { valid.Text = "invalid"; bunnyPanel.Visible = true; timer3.Start(); } iAmDone.Enabled = false; start.Enabled = false; done(); } else { done(); } }
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(); }
/*Generally, here we do everything which is necessary for a new round * the iAmDone button is enabled, we restart timer1 (for the ticking pie) * we increase the round counter and we also use the newRound() method */ public void nextRoundMethod() { iAmDone.Enabled = true; if (round < 5) { KeyPreview = true; pie = new Pie(100, 70); timer1.Start(); round += 1; label13.Text = round.ToString() + "/5"; if (ChangeLettersPerRound) newRound(); ChangeLettersPerRound = true; shuffle.Enabled = true; } nextRound.Enabled = false; }
/*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>(); }