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