diff --git a/logic/Client/MainWindow.xaml.cs b/logic/Client/MainWindow.xaml.cs index 7b9f6d1..f687207 100644 --- a/logic/Client/MainWindow.xaml.cs +++ b/logic/Client/MainWindow.xaml.cs @@ -57,6 +57,7 @@ namespace Client listOfClassroom = new List(); listOfDoor = new List(); listOfGate = new List(); + listOfHiddenGate = new List(); WindowStartupLocation = WindowStartupLocation.CenterScreen; ReactToCommandline(); } @@ -153,7 +154,7 @@ namespace Client { var pbClient = new PlaybackClient(fileName, pbSpeed); int[,]? map; - if ((map = pbClient.ReadDataFromFile(listOfProp, listOfHuman, listOfButcher, listOfBullet, listOfBombedBullet, listOfAll, listOfChest, listOfClassroom, listOfDoor, listOfGate, drawPicLock)) != null) + if ((map = pbClient.ReadDataFromFile(listOfProp, listOfHuman, listOfButcher, listOfBullet, listOfBombedBullet, listOfAll, listOfChest, listOfClassroom, listOfDoor, listOfHiddenGate, listOfGate, drawPicLock)) != null) { isClientStocked = false; isPlaybackMode = true; @@ -325,14 +326,6 @@ namespace Client mapPatches[i, j].Stroke = Brushes.LightSkyBlue; break;//gate case 10: - foreach (var obj in listOfAll) - { - if (obj.SubjectFinished >= Preparation.Utility.GameData.numOfGeneratorRequiredForEmergencyExit) - { - mapPatches[i, j].Fill = Brushes.LightSalmon; - mapPatches[i, j].Stroke = Brushes.LightSalmon; - } - } break;//emergency case 11: mapPatches[i, j].Fill = Brushes.Gray; @@ -404,6 +397,7 @@ namespace Client listOfChest.Clear(); listOfClassroom.Clear(); listOfDoor.Clear(); + listOfHiddenGate.Clear(); listOfGate.Clear(); MessageToClient content = responseStream.ResponseStream.Current; switch (content.GameState) @@ -508,11 +502,13 @@ namespace Client case MessageOfObj.MessageOfObjOneofCase.GateMessage: listOfGate.Add(obj.GateMessage); break; + case MessageOfObj.MessageOfObjOneofCase.HiddenGateMessage: + listOfHiddenGate.Add(obj.HiddenGateMessage); + break; } } listOfAll.Add(content.AllMessage); break; - case GameState.GameEnd: foreach (var obj in content.ObjMessage) { @@ -545,6 +541,9 @@ namespace Client case MessageOfObj.MessageOfObjOneofCase.GateMessage: listOfGate.Add(obj.GateMessage); break; + case MessageOfObj.MessageOfObjOneofCase.HiddenGateMessage: + listOfHiddenGate.Add(obj.HiddenGateMessage); + break; } } listOfAll.Add(content.AllMessage); @@ -567,7 +566,7 @@ namespace Client //待修改 private bool CanSee(MessageOfStudent msg) { - if (msg.PlayerState == PlayerState.Quit) + if (msg.PlayerState == PlayerState.Quit || msg.PlayerState == PlayerState.Graduated) return false; if (isSpectatorMode) return true; @@ -703,7 +702,7 @@ namespace Client { foreach (var data in listOfAll) { - StatusBarsOfCircumstance.SetValue(data, gateOpened); + StatusBarsOfCircumstance.SetValue(data, gateOpened, isEmergencyDrawed, isEmergencyOpened); } if (!hasDrawed && mapFlag) DrawMap(); @@ -937,6 +936,19 @@ namespace Client } UpperLayerOfMap.Children.Add(icon); } + foreach (var data in listOfHiddenGate) + { + if (!isEmergencyDrawed) + { + mapPatches[data.X / Preparation.Utility.GameData.numOfPosGridPerCell, data.Y / Preparation.Utility.GameData.numOfPosGridPerCell].Fill = Brushes.LightSalmon; + mapPatches[data.X / Preparation.Utility.GameData.numOfPosGridPerCell, data.Y / Preparation.Utility.GameData.numOfPosGridPerCell].Stroke = Brushes.LightSalmon; + isEmergencyDrawed = true; + } + if (data.Opened && !isEmergencyOpened) + { + isEmergencyOpened = true; + } + } //} ZoomMap(); } @@ -1298,6 +1310,7 @@ namespace Client private List listOfClassroom; private List listOfDoor; private List listOfGate; + private List listOfHiddenGate; private object drawPicLock = new object(); private MessageOfStudent? human = null; private MessageOfTricker? butcher = null; @@ -1363,6 +1376,8 @@ namespace Client ArgumentOptions? options = null; bool gateOpened = false; bool isSpectatorMode = false; + bool isEmergencyOpened = false; + bool isEmergencyDrawed = false; double coolTime0 = -1, coolTime1 = -1, coolTime2 = -1; const double radiusTimes = 1.0 * Preparation.Utility.GameData.characterRadius / Preparation.Utility.GameData.numOfPosGridPerCell; } diff --git a/logic/Client/PlaybackClient.cs b/logic/Client/PlaybackClient.cs index a09a6ed..af923ca 100644 --- a/logic/Client/PlaybackClient.cs +++ b/logic/Client/PlaybackClient.cs @@ -38,7 +38,7 @@ namespace Client public int[,]? ReadDataFromFile(List listOfProp, List listOfHuman, List listOfButcher, List listOfBullet, List listOfBombedBullet, List listOfAll, List listOfChest, List listOfClassroom, - List listOfDoor, List listOfGate, object dataLock) + List listOfDoor, List listOfHiddenGate, List listOfGate, object dataLock) { if (Reader == null) return null; @@ -103,6 +103,7 @@ namespace Client listOfChest.Clear(); listOfClassroom.Clear(); listOfDoor.Clear(); + listOfHiddenGate.Clear(); listOfGate.Clear(); switch (content.GameState) { @@ -146,6 +147,9 @@ namespace Client case MessageOfObj.MessageOfObjOneofCase.GateMessage: listOfGate.Add(obj.GateMessage); break; + case MessageOfObj.MessageOfObjOneofCase.HiddenGateMessage: + listOfHiddenGate.Add(obj.HiddenGateMessage); + break; case MessageOfObj.MessageOfObjOneofCase.MapMessage: break; } @@ -189,6 +193,9 @@ namespace Client case MessageOfObj.MessageOfObjOneofCase.DoorMessage: listOfDoor.Add(obj.DoorMessage); break; + case MessageOfObj.MessageOfObjOneofCase.HiddenGateMessage: + listOfHiddenGate.Add(obj.HiddenGateMessage); + break; case MessageOfObj.MessageOfObjOneofCase.GateMessage: listOfGate.Add(obj.GateMessage); break; @@ -226,6 +233,9 @@ namespace Client case MessageOfObj.MessageOfObjOneofCase.DoorMessage: listOfDoor.Add(obj.DoorMessage); break; + case MessageOfObj.MessageOfObjOneofCase.HiddenGateMessage: + listOfHiddenGate.Add(obj.HiddenGateMessage); + break; case MessageOfObj.MessageOfObjOneofCase.GateMessage: listOfGate.Add(obj.GateMessage); break; diff --git a/logic/Client/StatusBarOfCircumstance.xaml.cs b/logic/Client/StatusBarOfCircumstance.xaml.cs index b4294b6..c00da1f 100644 --- a/logic/Client/StatusBarOfCircumstance.xaml.cs +++ b/logic/Client/StatusBarOfCircumstance.xaml.cs @@ -36,9 +36,8 @@ namespace Client scoresOfStudents.FontSize = scoresOfTrickers.FontSize = fontsize; } - public void SetValue(MessageOfAll obj, bool gateOpened) + public void SetValue(MessageOfAll obj, bool gateOpened, bool hiddenGateRefreshed, bool hiddenGateOpened) { - bool hiddenGateRefreshed = false, hiddenGateOpened = false; time.Text = "Time⏳: " + Convert.ToString(obj.GameTime); status.Text = "📱: " + Convert.ToString(obj.SubjectFinished) + "\n🚪: "; if (gateOpened) @@ -49,14 +48,14 @@ namespace Client { status.Text += "Close\n🆘: "; } - if (obj.SubjectFinished >= Preparation.Utility.GameData.numOfGeneratorRequiredForEmergencyExit) - { - hiddenGateRefreshed = true; - } - if (Preparation.Utility.GameData.numOfStudent == 1 + obj.StudentQuited + obj.StudentGraduated) - { - hiddenGateOpened = true; - } + //if (obj.SubjectFinished >= Preparation.Utility.GameData.numOfGeneratorRequiredForEmergencyExit) + //{ + // hiddenGateRefreshed = true; + //} + //if (Preparation.Utility.GameData.numOfStudent == 1 + obj.StudentQuited + obj.StudentGraduated) + //{ + // hiddenGateOpened = true; + //} if (hiddenGateRefreshed) { if (hiddenGateOpened) diff --git a/logic/cmd/gameServer.cmd b/logic/cmd/gameServer.cmd index aaca460..7df8362 100644 --- a/logic/cmd/gameServer.cmd +++ b/logic/cmd/gameServer.cmd @@ -1,17 +1,25 @@ @echo off -start cmd /k ..\Server\bin\Debug\net6.0\Server.exe --ip 0.0.0.0 --port 8888 --studentCount 2 --trickerCount 1 --gameTimeInSecond 600 --fileName test +start cmd /k ..\Server\bin\Debug\net6.0\Server.exe --ip 0.0.0.0 --port 8888 --studentCount 4 --trickerCount 1 --gameTimeInSecond 600 --fileName test ping -n 2 127.0.0.1 > NUL -start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --port 8888 --characterID 4 --type 2 --occupation 1 +start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --port 8888 --characterID 4 --type 2 --occupation 3 ping -n 2 127.0.0.1 > NUL -start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --port 8888 --characterID 0 --type 1 --occupation 2 +start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --port 8888 --characterID 0 --type 1 --occupation 3 ping -n 2 127.0.0.1 > NUL -start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --port 8888 --characterID 1 --type 1 --occupation 5 +start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --port 8888 --characterID 1 --type 1 --occupation 3 + +ping -n 2 127.0.0.1 > NUL + +start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --port 8888 --characterID 2 --type 1 --occupation 3 + +ping -n 2 127.0.0.1 > NUL + +start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --port 8888 --characterID 3 --type 1 --occupation 3 ping -n 2 127.0.0.1 > NUL \ No newline at end of file diff --git a/logic/cmd/playback.cmd b/logic/cmd/playback.cmd index 018b69a..8bb70ea 100644 --- a/logic/cmd/playback.cmd +++ b/logic/cmd/playback.cmd @@ -1,5 +1,5 @@ @echo off -start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --playbackFile D:\2_autumn\thuai6\THUAI6\logic\cmd\test.thuaipb +start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --playbackFile .\test.thuaipb --playbackSpeed 3 ping -n 2 127.0.0.1 > NUL \ No newline at end of file