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 75 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
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471
  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 (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)
  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)
  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)
  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)
  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)
  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. StatusBarsOfSurvivor[data.PlayerId].SetValue(data, data.PlayerId);
  732. if (CanSee(data))
  733. {
  734. Ellipse icon = new()
  735. {
  736. Width = 2 * radiusTimes * unitWidth,
  737. Height = 2 * radiusTimes * unitHeight,
  738. HorizontalAlignment = HorizontalAlignment.Left,
  739. VerticalAlignment = VerticalAlignment.Top,
  740. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * radiusTimes, data.X * unitHeight / 1000.0 - unitHeight * radiusTimes, 0, 0),
  741. Fill = Brushes.BlueViolet,
  742. };
  743. TextBox num = new()
  744. {
  745. FontSize = 7 * UpperLayerOfMap.ActualHeight / 650,
  746. Width = 2 * radiusTimes * unitWidth,
  747. Height = 2 * radiusTimes * unitHeight,
  748. Text = Convert.ToString(data.PlayerId),
  749. HorizontalAlignment = HorizontalAlignment.Left,
  750. VerticalAlignment = VerticalAlignment.Top,
  751. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * radiusTimes, data.X * unitHeight / 1000.0 - unitHeight * radiusTimes, 0, 0),
  752. Background = Brushes.Transparent,
  753. BorderBrush = Brushes.Transparent,
  754. IsReadOnly = true,
  755. Foreground = Brushes.White,
  756. };
  757. UpperLayerOfMap.Children.Add(icon);
  758. UpperLayerOfMap.Children.Add(num);
  759. }
  760. }
  761. foreach (var data in listOfButcher)
  762. {
  763. StatusBarsOfHunter.SetValue(data);
  764. if (CanSee(data))
  765. {
  766. Ellipse icon = new()
  767. {
  768. Width = 2 * radiusTimes * unitWidth,
  769. Height = 2 * radiusTimes * unitHeight,
  770. HorizontalAlignment = HorizontalAlignment.Left,
  771. VerticalAlignment = VerticalAlignment.Top,
  772. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * radiusTimes, data.X * unitHeight / 1000.0 - unitHeight * radiusTimes, 0, 0),
  773. Fill = Brushes.Chocolate,
  774. };
  775. UpperLayerOfMap.Children.Add(icon);
  776. }
  777. }
  778. foreach (var data in listOfProp)
  779. {
  780. if (CanSee(data))
  781. {
  782. switch (data.Type)
  783. {
  784. case Protobuf.PropType.Key3:
  785. DrawProp(data, "🔑");
  786. break;
  787. case Protobuf.PropType.Key5:
  788. DrawProp(data, "🔑");
  789. break;
  790. case Protobuf.PropType.Key6:
  791. DrawProp(data, "🔑");
  792. break;
  793. case Protobuf.PropType.AddSpeed:
  794. DrawProp(data, "⛸");
  795. break;
  796. case Protobuf.PropType.AddHpOrAp:
  797. DrawProp(data, "♥");
  798. break;
  799. case Protobuf.PropType.AddLifeOrClairaudience:
  800. DrawProp(data, "🏅");
  801. break;
  802. case Protobuf.PropType.ShieldOrSpear:
  803. DrawProp(data, "🛡");
  804. break;
  805. case Protobuf.PropType.RecoveryFromDizziness:
  806. DrawProp(data, "🕶");
  807. break;
  808. default:
  809. DrawProp(data, "");
  810. break;
  811. }
  812. }
  813. }
  814. foreach (var data in listOfBullet)
  815. {
  816. if (CanSee(data))
  817. {
  818. Ellipse icon = new()
  819. {
  820. Width = 2 * bulletRadiusTimes * unitWidth,
  821. Height = 2 * bulletRadiusTimes * unitHeight,
  822. HorizontalAlignment = HorizontalAlignment.Left,
  823. VerticalAlignment = VerticalAlignment.Top,
  824. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bulletRadiusTimes, data.X * unitHeight / 1000.0 - unitHeight * bulletRadiusTimes, 0, 0),
  825. Fill = Brushes.Red,
  826. };
  827. switch (data.Type)
  828. {
  829. case Protobuf.BulletType.FlyingKnife:
  830. icon.Fill = Brushes.Blue;
  831. break;
  832. case Protobuf.BulletType.CommonAttackOfTricker:
  833. case Protobuf.BulletType.BombBomb:
  834. case Protobuf.BulletType.JumpyDumpty:
  835. icon.Fill = Brushes.Red;
  836. break;
  837. default:
  838. break;
  839. }
  840. UpperLayerOfMap.Children.Add(icon);
  841. }
  842. }
  843. foreach (var data in listOfBombedBullet)
  844. {
  845. if (CanSee(data))
  846. {
  847. switch (data.Type)
  848. {
  849. case Protobuf.BulletType.BombBomb:
  850. {
  851. double bombRange = 1.0 * data.BombRange / Preparation.Utility.GameData.numOfPosGridPerCell;
  852. Ellipse icon = new()
  853. {
  854. Width = 2 * bombRange * unitWidth,
  855. Height = 2 * bombRange * unitHeight,
  856. HorizontalAlignment = HorizontalAlignment.Left,
  857. VerticalAlignment = VerticalAlignment.Top,
  858. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bombRange, data.X * unitHeight / 1000.0 - unitHeight * bombRange, 0, 0),
  859. Fill = Brushes.DarkRed,
  860. };
  861. UpperLayerOfMap.Children.Add(icon);
  862. break;
  863. }
  864. case Protobuf.BulletType.JumpyDumpty:
  865. {
  866. double bombRange = 1.0 * data.BombRange / Preparation.Utility.GameData.numOfPosGridPerCell;
  867. Ellipse icon = new()
  868. {
  869. Width = 2 * bombRange * unitWidth,
  870. Height = 2 * bombRange * unitHeight,
  871. HorizontalAlignment = HorizontalAlignment.Left,
  872. VerticalAlignment = VerticalAlignment.Top,
  873. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bombRange, data.X * unitHeight / 1000.0 - unitHeight * bombRange, 0, 0),
  874. Fill = Brushes.DarkRed,
  875. };
  876. UpperLayerOfMap.Children.Add(icon);
  877. break;
  878. }
  879. //case Protobuf.BulletType.LineBullet:
  880. // {
  881. // double bombRange = data.BombRange / 1000;
  882. // DrawLaser(new Point(data.Y * unitWidth / 1000.0, data.X * unitHeight / 1000.0), -data.FacingDirection + Math.PI / 2, bombRange * unitHeight, 0.5 * unitWidth);
  883. // break;
  884. // }
  885. default:
  886. break;
  887. }
  888. }
  889. }
  890. foreach (var data in listOfClassroom)
  891. {
  892. int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfFixedGenerator);
  893. TextBox icon = new()
  894. {
  895. FontSize = 8 * UpperLayerOfMap.ActualHeight / 650,
  896. Width = unitWidth,
  897. Height = unitHeight,
  898. Text = Convert.ToString(deg),
  899. HorizontalAlignment = HorizontalAlignment.Left,
  900. VerticalAlignment = VerticalAlignment.Top,
  901. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  902. Background = Brushes.Transparent,
  903. BorderBrush = Brushes.Transparent,
  904. IsReadOnly = true
  905. };
  906. if (deg == 100)
  907. {
  908. icon.Text = "A+";
  909. }
  910. UpperLayerOfMap.Children.Add(icon);
  911. }
  912. foreach (var data in listOfChest)
  913. {
  914. int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfOpenedChest);
  915. TextBox icon = new()
  916. {
  917. FontSize = 8 * UpperLayerOfMap.ActualHeight / 650,
  918. Width = unitWidth,
  919. Height = unitHeight,
  920. Text = Convert.ToString(deg),
  921. HorizontalAlignment = HorizontalAlignment.Left,
  922. VerticalAlignment = VerticalAlignment.Top,
  923. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  924. Background = Brushes.Transparent,
  925. BorderBrush = Brushes.Transparent,
  926. IsReadOnly = true
  927. };
  928. if (deg == 100)
  929. {
  930. icon.Text = "Ø";
  931. }
  932. UpperLayerOfMap.Children.Add(icon);
  933. }
  934. foreach (var data in listOfGate)
  935. {
  936. int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfOpenedDoorway);
  937. TextBox icon = new()
  938. {
  939. FontSize = 8 * UpperLayerOfMap.ActualHeight / 650,
  940. Width = unitWidth,
  941. Height = unitHeight,
  942. Text = Convert.ToString(deg),
  943. HorizontalAlignment = HorizontalAlignment.Left,
  944. VerticalAlignment = VerticalAlignment.Top,
  945. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  946. Background = Brushes.Transparent,
  947. BorderBrush = Brushes.Transparent,
  948. IsReadOnly = true
  949. };
  950. if (deg == 100)
  951. {
  952. gateOpened = true;
  953. icon.Text = "🔓";
  954. }
  955. UpperLayerOfMap.Children.Add(icon);
  956. }
  957. foreach (var data in listOfDoor)
  958. {
  959. TextBox icon = new()
  960. {
  961. FontSize = 9 * UpperLayerOfMap.ActualHeight / 650,
  962. Width = unitWidth,
  963. Height = unitHeight,
  964. HorizontalAlignment = HorizontalAlignment.Left,
  965. VerticalAlignment = VerticalAlignment.Top,
  966. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  967. Background = Brushes.Transparent,
  968. BorderBrush = Brushes.Transparent,
  969. IsReadOnly = true
  970. };
  971. if (data.IsOpen)
  972. {
  973. icon.Text = Convert.ToString("🔓");
  974. }
  975. else
  976. {
  977. icon.Text = Convert.ToString("🔒");
  978. }
  979. UpperLayerOfMap.Children.Add(icon);
  980. }
  981. foreach (var data in listOfHiddenGate)
  982. {
  983. if (!isEmergencyDrawed)
  984. {
  985. mapPatches[data.X / Preparation.Utility.GameData.numOfPosGridPerCell, data.Y / Preparation.Utility.GameData.numOfPosGridPerCell].Fill = Brushes.LightSalmon;
  986. mapPatches[data.X / Preparation.Utility.GameData.numOfPosGridPerCell, data.Y / Preparation.Utility.GameData.numOfPosGridPerCell].Stroke = Brushes.LightSalmon;
  987. isEmergencyDrawed = true;
  988. }
  989. if (data.Opened)
  990. {
  991. isEmergencyOpened = true;
  992. TextBox icon = new()
  993. {
  994. FontSize = 9 * UpperLayerOfMap.ActualHeight / 650,
  995. Width = unitWidth,
  996. Height = unitHeight,
  997. Text = Convert.ToString("🔓"),
  998. HorizontalAlignment = HorizontalAlignment.Left,
  999. VerticalAlignment = VerticalAlignment.Top,
  1000. Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth / 2, data.X * unitHeight / 1000.0 - unitHeight / 2, 0, 0),
  1001. Background = Brushes.Transparent,
  1002. BorderBrush = Brushes.Transparent,
  1003. IsReadOnly = true
  1004. };
  1005. }
  1006. }
  1007. //}
  1008. ZoomMap();
  1009. }
  1010. catch (Exception exc)
  1011. {
  1012. ErrorDisplayer error = new("Error: " + exc.ToString());
  1013. error.Show();
  1014. isClientStocked = true;
  1015. PorC.Content = "▶";
  1016. }
  1017. }
  1018. counter++;
  1019. }
  1020. }
  1021. // 键盘控制,未完善
  1022. private void KeyBoardControl(object sender, KeyEventArgs e)
  1023. {
  1024. if (!isPlaybackMode && !isSpectatorMode)
  1025. {
  1026. switch (e.Key)
  1027. {
  1028. case Key.W:
  1029. case Key.NumPad8:
  1030. MoveMsg msgW = new()
  1031. {
  1032. PlayerId = playerID,
  1033. TimeInMilliseconds = 25,
  1034. Angle = Math.PI
  1035. };
  1036. client.Move(msgW);
  1037. break;
  1038. case Key.S:
  1039. case Key.NumPad2:
  1040. MoveMsg msgS = new()
  1041. {
  1042. PlayerId = playerID,
  1043. TimeInMilliseconds = 25,
  1044. Angle = 0
  1045. };
  1046. client.Move(msgS);
  1047. break;
  1048. case Key.D:
  1049. case Key.NumPad6:
  1050. MoveMsg msgD = new()
  1051. {
  1052. PlayerId = playerID,
  1053. TimeInMilliseconds = 25,
  1054. Angle = Math.PI / 2
  1055. };
  1056. client.Move(msgD);
  1057. break;
  1058. case Key.A:
  1059. case Key.NumPad4:
  1060. MoveMsg msgA = new()
  1061. {
  1062. PlayerId = playerID,
  1063. TimeInMilliseconds = 25,
  1064. Angle = 3 * Math.PI / 2
  1065. };
  1066. client.Move(msgA);
  1067. break;
  1068. case Key.J:
  1069. AttackMsg msgJ = new()
  1070. {
  1071. PlayerId = playerID,
  1072. Angle = Math.PI
  1073. };
  1074. client.Attack(msgJ);
  1075. break;
  1076. case Key.K:
  1077. IDMsg msgK = new()
  1078. {
  1079. PlayerId = playerID,
  1080. };
  1081. client.StartLearning(msgK);
  1082. break;
  1083. case Key.R:
  1084. TreatAndRescueMsg msgR = new()
  1085. {
  1086. PlayerId = playerID,
  1087. ToPlayerId = -1,
  1088. };
  1089. client.StartRescueMate(msgR);
  1090. break;
  1091. case Key.T:
  1092. TreatAndRescueMsg msgT = new()
  1093. {
  1094. PlayerId = playerID,
  1095. ToPlayerId = -1,
  1096. };
  1097. client.StartTreatMate(msgT);
  1098. break;
  1099. case Key.G:
  1100. IDMsg msgG = new()
  1101. {
  1102. PlayerId = playerID,
  1103. };
  1104. client.Graduate(msgG);
  1105. break;
  1106. case Key.H:
  1107. IDMsg msgH = new()
  1108. {
  1109. PlayerId = playerID,
  1110. };
  1111. client.StartOpenGate(msgH);
  1112. break;
  1113. case Key.O:
  1114. IDMsg msgO = new()
  1115. {
  1116. PlayerId = playerID,
  1117. };
  1118. client.OpenDoor(msgO);
  1119. break;
  1120. case Key.P:
  1121. IDMsg msgP = new()
  1122. {
  1123. PlayerId = playerID,
  1124. };
  1125. client.CloseDoor(msgP);
  1126. break;
  1127. case Key.U:
  1128. IDMsg msgU = new()
  1129. {
  1130. PlayerId = playerID,
  1131. };
  1132. client.SkipWindow(msgU);
  1133. break;
  1134. case Key.I:
  1135. IDMsg msgI = new()
  1136. {
  1137. PlayerId = playerID,
  1138. };
  1139. client.StartOpenChest(msgI);
  1140. break;
  1141. case Key.E:
  1142. IDMsg msgE = new()
  1143. {
  1144. PlayerId = playerID,
  1145. };
  1146. client.EndAllAction(msgE);
  1147. break;
  1148. case Key.F:
  1149. PropMsg msgF = new()
  1150. {
  1151. PlayerId = playerID,
  1152. PropType = Protobuf.PropType.NullPropType,
  1153. };
  1154. client.PickProp(msgF);
  1155. break;
  1156. case Key.C:
  1157. PropMsg msgC = new()
  1158. {
  1159. PlayerId = playerID,
  1160. PropType = Protobuf.PropType.NullPropType,
  1161. };
  1162. client.ThrowProp(msgC);
  1163. break;
  1164. case Key.V:
  1165. PropMsg msgV = new()
  1166. {
  1167. PlayerId = playerID,
  1168. PropType = Protobuf.PropType.NullPropType,
  1169. };
  1170. client.UseProp(msgV);
  1171. break;
  1172. case Key.B:
  1173. SkillMsg msgB = new()
  1174. {
  1175. PlayerId = playerID,
  1176. SkillId = 0,
  1177. };
  1178. client.UseSkill(msgB);
  1179. break;
  1180. case Key.N:
  1181. SkillMsg msgN = new()
  1182. {
  1183. PlayerId = playerID,
  1184. SkillId = 1,
  1185. };
  1186. client.UseSkill(msgN);
  1187. break;
  1188. case Key.M:
  1189. SkillMsg msgM = new()
  1190. {
  1191. PlayerId = playerID,
  1192. SkillId = 2,
  1193. };
  1194. client.UseSkill(msgM);
  1195. break;
  1196. default:
  1197. break;
  1198. }
  1199. }
  1200. }
  1201. //鼠标双击
  1202. private void Attack(object sender, RoutedEventArgs e)
  1203. {
  1204. if (!isPlaybackMode && !isSpectatorMode)
  1205. {
  1206. if (humanOrButcher && human != null)
  1207. {
  1208. AttackMsg msgJ = new()
  1209. {
  1210. PlayerId = playerID
  1211. };
  1212. double mouseY = Mouse.GetPosition(UpperLayerOfMap).X * 1000 / unitWidth;
  1213. double mouseX = Mouse.GetPosition(UpperLayerOfMap).Y * 1000 / unitHeight;
  1214. msgJ.Angle = Math.Atan2(mouseY - human.Y, mouseX - human.X);
  1215. client.Attack(msgJ);
  1216. }
  1217. if (!humanOrButcher && butcher != null)
  1218. {
  1219. AttackMsg msgJ = new()
  1220. {
  1221. PlayerId = playerID
  1222. };
  1223. double mouseY = Mouse.GetPosition(UpperLayerOfMap).X * 1000 / unitWidth;
  1224. double mouseX = Mouse.GetPosition(UpperLayerOfMap).Y * 1000 / unitHeight;
  1225. msgJ.Angle = Math.Atan2(mouseY - butcher.Y, mouseX - butcher.X);
  1226. client.Attack(msgJ);
  1227. }
  1228. }
  1229. }
  1230. // 之后需要修改,现在只具有修改按钮形状的功能,并不能实现暂停/继续
  1231. private void ClickToPauseOrContinue(object sender, RoutedEventArgs e)
  1232. {
  1233. if (!isClientStocked)
  1234. {
  1235. isClientStocked = true;
  1236. PorC.Content = "▶";
  1237. }
  1238. else if (!isPlaybackMode)
  1239. {
  1240. try
  1241. {
  1242. isClientStocked = false;
  1243. PorC.Content = "⏸";
  1244. }
  1245. catch (Exception ex)
  1246. {
  1247. ErrorDisplayer error = new("发生错误。以下是系统报告:\n" + ex.ToString());
  1248. error.Show();
  1249. }
  1250. }
  1251. }
  1252. // 未复现
  1253. private void ClickToConnect(object sender, RoutedEventArgs e)
  1254. {
  1255. }
  1256. // 窗口最大化、关闭、最小化、拖拽
  1257. private void ClickToMaxmize(object sender, RoutedEventArgs e)
  1258. {
  1259. if (WindowState != WindowState.Maximized)
  1260. WindowState = WindowState.Maximized;
  1261. else
  1262. WindowState = WindowState.Normal;
  1263. }
  1264. private void ClickToClose(object sender, RoutedEventArgs e)
  1265. {
  1266. Application.Current.Shutdown();
  1267. }
  1268. private void ClickToMinimize(object sender, RoutedEventArgs e)
  1269. {
  1270. WindowState = WindowState.Minimized;
  1271. }
  1272. private void DragWindow(object sender, RoutedEventArgs e)
  1273. {
  1274. DragMove();
  1275. }
  1276. // 寻求帮助、访问EESAST(部分功能未复原)
  1277. private void ClickForHelp(object sender, RoutedEventArgs e)
  1278. {
  1279. PleaseWait();
  1280. }
  1281. private void ClickToVisitEESAST(object sender, RoutedEventArgs e)
  1282. {
  1283. try
  1284. {
  1285. _ = Process.Start("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe", "https://eesast.com");
  1286. }
  1287. catch (Exception)
  1288. {
  1289. //ErrorDisplayer error = new("发生错误。以下是系统报告\n" + exc.ToString());
  1290. //error.Show();
  1291. }
  1292. }
  1293. // 配置连接(未复原)、我的AI(THUAI5未实现)、获取更新、天梯信息(可能需要网站协助)
  1294. private void ClickToSetConnect(object sender, RoutedEventArgs e)
  1295. {
  1296. // ConnectRegister crg = new();
  1297. // crg.Show();
  1298. }
  1299. private void ClickToEnterVS(object sender, RoutedEventArgs e)
  1300. {
  1301. // try
  1302. //{
  1303. // if (!File.Exists("VSRoute.txt"))
  1304. // {
  1305. // File.Create("VSRoute.txt");
  1306. // Exception ex = new("没有路径存储文件,已为您创建。请将VS路径输入该文件,并重新操作。");
  1307. // throw ex;
  1308. // }//创建路径文件
  1309. // using StreamReader sr = new("VSRoute.txt");
  1310. // _ = Process.Start(sr.ReadLine());
  1311. // }
  1312. // catch (Exception exc)
  1313. //{
  1314. // ErrorDisplayer error = new("发生错误。以下是系统报告:\n" + exc.ToString());
  1315. // error.Show();
  1316. // }
  1317. PleaseWait();
  1318. }
  1319. private void ClickForUpdate(object sender, RoutedEventArgs e)
  1320. {
  1321. PleaseWait();
  1322. }
  1323. private void ClickToCheckLadder(object sender, RoutedEventArgs e)
  1324. {
  1325. PleaseWait();
  1326. }
  1327. // 敬请期待函数
  1328. private void PleaseWait()
  1329. {
  1330. try
  1331. {
  1332. throw new Exception("敬请期待");
  1333. }
  1334. catch (Exception)
  1335. {
  1336. //ErrorDisplayer error = new(exc.Message)
  1337. //error.Show()
  1338. }
  1339. }
  1340. // 以下为Mainwindow自定义属性
  1341. private readonly DispatcherTimer timer; // 定时器
  1342. private long counter; // 预留的取时间变量
  1343. AvailableService.AvailableServiceClient client;
  1344. AsyncServerStreamingCall<MessageToClient>? responseStream;
  1345. private StatusBarOfSurvivor[] StatusBarsOfSurvivor;
  1346. private StatusBarOfHunter StatusBarsOfHunter;
  1347. private StatusBarOfCircumstance StatusBarsOfCircumstance;
  1348. private bool isClientStocked;
  1349. private bool isPlaybackMode;
  1350. private long playerID;
  1351. private PlayerType playerType;
  1352. private double unit;
  1353. private double unitHeight;
  1354. private double unitWidth;
  1355. private readonly Rectangle[,] mapPatches = new Rectangle[50, 50];
  1356. private List<MessageOfProp> listOfProp;
  1357. private List<MessageOfStudent> listOfHuman;
  1358. private List<MessageOfTricker> listOfButcher;
  1359. private List<MessageOfBullet> listOfBullet;
  1360. private List<MessageOfBombedBullet> listOfBombedBullet;
  1361. private List<MessageOfAll> listOfAll;
  1362. private List<MessageOfChest> listOfChest;
  1363. private List<MessageOfClassroom> listOfClassroom;
  1364. private List<MessageOfDoor> listOfDoor;
  1365. private List<MessageOfGate> listOfGate;
  1366. private List<MessageOfHiddenGate> listOfHiddenGate;
  1367. private object drawPicLock = new object();
  1368. private MessageOfStudent? human = null;
  1369. private MessageOfTricker? butcher = null;
  1370. private bool humanOrButcher;//true for human
  1371. private bool bonusflag;
  1372. private bool mapFlag = false;
  1373. private bool hasDrawed = false;
  1374. public int[,] defaultMap = new int[,] {
  1375. { 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出生点
  1376. { 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草
  1377. { 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机
  1378. { 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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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, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }
  1425. };
  1426. private string[] comInfo = new string[5];
  1427. ArgumentOptions? options = null;
  1428. bool gateOpened = false;
  1429. bool isSpectatorMode = false;
  1430. bool isEmergencyOpened = false;
  1431. bool isEmergencyDrawed = false;
  1432. bool isDataFixed = false;
  1433. const double radiusTimes = 1.0 * Preparation.Utility.GameData.characterRadius / Preparation.Utility.GameData.numOfPosGridPerCell;
  1434. const double bulletRadiusTimes = 1.0 * GameData.bulletRadius / Preparation.Utility.GameData.numOfPosGridPerCell;
  1435. private int[] totalLife = new int[4] { 100, 100, 100, 100 }, totalDeath = new int[4] { 100, 100, 100, 100 };
  1436. private int[,] coolTime = new int[3, 5] { { 100, 100, 100, 100, 100 }, { 100, 100, 100, 100, 100 }, { 100, 100, 100, 100, 100 } };
  1437. }
  1438. }