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