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

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