You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

MainWindow.xaml.cs 76 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490
  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 DrawMap()
  294. {
  295. for (int i = 0; i < defaultMap.GetLength(0); i++)
  296. {
  297. for (int j = 0; j < defaultMap.GetLength(1); j++)
  298. {
  299. mapPatches[i, j] = new()
  300. {
  301. Width = unitWidth,
  302. Height = unitHeight,
  303. HorizontalAlignment = HorizontalAlignment.Left,
  304. VerticalAlignment = VerticalAlignment.Top,
  305. Margin = new Thickness(Width * (j), Height * (i), 0, 0)
  306. };
  307. switch (defaultMap[i, j])
  308. {
  309. case 6:
  310. mapPatches[i, j].Fill = Brushes.Brown;
  311. mapPatches[i, j].Stroke = Brushes.Brown;
  312. break;//wall
  313. case 7:
  314. mapPatches[i, j].Fill = Brushes.Green;
  315. mapPatches[i, j].Stroke = Brushes.Green;
  316. break;//grass
  317. case 8:
  318. mapPatches[i, j].Fill = Brushes.LightPink;
  319. mapPatches[i, j].Stroke = Brushes.LightPink;
  320. break;//machine
  321. case 9:
  322. mapPatches[i, j].Fill = Brushes.LightSkyBlue;
  323. mapPatches[i, j].Stroke = Brushes.LightSkyBlue;
  324. break;//gate
  325. case 10:
  326. break;//emergency
  327. case 11:
  328. mapPatches[i, j].Fill = Brushes.Gray;
  329. mapPatches[i, j].Stroke = Brushes.Gray;
  330. break;//window
  331. case 12:
  332. case 13:
  333. case 14:
  334. mapPatches[i, j].Fill = Brushes.Khaki;
  335. mapPatches[i, j].Stroke = Brushes.Khaki;
  336. break;//door
  337. case 15:
  338. mapPatches[i, j].Fill = Brushes.Orange;
  339. mapPatches[i, j].Stroke = Brushes.Orange;
  340. break;//chest
  341. default:
  342. break;
  343. }
  344. UnderLayerOfMap.Children.Add(mapPatches[i, j]);
  345. }
  346. }
  347. hasDrawed = true;
  348. }
  349. //三个参数分别为攻击者的位置,攻击方位角(窗口坐标)和攻击半径
  350. private void DrawLaser(Point source, double theta, double range, double Width) // 三个参数分别为攻击者的位置,攻击方位角(窗口坐标)和攻击半径
  351. {
  352. Point[] endPoint = new Point[4];
  353. Point target = new();
  354. target.X = source.X + range * Math.Cos(theta);
  355. target.Y = source.Y + range * Math.Sin(theta);
  356. endPoint[0].X = source.X + Width * Math.Cos(theta - Math.PI / 2);
  357. endPoint[0].Y = source.Y + Width * Math.Sin(theta - Math.PI / 2);
  358. endPoint[1].X = target.X + Width * Math.Cos(theta - Math.PI / 2);
  359. endPoint[1].Y = target.Y + Width * Math.Sin(theta - Math.PI / 2);
  360. endPoint[2].X = target.X + Width * Math.Cos(theta + Math.PI / 2);
  361. endPoint[2].Y = target.Y + Width * Math.Sin(theta + Math.PI / 2);
  362. endPoint[3].X = source.X + Width * Math.Cos(theta + Math.PI / 2);
  363. endPoint[3].Y = source.Y + Width * Math.Sin(theta + Math.PI / 2);
  364. Polygon laserIcon = new();
  365. laserIcon.Stroke = System.Windows.Media.Brushes.Red;
  366. laserIcon.Fill = System.Windows.Media.Brushes.Red;
  367. laserIcon.StrokeThickness = 2;
  368. laserIcon.HorizontalAlignment = HorizontalAlignment.Left;
  369. laserIcon.VerticalAlignment = VerticalAlignment.Top;
  370. PointCollection laserEndPoints = new();
  371. for (int i = 0; i < 4; i++)
  372. {
  373. laserEndPoints.Add(endPoint[i]);
  374. }
  375. laserIcon.Points = laserEndPoints;
  376. UpperLayerOfMap.Children.Add(laserIcon);
  377. }
  378. private async void OnReceive() // 已按照3.5版proto更新信息,但是左侧信息栏还未填充。log未更新,switch1,2,3更新log
  379. {
  380. try
  381. {
  382. while (responseStream != null && await responseStream.ResponseStream.MoveNext())
  383. {
  384. lock (drawPicLock) // 加锁是必要的,画图操作和接收信息操作不能同时进行,否则画图时foreach会有bug
  385. {
  386. listOfHuman.Clear();
  387. listOfButcher.Clear();
  388. listOfProp.Clear();
  389. listOfBombedBullet.Clear();
  390. listOfBullet.Clear();
  391. listOfAll.Clear();
  392. listOfChest.Clear();
  393. listOfClassroom.Clear();
  394. listOfDoor.Clear();
  395. listOfHiddenGate.Clear();
  396. listOfGate.Clear();
  397. MessageToClient content = responseStream.ResponseStream.Current;
  398. switch (content.GameState)
  399. {
  400. case GameState.GameStart:
  401. foreach (var obj in content.ObjMessage)
  402. {
  403. switch (obj.MessageOfObjCase)
  404. {
  405. case MessageOfObj.MessageOfObjOneofCase.StudentMessage:
  406. if (humanOrButcher && obj.StudentMessage.PlayerId == playerID)
  407. {
  408. human = obj.StudentMessage;
  409. }
  410. listOfHuman.Add(obj.StudentMessage);
  411. break;
  412. case MessageOfObj.MessageOfObjOneofCase.TrickerMessage:
  413. if (!humanOrButcher && obj.TrickerMessage.PlayerId == playerID)
  414. {
  415. butcher = obj.TrickerMessage;
  416. }
  417. listOfButcher.Add(obj.TrickerMessage);
  418. break;
  419. case MessageOfObj.MessageOfObjOneofCase.PropMessage:
  420. listOfProp.Add(obj.PropMessage);
  421. break;
  422. case MessageOfObj.MessageOfObjOneofCase.BombedBulletMessage:
  423. listOfBombedBullet.Add(obj.BombedBulletMessage);
  424. break;
  425. case MessageOfObj.MessageOfObjOneofCase.BulletMessage:
  426. listOfBullet.Add(obj.BulletMessage);
  427. break;
  428. case MessageOfObj.MessageOfObjOneofCase.ChestMessage:
  429. listOfChest.Add(obj.ChestMessage);
  430. break;
  431. case MessageOfObj.MessageOfObjOneofCase.ClassroomMessage:
  432. listOfClassroom.Add(obj.ClassroomMessage);
  433. break;
  434. case MessageOfObj.MessageOfObjOneofCase.DoorMessage:
  435. listOfDoor.Add(obj.DoorMessage);
  436. break;
  437. case MessageOfObj.MessageOfObjOneofCase.GateMessage:
  438. listOfGate.Add(obj.GateMessage);
  439. break;
  440. case MessageOfObj.MessageOfObjOneofCase.MapMessage:
  441. GetMap(obj.MapMessage);
  442. break;
  443. }
  444. }
  445. listOfAll.Add(content.AllMessage);
  446. break;
  447. case GameState.GameRunning:
  448. foreach (var obj in content.ObjMessage)
  449. {
  450. switch (obj.MessageOfObjCase)
  451. {
  452. case MessageOfObj.MessageOfObjOneofCase.StudentMessage:
  453. if (humanOrButcher && obj.StudentMessage.PlayerId == playerID)
  454. {
  455. human = obj.StudentMessage;
  456. }
  457. listOfHuman.Add(obj.StudentMessage);
  458. break;
  459. case MessageOfObj.MessageOfObjOneofCase.TrickerMessage:
  460. if (!humanOrButcher && obj.TrickerMessage.PlayerId == playerID)
  461. {
  462. butcher = obj.TrickerMessage;
  463. }
  464. listOfButcher.Add(obj.TrickerMessage);
  465. break;
  466. case MessageOfObj.MessageOfObjOneofCase.PropMessage:
  467. listOfProp.Add(obj.PropMessage);
  468. break;
  469. case MessageOfObj.MessageOfObjOneofCase.BombedBulletMessage:
  470. listOfBombedBullet.Add(obj.BombedBulletMessage);
  471. break;
  472. case MessageOfObj.MessageOfObjOneofCase.BulletMessage:
  473. listOfBullet.Add(obj.BulletMessage);
  474. break;
  475. case MessageOfObj.MessageOfObjOneofCase.ChestMessage:
  476. listOfChest.Add(obj.ChestMessage);
  477. break;
  478. case MessageOfObj.MessageOfObjOneofCase.ClassroomMessage:
  479. listOfClassroom.Add(obj.ClassroomMessage);
  480. break;
  481. case MessageOfObj.MessageOfObjOneofCase.DoorMessage:
  482. listOfDoor.Add(obj.DoorMessage);
  483. break;
  484. case MessageOfObj.MessageOfObjOneofCase.GateMessage:
  485. listOfGate.Add(obj.GateMessage);
  486. break;
  487. case MessageOfObj.MessageOfObjOneofCase.HiddenGateMessage:
  488. listOfHiddenGate.Add(obj.HiddenGateMessage);
  489. break;
  490. case MessageOfObj.MessageOfObjOneofCase.MapMessage:
  491. GetMap(obj.MapMessage);
  492. break;
  493. }
  494. }
  495. listOfAll.Add(content.AllMessage);
  496. break;
  497. case GameState.GameEnd:
  498. MessageBox.Show("Game Over!");
  499. foreach (var obj in content.ObjMessage)
  500. {
  501. switch (obj.MessageOfObjCase)
  502. {
  503. case MessageOfObj.MessageOfObjOneofCase.StudentMessage:
  504. listOfHuman.Add(obj.StudentMessage);
  505. break;
  506. case MessageOfObj.MessageOfObjOneofCase.TrickerMessage:
  507. listOfButcher.Add(obj.TrickerMessage);
  508. break;
  509. case MessageOfObj.MessageOfObjOneofCase.PropMessage:
  510. listOfProp.Add(obj.PropMessage);
  511. break;
  512. case MessageOfObj.MessageOfObjOneofCase.BombedBulletMessage:
  513. listOfBombedBullet.Add(obj.BombedBulletMessage);
  514. break;
  515. case MessageOfObj.MessageOfObjOneofCase.BulletMessage:
  516. listOfBullet.Add(obj.BulletMessage);
  517. break;
  518. case MessageOfObj.MessageOfObjOneofCase.ChestMessage:
  519. listOfChest.Add(obj.ChestMessage);
  520. break;
  521. case MessageOfObj.MessageOfObjOneofCase.ClassroomMessage:
  522. listOfClassroom.Add(obj.ClassroomMessage);
  523. break;
  524. case MessageOfObj.MessageOfObjOneofCase.DoorMessage:
  525. listOfDoor.Add(obj.DoorMessage);
  526. break;
  527. case MessageOfObj.MessageOfObjOneofCase.GateMessage:
  528. listOfGate.Add(obj.GateMessage);
  529. break;
  530. case MessageOfObj.MessageOfObjOneofCase.HiddenGateMessage:
  531. listOfHiddenGate.Add(obj.HiddenGateMessage);
  532. break;
  533. }
  534. }
  535. listOfAll.Add(content.AllMessage);
  536. break;
  537. }
  538. }
  539. if (responseStream == null)
  540. {
  541. throw new Exception("Unconnected");
  542. }
  543. }
  544. }
  545. catch (Exception ex)
  546. {
  547. ErrorDisplayer error = new("Error: " + ex.ToString());
  548. error.Show();
  549. }
  550. }
  551. private bool CanSee(MessageOfStudent msg)
  552. {
  553. if (msg.PlayerState == PlayerState.Quit || msg.PlayerState == PlayerState.Graduated)
  554. return false;
  555. if (isSpectatorMode || isPlaybackMode)
  556. return true;
  557. if (humanOrButcher && human != null)
  558. {
  559. if (msg.Place == human.Place)
  560. return true;
  561. if (msg.PlayerId == playerID + Preparation.Utility.GameData.numOfPeople)//robot and its owner
  562. return true;
  563. }
  564. else if (!humanOrButcher && butcher != null)
  565. {
  566. if (msg.Place == butcher.Place)
  567. return true;
  568. }
  569. if (msg.Place == Protobuf.PlaceType.Grass)
  570. return false;
  571. return true;
  572. }
  573. private bool CanSee(MessageOfTricker msg)
  574. {
  575. if (isSpectatorMode || isPlaybackMode)
  576. return true;
  577. if (!humanOrButcher && butcher != null)
  578. {
  579. if (butcher.Guid == msg.Guid) // 自己能看见自己
  580. return true;
  581. }
  582. if (humanOrButcher && human != null)
  583. {
  584. if (msg.TrickerType == Protobuf.TrickerType.Assassin)
  585. {
  586. foreach (var buff in msg.Buff)
  587. {
  588. if (buff == Protobuf.TrickerBuffType.TrickerInvisible)
  589. return false;
  590. }
  591. }
  592. if (msg.Place == human.Place)
  593. return true;
  594. }
  595. if (msg.Place == Protobuf.PlaceType.Grass)
  596. return false;
  597. return true;
  598. }
  599. private bool CanSee(MessageOfProp msg)
  600. {
  601. if (isSpectatorMode || isPlaybackMode)
  602. return true;
  603. if (humanOrButcher && human != null)
  604. {
  605. if (msg.Place == human.Place)
  606. return true;
  607. }
  608. else if (!humanOrButcher && butcher != null)
  609. {
  610. if (msg.Place == butcher.Place)
  611. return true;
  612. }
  613. if (msg.Place == Protobuf.PlaceType.Grass)
  614. return false;
  615. return true;
  616. }
  617. private bool CanSee(MessageOfBullet msg)
  618. {
  619. if (isSpectatorMode || isPlaybackMode)
  620. return true;
  621. if (humanOrButcher && human != null)
  622. {
  623. if (msg.Place == human.Place)
  624. return true;
  625. }
  626. else if (!humanOrButcher && butcher != null)
  627. {
  628. if (msg.Place == butcher.Place)
  629. return true;
  630. }
  631. if (msg.Place == Protobuf.PlaceType.Grass)
  632. return false;
  633. return true;
  634. }
  635. private bool CanSee(MessageOfBombedBullet msg)
  636. {
  637. if (isSpectatorMode || isPlaybackMode)
  638. return true;
  639. //if (humanOrButcher && human != null)
  640. //{
  641. // if (msg.Place == human.Place)
  642. // return true;
  643. //}
  644. //else if (!humanOrButcher && butcher != null)
  645. //{
  646. // if (msg.Place == butcher.Place)
  647. // return true;
  648. //}
  649. //if (msg.Place == Protobuf.PlaceType.Grass)
  650. // return false;
  651. return true;
  652. }
  653. private void Refresh(object? sender, EventArgs e) //log未更新
  654. {
  655. lock (drawPicLock) // 加锁是必要的,画图操作和接收信息操作不能同时进行
  656. {
  657. // Bonus();
  658. if (WindowState == WindowState.Maximized)
  659. MaxButton.Content = "❐";
  660. else
  661. MaxButton.Content = "🗖";
  662. foreach (var obj in listOfHuman)
  663. {
  664. if (obj.PlayerId < GameData.numOfStudent && obj.StudentType != StudentType.Robot)
  665. {
  666. IStudentType occupation = (IStudentType)OccupationFactory.FindIOccupation(Transformation.ToStudentType(obj.StudentType));
  667. totalLife[obj.PlayerId] = occupation.MaxHp;
  668. totalDeath[obj.PlayerId] = occupation.MaxGamingAddiction;
  669. int i = 0;
  670. foreach (var skill in occupation.ListOfIActiveSkill)
  671. {
  672. var iActiveSkill = SkillFactory.FindIActiveSkill(skill);
  673. coolTime[i, obj.PlayerId] = iActiveSkill.SkillCD;
  674. ++i;
  675. }
  676. }
  677. }
  678. foreach (var obj in listOfButcher)
  679. {
  680. IGhostType occupation1 = (IGhostType)OccupationFactory.FindIOccupation(Transformation.ToTrickerType(obj.TrickerType));
  681. int j = 0;
  682. foreach (var skill in occupation1.ListOfIActiveSkill)
  683. {
  684. var iActiveSkill = SkillFactory.FindIActiveSkill(skill);
  685. coolTime[j, GameData.numOfStudent] = iActiveSkill.SkillCD;
  686. ++j;
  687. }
  688. }
  689. if (StatusBarsOfSurvivor != null)
  690. {
  691. for (int i = 0; i < GameData.numOfStudent; i++)
  692. {
  693. StatusBarsOfSurvivor[i].SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
  694. StatusBarsOfSurvivor[i].NewData(totalLife, totalDeath, coolTime);
  695. }
  696. }
  697. if (StatusBarsOfHunter != null)
  698. {
  699. StatusBarsOfHunter.SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
  700. StatusBarsOfHunter.NewData(totalLife, totalDeath, coolTime);
  701. }
  702. if (StatusBarsOfCircumstance != null)
  703. StatusBarsOfCircumstance.SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
  704. // 完成窗口信息更新
  705. if (!isClientStocked)
  706. {
  707. unit = Math.Sqrt(UpperLayerOfMap.ActualHeight * UpperLayerOfMap.ActualWidth) / 50;
  708. unitHeight = UpperLayerOfMap.ActualHeight / 50;
  709. unitWidth = UpperLayerOfMap.ActualWidth / 50;
  710. try
  711. {
  712. // if (log != null)
  713. //{
  714. // string temp = "";
  715. // for (int i = 0; i < dataDict[GameObjType.Character].Count; i++)
  716. // {
  717. // temp += Convert.ToString(dataDict[GameObjType.Character][i].MessageOfCharacter.TeamID) + "\n";
  718. // }
  719. // log.Content = temp;
  720. // }
  721. UpperLayerOfMap.Children.Clear();
  722. // if ((communicator == null || !communicator.Client.IsConnected) && !isPlaybackMode)
  723. //{
  724. // UnderLayerOfMap.Children.Clear();
  725. // throw new Exception("Client is unconnected.");
  726. // }
  727. // else
  728. //{
  729. foreach (var data in listOfAll)
  730. {
  731. StatusBarsOfCircumstance.SetValue(data, gateOpened, isEmergencyDrawed, isEmergencyOpened, playerID, isPlaybackMode);
  732. }
  733. if (!hasDrawed && mapFlag)
  734. DrawMap();
  735. foreach (var data in listOfHuman)
  736. {
  737. if (data.StudentType != StudentType.Robot)
  738. StatusBarsOfSurvivor[data.PlayerId].SetValue(data, data.PlayerId);
  739. if (CanSee(data))
  740. {
  741. Ellipse icon = new()
  742. {
  743. Width = 2 * radiusTimes * unitWidth,
  744. Height = 2 * radiusTimes * unitHeight,
  745. HorizontalAlignment = HorizontalAlignment.Left,
  746. VerticalAlignment = VerticalAlignment.Top,
  747. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * radiusTimes, data.X * unitHeight / 1000.0 - unitHeight * radiusTimes, 0, 0),
  748. Fill = Brushes.BlueViolet,
  749. };
  750. if (data.StudentType == StudentType.Robot)
  751. icon.Fill = Brushes.Gray;
  752. TextBox num = new()
  753. {
  754. FontSize = 7 * UpperLayerOfMap.ActualHeight / 650,
  755. Width = 2 * radiusTimes * unitWidth,
  756. Height = 2 * radiusTimes * unitHeight,
  757. Text = Convert.ToString(data.PlayerId),
  758. HorizontalAlignment = HorizontalAlignment.Left,
  759. VerticalAlignment = VerticalAlignment.Top,
  760. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * radiusTimes, data.X * unitHeight / 1000.0 - unitHeight * radiusTimes, 0, 0),
  761. Background = Brushes.Transparent,
  762. BorderBrush = Brushes.Transparent,
  763. IsReadOnly = true,
  764. Foreground = Brushes.White,
  765. };
  766. if (data.StudentType == StudentType.Robot)
  767. num.Text = Convert.ToString(data.PlayerId - Preparation.Utility.GameData.numOfPeople);
  768. UpperLayerOfMap.Children.Add(icon);
  769. UpperLayerOfMap.Children.Add(num);
  770. }
  771. }
  772. foreach (var data in listOfButcher)
  773. {
  774. StatusBarsOfHunter.SetValue(data);
  775. if (CanSee(data))
  776. {
  777. Ellipse icon = new()
  778. {
  779. Width = 2 * radiusTimes * unitWidth,
  780. Height = 2 * radiusTimes * unitHeight,
  781. HorizontalAlignment = HorizontalAlignment.Left,
  782. VerticalAlignment = VerticalAlignment.Top,
  783. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * radiusTimes, data.X * unitHeight / 1000.0 - unitHeight * radiusTimes, 0, 0),
  784. Fill = Brushes.Chocolate,
  785. };
  786. UpperLayerOfMap.Children.Add(icon);
  787. }
  788. }
  789. foreach (var data in listOfProp)
  790. {
  791. if (CanSee(data))
  792. {
  793. switch (data.Type)
  794. {
  795. case Protobuf.PropType.Key3:
  796. DrawProp(data, "🔑");
  797. break;
  798. case Protobuf.PropType.Key5:
  799. DrawProp(data, "🔑");
  800. break;
  801. case Protobuf.PropType.Key6:
  802. DrawProp(data, "🔑");
  803. break;
  804. case Protobuf.PropType.AddSpeed:
  805. DrawProp(data, "⛸");
  806. break;
  807. case Protobuf.PropType.AddHpOrAp:
  808. DrawProp(data, "♥");
  809. break;
  810. case Protobuf.PropType.AddLifeOrClairaudience:
  811. DrawProp(data, "🏅");
  812. break;
  813. case Protobuf.PropType.ShieldOrSpear:
  814. DrawProp(data, "🛡");
  815. break;
  816. case Protobuf.PropType.RecoveryFromDizziness:
  817. DrawProp(data, "🕶");
  818. break;
  819. default:
  820. DrawProp(data, "");
  821. break;
  822. }
  823. }
  824. }
  825. foreach (var data in listOfBullet)
  826. {
  827. if (CanSee(data))
  828. {
  829. Ellipse icon = new()
  830. {
  831. Width = 2 * bulletRadiusTimes * unitWidth,
  832. Height = 2 * bulletRadiusTimes * unitHeight,
  833. HorizontalAlignment = HorizontalAlignment.Left,
  834. VerticalAlignment = VerticalAlignment.Top,
  835. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bulletRadiusTimes, data.X * unitHeight / 1000.0 - unitHeight * bulletRadiusTimes, 0, 0),
  836. Fill = Brushes.Red,
  837. };
  838. switch (data.Type)
  839. {
  840. case Protobuf.BulletType.FlyingKnife:
  841. icon.Fill = Brushes.Blue;
  842. break;
  843. case Protobuf.BulletType.CommonAttackOfTricker:
  844. case Protobuf.BulletType.BombBomb:
  845. case Protobuf.BulletType.JumpyDumpty:
  846. icon.Fill = Brushes.Red;
  847. break;
  848. default:
  849. break;
  850. }
  851. UpperLayerOfMap.Children.Add(icon);
  852. }
  853. }
  854. foreach (var data in listOfBombedBullet)
  855. {
  856. if (CanSee(data))
  857. {
  858. switch (data.Type)
  859. {
  860. case Protobuf.BulletType.BombBomb:
  861. {
  862. double bombRange = 1.0 * data.BombRange / Preparation.Utility.GameData.numOfPosGridPerCell;
  863. Ellipse icon = new()
  864. {
  865. Width = 2 * bombRange * unitWidth,
  866. Height = 2 * bombRange * unitHeight,
  867. HorizontalAlignment = HorizontalAlignment.Left,
  868. VerticalAlignment = VerticalAlignment.Top,
  869. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bombRange, data.X * unitHeight / 1000.0 - unitHeight * bombRange, 0, 0),
  870. Fill = Brushes.DarkRed,
  871. };
  872. UpperLayerOfMap.Children.Add(icon);
  873. break;
  874. }
  875. case Protobuf.BulletType.JumpyDumpty:
  876. {
  877. double bombRange = 1.0 * data.BombRange / Preparation.Utility.GameData.numOfPosGridPerCell;
  878. Ellipse icon = new()
  879. {
  880. Width = 2 * bombRange * unitWidth,
  881. Height = 2 * bombRange * unitHeight,
  882. HorizontalAlignment = HorizontalAlignment.Left,
  883. VerticalAlignment = VerticalAlignment.Top,
  884. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bombRange, data.X * unitHeight / 1000.0 - unitHeight * bombRange, 0, 0),
  885. Fill = Brushes.DarkRed,
  886. };
  887. UpperLayerOfMap.Children.Add(icon);
  888. break;
  889. }
  890. //case Protobuf.BulletType.LineBullet:
  891. // {
  892. // double bombRange = data.BombRange / 1000;
  893. // DrawLaser(new Point(data.Y * unitWidth / 1000.0, data.X * unitHeight / 1000.0), -data.FacingDirection + Math.PI / 2, bombRange * unitHeight, 0.5 * unitWidth);
  894. // break;
  895. // }
  896. default:
  897. break;
  898. }
  899. }
  900. }
  901. foreach (var data in listOfClassroom)
  902. {
  903. int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfFixedGenerator);
  904. TextBox icon = new()
  905. {
  906. FontSize = 8 * UpperLayerOfMap.ActualHeight / 650,
  907. Width = unitWidth,
  908. Height = unitHeight,
  909. Text = Convert.ToString(deg),
  910. HorizontalAlignment = HorizontalAlignment.Left,
  911. VerticalAlignment = VerticalAlignment.Top,
  912. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  913. Background = Brushes.Transparent,
  914. BorderBrush = Brushes.Transparent,
  915. IsReadOnly = true
  916. };
  917. if (deg == 100)
  918. {
  919. icon.Text = "A+";
  920. }
  921. UpperLayerOfMap.Children.Add(icon);
  922. }
  923. foreach (var data in listOfChest)
  924. {
  925. int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfOpenedChest);
  926. TextBox icon = new()
  927. {
  928. FontSize = 8 * UpperLayerOfMap.ActualHeight / 650,
  929. Width = unitWidth,
  930. Height = unitHeight,
  931. Text = Convert.ToString(deg),
  932. HorizontalAlignment = HorizontalAlignment.Left,
  933. VerticalAlignment = VerticalAlignment.Top,
  934. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  935. Background = Brushes.Transparent,
  936. BorderBrush = Brushes.Transparent,
  937. IsReadOnly = true
  938. };
  939. if (deg == 100)
  940. {
  941. icon.Text = "Ø";
  942. }
  943. UpperLayerOfMap.Children.Add(icon);
  944. }
  945. foreach (var data in listOfGate)
  946. {
  947. int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfOpenedDoorway);
  948. TextBox icon = new()
  949. {
  950. FontSize = 8 * UpperLayerOfMap.ActualHeight / 650,
  951. Width = unitWidth,
  952. Height = unitHeight,
  953. Text = Convert.ToString(deg),
  954. HorizontalAlignment = HorizontalAlignment.Left,
  955. VerticalAlignment = VerticalAlignment.Top,
  956. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  957. Background = Brushes.Transparent,
  958. BorderBrush = Brushes.Transparent,
  959. IsReadOnly = true
  960. };
  961. if (deg == 100)
  962. {
  963. gateOpened = true;
  964. icon.Text = "🔓";
  965. }
  966. UpperLayerOfMap.Children.Add(icon);
  967. }
  968. foreach (var data in listOfDoor)
  969. {
  970. TextBox icon = new()
  971. {
  972. FontSize = 9 * UpperLayerOfMap.ActualHeight / 650,
  973. Width = unitWidth,
  974. Height = unitHeight,
  975. HorizontalAlignment = HorizontalAlignment.Left,
  976. VerticalAlignment = VerticalAlignment.Top,
  977. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  978. Background = Brushes.Transparent,
  979. BorderBrush = Brushes.Transparent,
  980. IsReadOnly = true
  981. };
  982. if (data.IsOpen)
  983. {
  984. icon.Text = Convert.ToString("🔓");
  985. }
  986. else
  987. {
  988. icon.Text = Convert.ToString("🔒");
  989. }
  990. UpperLayerOfMap.Children.Add(icon);
  991. }
  992. foreach (var data in listOfHiddenGate)
  993. {
  994. if (!isEmergencyDrawed)
  995. {
  996. mapPatches[data.X / Preparation.Utility.GameData.numOfPosGridPerCell, data.Y / Preparation.Utility.GameData.numOfPosGridPerCell].Fill = Brushes.LightSalmon;
  997. mapPatches[data.X / Preparation.Utility.GameData.numOfPosGridPerCell, data.Y / Preparation.Utility.GameData.numOfPosGridPerCell].Stroke = Brushes.LightSalmon;
  998. isEmergencyDrawed = true;
  999. }
  1000. if (data.Opened)
  1001. {
  1002. isEmergencyOpened = true;
  1003. TextBox icon = new()
  1004. {
  1005. FontSize = 9 * UpperLayerOfMap.ActualHeight / 650,
  1006. Width = unitWidth,
  1007. Height = unitHeight,
  1008. Text = Convert.ToString("🔓"),
  1009. HorizontalAlignment = HorizontalAlignment.Left,
  1010. VerticalAlignment = VerticalAlignment.Top,
  1011. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  1012. Background = Brushes.Transparent,
  1013. BorderBrush = Brushes.Transparent,
  1014. IsReadOnly = true
  1015. };
  1016. UpperLayerOfMap.Children.Add(icon);
  1017. }
  1018. }
  1019. //}
  1020. ZoomMap();
  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 bonusflag;
  1383. private bool mapFlag = false;
  1384. private bool hasDrawed = false;
  1385. public int[,] defaultMap = new int[,] {
  1386. { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 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出生点
  1387. { 6, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 6 },
  1433. { 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 },
  1434. { 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 },
  1435. { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }
  1436. };
  1437. private string[] comInfo = new string[5];
  1438. ArgumentOptions? options = null;
  1439. bool gateOpened = false;
  1440. bool isSpectatorMode = false;
  1441. bool isEmergencyOpened = false;
  1442. bool isEmergencyDrawed = false;
  1443. bool isDataFixed = false;
  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. }