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