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