Config.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. using Client;
  2. using System.Resources;
  3. using System.Reflection;
  4. using Client.Resolution;
  5. namespace Launcher
  6. {
  7. public partial class Config : Form
  8. {
  9. public Config()
  10. {
  11. InitializeComponent();
  12. }
  13. private void Config_Load(object sender, EventArgs e)
  14. {
  15. this.label10.Text = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.Resolution) ;
  16. this.AutoStart_label.Text = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.Autostart);
  17. this.ID_l.Text = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.Usrname);
  18. this.Password_l.Text = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.Password);
  19. DrawSupportedResolutions();
  20. }
  21. private void Res1_pb_Click(object sender, EventArgs e)
  22. {
  23. resolutionChoice(eSupportedResolution.w1024h768);
  24. }
  25. public void resolutionChoice(eSupportedResolution res)
  26. {
  27. Res2_pb.Image = Client.Resources.Images.Radio_Unactive;
  28. Res3_pb.Image = Client.Resources.Images.Radio_Unactive;
  29. Res4_pb.Image = Client.Resources.Images.Radio_Unactive;
  30. Res5_pb.Image = Client.Resources.Images.Radio_Unactive;
  31. switch (res)
  32. {
  33. case eSupportedResolution.w1024h768:
  34. Res2_pb.Image = Client.Resources.Images.Config_Radio_On;
  35. break;
  36. case eSupportedResolution.w1366h768:
  37. Res3_pb.Image = Client.Resources.Images.Config_Radio_On;
  38. break;
  39. case eSupportedResolution.w1280h720:
  40. Res4_pb.Image = Client.Resources.Images.Config_Radio_On;
  41. break;
  42. case eSupportedResolution.w1920h1080:
  43. Res5_pb.Image = Client.Resources.Images.Config_Radio_On;
  44. break;
  45. }
  46. Settings.Resolution = (int)res;
  47. }
  48. private void Res2_pb_Click(object sender, EventArgs e)
  49. {
  50. resolutionChoice(eSupportedResolution.w1024h768);
  51. }
  52. private void Res3_pb_Click(object sender, EventArgs e)
  53. {
  54. resolutionChoice(eSupportedResolution.w1366h768);
  55. }
  56. private void Config_VisibleChanged(object sender, EventArgs e)
  57. {
  58. if (Visible)
  59. {
  60. AccountLogin_txt.Text = Settings.AccountID;
  61. AccountPass_txt.Text = Settings.Password;
  62. resolutionChoice((eSupportedResolution)Settings.Resolution);
  63. Fullscreen_pb.Image = Settings.FullScreen
  64. ? Client.Resources.Images.Config_Check_On
  65. : Client.Resources.Images.Config_Check_Off1;
  66. FPScap_pb.Image = Settings.FPSCap
  67. ? Client.Resources.Images.Config_Check_On
  68. : Client.Resources.Images.Config_Check_Off1;
  69. OnTop_pb.Image = Settings.TopMost
  70. ? Client.Resources.Images.Config_Check_On
  71. : Client.Resources.Images.Config_Check_Off1;
  72. AutoStart_pb.Image = Settings.P_AutoStart
  73. ? Client.Resources.Images.Config_Check_On
  74. : Client.Resources.Images.Config_Check_Off1;
  75. this.ActiveControl = label4;
  76. }
  77. else
  78. {
  79. Settings.AccountID = AccountLogin_txt.Text;
  80. Settings.Password = AccountPass_txt.Text;
  81. Settings.Save();
  82. }
  83. }
  84. private void AccountLogin_txt_TextChanged(object sender, EventArgs e)
  85. {
  86. if (AccountLogin_txt.Text == string.Empty) ID_l.Visible = true;
  87. else ID_l.Visible = false;
  88. }
  89. private void AccountPass_txt_TextChanged(object sender, EventArgs e)
  90. {
  91. if (AccountPass_txt.Text == string.Empty) Password_l.Visible = true;
  92. else Password_l.Visible = false;
  93. }
  94. private void AccountLogin_txt_Click(object sender, EventArgs e)
  95. {
  96. ID_l.Visible = false;
  97. AccountLogin_txt.Focus();
  98. }
  99. private void AccountPass_txt_Click(object sender, EventArgs e)
  100. {
  101. Password_l.Visible = false;
  102. AccountPass_txt.Focus();
  103. }
  104. private void Config_Click(object sender, EventArgs e)
  105. {
  106. this.ActiveControl = label4;
  107. }
  108. private void Fullscreen_pb_Click(object sender, EventArgs e)
  109. {
  110. Settings.FullScreen = !Settings.FullScreen;
  111. Fullscreen_pb.Image = Settings.FullScreen
  112. ? Client.Resources.Images.Config_Check_On
  113. : Client.Resources.Images.Config_Check_Off1;
  114. }
  115. private void FPScap_pb_Click(object sender, EventArgs e)
  116. {
  117. Settings.FPSCap = !Settings.FPSCap;
  118. FPScap_pb.Image = Settings.FPSCap
  119. ? Client.Resources.Images.Config_Check_On
  120. : Client.Resources.Images.Config_Check_Off1;
  121. }
  122. private void OnTop_pb_Click(object sender, EventArgs e)
  123. {
  124. Settings.TopMost = !Settings.TopMost;
  125. OnTop_pb.Image = Settings.TopMost
  126. ? Client.Resources.Images.Config_Check_On
  127. : Client.Resources.Images.Config_Check_Off1;
  128. }
  129. private void AutoStart_pb_Click(object sender, EventArgs e)
  130. {
  131. Settings.P_AutoStart = !Settings.P_AutoStart;
  132. AutoStart_pb.Image = Settings.P_AutoStart
  133. ? Client.Resources.Images.Config_Check_On
  134. : Client.Resources.Images.Config_Check_Off1;
  135. }
  136. private void CleanFiles_pb_MouseDown(object sender, MouseEventArgs e)
  137. {
  138. CleanFiles_pb.Image = Client.Resources.Images.CheckF_Pressed;
  139. }
  140. private void CleanFiles_pb_MouseUp(object sender, MouseEventArgs e)
  141. {
  142. CleanFiles_pb.Image = Client.Resources.Images.CheckF_Base2;
  143. }
  144. private void CleanFiles_pb_MouseEnter(object sender, EventArgs e)
  145. {
  146. CleanFiles_pb.Image = Client.Resources.Images.CheckF_Hover;
  147. }
  148. private void CleanFiles_pb_MouseLeave(object sender, EventArgs e)
  149. {
  150. CleanFiles_pb.Image = Client.Resources.Images.CheckF_Base2;
  151. }
  152. private void CleanFiles_pb_Click(object sender, EventArgs e)
  153. {
  154. if (!Program.PForm.Launch_pb.Enabled) return;
  155. Program.PForm.Completed = false;
  156. Program.PForm.InterfaceTimer.Enabled = true;
  157. Program.PForm.CleanFiles = true;
  158. Program.PForm._workThread = new Thread(Program.PForm.Start) { IsBackground = true };
  159. Program.PForm._workThread.Start();
  160. }
  161. private void Res4_pb_Click(object sender, EventArgs e)
  162. {
  163. resolutionChoice(eSupportedResolution.w1280h720);
  164. }
  165. private void Res5_pb_Click(object sender, EventArgs e)
  166. {
  167. resolutionChoice(eSupportedResolution.w1920h1080);
  168. }
  169. private void DrawSupportedResolutions()
  170. {
  171. Res2_pb.Enabled = false;
  172. label2.ForeColor = Color.Red;
  173. Res4_pb.Enabled = false;
  174. label5.ForeColor = Color.Red;
  175. Res3_pb.Enabled = false;
  176. label3.ForeColor = Color.Red;
  177. Res5_pb.Enabled = false;
  178. label1.ForeColor = Color.Red;
  179. foreach (eSupportedResolution supportedResolution in DisplayResolutions.DisplaySupportedResolutions)
  180. {
  181. switch (supportedResolution)
  182. {
  183. case (eSupportedResolution.w1024h768):
  184. Res2_pb.Enabled = true;
  185. label2.ForeColor = Color.Gray;
  186. break;
  187. case (eSupportedResolution.w1280h720):
  188. Res4_pb.Enabled = true;
  189. label5.ForeColor = Color.Gray;
  190. break;
  191. case (eSupportedResolution.w1366h768):
  192. Res3_pb.Enabled = true;
  193. label3.ForeColor = Color.Gray;
  194. break;
  195. case (eSupportedResolution.w1920h1080):
  196. Res5_pb.Enabled = true;
  197. label1.ForeColor = Color.Gray;
  198. break;
  199. }
  200. }
  201. }
  202. }
  203. }