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