Advertisement
Guest User

Untitled

a guest
Sep 20th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Runtime.InteropServices;
  11. using System.Reflection;
  12. using System.IO;
  13. using System.Media;
  14. using System.Threading;
  15.  
  16. namespace Lingo_1._0
  17. {
  18. public partial class Tiebreak_5 : Form
  19. {
  20. public Tiebreak_5()
  21. {
  22. InitializeComponent();
  23. }
  24.  
  25. static int current_letter = 0;
  26. static int current_line = 0;
  27. static int check_word = 0;
  28. static int loop_word = 0;
  29. static int woordnummer = 1;
  30. static int start = 1;
  31.  
  32.  
  33.  
  34. public const int WM_NCLBUTTONDOWN = 0xA1;
  35. public const int HT_CAPTION = 0x2;
  36. [DllImportAttribute("user32.dll")]
  37. public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
  38. [DllImportAttribute("user32.dll")]
  39. public static extern bool ReleaseCapture();
  40.  
  41. private void Lingo_Load(object sender, EventArgs e)
  42. {
  43. TEAM1.Parent = Basis;
  44. TEAM1.BackColor = Color.Transparent;
  45.  
  46. TEAM2.Parent = Basis;
  47. TEAM2.BackColor = Color.Transparent;
  48.  
  49. Score_1.Parent = Basis;
  50. Score_1.BackColor = Color.Transparent;
  51.  
  52. Score_2.Parent = Basis;
  53. Score_2.BackColor = Color.Transparent;
  54.  
  55. Name1.Parent = Basis;
  56. Name1.BackColor = Color.Transparent;
  57.  
  58. Name2.Parent = Basis;
  59. Name2.BackColor = Color.Transparent;
  60.  
  61. Name3.Parent = Basis;
  62. Name3.BackColor = Color.Transparent;
  63.  
  64. Name4.Parent = Basis;
  65. Name4.BackColor = Color.Transparent;
  66.  
  67. l01.Parent = v1;
  68. l01.BackColor = Color.Transparent;
  69.  
  70. l02.Parent = v2;
  71. l02.BackColor = Color.Transparent;
  72.  
  73. l03.Parent = v3;
  74. l03.BackColor = Color.Transparent;
  75.  
  76. l04.Parent = v4;
  77. l04.BackColor = Color.Transparent;
  78.  
  79. l05.Parent = v5;
  80. l05.BackColor = Color.Transparent;
  81.  
  82. l06.Parent = v6;
  83. l06.BackColor = Color.Transparent;
  84.  
  85. l07.Parent = v7;
  86. l07.BackColor = Color.Transparent;
  87.  
  88. l08.Parent = v8;
  89. l08.BackColor = Color.Transparent;
  90.  
  91. l09.Parent = v9;
  92. l09.BackColor = Color.Transparent;
  93.  
  94. l10.Parent = v10;
  95. l10.BackColor = Color.Transparent;
  96.  
  97. l11.Parent = v11;
  98. l11.BackColor = Color.Transparent;
  99.  
  100. l12.Parent = v12;
  101. l12.BackColor = Color.Transparent;
  102.  
  103. l13.Parent = v13;
  104. l13.BackColor = Color.Transparent;
  105.  
  106. l14.Parent = v14;
  107. l14.BackColor = Color.Transparent;
  108.  
  109. l15.Parent = v15;
  110. l15.BackColor = Color.Transparent;
  111.  
  112. l16.Parent = v16;
  113. l16.BackColor = Color.Transparent;
  114.  
  115. l17.Parent = v17;
  116. l17.BackColor = Color.Transparent;
  117.  
  118. l18.Parent = v18;
  119. l18.BackColor = Color.Transparent;
  120.  
  121. l19.Parent = v19;
  122. l19.BackColor = Color.Transparent;
  123.  
  124. l20.Parent = v20;
  125. l20.BackColor = Color.Transparent;
  126.  
  127. l21.Parent = v21;
  128. l21.BackColor = Color.Transparent;
  129.  
  130. l22.Parent = v22;
  131. l22.BackColor = Color.Transparent;
  132.  
  133. l23.Parent = v23;
  134. l23.BackColor = Color.Transparent;
  135.  
  136. l24.Parent = v24;
  137. l24.BackColor = Color.Transparent;
  138.  
  139. l25.Parent = v25;
  140. l25.BackColor = Color.Transparent;
  141.  
  142. solution.Parent = Basis;
  143. solution.BackColor = Color.Transparent;
  144.  
  145. Spelers namen = Application.OpenForms.OfType<Spelers>().FirstOrDefault();
  146.  
  147. Name1.Text = namen.Player1.Text;
  148. Name2.Text = namen.Player2.Text;
  149. Name3.Text = namen.Player3.Text;
  150. Name4.Text = namen.Player4.Text;
  151. }
  152.  
  153. private void Basis_MouseDown(object sender, MouseEventArgs e)
  154. {
  155. ReleaseCapture();
  156. SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
  157. }
  158.  
  159. private void Basis_MouseDoubleClick(object sender, MouseEventArgs e)
  160. {
  161. WindowState = FormWindowState.Maximized;
  162. }
  163.  
  164. private void Basis_A_MouseDown(object sender, MouseEventArgs e)
  165. {
  166. ReleaseCapture();
  167. SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
  168. }
  169.  
  170. private void Basis_A_MouseDoubleClick(object sender, MouseEventArgs e)
  171. {
  172. WindowState = FormWindowState.Maximized;
  173. }
  174.  
  175. private void Basis_B_MouseDown(object sender, MouseEventArgs e)
  176. {
  177. ReleaseCapture();
  178. SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
  179. }
  180.  
  181. private void Basis_B_MouseDoubleClick(object sender, MouseEventArgs e)
  182. {
  183. WindowState = FormWindowState.Maximized;
  184. }
  185.  
  186. private void Tiebreak_5_KeyPress(object sender, KeyPressEventArgs e)
  187. {
  188. string current_word = File
  189. .ReadLines(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Woorden\nl_5.txt")
  190. .Skip(woordnummer - 1)
  191. .FirstOrDefault();
  192.  
  193. string[] mistery_word = current_word.Select(c => c.ToString()).ToArray();
  194.  
  195. string[] correct_letters = new string[] { ".", ".", ".", ".", "." };
  196.  
  197. string[,] letters = new string[5, 5]{ {".", ".", ".", ".", "."} ,
  198. {".", ".", ".", ".", "."} ,
  199. {".", ".", ".", ".", "."} ,
  200. {".", ".", ".", ".", "."} ,
  201. {".", ".", ".", ".", "."} ,};
  202.  
  203. Label[,] labels = new Label[5, 5]{ {l01, l02, l03, l04, l05} ,
  204. {l06, l07, l08, l09, l10} ,
  205. {l11, l12, l13, l14, l15} ,
  206. {l16, l17, l18, l19, l20} ,
  207. {l21, l22, l23, l24, l25} , };
  208.  
  209. TableLayoutPanel[,] vakjes = new TableLayoutPanel[5, 5]{ {v1, v2, v3, v4, v5} ,
  210. {v6, v7, v8, v9, v10} ,
  211. {v11, v12, v13, v14, v15} ,
  212. {v16, v17, v18, v19, v20} ,
  213. {v21, v22, v23, v24, v25} , };
  214.  
  215. Label[,] l = labels;
  216. TableLayoutPanel[,] v = vakjes;
  217.  
  218.  
  219.  
  220. if (e.KeyChar == Convert.ToChar(Keys.Enter) && start == 1 && check_word == 0)
  221. {
  222. solution.Text = (current_word);
  223. start--;
  224.  
  225. l01.Text = mistery_word[0];
  226. correct_letters[loop_word] = mistery_word[0];
  227.  
  228. l01.Visible = true;
  229. l02.Visible = true;
  230. l03.Visible = true;
  231. l04.Visible = true;
  232. l05.Visible = true;
  233.  
  234. SoundPlayer Nieuwwoord = new SoundPlayer(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Sounds\Start_woord.wav");
  235. Nieuwwoord.PlaySync();
  236. }
  237.  
  238. else if (e.KeyChar == Convert.ToChar(Keys.Space) && check_word != 1 && start == 0) /// spatie
  239. {
  240. check_word++;
  241. }
  242.  
  243. else if (e.KeyChar >= 97 && e.KeyChar <= 122 ||
  244. e.KeyChar == 59 && current_letter < 5 ||
  245. current_letter >= 0 && e.KeyChar != Convert.ToChar(Keys.Space))
  246.  
  247. if (e.KeyChar >= 97 && e.KeyChar <= 122 && current_letter < 5)
  248. {
  249. l[current_line, current_letter].Text = e.KeyChar.ToString().ToUpper();
  250. letters[current_line, current_letter] = e.KeyChar.ToString().ToUpper();
  251.  
  252. current_letter++;
  253. }
  254.  
  255. else if (e.KeyChar == 59) /// een lange ij
  256. {
  257. l[current_line, current_letter].Text = "IJ";
  258. letters[current_line, current_letter] = "IJ";
  259.  
  260. current_letter++;
  261. }
  262.  
  263. else if (e.KeyChar == Convert.ToChar(Keys.Enter) && check_word == 1) /// enter
  264. {
  265. for (loop_word = 0; loop_word < 5; loop_word++)
  266. {
  267. if (l[current_line, loop_word].Text == mistery_word[loop_word])
  268. {
  269. 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");
  270. SoundPlayer goed = new SoundPlayer(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Sounds\Piep_goed.wav");
  271. goed.PlaySync();
  272. Refresh();
  273. }
  274.  
  275. else if (l[current_line, loop_word].Text != mistery_word[loop_word] && current_word.Contains(l[current_line, loop_word].Text))
  276. {
  277. 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");
  278. SoundPlayer half = new SoundPlayer(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Sounds\Piep_half.wav");
  279. half.PlaySync();
  280. Refresh();
  281. }
  282.  
  283. else if (l[current_line, loop_word].Text != mistery_word[loop_word] != current_word.Contains(l[current_line, loop_word].Text))
  284. {
  285. SoundPlayer fout = new SoundPlayer(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Sounds\Piep_fout.wav");
  286. fout.PlaySync();
  287. Refresh();
  288. }
  289.  
  290. else if (!l[current_line+1, loop_word].Visible)
  291. {
  292. for (int i = 0; i < 5; i++)
  293. {
  294. current_line++;
  295. l[current_line, i].Visible = true;
  296. loop_word = 0;
  297. current_letter = 0;
  298. }
  299.  
  300. Refresh();
  301. }
  302.  
  303. else if (current_line == 0)
  304. {
  305. l06.Visible = true;
  306. l07.Visible = true;
  307. l08.Visible = true;
  308. l09.Visible = true;
  309. l10.Visible = true;
  310.  
  311. }
  312.  
  313. //else if (loop_word == 4 &&
  314. // 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") &&
  315. // 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") &&
  316. // 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") &&
  317. // 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") &&
  318. // 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"))
  319. //{
  320. // if (Basis.Image == Properties.Resources.Basis_A)
  321. // {
  322. // int score_A = Convert.ToInt32(Score_1.Text);
  323. // score_A += 25;
  324. // SoundPlayer Lingo = new SoundPlayer(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Sounds\Lingo.wav");
  325. // Lingo.PlaySync();
  326. // }
  327.  
  328. // else if (Basis.Image == Properties.Resources.Basis_B)
  329. // {
  330. // int score_B = Convert.ToInt32(Score_2.Text);
  331. // score_B += 25;
  332. // SoundPlayer Lingo = new SoundPlayer(@"C:\Users\Gebruiker\Documents\Visual Studio 2015\Projects\Lingo 1.0\Lingo 1.0\Resources\Sounds\Lingo.wav");
  333. // Lingo.PlaySync();
  334. // }
  335. //}
  336. }
  337. }
  338. }
  339. }
  340. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement