From c6d5fddcb8394d037215f7198c445ef811909e33 Mon Sep 17 00:00:00 2001 From: Shawqeem <1004837646@qq.com> Date: Tue, 25 Apr 2023 15:41:01 +0800 Subject: [PATCH] fix: :bug: fix the bug that the map will not be refreshed at the beginning of a game fix the bug that the map will not be refreshed at the beginning of a game --- logic/Client/MainWindow.xaml.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/logic/Client/MainWindow.xaml.cs b/logic/Client/MainWindow.xaml.cs index 9001d75..4ab6665 100644 --- a/logic/Client/MainWindow.xaml.cs +++ b/logic/Client/MainWindow.xaml.cs @@ -300,6 +300,24 @@ namespace Client } } + private void ZoomMapAtFirst() + { + for (int i = 0; i < 50; i++) + { + for (int j = 0; j < 50; j++) + { + if (mapPatches[i, j] != null) + { + mapPatches[i, j].Width = UpperLayerOfMap.ActualWidth / 50; + mapPatches[i, j].Height = UpperLayerOfMap.ActualHeight / 50; + mapPatches[i, j].HorizontalAlignment = HorizontalAlignment.Left; + mapPatches[i, j].VerticalAlignment = VerticalAlignment.Top; + mapPatches[i, j].Margin = new Thickness(UpperLayerOfMap.ActualWidth / 50 * j, UpperLayerOfMap.ActualHeight / 50 * i, 0, 0); + } + } + } + } + private void DrawMap() { for (int i = 0; i < defaultMap.GetLength(0); i++) @@ -750,7 +768,10 @@ namespace Client StatusBarsOfCircumstance.SetValue(data, gateOpened, isEmergencyDrawed, isEmergencyOpened, playerID, isPlaybackMode); } if (!hasDrawed && mapFlag) + { DrawMap(); + ZoomMapAtFirst(); + } foreach (var data in listOfHuman) { if (data.StudentType != StudentType.Robot)