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