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