PageRenderTime 106ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/FilamentFinalProject/MakeCharacter.cs

https://gitlab.com/sheminusminus/filament
C# | 380 lines | 300 code | 78 blank | 2 comment | 0 complexity | fde39db9e1dd3e923a5c65aabc1d6260 MD5 | raw file
  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.IO;
  11. namespace FilamentFinalProject
  12. {
  13. public partial class MakeCharacter : Form
  14. {
  15. //class variables
  16. private string hairFile = "decisions/hair.txt";
  17. private string toneFile = "decisions/shirt.txt";
  18. private string sexFile = "decisions/sex.txt";
  19. private string hairColor = "";
  20. private string shirtColor = "";
  21. private string playerSex = "";
  22. public MakeCharacter()
  23. {
  24. InitializeComponent();
  25. }
  26. private void PbMaleSymbol_Click(object sender, EventArgs e)
  27. {
  28. playerSex = "male";
  29. PbBrownM.Visible = true;
  30. PbBlondeM.Visible = true;
  31. PbRedM.Visible = true;
  32. PbBlackM.Visible = true;
  33. PbBrownF.Visible = false;
  34. PbBlondeF.Visible = false;
  35. PbBlackF.Visible = false;
  36. PbRedF.Visible = false;
  37. PbHair.Visible = true;
  38. PbFemaleSymbol.Visible = false;
  39. PbMaleSymbol.Visible = true;
  40. }
  41. private void PbFemaleSymbol_Click(object sender, EventArgs e)
  42. {
  43. playerSex = "female";
  44. PbBrownF.Visible = true;
  45. PbBlondeF.Visible = true;
  46. PbBlackF.Visible = true;
  47. PbRedF.Visible = true;
  48. PbBrownM.Visible = false;
  49. PbBlondeM.Visible = false;
  50. PbRedM.Visible = false;
  51. PbBlackM.Visible = false;
  52. PbHair.Visible = true;
  53. PbMaleSymbol.Visible = false;
  54. PbFemaleSymbol.Visible = true;
  55. }
  56. private void PbBlackM_Click(object sender, EventArgs e)
  57. {
  58. hairColor = "black";
  59. PbBlueM.Visible = true;
  60. PbPurpleM.Visible = true;
  61. PbOrangeM.Visible = true;
  62. PbBrownF.Visible = false;
  63. PbBlondeF.Visible = false;
  64. PbBlackF.Visible = false;
  65. PbRedF.Visible = false;
  66. PbBrownM.Visible = false;
  67. PbBlondeM.Visible = false;
  68. PbRedM.Visible = false;
  69. PbBlackM.Visible = true;
  70. PbWear.Visible = true;
  71. }
  72. private void PbBlondeM_Click(object sender, EventArgs e)
  73. {
  74. hairColor = "blonde";
  75. PbBlueM.Visible = true;
  76. PbPurpleM.Visible = true;
  77. PbOrangeM.Visible = true;
  78. PbBrownF.Visible = false;
  79. PbBlondeF.Visible = false;
  80. PbBlackF.Visible = false;
  81. PbRedF.Visible = false;
  82. PbBrownM.Visible = false;
  83. PbBlondeM.Visible = true;
  84. PbRedM.Visible = false;
  85. PbBlackM.Visible = false;
  86. PbWear.Visible = true;
  87. }
  88. private void PbBrownM_Click(object sender, EventArgs e)
  89. {
  90. hairColor = "brown";
  91. PbBlueM.Visible = true;
  92. PbPurpleM.Visible = true;
  93. PbOrangeM.Visible = true;
  94. PbBrownF.Visible = false;
  95. PbBlondeF.Visible = false;
  96. PbBlackF.Visible = false;
  97. PbRedF.Visible = false;
  98. PbBrownM.Visible = true;
  99. PbBlondeM.Visible = false;
  100. PbRedM.Visible = false;
  101. PbBlackM.Visible = false;
  102. PbWear.Visible = true;
  103. }
  104. private void PbRedM_Click(object sender, EventArgs e)
  105. {
  106. hairColor = "red";
  107. PbBlueM.Visible = true;
  108. PbPurpleM.Visible = true;
  109. PbOrangeM.Visible = true;
  110. PbBrownF.Visible = false;
  111. PbBlondeF.Visible = false;
  112. PbBlackF.Visible = false;
  113. PbRedF.Visible = false;
  114. PbBrownM.Visible = false;
  115. PbBlondeM.Visible = false;
  116. PbRedM.Visible = true;
  117. PbBlackM.Visible = false;
  118. PbWear.Visible = true;
  119. }
  120. private void PbRedF_Click(object sender, EventArgs e)
  121. {
  122. hairColor = "red";
  123. PbBlueF.Visible = true;
  124. PbPurpleF.Visible = true;
  125. PbOrangeF.Visible = true;
  126. PbBlueM.Visible = false;
  127. PbPurpleM.Visible = false;
  128. PbOrangeM.Visible = false;
  129. PbBrownF.Visible = false;
  130. PbBlondeF.Visible = false;
  131. PbBlackF.Visible = false;
  132. PbRedF.Visible = true;
  133. PbBrownM.Visible = false;
  134. PbBlondeM.Visible = false;
  135. PbRedM.Visible = false;
  136. PbBlackM.Visible = false;
  137. PbWear.Visible = true;
  138. }
  139. private void PbBrownF_Click(object sender, EventArgs e)
  140. {
  141. hairColor = "brown";
  142. PbBlueF.Visible = true;
  143. PbPurpleF.Visible = true;
  144. PbOrangeF.Visible = true;
  145. PbBlueM.Visible = false;
  146. PbPurpleM.Visible = false;
  147. PbOrangeM.Visible = false;
  148. PbBrownF.Visible = true;
  149. PbBlondeF.Visible = false;
  150. PbBlackF.Visible = false;
  151. PbRedF.Visible = false;
  152. PbBrownM.Visible = false;
  153. PbBlondeM.Visible = false;
  154. PbRedM.Visible = false;
  155. PbBlackM.Visible = false;
  156. PbWear.Visible = true;
  157. }
  158. private void PbBlondeF_Click(object sender, EventArgs e)
  159. {
  160. hairColor = "blonde";
  161. PbBlueF.Visible = true;
  162. PbPurpleF.Visible = true;
  163. PbOrangeF.Visible = true;
  164. PbBlueM.Visible = false;
  165. PbPurpleM.Visible = false;
  166. PbOrangeM.Visible = false;
  167. PbBrownF.Visible = false;
  168. PbBlondeF.Visible = true;
  169. PbBlackF.Visible = false;
  170. PbRedF.Visible = false;
  171. PbBrownM.Visible = false;
  172. PbBlondeM.Visible = false;
  173. PbRedM.Visible = false;
  174. PbBlackM.Visible = false;
  175. PbWear.Visible = true;
  176. }
  177. private void PbBlackF_Click(object sender, EventArgs e)
  178. {
  179. hairColor = "black";
  180. PbBlueF.Visible = true;
  181. PbPurpleF.Visible = true;
  182. PbOrangeF.Visible = true;
  183. PbBlueM.Visible = false;
  184. PbPurpleM.Visible = false;
  185. PbOrangeM.Visible = false;
  186. PbBrownF.Visible = false;
  187. PbBlondeF.Visible = false;
  188. PbBlackF.Visible = true;
  189. PbRedF.Visible = false;
  190. PbBrownM.Visible = false;
  191. PbBlondeM.Visible = false;
  192. PbRedM.Visible = false;
  193. PbBlackM.Visible = false;
  194. PbWear.Visible = true;
  195. }
  196. private void PbBlueM_Click(object sender, EventArgs e)
  197. {
  198. shirtColor = "blue";
  199. PbBlueM.Visible = true;
  200. PbPurpleM.Visible = false;
  201. PbOrangeM.Visible = false;
  202. PbBlueF.Visible = false;
  203. PbPurpleF.Visible = false;
  204. PbOrangeF.Visible = false;
  205. }
  206. private void PbPurpleM_Click(object sender, EventArgs e)
  207. {
  208. shirtColor = "purple";
  209. PbBlueM.Visible = false;
  210. PbPurpleM.Visible = true;
  211. PbOrangeM.Visible = false;
  212. PbBlueF.Visible = false;
  213. PbPurpleF.Visible = false;
  214. PbOrangeF.Visible = false;
  215. }
  216. private void PbOrangeM_Click(object sender, EventArgs e)
  217. {
  218. shirtColor = "orange";
  219. PbBlueM.Visible = false;
  220. PbPurpleM.Visible = false;
  221. PbOrangeM.Visible = true;
  222. PbBlueF.Visible = false;
  223. PbPurpleF.Visible = false;
  224. PbOrangeF.Visible = false;
  225. }
  226. private void PBOrangeF_Click(object sender, EventArgs e)
  227. {
  228. shirtColor = "orange";
  229. PbBlueF.Visible = false;
  230. PbPurpleF.Visible = false;
  231. PbOrangeF.Visible = true;
  232. PbBlueM.Visible = false;
  233. PbPurpleM.Visible = false;
  234. PbOrangeM.Visible = false;
  235. }
  236. private void PbPurpleF_Click(object sender, EventArgs e)
  237. {
  238. shirtColor = "purple";
  239. PbBlueF.Visible = false;
  240. PbPurpleF.Visible = true;
  241. PbOrangeF.Visible = false;
  242. PbBlueM.Visible = false;
  243. PbPurpleM.Visible = false;
  244. PbOrangeM.Visible = false;
  245. }
  246. private void PbBlueF_Click(object sender, EventArgs e)
  247. {
  248. shirtColor = "blue";
  249. PbBlueF.Visible = true;
  250. PbPurpleF.Visible = false;
  251. PbOrangeF.Visible = false;
  252. PbBlueM.Visible = false;
  253. PbPurpleM.Visible = false;
  254. PbOrangeM.Visible = false;
  255. }
  256. //starts the creation process over
  257. private void BtnStartOver_Click(object sender, EventArgs e)
  258. {
  259. PbFemaleSymbol.Visible = true;
  260. PbMaleSymbol.Visible = true;
  261. PbSex.Visible = true;
  262. PbBlueM.Visible = false;
  263. PbPurpleM.Visible = false;
  264. PbOrangeM.Visible = false;
  265. PbBlueF.Visible = false;
  266. PbPurpleF.Visible = false;
  267. PbOrangeF.Visible = false;
  268. PbWear.Visible = false;
  269. PbHair.Visible = false;
  270. PbBrownF.Visible = false;
  271. PbBlondeF.Visible = false;
  272. PbBlackF.Visible = false;
  273. PbRedF.Visible = false;
  274. PbBrownM.Visible = false;
  275. PbBlondeM.Visible = false;
  276. PbRedM.Visible = false;
  277. PbBlackM.Visible = false;
  278. playerSex = "";
  279. hairColor = "";
  280. shirtColor = "";
  281. File.WriteAllText(sexFile, playerSex);
  282. File.WriteAllText(hairFile, hairColor);
  283. File.WriteAllText(toneFile, shirtColor);
  284. }
  285. private void CreateInfoFiles(string sex, string hair, string tone)
  286. {
  287. sex = playerSex;
  288. hair = hairColor;
  289. tone = shirtColor;
  290. File.WriteAllText(sexFile, playerSex);
  291. File.WriteAllText(hairFile, hairColor);
  292. File.WriteAllText(toneFile, shirtColor);
  293. }
  294. private void BtnAllDone_Click(object sender, EventArgs e)
  295. {
  296. CreateInfoFiles(playerSex, hairColor, shirtColor);
  297. NewGame gameOn = new NewGame();
  298. gameOn.Show();
  299. this.Hide();
  300. }
  301. }
  302. }