Browse Source

fix: Help the hidden Gate work correctly

Help the hidden gate work correctly
tags/0.1.0
Shawqeem 3 years ago
parent
commit
f4c6cce704
5 changed files with 60 additions and 28 deletions
  1. +27
    -12
      logic/Client/MainWindow.xaml.cs
  2. +11
    -1
      logic/Client/PlaybackClient.cs
  3. +9
    -10
      logic/Client/StatusBarOfCircumstance.xaml.cs
  4. +12
    -4
      logic/cmd/gameServer.cmd
  5. +1
    -1
      logic/cmd/playback.cmd

+ 27
- 12
logic/Client/MainWindow.xaml.cs View File

@@ -57,6 +57,7 @@ namespace Client
listOfClassroom = new List<MessageOfClassroom>();
listOfDoor = new List<MessageOfDoor>();
listOfGate = new List<MessageOfGate>();
listOfHiddenGate = new List<MessageOfHiddenGate>();
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<MessageOfClassroom> listOfClassroom;
private List<MessageOfDoor> listOfDoor;
private List<MessageOfGate> listOfGate;
private List<MessageOfHiddenGate> 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;
}


+ 11
- 1
logic/Client/PlaybackClient.cs View File

@@ -38,7 +38,7 @@ namespace Client

public int[,]? ReadDataFromFile(List<MessageOfProp> listOfProp, List<MessageOfStudent> listOfHuman, List<MessageOfTricker> listOfButcher, List<MessageOfBullet> listOfBullet,
List<MessageOfBombedBullet> listOfBombedBullet, List<MessageOfAll> listOfAll, List<MessageOfChest> listOfChest, List<MessageOfClassroom> listOfClassroom,
List<MessageOfDoor> listOfDoor, List<MessageOfGate> listOfGate, object dataLock)
List<MessageOfDoor> listOfDoor, List<MessageOfHiddenGate> listOfHiddenGate, List<MessageOfGate> 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;


+ 9
- 10
logic/Client/StatusBarOfCircumstance.xaml.cs View File

@@ -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)


+ 12
- 4
logic/cmd/gameServer.cmd View File

@@ -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

+ 1
- 1
logic/cmd/playback.cmd View File

@@ -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

Loading…
Cancel
Save