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
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484
  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)
  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. //待修改
  552. private bool CanSee(MessageOfStudent msg)
  553. {
  554. if (msg.PlayerState == PlayerState.Quit || msg.PlayerState == PlayerState.Graduated)
  555. return false;
  556. if (isSpectatorMode || isPlaybackMode)
  557. return true;
  558. if (humanOrButcher && human != null)
  559. {
  560. if (msg.Place == human.Place)
  561. return true;
  562. if (msg.PlayerId == playerID + Preparation.Utility.GameData.numOfPeople)//robot and its owner
  563. return true;
  564. }
  565. else if (!humanOrButcher && butcher != null)
  566. {
  567. if (msg.Place == butcher.Place)
  568. return true;
  569. }
  570. if (msg.Place == Protobuf.PlaceType.Grass)
  571. return false;
  572. return true;
  573. }
  574. private bool CanSee(MessageOfTricker msg)
  575. {
  576. if (isSpectatorMode || isPlaybackMode)
  577. return true;
  578. if (!humanOrButcher && butcher != null)
  579. {
  580. if (butcher.Guid == msg.Guid) // 自己能看见自己
  581. return true;
  582. }
  583. if (humanOrButcher && human != null)
  584. {
  585. if (msg.TrickerType == Protobuf.TrickerType.Assassin)
  586. {
  587. foreach (var buff in msg.Buff)
  588. {
  589. if (buff == Protobuf.TrickerBuffType.TrickerInvisible)
  590. return false;
  591. }
  592. }
  593. if (msg.Place == human.Place)
  594. return true;
  595. }
  596. if (msg.Place == Protobuf.PlaceType.Grass)
  597. return false;
  598. return true;
  599. }
  600. private bool CanSee(MessageOfProp msg)
  601. {
  602. if (isSpectatorMode || isPlaybackMode)
  603. return true;
  604. if (humanOrButcher && human != null)
  605. {
  606. if (msg.Place == human.Place)
  607. return true;
  608. }
  609. else if (!humanOrButcher && butcher != null)
  610. {
  611. if (msg.Place == butcher.Place)
  612. return true;
  613. }
  614. if (msg.Place == Protobuf.PlaceType.Grass)
  615. return false;
  616. return true;
  617. }
  618. private bool CanSee(MessageOfBullet msg)
  619. {
  620. if (isSpectatorMode || isPlaybackMode)
  621. return true;
  622. if (humanOrButcher && human != null)
  623. {
  624. if (msg.Place == human.Place)
  625. return true;
  626. }
  627. else if (!humanOrButcher && butcher != null)
  628. {
  629. if (msg.Place == butcher.Place)
  630. return true;
  631. }
  632. if (msg.Place == Protobuf.PlaceType.Grass)
  633. return false;
  634. return true;
  635. }
  636. private bool CanSee(MessageOfBombedBullet msg)
  637. {
  638. if (isSpectatorMode || isPlaybackMode)
  639. return true;
  640. //if (humanOrButcher && human != null)
  641. //{
  642. // if (msg.Place == human.Place)
  643. // return true;
  644. //}
  645. //else if (!humanOrButcher && butcher != null)
  646. //{
  647. // if (msg.Place == butcher.Place)
  648. // return true;
  649. //}
  650. //if (msg.Place == Protobuf.PlaceType.Grass)
  651. // return false;
  652. return true;
  653. }
  654. private void Refresh(object? sender, EventArgs e) //log未更新
  655. {
  656. lock (drawPicLock) // 加锁是必要的,画图操作和接收信息操作不能同时进行
  657. {
  658. // Bonus();
  659. if (WindowState == WindowState.Maximized)
  660. MaxButton.Content = "❐";
  661. else
  662. MaxButton.Content = "🗖";
  663. foreach (var obj in listOfHuman)
  664. {
  665. if (obj.PlayerId < GameData.numOfStudent && obj.StudentType != StudentType.Robot)
  666. {
  667. IStudentType occupation = (IStudentType)OccupationFactory.FindIOccupation(Transformation.ToStudentType(obj.StudentType));
  668. totalLife[obj.PlayerId] = occupation.MaxHp;
  669. totalDeath[obj.PlayerId] = occupation.MaxGamingAddiction;
  670. int i = 0;
  671. foreach (var skill in occupation.ListOfIActiveSkill)
  672. {
  673. var iActiveSkill = SkillFactory.FindIActiveSkill(skill);
  674. coolTime[i, obj.PlayerId] = iActiveSkill.SkillCD;
  675. ++i;
  676. }
  677. }
  678. }
  679. foreach (var obj in listOfButcher)
  680. {
  681. IGhostType occupation1 = (IGhostType)OccupationFactory.FindIOccupation(Transformation.ToTrickerType(obj.TrickerType));
  682. int j = 0;
  683. foreach (var skill in occupation1.ListOfIActiveSkill)
  684. {
  685. var iActiveSkill = SkillFactory.FindIActiveSkill(skill);
  686. coolTime[j, GameData.numOfStudent] = iActiveSkill.SkillCD;
  687. ++j;
  688. }
  689. }
  690. if (StatusBarsOfSurvivor != null)
  691. {
  692. for (int i = 0; i < GameData.numOfStudent; i++)
  693. {
  694. StatusBarsOfSurvivor[i].SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
  695. StatusBarsOfSurvivor[i].NewData(totalLife, totalDeath, coolTime);
  696. }
  697. }
  698. if (StatusBarsOfHunter != null)
  699. {
  700. StatusBarsOfHunter.SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
  701. StatusBarsOfHunter.NewData(totalLife, totalDeath, coolTime);
  702. }
  703. if (StatusBarsOfCircumstance != null)
  704. StatusBarsOfCircumstance.SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650);
  705. // 完成窗口信息更新
  706. if (!isClientStocked)
  707. {
  708. unit = Math.Sqrt(UpperLayerOfMap.ActualHeight * UpperLayerOfMap.ActualWidth) / 50;
  709. unitHeight = UpperLayerOfMap.ActualHeight / 50;
  710. unitWidth = UpperLayerOfMap.ActualWidth / 50;
  711. try
  712. {
  713. // if (log != null)
  714. //{
  715. // string temp = "";
  716. // for (int i = 0; i < dataDict[GameObjType.Character].Count; i++)
  717. // {
  718. // temp += Convert.ToString(dataDict[GameObjType.Character][i].MessageOfCharacter.TeamID) + "\n";
  719. // }
  720. // log.Content = temp;
  721. // }
  722. UpperLayerOfMap.Children.Clear();
  723. // if ((communicator == null || !communicator.Client.IsConnected) && !isPlaybackMode)
  724. //{
  725. // UnderLayerOfMap.Children.Clear();
  726. // throw new Exception("Client is unconnected.");
  727. // }
  728. // else
  729. //{
  730. foreach (var data in listOfAll)
  731. {
  732. StatusBarsOfCircumstance.SetValue(data, gateOpened, isEmergencyDrawed, isEmergencyOpened, playerID, isPlaybackMode);
  733. }
  734. if (!hasDrawed && mapFlag)
  735. DrawMap();
  736. foreach (var data in listOfHuman)
  737. {
  738. if (data.StudentType != StudentType.Robot)
  739. StatusBarsOfSurvivor[data.PlayerId].SetValue(data, data.PlayerId);
  740. if (CanSee(data))
  741. {
  742. Ellipse icon = new()
  743. {
  744. Width = 2 * radiusTimes * unitWidth,
  745. Height = 2 * radiusTimes * unitHeight,
  746. HorizontalAlignment = HorizontalAlignment.Left,
  747. VerticalAlignment = VerticalAlignment.Top,
  748. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * radiusTimes, data.X * unitHeight / 1000.0 - unitHeight * radiusTimes, 0, 0),
  749. Fill = Brushes.BlueViolet,
  750. };
  751. if (data.StudentType == StudentType.Robot)
  752. icon.Fill = Brushes.Gray;
  753. TextBox num = new()
  754. {
  755. FontSize = 7 * UpperLayerOfMap.ActualHeight / 650,
  756. Width = 2 * radiusTimes * unitWidth,
  757. Height = 2 * radiusTimes * unitHeight,
  758. Text = Convert.ToString(data.PlayerId),
  759. HorizontalAlignment = HorizontalAlignment.Left,
  760. VerticalAlignment = VerticalAlignment.Top,
  761. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * radiusTimes, data.X * unitHeight / 1000.0 - unitHeight * radiusTimes, 0, 0),
  762. Background = Brushes.Transparent,
  763. BorderBrush = Brushes.Transparent,
  764. IsReadOnly = true,
  765. Foreground = Brushes.White,
  766. };
  767. if (data.StudentType == StudentType.Robot)
  768. num.Text = Convert.ToString(data.PlayerId - Preparation.Utility.GameData.numOfPeople);
  769. UpperLayerOfMap.Children.Add(icon);
  770. UpperLayerOfMap.Children.Add(num);
  771. }
  772. }
  773. foreach (var data in listOfButcher)
  774. {
  775. StatusBarsOfHunter.SetValue(data);
  776. if (CanSee(data))
  777. {
  778. Ellipse icon = new()
  779. {
  780. Width = 2 * radiusTimes * unitWidth,
  781. Height = 2 * radiusTimes * unitHeight,
  782. HorizontalAlignment = HorizontalAlignment.Left,
  783. VerticalAlignment = VerticalAlignment.Top,
  784. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * radiusTimes, data.X * unitHeight / 1000.0 - unitHeight * radiusTimes, 0, 0),
  785. Fill = Brushes.Chocolate,
  786. };
  787. UpperLayerOfMap.Children.Add(icon);
  788. }
  789. }
  790. foreach (var data in listOfProp)
  791. {
  792. if (CanSee(data))
  793. {
  794. switch (data.Type)
  795. {
  796. case Protobuf.PropType.Key3:
  797. DrawProp(data, "🔑");
  798. break;
  799. case Protobuf.PropType.Key5:
  800. DrawProp(data, "🔑");
  801. break;
  802. case Protobuf.PropType.Key6:
  803. DrawProp(data, "🔑");
  804. break;
  805. case Protobuf.PropType.AddSpeed:
  806. DrawProp(data, "⛸");
  807. break;
  808. case Protobuf.PropType.AddHpOrAp:
  809. DrawProp(data, "♥");
  810. break;
  811. case Protobuf.PropType.AddLifeOrClairaudience:
  812. DrawProp(data, "🏅");
  813. break;
  814. case Protobuf.PropType.ShieldOrSpear:
  815. DrawProp(data, "🛡");
  816. break;
  817. case Protobuf.PropType.RecoveryFromDizziness:
  818. DrawProp(data, "🕶");
  819. break;
  820. default:
  821. DrawProp(data, "");
  822. break;
  823. }
  824. }
  825. }
  826. foreach (var data in listOfBullet)
  827. {
  828. if (CanSee(data))
  829. {
  830. Ellipse icon = new()
  831. {
  832. Width = 2 * bulletRadiusTimes * unitWidth,
  833. Height = 2 * bulletRadiusTimes * unitHeight,
  834. HorizontalAlignment = HorizontalAlignment.Left,
  835. VerticalAlignment = VerticalAlignment.Top,
  836. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bulletRadiusTimes, data.X * unitHeight / 1000.0 - unitHeight * bulletRadiusTimes, 0, 0),
  837. Fill = Brushes.Red,
  838. };
  839. switch (data.Type)
  840. {
  841. case Protobuf.BulletType.FlyingKnife:
  842. icon.Fill = Brushes.Blue;
  843. break;
  844. case Protobuf.BulletType.CommonAttackOfTricker:
  845. case Protobuf.BulletType.BombBomb:
  846. case Protobuf.BulletType.JumpyDumpty:
  847. icon.Fill = Brushes.Red;
  848. break;
  849. default:
  850. break;
  851. }
  852. UpperLayerOfMap.Children.Add(icon);
  853. }
  854. }
  855. foreach (var data in listOfBombedBullet)
  856. {
  857. if (CanSee(data))
  858. {
  859. switch (data.Type)
  860. {
  861. case Protobuf.BulletType.BombBomb:
  862. {
  863. double bombRange = 1.0 * data.BombRange / Preparation.Utility.GameData.numOfPosGridPerCell;
  864. Ellipse icon = new()
  865. {
  866. Width = 2 * bombRange * unitWidth,
  867. Height = 2 * bombRange * unitHeight,
  868. HorizontalAlignment = HorizontalAlignment.Left,
  869. VerticalAlignment = VerticalAlignment.Top,
  870. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bombRange, data.X * unitHeight / 1000.0 - unitHeight * bombRange, 0, 0),
  871. Fill = Brushes.DarkRed,
  872. };
  873. UpperLayerOfMap.Children.Add(icon);
  874. break;
  875. }
  876. case Protobuf.BulletType.JumpyDumpty:
  877. {
  878. double bombRange = 1.0 * data.BombRange / Preparation.Utility.GameData.numOfPosGridPerCell;
  879. Ellipse icon = new()
  880. {
  881. Width = 2 * bombRange * unitWidth,
  882. Height = 2 * bombRange * unitHeight,
  883. HorizontalAlignment = HorizontalAlignment.Left,
  884. VerticalAlignment = VerticalAlignment.Top,
  885. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bombRange, data.X * unitHeight / 1000.0 - unitHeight * bombRange, 0, 0),
  886. Fill = Brushes.DarkRed,
  887. };
  888. UpperLayerOfMap.Children.Add(icon);
  889. break;
  890. }
  891. //case Protobuf.BulletType.LineBullet:
  892. // {
  893. // double bombRange = data.BombRange / 1000;
  894. // DrawLaser(new Point(data.Y * unitWidth / 1000.0, data.X * unitHeight / 1000.0), -data.FacingDirection + Math.PI / 2, bombRange * unitHeight, 0.5 * unitWidth);
  895. // break;
  896. // }
  897. default:
  898. break;
  899. }
  900. }
  901. }
  902. foreach (var data in listOfClassroom)
  903. {
  904. int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfFixedGenerator);
  905. TextBox icon = new()
  906. {
  907. FontSize = 8 * UpperLayerOfMap.ActualHeight / 650,
  908. Width = unitWidth,
  909. Height = unitHeight,
  910. Text = Convert.ToString(deg),
  911. HorizontalAlignment = HorizontalAlignment.Left,
  912. VerticalAlignment = VerticalAlignment.Top,
  913. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  914. Background = Brushes.Transparent,
  915. BorderBrush = Brushes.Transparent,
  916. IsReadOnly = true
  917. };
  918. if (deg == 100)
  919. {
  920. icon.Text = "A+";
  921. }
  922. UpperLayerOfMap.Children.Add(icon);
  923. }
  924. foreach (var data in listOfChest)
  925. {
  926. int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfOpenedChest);
  927. TextBox icon = new()
  928. {
  929. FontSize = 8 * UpperLayerOfMap.ActualHeight / 650,
  930. Width = unitWidth,
  931. Height = unitHeight,
  932. Text = Convert.ToString(deg),
  933. HorizontalAlignment = HorizontalAlignment.Left,
  934. VerticalAlignment = VerticalAlignment.Top,
  935. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  936. Background = Brushes.Transparent,
  937. BorderBrush = Brushes.Transparent,
  938. IsReadOnly = true
  939. };
  940. if (deg == 100)
  941. {
  942. icon.Text = "Ø";
  943. }
  944. UpperLayerOfMap.Children.Add(icon);
  945. }
  946. foreach (var data in listOfGate)
  947. {
  948. int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfOpenedDoorway);
  949. TextBox icon = new()
  950. {
  951. FontSize = 8 * UpperLayerOfMap.ActualHeight / 650,
  952. Width = unitWidth,
  953. Height = unitHeight,
  954. Text = Convert.ToString(deg),
  955. HorizontalAlignment = HorizontalAlignment.Left,
  956. VerticalAlignment = VerticalAlignment.Top,
  957. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  958. Background = Brushes.Transparent,
  959. BorderBrush = Brushes.Transparent,
  960. IsReadOnly = true
  961. };
  962. if (deg == 100)
  963. {
  964. gateOpened = true;
  965. icon.Text = "🔓";
  966. }
  967. UpperLayerOfMap.Children.Add(icon);
  968. }
  969. foreach (var data in listOfDoor)
  970. {
  971. TextBox icon = new()
  972. {
  973. FontSize = 9 * UpperLayerOfMap.ActualHeight / 650,
  974. Width = unitWidth,
  975. Height = unitHeight,
  976. HorizontalAlignment = HorizontalAlignment.Left,
  977. VerticalAlignment = VerticalAlignment.Top,
  978. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  979. Background = Brushes.Transparent,
  980. BorderBrush = Brushes.Transparent,
  981. IsReadOnly = true
  982. };
  983. if (data.IsOpen)
  984. {
  985. icon.Text = Convert.ToString("🔓");
  986. }
  987. else
  988. {
  989. icon.Text = Convert.ToString("🔒");
  990. }
  991. UpperLayerOfMap.Children.Add(icon);
  992. }
  993. foreach (var data in listOfHiddenGate)
  994. {
  995. if (!isEmergencyDrawed)
  996. {
  997. mapPatches[data.X / Preparation.Utility.GameData.numOfPosGridPerCell, data.Y / Preparation.Utility.GameData.numOfPosGridPerCell].Fill = Brushes.LightSalmon;
  998. mapPatches[data.X / Preparation.Utility.GameData.numOfPosGridPerCell, data.Y / Preparation.Utility.GameData.numOfPosGridPerCell].Stroke = Brushes.LightSalmon;
  999. isEmergencyDrawed = true;
  1000. }
  1001. if (data.Opened)
  1002. {
  1003. isEmergencyOpened = true;
  1004. TextBox icon = new()
  1005. {
  1006. FontSize = 9 * UpperLayerOfMap.ActualHeight / 650,
  1007. Width = unitWidth,
  1008. Height = unitHeight,
  1009. Text = Convert.ToString("🔓"),
  1010. HorizontalAlignment = HorizontalAlignment.Left,
  1011. VerticalAlignment = VerticalAlignment.Top,
  1012. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  1013. Background = Brushes.Transparent,
  1014. BorderBrush = Brushes.Transparent,
  1015. IsReadOnly = true
  1016. };
  1017. UpperLayerOfMap.Children.Add(icon);
  1018. }
  1019. }
  1020. //}
  1021. ZoomMap();
  1022. }
  1023. catch (Exception exc)
  1024. {
  1025. ErrorDisplayer error = new("Error: " + exc.ToString());
  1026. error.Show();
  1027. isClientStocked = true;
  1028. PorC.Content = "▶";
  1029. }
  1030. }
  1031. counter++;
  1032. }
  1033. }
  1034. // 键盘控制,未完善
  1035. private void KeyBoardControl(object sender, KeyEventArgs e)
  1036. {
  1037. if (!isPlaybackMode && !isSpectatorMode)
  1038. {
  1039. switch (e.Key)
  1040. {
  1041. case Key.W:
  1042. case Key.NumPad8:
  1043. MoveMsg msgW = new()
  1044. {
  1045. PlayerId = playerID,
  1046. TimeInMilliseconds = 25,
  1047. Angle = Math.PI
  1048. };
  1049. client.Move(msgW);
  1050. break;
  1051. case Key.S:
  1052. case Key.NumPad2:
  1053. MoveMsg msgS = new()
  1054. {
  1055. PlayerId = playerID,
  1056. TimeInMilliseconds = 25,
  1057. Angle = 0
  1058. };
  1059. client.Move(msgS);
  1060. break;
  1061. case Key.D:
  1062. case Key.NumPad6:
  1063. MoveMsg msgD = new()
  1064. {
  1065. PlayerId = playerID,
  1066. TimeInMilliseconds = 25,
  1067. Angle = Math.PI / 2
  1068. };
  1069. client.Move(msgD);
  1070. break;
  1071. case Key.A:
  1072. case Key.NumPad4:
  1073. MoveMsg msgA = new()
  1074. {
  1075. PlayerId = playerID,
  1076. TimeInMilliseconds = 25,
  1077. Angle = 3 * Math.PI / 2
  1078. };
  1079. client.Move(msgA);
  1080. break;
  1081. case Key.J:
  1082. AttackMsg msgJ = new()
  1083. {
  1084. PlayerId = playerID,
  1085. Angle = Math.PI
  1086. };
  1087. client.Attack(msgJ);
  1088. break;
  1089. case Key.K:
  1090. IDMsg msgK = new()
  1091. {
  1092. PlayerId = playerID,
  1093. };
  1094. client.StartLearning(msgK);
  1095. break;
  1096. case Key.R:
  1097. TreatAndRescueMsg msgR = new()
  1098. {
  1099. PlayerId = playerID,
  1100. ToPlayerId = -1,
  1101. };
  1102. client.StartRescueMate(msgR);
  1103. break;
  1104. case Key.T:
  1105. TreatAndRescueMsg msgT = new()
  1106. {
  1107. PlayerId = playerID,
  1108. ToPlayerId = -1,
  1109. };
  1110. client.StartTreatMate(msgT);
  1111. break;
  1112. case Key.G:
  1113. IDMsg msgG = new()
  1114. {
  1115. PlayerId = playerID,
  1116. };
  1117. client.Graduate(msgG);
  1118. break;
  1119. case Key.H:
  1120. IDMsg msgH = new()
  1121. {
  1122. PlayerId = playerID,
  1123. };
  1124. client.StartOpenGate(msgH);
  1125. break;
  1126. case Key.O:
  1127. IDMsg msgO = new()
  1128. {
  1129. PlayerId = playerID,
  1130. };
  1131. client.OpenDoor(msgO);
  1132. break;
  1133. case Key.P:
  1134. IDMsg msgP = new()
  1135. {
  1136. PlayerId = playerID,
  1137. };
  1138. client.CloseDoor(msgP);
  1139. break;
  1140. case Key.U:
  1141. IDMsg msgU = new()
  1142. {
  1143. PlayerId = playerID,
  1144. };
  1145. client.SkipWindow(msgU);
  1146. break;
  1147. case Key.I:
  1148. IDMsg msgI = new()
  1149. {
  1150. PlayerId = playerID,
  1151. };
  1152. client.StartOpenChest(msgI);
  1153. break;
  1154. case Key.E:
  1155. IDMsg msgE = new()
  1156. {
  1157. PlayerId = playerID,
  1158. };
  1159. client.EndAllAction(msgE);
  1160. break;
  1161. case Key.F:
  1162. PropMsg msgF = new()
  1163. {
  1164. PlayerId = playerID,
  1165. PropType = Protobuf.PropType.NullPropType,
  1166. };
  1167. client.PickProp(msgF);
  1168. break;
  1169. case Key.C:
  1170. PropMsg msgC = new()
  1171. {
  1172. PlayerId = playerID,
  1173. PropType = Protobuf.PropType.NullPropType,
  1174. };
  1175. client.ThrowProp(msgC);
  1176. break;
  1177. case Key.V:
  1178. PropMsg msgV = new()
  1179. {
  1180. PlayerId = playerID,
  1181. PropType = Protobuf.PropType.NullPropType,
  1182. };
  1183. client.UseProp(msgV);
  1184. break;
  1185. case Key.B:
  1186. SkillMsg msgB = new()
  1187. {
  1188. PlayerId = playerID,
  1189. SkillId = 0,
  1190. };
  1191. client.UseSkill(msgB);
  1192. break;
  1193. case Key.N:
  1194. SkillMsg msgN = new()
  1195. {
  1196. PlayerId = playerID,
  1197. SkillId = 1,
  1198. };
  1199. client.UseSkill(msgN);
  1200. break;
  1201. case Key.M:
  1202. SkillMsg msgM = new()
  1203. {
  1204. PlayerId = playerID,
  1205. SkillId = 2,
  1206. };
  1207. client.UseSkill(msgM);
  1208. break;
  1209. default:
  1210. break;
  1211. }
  1212. }
  1213. }
  1214. //鼠标双击
  1215. private void Attack(object sender, RoutedEventArgs e)
  1216. {
  1217. if (!isPlaybackMode && !isSpectatorMode)
  1218. {
  1219. if (humanOrButcher && human != null)
  1220. {
  1221. AttackMsg msgJ = new()
  1222. {
  1223. PlayerId = playerID
  1224. };
  1225. double mouseY = Mouse.GetPosition(UpperLayerOfMap).X * 1000 / unitWidth;
  1226. double mouseX = Mouse.GetPosition(UpperLayerOfMap).Y * 1000 / unitHeight;
  1227. msgJ.Angle = Math.Atan2(mouseY - human.Y, mouseX - human.X);
  1228. client.Attack(msgJ);
  1229. }
  1230. if (!humanOrButcher && butcher != null)
  1231. {
  1232. AttackMsg msgJ = new()
  1233. {
  1234. PlayerId = playerID
  1235. };
  1236. double mouseY = Mouse.GetPosition(UpperLayerOfMap).X * 1000 / unitWidth;
  1237. double mouseX = Mouse.GetPosition(UpperLayerOfMap).Y * 1000 / unitHeight;
  1238. msgJ.Angle = Math.Atan2(mouseY - butcher.Y, mouseX - butcher.X);
  1239. client.Attack(msgJ);
  1240. }
  1241. }
  1242. }
  1243. // 之后需要修改,现在只具有修改按钮形状的功能,并不能实现暂停/继续
  1244. private void ClickToPauseOrContinue(object sender, RoutedEventArgs e)
  1245. {
  1246. if (!isClientStocked)
  1247. {
  1248. isClientStocked = true;
  1249. PorC.Content = "▶";
  1250. }
  1251. else
  1252. {
  1253. try
  1254. {
  1255. isClientStocked = false;
  1256. PorC.Content = "⏸";
  1257. }
  1258. catch (Exception ex)
  1259. {
  1260. ErrorDisplayer error = new("发生错误。以下是系统报告:\n" + ex.ToString());
  1261. error.Show();
  1262. }
  1263. }
  1264. }
  1265. // 未复现
  1266. private void ClickToConnect(object sender, RoutedEventArgs e)
  1267. {
  1268. }
  1269. // 窗口最大化、关闭、最小化、拖拽
  1270. private void ClickToMaxmize(object sender, RoutedEventArgs e)
  1271. {
  1272. if (WindowState != WindowState.Maximized)
  1273. WindowState = WindowState.Maximized;
  1274. else
  1275. WindowState = WindowState.Normal;
  1276. }
  1277. private void ClickToClose(object sender, RoutedEventArgs e)
  1278. {
  1279. Application.Current.Shutdown();
  1280. }
  1281. private void ClickToMinimize(object sender, RoutedEventArgs e)
  1282. {
  1283. WindowState = WindowState.Minimized;
  1284. }
  1285. private void DragWindow(object sender, RoutedEventArgs e)
  1286. {
  1287. DragMove();
  1288. }
  1289. // 寻求帮助、访问EESAST(部分功能未复原)
  1290. private void ClickForHelp(object sender, RoutedEventArgs e)
  1291. {
  1292. PleaseWait();
  1293. }
  1294. private void ClickToVisitEESAST(object sender, RoutedEventArgs e)
  1295. {
  1296. try
  1297. {
  1298. _ = Process.Start("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe", "https://eesast.com");
  1299. }
  1300. catch (Exception)
  1301. {
  1302. //ErrorDisplayer error = new("发生错误。以下是系统报告\n" + exc.ToString());
  1303. //error.Show();
  1304. }
  1305. }
  1306. // 配置连接(未复原)、我的AI(THUAI5未实现)、获取更新、天梯信息(可能需要网站协助)
  1307. private void ClickToSetConnect(object sender, RoutedEventArgs e)
  1308. {
  1309. // ConnectRegister crg = new();
  1310. // crg.Show();
  1311. }
  1312. private void ClickToEnterVS(object sender, RoutedEventArgs e)
  1313. {
  1314. // try
  1315. //{
  1316. // if (!File.Exists("VSRoute.txt"))
  1317. // {
  1318. // File.Create("VSRoute.txt");
  1319. // Exception ex = new("没有路径存储文件,已为您创建。请将VS路径输入该文件,并重新操作。");
  1320. // throw ex;
  1321. // }//创建路径文件
  1322. // using StreamReader sr = new("VSRoute.txt");
  1323. // _ = Process.Start(sr.ReadLine());
  1324. // }
  1325. // catch (Exception exc)
  1326. //{
  1327. // ErrorDisplayer error = new("发生错误。以下是系统报告:\n" + exc.ToString());
  1328. // error.Show();
  1329. // }
  1330. PleaseWait();
  1331. }
  1332. private void ClickForUpdate(object sender, RoutedEventArgs e)
  1333. {
  1334. PleaseWait();
  1335. }
  1336. private void ClickToCheckLadder(object sender, RoutedEventArgs e)
  1337. {
  1338. PleaseWait();
  1339. }
  1340. // 敬请期待函数
  1341. private void PleaseWait()
  1342. {
  1343. try
  1344. {
  1345. throw new Exception("敬请期待");
  1346. }
  1347. catch (Exception)
  1348. {
  1349. //ErrorDisplayer error = new(exc.Message)
  1350. //error.Show()
  1351. }
  1352. }
  1353. // 以下为Mainwindow自定义属性
  1354. private readonly DispatcherTimer timer; // 定时器
  1355. private long counter; // 预留的取时间变量
  1356. AvailableService.AvailableServiceClient client;
  1357. AsyncServerStreamingCall<MessageToClient>? responseStream;
  1358. private StatusBarOfSurvivor[] StatusBarsOfSurvivor;
  1359. private StatusBarOfHunter StatusBarsOfHunter;
  1360. private StatusBarOfCircumstance StatusBarsOfCircumstance;
  1361. private bool isClientStocked;
  1362. private bool isPlaybackMode;
  1363. private long playerID;
  1364. private PlayerType playerType;
  1365. private double unit;
  1366. private double unitHeight;
  1367. private double unitWidth;
  1368. private readonly Rectangle[,] mapPatches = new Rectangle[50, 50];
  1369. private List<MessageOfProp> listOfProp;
  1370. private List<MessageOfStudent> listOfHuman;
  1371. private List<MessageOfTricker> listOfButcher;
  1372. private List<MessageOfBullet> listOfBullet;
  1373. private List<MessageOfBombedBullet> listOfBombedBullet;
  1374. private List<MessageOfAll> listOfAll;
  1375. private List<MessageOfChest> listOfChest;
  1376. private List<MessageOfClassroom> listOfClassroom;
  1377. private List<MessageOfDoor> listOfDoor;
  1378. private List<MessageOfGate> listOfGate;
  1379. private List<MessageOfHiddenGate> listOfHiddenGate;
  1380. private object drawPicLock = new object();
  1381. private MessageOfStudent? human = null;
  1382. private MessageOfTricker? butcher = null;
  1383. private bool humanOrButcher;//true for human
  1384. private bool bonusflag;
  1385. private bool mapFlag = false;
  1386. private bool hasDrawed = false;
  1387. public int[,] defaultMap = new int[,] {
  1388. { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 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出生点
  1389. { 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 9, 0, 0, 0, 6 },
  1435. { 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 },
  1436. { 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 },
  1437. { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }
  1438. };
  1439. private string[] comInfo = new string[5];
  1440. ArgumentOptions? options = null;
  1441. bool gateOpened = false;
  1442. bool isSpectatorMode = false;
  1443. bool isEmergencyOpened = false;
  1444. bool isEmergencyDrawed = false;
  1445. bool isDataFixed = false;
  1446. const double radiusTimes = 1.0 * Preparation.Utility.GameData.characterRadius / Preparation.Utility.GameData.numOfPosGridPerCell;
  1447. const double bulletRadiusTimes = 1.0 * GameData.bulletRadius / Preparation.Utility.GameData.numOfPosGridPerCell;
  1448. private int[] totalLife = new int[4] { 100, 100, 100, 100 }, totalDeath = new int[4] { 100, 100, 100, 100 };
  1449. private int[,] coolTime = new int[3, 5] { { 100, 100, 100, 100, 100 }, { 100, 100, 100, 100, 100 }, { 100, 100, 100, 100, 100 } };
  1450. }
  1451. }