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 71 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386
  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. using System.Windows.Threading;
  17. using Grpc.Core;
  18. using Protobuf;
  19. using Playback;
  20. using CommandLine;
  21. using Preparation.Utility;
  22. // 目前MainWindow还未复现的功能:
  23. // private void ClickToSetMode(object sender, RoutedEventArgs e)
  24. // private void Bonus()
  25. namespace Client
  26. {
  27. /// <summary>
  28. /// Interaction logic for MainWindow.xaml
  29. /// </summary>
  30. public partial class MainWindow : Window
  31. {
  32. public MainWindow()
  33. {
  34. unitHeight = unitWidth = unit = 13;
  35. bonusflag = true;
  36. timer = new DispatcherTimer
  37. {
  38. Interval = new TimeSpan(50000) // 每50ms刷新一次
  39. };
  40. timer.Tick += new EventHandler(Refresh); // 定时器初始化
  41. InitializeComponent();
  42. timer.Start();
  43. SetStatusBar();
  44. isClientStocked = true;
  45. isPlaybackMode = false;
  46. isSpectatorMode = false;
  47. drawPicLock = new();
  48. listOfProp = new List<MessageOfProp>();
  49. listOfHuman = new List<MessageOfStudent>();
  50. listOfButcher = new List<MessageOfTricker>();
  51. listOfBullet = new List<MessageOfBullet>();
  52. listOfBombedBullet = new List<MessageOfBombedBullet>();
  53. listOfAll = new List<MessageOfAll>();
  54. listOfChest = new List<MessageOfChest>();
  55. listOfClassroom = new List<MessageOfClassroom>();
  56. listOfDoor = new List<MessageOfDoor>();
  57. listOfGate = new List<MessageOfGate>();
  58. listOfHiddenGate = new List<MessageOfHiddenGate>();
  59. WindowStartupLocation = WindowStartupLocation.CenterScreen;
  60. ReactToCommandline();
  61. }
  62. private void SetStatusBar()
  63. {
  64. StatusBarsOfSurvivor = new StatusBarOfSurvivor[4];
  65. StatusBarsOfHunter = new StatusBarOfHunter(MainGrid, 3, 0);
  66. StatusBarsOfCircumstance = new StatusBarOfCircumstance(MainGrid, 1, 0);
  67. for (int i = 4; i < 8; i++)
  68. {
  69. StatusBarsOfSurvivor[i - 4] = new(MainGrid, i / 2 + 2, i % 2);
  70. }
  71. }
  72. // 获得地图信息,未更新数值
  73. private void GetMap(MessageOfMap obj)
  74. {
  75. int[,] map = new int[50, 50];
  76. try
  77. {
  78. for (int i = 0; i < 50; i++)
  79. {
  80. for (int j = 0; j < 50; j++)
  81. {
  82. map[i, j] = Convert.ToInt32(obj.Row[i].Col[j]) + 4;//与proto一致
  83. }
  84. }
  85. }
  86. catch
  87. {
  88. mapFlag = false;
  89. }
  90. finally
  91. {
  92. defaultMap = map;
  93. mapFlag = true;
  94. }
  95. }
  96. private void ReactToCommandline()
  97. {
  98. string[] args = Environment.GetCommandLineArgs();
  99. if (args.Length == 2)
  100. {
  101. Playback(args[1]);
  102. return;
  103. }
  104. _ = Parser.Default.ParseArguments<ArgumentOptions>(args).WithParsed(o =>
  105. { options = o; });
  106. if ((args.Length == 3 || args.Length == 4) && options != null && Convert.ToInt64(options.PlayerID) > 2023)
  107. {
  108. isSpectatorMode = true;
  109. string[] comInfo = new string[3];
  110. comInfo[0] = options.Ip;
  111. comInfo[1] = options.Port;
  112. comInfo[2] = options.PlayerID;
  113. ConnectToServer(comInfo);
  114. OnReceive();
  115. return;
  116. }
  117. if (options == null || options.cl == false)
  118. {
  119. OnReceive();
  120. }
  121. else
  122. {
  123. if (options.PlaybackFile == DefaultArgumentOptions.FileName)
  124. {
  125. try
  126. {
  127. string[] comInfo = new string[5];
  128. comInfo[0] = options.Ip;
  129. comInfo[1] = options.Port;
  130. comInfo[2] = options.PlayerID;
  131. comInfo[3] = options.PlayerType;
  132. comInfo[4] = options.Occupation;
  133. ConnectToServer(comInfo);
  134. OnReceive();
  135. }
  136. catch
  137. {
  138. OnReceive();
  139. }
  140. }
  141. else
  142. {
  143. Playback(options.PlaybackFile, options.PlaybackSpeed);
  144. }
  145. }
  146. }
  147. private void Playback(string fileName, double pbSpeed = 2.0)
  148. {
  149. var pbClient = new PlaybackClient(fileName, pbSpeed);
  150. int[,]? map;
  151. if ((map = pbClient.ReadDataFromFile(listOfProp, listOfHuman, listOfButcher, listOfBullet, listOfBombedBullet, listOfAll, listOfChest, listOfClassroom, listOfDoor, listOfHiddenGate, listOfGate, drawPicLock)) != null)
  152. {
  153. isClientStocked = false;
  154. isPlaybackMode = true;
  155. defaultMap = map;
  156. mapFlag = true;
  157. }
  158. else
  159. {
  160. MessageBox.Show("Failed to read the playback file!");
  161. isClientStocked = true;
  162. }
  163. }
  164. // 连接Server,comInfo[]的格式:0-ip 1- port 2-playerID 3-human/TrickerType 4-occupation
  165. private void ConnectToServer(string[] comInfo)
  166. {
  167. if (!isPlaybackMode)
  168. {
  169. if (!isSpectatorMode && comInfo.Length != 5 || isSpectatorMode && comInfo.Length != 3)
  170. throw new Exception("注册信息有误!");
  171. playerID = Convert.ToInt64(comInfo[2]);
  172. Connect.Background = Brushes.Gray;
  173. string connect = new string(comInfo[0]);
  174. connect += ':';
  175. connect += comInfo[1];
  176. Channel channel = new Channel(connect, ChannelCredentials.Insecure);
  177. client = new AvailableService.AvailableServiceClient(channel);
  178. PlayerMsg playerMsg = new PlayerMsg();
  179. playerMsg.PlayerId = playerID;
  180. if (!isSpectatorMode)
  181. {
  182. playerType = Convert.ToInt64(comInfo[3]) switch
  183. {
  184. 0 => PlayerType.NullPlayerType,
  185. 1 => PlayerType.StudentPlayer,
  186. 2 => PlayerType.TrickerPlayer,
  187. };
  188. playerMsg.PlayerType = playerType;
  189. if (Convert.ToInt64(comInfo[3]) == 1)
  190. {
  191. humanOrButcher = true;
  192. }
  193. else if (Convert.ToInt64(comInfo[3]) == 2)
  194. {
  195. humanOrButcher = false;
  196. }
  197. if (playerType == PlayerType.StudentPlayer)
  198. {
  199. switch (Convert.ToInt64(comInfo[4]))
  200. {
  201. case 1:
  202. playerMsg.StudentType = StudentType.Athlete;
  203. break;
  204. case 2:
  205. playerMsg.StudentType = StudentType.Teacher;
  206. break;
  207. case 3:
  208. playerMsg.StudentType = StudentType.StraightAStudent;
  209. break;
  210. case 4:
  211. playerMsg.StudentType = StudentType.Robot;
  212. break;
  213. case 5:
  214. playerMsg.StudentType = StudentType.TechOtaku;
  215. break;
  216. case 0:
  217. default:
  218. playerMsg.StudentType = StudentType.NullStudentType;
  219. break;
  220. }
  221. }
  222. else if (playerType == PlayerType.TrickerPlayer)
  223. {
  224. switch (Convert.ToInt64(comInfo[4]))
  225. {
  226. case 1:
  227. playerMsg.TrickerType = TrickerType.Assassin;
  228. break;
  229. case 2:
  230. playerMsg.TrickerType = TrickerType.Klee;
  231. break;
  232. case 3:
  233. playerMsg.TrickerType = TrickerType.ANoisyPerson;
  234. break;
  235. case 4:
  236. playerMsg.TrickerType = TrickerType._4;
  237. break;
  238. case 0:
  239. default:
  240. playerMsg.TrickerType = TrickerType.NullTrickerType;
  241. break;
  242. }
  243. }
  244. }
  245. responseStream = client.AddPlayer(playerMsg);
  246. Connect.Background = Brushes.Transparent;
  247. isClientStocked = false;
  248. PorC.Content = "⏸";
  249. // 建立连接的同时加入人物
  250. }
  251. }
  252. // 绘制道具
  253. private void DrawProp(MessageOfProp data, string text)
  254. {
  255. TextBox icon = new()
  256. {
  257. FontSize = 10,
  258. Width = 20,
  259. Height = 20,
  260. Text = text,
  261. HorizontalAlignment = HorizontalAlignment.Left,
  262. VerticalAlignment = VerticalAlignment.Top,
  263. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  264. Background = Brushes.Transparent,
  265. BorderBrush = Brushes.Transparent,
  266. IsReadOnly = true
  267. };
  268. UpperLayerOfMap.Children.Add(icon);
  269. }
  270. private void ZoomMap()
  271. {
  272. for (int i = 0; i < 50; i++)
  273. {
  274. for (int j = 0; j < 50; j++)
  275. {
  276. if (mapPatches[i, j] != null)
  277. {
  278. mapPatches[i, j].Width = UpperLayerOfMap.ActualWidth / 50;
  279. mapPatches[i, j].Height = UpperLayerOfMap.ActualHeight / 50;
  280. mapPatches[i, j].HorizontalAlignment = HorizontalAlignment.Left;
  281. mapPatches[i, j].VerticalAlignment = VerticalAlignment.Top;
  282. mapPatches[i, j].Margin = new Thickness(UpperLayerOfMap.ActualWidth / 50 * j, UpperLayerOfMap.ActualHeight / 50 * i, 0, 0);
  283. }
  284. }
  285. }
  286. }
  287. private void DrawMap()
  288. {
  289. for (int i = 0; i < defaultMap.GetLength(0); i++)
  290. {
  291. for (int j = 0; j < defaultMap.GetLength(1); j++)
  292. {
  293. mapPatches[i, j] = new()
  294. {
  295. Width = unitWidth,
  296. Height = unitHeight,
  297. HorizontalAlignment = HorizontalAlignment.Left,
  298. VerticalAlignment = VerticalAlignment.Top,
  299. Margin = new Thickness(Width * (j), Height * (i), 0, 0)
  300. };
  301. switch (defaultMap[i, j])
  302. {
  303. case 6:
  304. mapPatches[i, j].Fill = Brushes.Brown;
  305. mapPatches[i, j].Stroke = Brushes.Brown;
  306. break;//wall
  307. case 7:
  308. mapPatches[i, j].Fill = Brushes.Green;
  309. mapPatches[i, j].Stroke = Brushes.Green;
  310. break;//grass
  311. case 8:
  312. mapPatches[i, j].Fill = Brushes.LightPink;
  313. mapPatches[i, j].Stroke = Brushes.LightPink;
  314. break;//machine
  315. case 9:
  316. mapPatches[i, j].Fill = Brushes.LightSkyBlue;
  317. mapPatches[i, j].Stroke = Brushes.LightSkyBlue;
  318. break;//gate
  319. case 10:
  320. break;//emergency
  321. case 11:
  322. mapPatches[i, j].Fill = Brushes.Gray;
  323. mapPatches[i, j].Stroke = Brushes.Gray;
  324. break;//window
  325. case 12:
  326. case 13:
  327. case 14:
  328. mapPatches[i, j].Fill = Brushes.Khaki;
  329. mapPatches[i, j].Stroke = Brushes.Khaki;
  330. break;//door
  331. case 15:
  332. mapPatches[i, j].Fill = Brushes.Orange;
  333. mapPatches[i, j].Stroke = Brushes.Orange;
  334. break;//chest
  335. default:
  336. break;
  337. }
  338. UnderLayerOfMap.Children.Add(mapPatches[i, j]);
  339. }
  340. }
  341. hasDrawed = true;
  342. }
  343. //三个参数分别为攻击者的位置,攻击方位角(窗口坐标)和攻击半径
  344. private void DrawLaser(Point source, double theta, double range, double Width) // 三个参数分别为攻击者的位置,攻击方位角(窗口坐标)和攻击半径
  345. {
  346. Point[] endPoint = new Point[4];
  347. Point target = new();
  348. target.X = source.X + range * Math.Cos(theta);
  349. target.Y = source.Y + range * Math.Sin(theta);
  350. endPoint[0].X = source.X + Width * Math.Cos(theta - Math.PI / 2);
  351. endPoint[0].Y = source.Y + Width * Math.Sin(theta - Math.PI / 2);
  352. endPoint[1].X = target.X + Width * Math.Cos(theta - Math.PI / 2);
  353. endPoint[1].Y = target.Y + Width * Math.Sin(theta - Math.PI / 2);
  354. endPoint[2].X = target.X + Width * Math.Cos(theta + Math.PI / 2);
  355. endPoint[2].Y = target.Y + Width * Math.Sin(theta + Math.PI / 2);
  356. endPoint[3].X = source.X + Width * Math.Cos(theta + Math.PI / 2);
  357. endPoint[3].Y = source.Y + Width * Math.Sin(theta + Math.PI / 2);
  358. Polygon laserIcon = new();
  359. laserIcon.Stroke = System.Windows.Media.Brushes.Red;
  360. laserIcon.Fill = System.Windows.Media.Brushes.Red;
  361. laserIcon.StrokeThickness = 2;
  362. laserIcon.HorizontalAlignment = HorizontalAlignment.Left;
  363. laserIcon.VerticalAlignment = VerticalAlignment.Top;
  364. PointCollection laserEndPoints = new();
  365. for (int i = 0; i < 4; i++)
  366. {
  367. laserEndPoints.Add(endPoint[i]);
  368. }
  369. laserIcon.Points = laserEndPoints;
  370. UpperLayerOfMap.Children.Add(laserIcon);
  371. }
  372. private async void OnReceive() // 已按照3.5版proto更新信息,但是左侧信息栏还未填充。log未更新,switch1,2,3更新log
  373. {
  374. try
  375. {
  376. while (responseStream != null && await responseStream.ResponseStream.MoveNext())
  377. {
  378. lock (drawPicLock) // 加锁是必要的,画图操作和接收信息操作不能同时进行,否则画图时foreach会有bug
  379. {
  380. listOfHuman.Clear();
  381. listOfButcher.Clear();
  382. listOfProp.Clear();
  383. listOfBombedBullet.Clear();
  384. listOfBullet.Clear();
  385. listOfAll.Clear();
  386. listOfChest.Clear();
  387. listOfClassroom.Clear();
  388. listOfDoor.Clear();
  389. listOfHiddenGate.Clear();
  390. listOfGate.Clear();
  391. MessageToClient content = responseStream.ResponseStream.Current;
  392. switch (content.GameState)
  393. {
  394. case GameState.GameStart:
  395. foreach (var obj in content.ObjMessage)
  396. {
  397. switch (obj.MessageOfObjCase)
  398. {
  399. case MessageOfObj.MessageOfObjOneofCase.StudentMessage:
  400. if (humanOrButcher && obj.StudentMessage.PlayerId == playerID)
  401. {
  402. human = obj.StudentMessage;
  403. if (human.TimeUntilSkillAvailable[0] >= 0)
  404. coolTime0 = human.TimeUntilSkillAvailable[0];
  405. if (human.TimeUntilSkillAvailable[1] >= 0)
  406. coolTime1 = human.TimeUntilSkillAvailable[1];
  407. if (human.TimeUntilSkillAvailable[2] >= 0)
  408. coolTime2 = human.TimeUntilSkillAvailable[2];
  409. }
  410. listOfHuman.Add(obj.StudentMessage);
  411. break;
  412. case MessageOfObj.MessageOfObjOneofCase.TrickerMessage:
  413. if (!humanOrButcher && obj.TrickerMessage.PlayerId == playerID)
  414. {
  415. butcher = obj.TrickerMessage;
  416. if (butcher.TimeUntilSkillAvailable[0] >= 0)
  417. coolTime0 = butcher.TimeUntilSkillAvailable[0];
  418. if (butcher.TimeUntilSkillAvailable[1] >= 0)
  419. coolTime1 = butcher.TimeUntilSkillAvailable[1];
  420. if (butcher.TimeUntilSkillAvailable[2] >= 0)
  421. coolTime2 = butcher.TimeUntilSkillAvailable[2];
  422. }
  423. listOfButcher.Add(obj.TrickerMessage);
  424. break;
  425. case MessageOfObj.MessageOfObjOneofCase.PropMessage:
  426. listOfProp.Add(obj.PropMessage);
  427. break;
  428. case MessageOfObj.MessageOfObjOneofCase.BombedBulletMessage:
  429. listOfBombedBullet.Add(obj.BombedBulletMessage);
  430. break;
  431. case MessageOfObj.MessageOfObjOneofCase.BulletMessage:
  432. listOfBullet.Add(obj.BulletMessage);
  433. break;
  434. case MessageOfObj.MessageOfObjOneofCase.ChestMessage:
  435. listOfChest.Add(obj.ChestMessage);
  436. break;
  437. case MessageOfObj.MessageOfObjOneofCase.ClassroomMessage:
  438. listOfClassroom.Add(obj.ClassroomMessage);
  439. break;
  440. case MessageOfObj.MessageOfObjOneofCase.DoorMessage:
  441. listOfDoor.Add(obj.DoorMessage);
  442. break;
  443. case MessageOfObj.MessageOfObjOneofCase.GateMessage:
  444. listOfGate.Add(obj.GateMessage);
  445. break;
  446. case MessageOfObj.MessageOfObjOneofCase.MapMessage:
  447. GetMap(obj.MapMessage);
  448. break;
  449. }
  450. }
  451. listOfAll.Add(content.AllMessage);
  452. break;
  453. case GameState.GameRunning:
  454. foreach (var obj in content.ObjMessage)
  455. {
  456. switch (obj.MessageOfObjCase)
  457. {
  458. case MessageOfObj.MessageOfObjOneofCase.StudentMessage:
  459. if (humanOrButcher && obj.StudentMessage.PlayerId == playerID)
  460. {
  461. human = obj.StudentMessage;
  462. }
  463. listOfHuman.Add(obj.StudentMessage);
  464. break;
  465. case MessageOfObj.MessageOfObjOneofCase.TrickerMessage:
  466. if (!humanOrButcher && obj.TrickerMessage.PlayerId == playerID)
  467. {
  468. butcher = obj.TrickerMessage;
  469. }
  470. listOfButcher.Add(obj.TrickerMessage);
  471. break;
  472. case MessageOfObj.MessageOfObjOneofCase.PropMessage:
  473. listOfProp.Add(obj.PropMessage);
  474. break;
  475. case MessageOfObj.MessageOfObjOneofCase.BombedBulletMessage:
  476. listOfBombedBullet.Add(obj.BombedBulletMessage);
  477. break;
  478. case MessageOfObj.MessageOfObjOneofCase.BulletMessage:
  479. listOfBullet.Add(obj.BulletMessage);
  480. break;
  481. case MessageOfObj.MessageOfObjOneofCase.ChestMessage:
  482. listOfChest.Add(obj.ChestMessage);
  483. break;
  484. case MessageOfObj.MessageOfObjOneofCase.ClassroomMessage:
  485. listOfClassroom.Add(obj.ClassroomMessage);
  486. break;
  487. case MessageOfObj.MessageOfObjOneofCase.DoorMessage:
  488. listOfDoor.Add(obj.DoorMessage);
  489. break;
  490. case MessageOfObj.MessageOfObjOneofCase.GateMessage:
  491. listOfGate.Add(obj.GateMessage);
  492. break;
  493. case MessageOfObj.MessageOfObjOneofCase.HiddenGateMessage:
  494. listOfHiddenGate.Add(obj.HiddenGateMessage);
  495. break;
  496. }
  497. }
  498. listOfAll.Add(content.AllMessage);
  499. break;
  500. case GameState.GameEnd:
  501. foreach (var obj in content.ObjMessage)
  502. {
  503. switch (obj.MessageOfObjCase)
  504. {
  505. case MessageOfObj.MessageOfObjOneofCase.StudentMessage:
  506. listOfHuman.Add(obj.StudentMessage);
  507. break;
  508. case MessageOfObj.MessageOfObjOneofCase.TrickerMessage:
  509. listOfButcher.Add(obj.TrickerMessage);
  510. break;
  511. case MessageOfObj.MessageOfObjOneofCase.PropMessage:
  512. listOfProp.Add(obj.PropMessage);
  513. break;
  514. case MessageOfObj.MessageOfObjOneofCase.BombedBulletMessage:
  515. listOfBombedBullet.Add(obj.BombedBulletMessage);
  516. break;
  517. case MessageOfObj.MessageOfObjOneofCase.BulletMessage:
  518. listOfBullet.Add(obj.BulletMessage);
  519. break;
  520. case MessageOfObj.MessageOfObjOneofCase.ChestMessage:
  521. listOfChest.Add(obj.ChestMessage);
  522. break;
  523. case MessageOfObj.MessageOfObjOneofCase.ClassroomMessage:
  524. listOfClassroom.Add(obj.ClassroomMessage);
  525. break;
  526. case MessageOfObj.MessageOfObjOneofCase.DoorMessage:
  527. listOfDoor.Add(obj.DoorMessage);
  528. break;
  529. case MessageOfObj.MessageOfObjOneofCase.GateMessage:
  530. listOfGate.Add(obj.GateMessage);
  531. break;
  532. case MessageOfObj.MessageOfObjOneofCase.HiddenGateMessage:
  533. listOfHiddenGate.Add(obj.HiddenGateMessage);
  534. break;
  535. }
  536. }
  537. listOfAll.Add(content.AllMessage);
  538. break;
  539. }
  540. }
  541. if (responseStream == null)
  542. {
  543. throw new Exception("Unconnected");
  544. }
  545. }
  546. }
  547. catch (Exception ex)
  548. {
  549. ErrorDisplayer error = new("Error: " + ex.ToString());
  550. error.Show();
  551. }
  552. }
  553. //待修改
  554. private bool CanSee(MessageOfStudent msg)
  555. {
  556. if (msg.PlayerState == PlayerState.Quit || msg.PlayerState == PlayerState.Graduated)
  557. return false;
  558. if (isSpectatorMode)
  559. return true;
  560. if (humanOrButcher && human != null)
  561. {
  562. if (human.Guid == msg.Guid) // 自己能看见自己
  563. return true;
  564. }
  565. if (msg.Place == Protobuf.PlaceType.Grass || msg.Place == Protobuf.PlaceType.Gate || msg.Place == Protobuf.PlaceType.HiddenGate)
  566. return false;
  567. if (msg.Place == Protobuf.PlaceType.Land || msg.Place == Protobuf.PlaceType.Classroom)
  568. return true;
  569. if (humanOrButcher && human != null)
  570. {
  571. if (msg.Place != human.Place)
  572. return false;
  573. }
  574. else if (!humanOrButcher && butcher != null)
  575. {
  576. if (msg.Place != butcher.Place)
  577. return false;
  578. }
  579. return true;
  580. }
  581. private bool CanSee(MessageOfTricker msg)
  582. {
  583. if (isSpectatorMode)
  584. return true;
  585. if (!humanOrButcher && butcher != null)
  586. {
  587. if (butcher.Guid == msg.Guid) // 自己能看见自己
  588. return true;
  589. }
  590. if (msg.Place == Protobuf.PlaceType.Grass || msg.Place == Protobuf.PlaceType.Gate || msg.Place == Protobuf.PlaceType.HiddenGate)
  591. return false;
  592. if (msg.Place == Protobuf.PlaceType.Land || msg.Place == Protobuf.PlaceType.Classroom)
  593. return true;
  594. if (humanOrButcher && human != null)
  595. {
  596. if (msg.Place != human.Place)
  597. return false;
  598. }
  599. else if (!humanOrButcher && butcher != null)
  600. {
  601. if (msg.Place != butcher.Place)
  602. return false;
  603. }
  604. return true;
  605. }
  606. private bool CanSee(MessageOfProp msg)
  607. {
  608. if (isSpectatorMode)
  609. return true;
  610. if (msg.Place == Protobuf.PlaceType.Land)
  611. return true;
  612. if (humanOrButcher && human != null)
  613. {
  614. if (msg.Place != human.Place)
  615. return false;
  616. }
  617. else if (!humanOrButcher && butcher != null)
  618. {
  619. if (msg.Place != butcher.Place)
  620. return false;
  621. }
  622. return true;
  623. }
  624. private bool CanSee(MessageOfBullet msg)
  625. {
  626. if (isSpectatorMode)
  627. return true;
  628. if (msg.Place == Protobuf.PlaceType.Land)
  629. return true;
  630. if (humanOrButcher && human != null)
  631. {
  632. if (msg.Place != human.Place)
  633. return false;
  634. }
  635. else if (!humanOrButcher && butcher != null)
  636. {
  637. if (msg.Place != butcher.Place)
  638. return false;
  639. }
  640. return true;
  641. }
  642. private void Refresh(object? sender, EventArgs e) // 已按照3.5版proto更新信息,circumstance栏未更新 log未更新
  643. {
  644. // Bonus();
  645. if (WindowState == WindowState.Maximized)
  646. MaxButton.Content = "❐";
  647. else
  648. MaxButton.Content = "🗖";
  649. if (StatusBarsOfSurvivor != null)
  650. for (int i = 4; i < 8; i++)
  651. {
  652. StatusBarsOfSurvivor[i - 4].SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
  653. }
  654. if (StatusBarsOfHunter != null)
  655. StatusBarsOfHunter.SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
  656. if (StatusBarsOfCircumstance != null)
  657. StatusBarsOfCircumstance.SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
  658. // 完成窗口信息更新
  659. if (!isClientStocked)
  660. {
  661. unit = Math.Sqrt(UpperLayerOfMap.ActualHeight * UpperLayerOfMap.ActualWidth) / 50;
  662. unitHeight = UpperLayerOfMap.ActualHeight / 50;
  663. unitWidth = UpperLayerOfMap.ActualWidth / 50;
  664. try
  665. {
  666. // if (log != null)
  667. //{
  668. // string temp = "";
  669. // for (int i = 0; i < dataDict[GameObjType.Character].Count; i++)
  670. // {
  671. // temp += Convert.ToString(dataDict[GameObjType.Character][i].MessageOfCharacter.TeamID) + "\n";
  672. // }
  673. // log.Content = temp;
  674. // }
  675. UpperLayerOfMap.Children.Clear();
  676. // if ((communicator == null || !communicator.Client.IsConnected) && !isPlaybackMode)
  677. //{
  678. // UnderLayerOfMap.Children.Clear();
  679. // throw new Exception("Client is unconnected.");
  680. // }
  681. // else
  682. //{
  683. lock (drawPicLock) // 加锁是必要的,画图操作和接收信息操作不能同时进行
  684. {
  685. foreach (var data in listOfAll)
  686. {
  687. StatusBarsOfCircumstance.SetValue(data, gateOpened, isEmergencyDrawed, isEmergencyOpened);
  688. }
  689. if (!hasDrawed && mapFlag)
  690. DrawMap();
  691. foreach (var data in listOfHuman)
  692. {
  693. StatusBarsOfSurvivor[data.PlayerId].SetValue(data, coolTime0, coolTime1, coolTime2);
  694. if (CanSee(data))
  695. {
  696. Ellipse icon = new()
  697. {
  698. Width = 2 * radiusTimes * unitWidth,
  699. Height = 2 * radiusTimes * unitHeight,
  700. HorizontalAlignment = HorizontalAlignment.Left,
  701. VerticalAlignment = VerticalAlignment.Top,
  702. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * radiusTimes, data.X * unitHeight / 1000.0 - unitHeight * radiusTimes, 0, 0),
  703. Fill = Brushes.BlueViolet,
  704. };
  705. UpperLayerOfMap.Children.Add(icon);
  706. }
  707. }
  708. foreach (var data in listOfButcher)
  709. {
  710. StatusBarsOfHunter.SetValue(data, coolTime0, coolTime1, coolTime2);
  711. if (CanSee(data))
  712. {
  713. Ellipse icon = new()
  714. {
  715. Width = 2 * radiusTimes * unitWidth,
  716. Height = 2 * radiusTimes * unitHeight,
  717. HorizontalAlignment = HorizontalAlignment.Left,
  718. VerticalAlignment = VerticalAlignment.Top,
  719. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * radiusTimes, data.X * unitHeight / 1000.0 - unitHeight * radiusTimes, 0, 0),
  720. Fill = Brushes.Chocolate,
  721. };
  722. UpperLayerOfMap.Children.Add(icon);
  723. }
  724. }
  725. foreach (var data in listOfProp)
  726. {
  727. if (CanSee(data))
  728. {
  729. switch (data.Type)
  730. {
  731. case Protobuf.PropType.Key3:
  732. DrawProp(data, "🔑");
  733. break;
  734. case Protobuf.PropType.Key5:
  735. DrawProp(data, "🔑");
  736. break;
  737. case Protobuf.PropType.Key6:
  738. DrawProp(data, "🔑");
  739. break;
  740. case Protobuf.PropType.AddSpeed:
  741. DrawProp(data, "⛸");
  742. break;
  743. case Protobuf.PropType.AddHpOrAp:
  744. DrawProp(data, "♥");
  745. break;
  746. case Protobuf.PropType.AddLifeOrClairaudience:
  747. DrawProp(data, "🏅");
  748. break;
  749. case Protobuf.PropType.ShieldOrSpear:
  750. DrawProp(data, "🛡");
  751. break;
  752. case Protobuf.PropType.RecoveryFromDizziness:
  753. DrawProp(data, "🕶");
  754. break;
  755. default:
  756. DrawProp(data, "");
  757. break;
  758. }
  759. }
  760. }
  761. foreach (var data in listOfBullet)
  762. {
  763. if (CanSee(data))
  764. {
  765. Ellipse icon = new()
  766. {
  767. Width = 10,
  768. Height = 10,
  769. HorizontalAlignment = HorizontalAlignment.Left,
  770. VerticalAlignment = VerticalAlignment.Top,
  771. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  772. Fill = Brushes.Red,
  773. };
  774. switch (data.Type)
  775. {
  776. case Protobuf.BulletType.FlyingKnife:
  777. icon.Fill = Brushes.Blue;
  778. break;
  779. case Protobuf.BulletType.CommonAttackOfTricker:
  780. case Protobuf.BulletType.BombBomb:
  781. case Protobuf.BulletType.JumpyDumpty:
  782. icon.Fill = Brushes.Red;
  783. break;
  784. default:
  785. break;
  786. }
  787. UpperLayerOfMap.Children.Add(icon);
  788. }
  789. }
  790. foreach (var data in listOfBombedBullet)
  791. {
  792. switch (data.Type)
  793. {
  794. case Protobuf.BulletType.BombBomb:
  795. {
  796. Ellipse icon = new();
  797. double bombRange = data.BombRange / 1000;
  798. icon.Width = bombRange * unitWidth;
  799. icon.Height = bombRange * unitHeight;
  800. icon.HorizontalAlignment = HorizontalAlignment.Left;
  801. icon.VerticalAlignment = VerticalAlignment.Top;
  802. icon.Margin = new Thickness(data.Y * unitWidth / 1000.0 - bombRange * unitWidth / 2, data.X * unitHeight / 1000.0 - bombRange * unitHeight / 2, 0, 0);
  803. icon.Fill = Brushes.Red;
  804. UpperLayerOfMap.Children.Add(icon);
  805. break;
  806. }
  807. case Protobuf.BulletType.JumpyDumpty:
  808. {
  809. Ellipse icon = new Ellipse();
  810. double bombRange = data.BombRange / 1000;
  811. icon.Width = bombRange * unitWidth;
  812. icon.Height = bombRange * unitHeight;
  813. icon.HorizontalAlignment = HorizontalAlignment.Left;
  814. icon.VerticalAlignment = VerticalAlignment.Top;
  815. icon.Margin = new Thickness(data.Y * unitWidth / 1000.0 - bombRange * unitWidth / 2, data.X * unitHeight / 1000.0 - bombRange * unitHeight / 2, 0, 0);
  816. icon.Fill = Brushes.Red;
  817. UpperLayerOfMap.Children.Add(icon);
  818. break;
  819. }
  820. //case Protobuf.BulletType.LineBullet:
  821. // {
  822. // double bombRange = data.BombRange / 1000;
  823. // DrawLaser(new Point(data.Y * unitWidth / 1000.0, data.X * unitHeight / 1000.0), -data.FacingDirection + Math.PI / 2, bombRange * unitHeight, 0.5 * unitWidth);
  824. // break;
  825. // }
  826. default:
  827. break;
  828. }
  829. }
  830. foreach (var data in listOfClassroom)
  831. {
  832. int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfFixedGenerator);
  833. TextBox icon = new()
  834. {
  835. FontSize = 8 * UpperLayerOfMap.ActualHeight / 650,
  836. Width = unitWidth,
  837. Height = unitHeight,
  838. Text = Convert.ToString(deg),
  839. HorizontalAlignment = HorizontalAlignment.Left,
  840. VerticalAlignment = VerticalAlignment.Top,
  841. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  842. Background = Brushes.Transparent,
  843. BorderBrush = Brushes.Transparent,
  844. IsReadOnly = true
  845. };
  846. if (deg == 100)
  847. {
  848. icon.Text = "A+";
  849. }
  850. UpperLayerOfMap.Children.Add(icon);
  851. }
  852. foreach (var data in listOfChest)
  853. {
  854. int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfOpenedChest);
  855. TextBox icon = new()
  856. {
  857. FontSize = 8 * UpperLayerOfMap.ActualHeight / 650,
  858. Width = unitWidth,
  859. Height = unitHeight,
  860. Text = Convert.ToString(deg),
  861. HorizontalAlignment = HorizontalAlignment.Left,
  862. VerticalAlignment = VerticalAlignment.Top,
  863. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  864. Background = Brushes.Transparent,
  865. BorderBrush = Brushes.Transparent,
  866. IsReadOnly = true
  867. };
  868. if (deg == 100)
  869. {
  870. icon.Text = "Ø";
  871. }
  872. UpperLayerOfMap.Children.Add(icon);
  873. }
  874. foreach (var data in listOfGate)
  875. {
  876. int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfOpenedDoorway);
  877. TextBox icon = new()
  878. {
  879. FontSize = 8 * UpperLayerOfMap.ActualHeight / 650,
  880. Width = unitWidth,
  881. Height = unitHeight,
  882. Text = Convert.ToString(deg),
  883. HorizontalAlignment = HorizontalAlignment.Left,
  884. VerticalAlignment = VerticalAlignment.Top,
  885. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  886. Background = Brushes.Transparent,
  887. BorderBrush = Brushes.Transparent,
  888. IsReadOnly = true
  889. };
  890. if (deg == 100)
  891. {
  892. gateOpened = true;
  893. icon.Text = "🔓";
  894. }
  895. UpperLayerOfMap.Children.Add(icon);
  896. }
  897. foreach (var data in listOfDoor)
  898. {
  899. TextBox icon = new()
  900. {
  901. FontSize = 9 * UpperLayerOfMap.ActualHeight / 650,
  902. Width = unitWidth,
  903. Height = unitHeight,
  904. HorizontalAlignment = HorizontalAlignment.Left,
  905. VerticalAlignment = VerticalAlignment.Top,
  906. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  907. Background = Brushes.Transparent,
  908. BorderBrush = Brushes.Transparent,
  909. IsReadOnly = true
  910. };
  911. if (data.IsOpen)
  912. {
  913. icon.Text = Convert.ToString("🔓");
  914. }
  915. else
  916. {
  917. icon.Text = Convert.ToString("🔒");
  918. }
  919. UpperLayerOfMap.Children.Add(icon);
  920. }
  921. foreach (var data in listOfHiddenGate)
  922. {
  923. if (!isEmergencyDrawed)
  924. {
  925. mapPatches[data.X / Preparation.Utility.GameData.numOfPosGridPerCell, data.Y / Preparation.Utility.GameData.numOfPosGridPerCell].Fill = Brushes.LightSalmon;
  926. mapPatches[data.X / Preparation.Utility.GameData.numOfPosGridPerCell, data.Y / Preparation.Utility.GameData.numOfPosGridPerCell].Stroke = Brushes.LightSalmon;
  927. isEmergencyDrawed = true;
  928. }
  929. if (data.Opened && !isEmergencyOpened)
  930. {
  931. isEmergencyOpened = true;
  932. }
  933. }
  934. //}
  935. ZoomMap();
  936. }
  937. }
  938. catch (Exception exc)
  939. {
  940. ErrorDisplayer error = new("Error: " + exc.ToString());
  941. error.Show();
  942. isClientStocked = true;
  943. PorC.Content = "▶";
  944. }
  945. }
  946. counter++;
  947. }
  948. // 键盘控制,未完善
  949. private void KeyBoardControl(object sender, KeyEventArgs e)
  950. {
  951. if (!isPlaybackMode && !isSpectatorMode)
  952. {
  953. switch (e.Key)
  954. {
  955. case Key.W:
  956. case Key.NumPad8:
  957. MoveMsg msgW = new()
  958. {
  959. PlayerId = playerID,
  960. TimeInMilliseconds = 50,
  961. Angle = Math.PI
  962. };
  963. client.Move(msgW);
  964. break;
  965. case Key.S:
  966. case Key.NumPad2:
  967. MoveMsg msgS = new()
  968. {
  969. PlayerId = playerID,
  970. TimeInMilliseconds = 50,
  971. Angle = 0
  972. };
  973. client.Move(msgS);
  974. break;
  975. case Key.D:
  976. case Key.NumPad6:
  977. MoveMsg msgD = new()
  978. {
  979. PlayerId = playerID,
  980. TimeInMilliseconds = 50,
  981. Angle = Math.PI / 2
  982. };
  983. client.Move(msgD);
  984. break;
  985. case Key.A:
  986. case Key.NumPad4:
  987. MoveMsg msgA = new()
  988. {
  989. PlayerId = playerID,
  990. TimeInMilliseconds = 50,
  991. Angle = 3 * Math.PI / 2
  992. };
  993. client.Move(msgA);
  994. break;
  995. case Key.J:
  996. AttackMsg msgJ = new()
  997. {
  998. PlayerId = playerID,
  999. Angle = Math.PI
  1000. };
  1001. client.Attack(msgJ);
  1002. break;
  1003. case Key.K:
  1004. IDMsg msgK = new()
  1005. {
  1006. PlayerId = playerID,
  1007. };
  1008. client.StartLearning(msgK);
  1009. break;
  1010. case Key.R:
  1011. TreatAndRescueMsg msgR = new()
  1012. {
  1013. PlayerId = playerID,
  1014. ToPlayerId = -1,
  1015. };
  1016. client.StartRescueMate(msgR);
  1017. break;
  1018. case Key.T:
  1019. TreatAndRescueMsg msgT = new()
  1020. {
  1021. PlayerId = playerID,
  1022. ToPlayerId = -1,
  1023. };
  1024. client.StartTreatMate(msgT);
  1025. break;
  1026. case Key.G:
  1027. IDMsg msgG = new()
  1028. {
  1029. PlayerId = playerID,
  1030. };
  1031. client.Graduate(msgG);
  1032. break;
  1033. case Key.H:
  1034. IDMsg msgH = new()
  1035. {
  1036. PlayerId = playerID,
  1037. };
  1038. client.StartOpenGate(msgH);
  1039. break;
  1040. case Key.O:
  1041. IDMsg msgO = new()
  1042. {
  1043. PlayerId = playerID,
  1044. };
  1045. client.OpenDoor(msgO);
  1046. break;
  1047. case Key.P:
  1048. IDMsg msgP = new()
  1049. {
  1050. PlayerId = playerID,
  1051. };
  1052. client.CloseDoor(msgP);
  1053. break;
  1054. case Key.U:
  1055. IDMsg msgU = new()
  1056. {
  1057. PlayerId = playerID,
  1058. };
  1059. client.SkipWindow(msgU);
  1060. break;
  1061. case Key.I:
  1062. IDMsg msgI = new()
  1063. {
  1064. PlayerId = playerID,
  1065. };
  1066. client.StartOpenChest(msgI);
  1067. break;
  1068. case Key.E:
  1069. IDMsg msgE = new()
  1070. {
  1071. PlayerId = playerID,
  1072. };
  1073. client.EndAllAction(msgE);
  1074. break;
  1075. case Key.F:
  1076. PropMsg msgF = new()
  1077. {
  1078. PlayerId = playerID,
  1079. PropType = Protobuf.PropType.NullPropType,
  1080. };
  1081. client.PickProp(msgF);
  1082. break;
  1083. case Key.C:
  1084. PropMsg msgC = new()
  1085. {
  1086. PlayerId = playerID,
  1087. PropType = Protobuf.PropType.NullPropType,
  1088. };
  1089. client.ThrowProp(msgC);
  1090. break;
  1091. case Key.V:
  1092. PropMsg msgV = new()
  1093. {
  1094. PlayerId = playerID,
  1095. PropType = Protobuf.PropType.NullPropType,
  1096. };
  1097. client.UseProp(msgV);
  1098. break;
  1099. case Key.B:
  1100. SkillMsg msgB = new()
  1101. {
  1102. PlayerId = playerID,
  1103. SkillId = 0,
  1104. };
  1105. client.UseSkill(msgB);
  1106. break;
  1107. case Key.N:
  1108. SkillMsg msgN = new()
  1109. {
  1110. PlayerId = playerID,
  1111. SkillId = 1,
  1112. };
  1113. client.UseSkill(msgN);
  1114. break;
  1115. case Key.M:
  1116. SkillMsg msgM = new()
  1117. {
  1118. PlayerId = playerID,
  1119. SkillId = 2,
  1120. };
  1121. client.UseSkill(msgM);
  1122. break;
  1123. default:
  1124. break;
  1125. }
  1126. }
  1127. }
  1128. //鼠标双击
  1129. private void Attack(object sender, RoutedEventArgs e)
  1130. {
  1131. if (!isPlaybackMode && !isSpectatorMode)
  1132. {
  1133. if (humanOrButcher && human != null)
  1134. {
  1135. AttackMsg msgJ = new()
  1136. {
  1137. PlayerId = playerID
  1138. };
  1139. double mouseY = Mouse.GetPosition(UpperLayerOfMap).X * 1000 / unitWidth;
  1140. double mouseX = Mouse.GetPosition(UpperLayerOfMap).Y * 1000 / unitHeight;
  1141. msgJ.Angle = Math.Atan2(mouseY - human.Y, mouseX - human.X);
  1142. client.Attack(msgJ);
  1143. }
  1144. if (!humanOrButcher && butcher != null)
  1145. {
  1146. AttackMsg msgJ = new()
  1147. {
  1148. PlayerId = playerID
  1149. };
  1150. double mouseY = Mouse.GetPosition(UpperLayerOfMap).X * 1000 / unitWidth;
  1151. double mouseX = Mouse.GetPosition(UpperLayerOfMap).Y * 1000 / unitHeight;
  1152. msgJ.Angle = Math.Atan2(mouseY - butcher.Y, mouseX - butcher.X);
  1153. client.Attack(msgJ);
  1154. }
  1155. }
  1156. }
  1157. // 之后需要修改,现在只具有修改按钮形状的功能,并不能实现暂停/继续
  1158. private void ClickToPauseOrContinue(object sender, RoutedEventArgs e)
  1159. {
  1160. if (!isClientStocked)
  1161. {
  1162. isClientStocked = true;
  1163. PorC.Content = "▶";
  1164. }
  1165. else
  1166. {
  1167. isClientStocked = false;
  1168. PorC.Content = "⏸";
  1169. }
  1170. }
  1171. // 未复现
  1172. private void ClickToConnect(object sender, RoutedEventArgs e)
  1173. {
  1174. }
  1175. // 窗口最大化、关闭、最小化、拖拽
  1176. private void ClickToMaxmize(object sender, RoutedEventArgs e)
  1177. {
  1178. if (WindowState != WindowState.Maximized)
  1179. WindowState = WindowState.Maximized;
  1180. else
  1181. WindowState = WindowState.Normal;
  1182. }
  1183. private void ClickToClose(object sender, RoutedEventArgs e)
  1184. {
  1185. Application.Current.Shutdown();
  1186. }
  1187. private void ClickToMinimize(object sender, RoutedEventArgs e)
  1188. {
  1189. WindowState = WindowState.Minimized;
  1190. }
  1191. private void DragWindow(object sender, RoutedEventArgs e)
  1192. {
  1193. DragMove();
  1194. }
  1195. // 寻求帮助、访问EESAST(部分功能未复原)
  1196. private void ClickForHelp(object sender, RoutedEventArgs e)
  1197. {
  1198. PleaseWait();
  1199. }
  1200. private void ClickToVisitEESAST(object sender, RoutedEventArgs e)
  1201. {
  1202. try
  1203. {
  1204. _ = Process.Start("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe", "https://eesast.com");
  1205. }
  1206. catch (Exception)
  1207. {
  1208. //ErrorDisplayer error = new("发生错误。以下是系统报告\n" + exc.ToString());
  1209. //error.Show();
  1210. }
  1211. }
  1212. // 配置连接(未复原)、我的AI(THUAI5未实现)、获取更新、天梯信息(可能需要网站协助)
  1213. private void ClickToSetConnect(object sender, RoutedEventArgs e)
  1214. {
  1215. // ConnectRegister crg = new();
  1216. // crg.Show();
  1217. }
  1218. private void ClickToEnterVS(object sender, RoutedEventArgs e)
  1219. {
  1220. // try
  1221. //{
  1222. // if (!File.Exists("VSRoute.txt"))
  1223. // {
  1224. // File.Create("VSRoute.txt");
  1225. // Exception ex = new("没有路径存储文件,已为您创建。请将VS路径输入该文件,并重新操作。");
  1226. // throw ex;
  1227. // }//创建路径文件
  1228. // using StreamReader sr = new("VSRoute.txt");
  1229. // _ = Process.Start(sr.ReadLine());
  1230. // }
  1231. // catch (Exception exc)
  1232. //{
  1233. // ErrorDisplayer error = new("发生错误。以下是系统报告:\n" + exc.ToString());
  1234. // error.Show();
  1235. // }
  1236. PleaseWait();
  1237. }
  1238. private void ClickForUpdate(object sender, RoutedEventArgs e)
  1239. {
  1240. PleaseWait();
  1241. }
  1242. private void ClickToCheckLadder(object sender, RoutedEventArgs e)
  1243. {
  1244. PleaseWait();
  1245. }
  1246. // 敬请期待函数
  1247. private void PleaseWait()
  1248. {
  1249. try
  1250. {
  1251. throw new Exception("敬请期待");
  1252. }
  1253. catch (Exception)
  1254. {
  1255. //ErrorDisplayer error = new(exc.Message)
  1256. //error.Show()
  1257. }
  1258. }
  1259. // 以下为Mainwindow自定义属性
  1260. private readonly DispatcherTimer timer; // 定时器
  1261. private long counter; // 预留的取时间变量
  1262. AvailableService.AvailableServiceClient client;
  1263. AsyncServerStreamingCall<MessageToClient>? responseStream;
  1264. private StatusBarOfSurvivor[] StatusBarsOfSurvivor;
  1265. private StatusBarOfHunter StatusBarsOfHunter;
  1266. private StatusBarOfCircumstance StatusBarsOfCircumstance;
  1267. private bool isClientStocked;
  1268. private bool isPlaybackMode;
  1269. private long playerID;
  1270. private PlayerType playerType;
  1271. private double unit;
  1272. private double unitHeight;
  1273. private double unitWidth;
  1274. private readonly Rectangle[,] mapPatches = new Rectangle[50, 50];
  1275. private List<MessageOfProp> listOfProp;
  1276. private List<MessageOfStudent> listOfHuman;
  1277. private List<MessageOfTricker> listOfButcher;
  1278. private List<MessageOfBullet> listOfBullet;
  1279. private List<MessageOfBombedBullet> listOfBombedBullet;
  1280. private List<MessageOfAll> listOfAll;
  1281. private List<MessageOfChest> listOfChest;
  1282. private List<MessageOfClassroom> listOfClassroom;
  1283. private List<MessageOfDoor> listOfDoor;
  1284. private List<MessageOfGate> listOfGate;
  1285. private List<MessageOfHiddenGate> listOfHiddenGate;
  1286. private object drawPicLock = new object();
  1287. private MessageOfStudent? human = null;
  1288. private MessageOfTricker? butcher = null;
  1289. private bool humanOrButcher;//true for human
  1290. private bool bonusflag;
  1291. private bool mapFlag = false;
  1292. private bool hasDrawed = false;
  1293. public int[,] defaultMap = new int[,] {
  1294. { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 },//6墙,1-5出生点
  1295. { 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6 },//7草
  1296. { 6, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6 },//8机
  1297. { 6, 0, 0, 0, 0, 6, 0, 6, 7, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 0, 0, 0, 6 },//9大门
  1298. { 6, 0, 0, 0, 0, 6, 6, 6, 6, 7, 0, 0, 0, 0, 0, 15, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 15, 0, 0, 0, 6 },//10紧急出口
  1299. { 6, 6, 0, 0, 0, 0, 9, 6, 6, 7, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 6, 6, 7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0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 7, 6, 6, 6, 0, 0, 6 },
  1339. { 6, 0, 0, 0, 0, 0, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6 },
  1340. { 6, 0, 0, 0, 0, 6, 6, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 11, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 6 },
  1341. { 6, 0, 0, 0, 6, 6, 6, 6, 6, 7, 0, 0, 0, 10, 0, 0, 0, 0, 6, 6, 7, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6, 0, 0, 0, 0, 7, 6, 6, 0, 0, 0, 6 },
  1342. { 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 7, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6, 0, 0, 0, 7, 7, 6, 6, 0, 0, 0, 6 },
  1343. { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }
  1344. };
  1345. private string[] comInfo = new string[5];
  1346. ArgumentOptions? options = null;
  1347. bool gateOpened = false;
  1348. bool isSpectatorMode = false;
  1349. bool isEmergencyOpened = false;
  1350. bool isEmergencyDrawed = false;
  1351. double coolTime0 = -1, coolTime1 = -1, coolTime2 = -1;
  1352. const double radiusTimes = 1.0 * Preparation.Utility.GameData.characterRadius / Preparation.Utility.GameData.numOfPosGridPerCell;
  1353. }
  1354. }