You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

MainWindow.xaml.cs 6.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. using System.Diagnostics;
  16. // 留意初始化
  17. // 目前MainWindow还未复现的功能:
  18. // private void ReactToCommandline(),
  19. // private void Playback(string fileName, double pbSpeed = 2.0)
  20. // 绘图函数private void DrawLaser(Point source, double theta, double range,double Width)//三个参数分别为攻击者的位置,攻击方位角(窗口坐标)和攻击半径
  21. // private void DrawProp(MessageToClient.Types.GameObjMessage data, string text),
  22. // private void Attack(object sender,RoutedEventArgs e)
  23. // 地图相关private void ZoomMap(),private void DrawMap()
  24. // 交互:private void ClickToSetMode(object sender, RoutedEventArgs e)
  25. // 最近要解决private void ConnectToServer(string[] comInfo)
  26. // private void KeyBoardControl(object sender, KeyEventArgs e)
  27. // private void GetMap(MessageToClient.Types.GameObjMessage obj)
  28. // private void OnReceive()
  29. // private bool CanSee(MessageOfCharacter msg) (以及两个重载函数)
  30. // private void Refresh(object? sender, EventArgs e)
  31. // private void Bonus()
  32. namespace Client
  33. {
  34. /// <summary>
  35. /// Interaction logic for MainWindow.xaml
  36. /// </summary>
  37. public partial class MainWindow : Window
  38. {
  39. public MainWindow()
  40. {
  41. InitializeComponent();
  42. SetStatusBar();
  43. isClientStocked = true;
  44. isPlaybackMode = false;
  45. WindowStartupLocation = WindowStartupLocation.CenterScreen;
  46. }
  47. private void SetStatusBar()
  48. {
  49. StatusBarsOfSurvivor = new StatusBarOfSurvivor[4];
  50. StatusBarsOfHunter = new StatusBarOfHunter(MainGrid, 3, 0);
  51. StatusBarsOfCircumstance = new StatusBarOfCircumstance(MainGrid, 1, 0);
  52. for (int i = 4; i < 8; i++)
  53. {
  54. StatusBarsOfSurvivor[i - 4] = new(MainGrid, i / 2 + 2, i % 2);
  55. }
  56. }
  57. // 连接Server
  58. private void ConnectToServer(string[] comInfo)
  59. {
  60. }
  61. // 之后需要修改,现在只具有修改按钮形状的功能,并不能实现暂停/继续
  62. private void ClickToPauseOrContinue(object sender, RoutedEventArgs e)
  63. {
  64. if (!isClientStocked)
  65. {
  66. isClientStocked = true;
  67. PorC.Content = "▶";
  68. }
  69. else
  70. {
  71. isClientStocked = false;
  72. PorC.Content = "⏸";
  73. }
  74. }
  75. // 未复现
  76. private void ClickToConnect(object sender, RoutedEventArgs e)
  77. {
  78. }
  79. // 窗口最大化、关闭、最小化、拖拽
  80. private void ClickToMaxmize(object sender, RoutedEventArgs e)
  81. {
  82. if (WindowState != WindowState.Maximized)
  83. WindowState = WindowState.Maximized;
  84. else
  85. WindowState = WindowState.Normal;
  86. }
  87. private void ClickToClose(object sender, RoutedEventArgs e)
  88. {
  89. Application.Current.Shutdown();
  90. }
  91. private void ClickToMinimize(object sender, RoutedEventArgs e)
  92. {
  93. WindowState = WindowState.Minimized;
  94. }
  95. private void DragWindow(object sender, RoutedEventArgs e)
  96. {
  97. DragMove();
  98. }
  99. // 寻求帮助、访问EESAST(部分功能未复原)
  100. private void ClickForHelp(object sender, RoutedEventArgs e)
  101. {
  102. PleaseWait();
  103. }
  104. private void ClickToVisitEESAST(object sender, RoutedEventArgs e)
  105. {
  106. try
  107. {
  108. _ = Process.Start("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe", "https://eesast.com");
  109. }
  110. catch (Exception exc)
  111. {
  112. // ErrorDisplayer error = new("发生错误。以下是系统报告\n" + exc.ToString());
  113. // error.Show();
  114. }
  115. }
  116. // 配置连接(未复原)、我的AI(THUAI5未实现)、获取更新、天梯信息(可能需要网站协助)
  117. private void ClickToSetConnect(object sender, RoutedEventArgs e)
  118. {
  119. // ConnectRegister crg = new();
  120. // crg.Show();
  121. }
  122. private void ClickToEnterVS(object sender, RoutedEventArgs e)
  123. {
  124. // try
  125. //{
  126. // if (!File.Exists("VSRoute.txt"))
  127. // {
  128. // File.Create("VSRoute.txt");
  129. // Exception ex = new("没有路径存储文件,已为您创建。请将VS路径输入该文件,并重新操作。");
  130. // throw ex;
  131. // }//创建路径文件
  132. // using StreamReader sr = new("VSRoute.txt");
  133. // _ = Process.Start(sr.ReadLine());
  134. // }
  135. // catch (Exception exc)
  136. //{
  137. // ErrorDisplayer error = new("发生错误。以下是系统报告:\n" + exc.ToString());
  138. // error.Show();
  139. // }
  140. PleaseWait();
  141. }
  142. private void ClickForUpdate(object sender, RoutedEventArgs e)
  143. {
  144. PleaseWait();
  145. }
  146. private void ClickToCheckLadder(object sender, RoutedEventArgs e)
  147. {
  148. PleaseWait();
  149. }
  150. // 敬请期待函数
  151. private void PleaseWait()
  152. {
  153. try
  154. {
  155. throw new Exception("敬请期待");
  156. }
  157. catch (Exception exc)
  158. {
  159. // ErrorDisplayer error = new(exc.Message);
  160. // error.Show();
  161. }
  162. }
  163. private StatusBarOfSurvivor[] StatusBarsOfSurvivor;
  164. private StatusBarOfHunter StatusBarsOfHunter;
  165. private StatusBarOfCircumstance StatusBarsOfCircumstance;
  166. private bool isClientStocked;
  167. private bool isPlaybackMode;
  168. private long playerID;
  169. private long teamID;
  170. }
  171. }