Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Runtime.InteropServices;
- using System.Reflection;
- using System.IO;
- using System.Media;
- using System.Threading;
- namespace Lingo_1._0
- {
- public partial class Tiebreak_5 : Form
- {
- public Tiebreak_5()
- {
- InitializeComponent();
- }
- static int current_letter = 0;
- static int current_line = 0;
- static int check_word = 0;
- static int loop_word = 0;
- static int woordnummer = 1;
- static int start = 1;
- public const int WM_NCLBUTTONDOWN = 0xA1;
- public const int HT_CAPTION = 0x2;
- [DllImportAttribute("user32.dll")]
- public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
- [DllImportAttribute("user32.dll")]
- public static extern bool ReleaseCapture();
- private void Lingo_Load(object sender, EventArgs e)
- {
- TEAM1.Parent = Basis;
- TEAM1.BackColor = Color.Transparent;
- TEAM2.Parent = Basis;
- TEAM2.BackColor = Color.Transparent;
- Score_1.Parent = Basis;
- Score_1.BackColor = Color.Transparent;
- Score_2.Parent = Basis;
- Score_2.BackColor = Color.Transparent;
- Name1.Parent = Basis;
- Name1.BackColor = Color.Transparent;
- Name2.Parent = Basis;
- Name2.BackColor = Color.Transparent;
- Name3.Parent = Basis;
- Name3.BackColor = Color.Transparent;
- Name4.Parent = Basis;
- Name4.BackColor = Color.Transparent;
- l01.Parent = v1;
- l01.BackColor = Color.Transparent;
- l02.Parent = v2;
- l02.BackColor = Color.Transparent;
- l03.Parent = v3;
- l03.BackColor = Color.Transparent;
- l04.Parent = v4;
- l04.BackColor = Color.Transparent;
- l05.Parent = v5;
- l05.BackColor = Color.Transparent;
- l06.Parent = v6;
- l06.BackColor = Color.Transparent;
- l07.Parent = v7;
- l07.BackColor = Color.Transparent;
- l08.Parent = v8;
- l08.BackColor = Color.Transparent;
- l09.Parent = v9;
- l09.BackColor = Color.Transparent;
- l10.Parent = v10;
- l10.BackColor = Color.Transparent;
- l11.Parent = v11;
- l11.BackColor = Color.Transparent;
- l12.Parent = v12;
- l12.BackColor = Color.Transparent;
- l13.Parent = v13;
- l13.BackColor = Color.Transparent;
- l14.Parent = v14;
- l14.BackColor = Color.Transparent;
- l15.Parent = v15;
- l15.BackColor = Color.Transparent;
- l16.Parent = v16;
- l16.BackColor = Color.Transparent;
- l17.Parent = v17;
- l17.BackColor = Color.Transparent;
- l18.Parent = v18;
- l18.BackColor = Color.Transparent;
- l19.Parent = v19;
- l19.BackColor = Color.Transparent;
- l20.Parent = v20;
- l20.BackColor = Color.Transparent;
- l21.Parent = v21;
- l21.BackColor = Color.Transparent;
- l22.Parent = v22;
- l22.BackColor = Color.Transparent;
- l23.Parent = v23;
- l23.BackColor = Color.Transparent;
- l24.Parent = v24;
- l24.BackColor = Color.Transparent;
- l25.Parent = v25;
- l25.BackColor = Color.Transparent;
- solution.Parent = Basis;
- solution.BackColor = Color.Transparent;
- Spelers namen = Application.OpenForms.OfType<Spelers>().FirstOrDefault();
- Name1.Text = namen.Player1.Text;
- Name2.Text = namen.Player2.Text;
- Name3.Text = namen.Player3.Text;
- Name4.Text = namen.Player4.Text;
- }
- private void Basis_MouseDown(object sender, MouseEventArgs e)
- {
- ReleaseCapture();
- SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
- }
- private void Basis_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- WindowState = FormWindowState.Maximized;
- }
- private void Basis_A_MouseDown(object sender, MouseEventArgs e)
- {
- ReleaseCapture();
- SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
- }
- private void Basis_A_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- WindowState = FormWindowState.Maximized;
- }
- private void Basis_B_MouseDown(object sender, MouseEventArgs e)
- {
- ReleaseCapture();
- SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
- }
- private void Basis_B_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- WindowState = FormWindowState.Maximized;
- }
- private void Tiebreak_5_KeyPress(object sender, KeyPressEventArgs e)
- {
- string current_word = File
- .ReadLines(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Woorden\nl_5.txt")
- .Skip(woordnummer - 1)
- .FirstOrDefault();
- string[] mistery_word = current_word.Select(c => c.ToString()).ToArray();
- string[] correct_letters = new string[] { ".", ".", ".", ".", "." };
- string[,] letters = new string[5, 5]{ {".", ".", ".", ".", "."} ,
- {".", ".", ".", ".", "."} ,
- {".", ".", ".", ".", "."} ,
- {".", ".", ".", ".", "."} ,
- {".", ".", ".", ".", "."} ,};
- Label[,] labels = new Label[5, 5]{ {l01, l02, l03, l04, l05} ,
- {l06, l07, l08, l09, l10} ,
- {l11, l12, l13, l14, l15} ,
- {l16, l17, l18, l19, l20} ,
- {l21, l22, l23, l24, l25} , };
- TableLayoutPanel[,] vakjes = new TableLayoutPanel[5, 5]{ {v1, v2, v3, v4, v5} ,
- {v6, v7, v8, v9, v10} ,
- {v11, v12, v13, v14, v15} ,
- {v16, v17, v18, v19, v20} ,
- {v21, v22, v23, v24, v25} , };
- Label[,] l = labels;
- TableLayoutPanel[,] v = vakjes;
- if (e.KeyChar == Convert.ToChar(Keys.Enter) && start == 1 && check_word == 0)
- {
- solution.Text = (current_word);
- start--;
- l01.Text = mistery_word[0];
- correct_letters[loop_word] = mistery_word[0];
- l01.Visible = true;
- l02.Visible = true;
- l03.Visible = true;
- l04.Visible = true;
- l05.Visible = true;
- SoundPlayer Nieuwwoord = new SoundPlayer(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Sounds\Start_woord.wav");
- Nieuwwoord.PlaySync();
- }
- else if (e.KeyChar == Convert.ToChar(Keys.Space) && check_word != 1 && start == 0) /// spatie
- {
- check_word++;
- }
- else if (e.KeyChar >= 97 && e.KeyChar <= 122 ||
- e.KeyChar == 59 && current_letter < 5 ||
- current_letter >= 0 && e.KeyChar != Convert.ToChar(Keys.Space))
- if (e.KeyChar >= 97 && e.KeyChar <= 122 && current_letter < 5)
- {
- l[current_line, current_letter].Text = e.KeyChar.ToString().ToUpper();
- letters[current_line, current_letter] = e.KeyChar.ToString().ToUpper();
- current_letter++;
- }
- else if (e.KeyChar == 59) /// een lange ij
- {
- l[current_line, current_letter].Text = "IJ";
- letters[current_line, current_letter] = "IJ";
- current_letter++;
- }
- else if (e.KeyChar == Convert.ToChar(Keys.Enter) && check_word == 1) /// enter
- {
- for (loop_word = 0; loop_word < 5; loop_word++)
- {
- if (l[current_line, loop_word].Text == mistery_word[loop_word])
- {
- v[current_line, loop_word].BackgroundImage = new Bitmap(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Images\Goed.png");
- SoundPlayer goed = new SoundPlayer(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Sounds\Piep_goed.wav");
- goed.PlaySync();
- Refresh();
- }
- else if (l[current_line, loop_word].Text != mistery_word[loop_word] && current_word.Contains(l[current_line, loop_word].Text))
- {
- v[current_line, loop_word].BackgroundImage = new Bitmap(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Images\HalfGoed.png");
- SoundPlayer half = new SoundPlayer(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Sounds\Piep_half.wav");
- half.PlaySync();
- Refresh();
- }
- else if (l[current_line, loop_word].Text != mistery_word[loop_word] != current_word.Contains(l[current_line, loop_word].Text))
- {
- SoundPlayer fout = new SoundPlayer(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Sounds\Piep_fout.wav");
- fout.PlaySync();
- Refresh();
- }
- else if (!l[current_line+1, loop_word].Visible)
- {
- for (int i = 0; i < 5; i++)
- {
- current_line++;
- l[current_line, i].Visible = true;
- loop_word = 0;
- current_letter = 0;
- }
- Refresh();
- }
- else if (current_line == 0)
- {
- l06.Visible = true;
- l07.Visible = true;
- l08.Visible = true;
- l09.Visible = true;
- l10.Visible = true;
- }
- //else if (loop_word == 4 &&
- // v[current_line, 0].BackgroundImage == new Bitmap(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Images\Goed.png") &&
- // v[current_line, 1].BackgroundImage == new Bitmap(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Images\Goed.png") &&
- // v[current_line, 2].BackgroundImage == new Bitmap(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Images\Goed.png") &&
- // v[current_line, 3].BackgroundImage == new Bitmap(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Images\Goed.png") &&
- // v[current_line, 4].BackgroundImage == new Bitmap(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Images\Goed.png"))
- //{
- // if (Basis.Image == Properties.Resources.Basis_A)
- // {
- // int score_A = Convert.ToInt32(Score_1.Text);
- // score_A += 25;
- // SoundPlayer Lingo = new SoundPlayer(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Sounds\Lingo.wav");
- // Lingo.PlaySync();
- // }
- // else if (Basis.Image == Properties.Resources.Basis_B)
- // {
- // int score_B = Convert.ToInt32(Score_2.Text);
- // score_B += 25;
- // SoundPlayer Lingo = new SoundPlayer(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Sounds\Lingo.wav");
- // Lingo.PlaySync();
- // }
- //}
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement