diff --git a/docs/QandA.md b/docs/QandA.md index 27cc151..e66d722 100644 --- a/docs/QandA.md +++ b/docs/QandA.md @@ -61,7 +61,9 @@ A: 2. 不要点重新生成,要点生成 3. 开启下图选项 ![CompileFaster](https://raw.githubusercontent.com/shangfengh/THUAI6/new/resource/CompileFaster.png) - + +Q:这是什么错误啊 +![vector](https://raw.githubusercontent.com/shangfengh/THUAI6/new/resource/vector.png) ## Python diff --git a/logic/GameClass/GameObj/Map/Map.cs b/logic/GameClass/GameObj/Map/Map.cs index 953ddb3..3cfbf49 100644 --- a/logic/GameClass/GameObj/Map/Map.cs +++ b/logic/GameClass/GameObj/Map/Map.cs @@ -232,14 +232,14 @@ namespace GameClass.GameObj break; } } + if (ToDel != null) + GameObjDict[gameObj.Type].Remove(ToDel); } finally { GameObjLockDict[gameObj.Type].ExitWriteLock(); } - if (ToDel == null) return false; - GameObjDict[gameObj.Type].Remove(ToDel); - return true; + return ToDel != null; } public bool RemoveJustFromMap(GameObj gameObj) { diff --git a/logic/GameEngine/MoveEngine.cs b/logic/GameEngine/MoveEngine.cs index 978f6c5..aa13c68 100644 --- a/logic/GameEngine/MoveEngine.cs +++ b/logic/GameEngine/MoveEngine.cs @@ -147,14 +147,16 @@ namespace GameEngine isDestroyed = true; return false; case AfterCollision.MoveMax: - MoveMax(obj, res); + if (threadNum == 0 || ((ICharacter)obj).ThreadNum == threadNum) + MoveMax(obj, res); moveVecLength = 0; res = new XY(direction, moveVecLength); break; } } while (flag); - deltaLen += moveVecLength - Math.Sqrt(obj.MovingSetPos(res, GetPlaceType(obj.Position + res))); + if (threadNum == 0 || ((ICharacter)obj).ThreadNum == threadNum) + deltaLen += moveVecLength - Math.Sqrt(obj.MovingSetPos(res, GetPlaceType(obj.Position + res))); return true; }, @@ -172,7 +174,8 @@ namespace GameEngine res = new XY(direction, moveVecLength); if ((collisionObj = collisionChecker.CheckCollisionWhenMoving(obj, res)) == null) { - obj.MovingSetPos(res, GetPlaceType(obj.Position + res)); + if (threadNum == 0 || ((ICharacter)obj).ThreadNum == threadNum) + obj.MovingSetPos(res, GetPlaceType(obj.Position + res)); } else { @@ -186,7 +189,8 @@ namespace GameEngine isDestroyed = true; break; case AfterCollision.MoveMax: - MoveMax(obj, res); + if (threadNum == 0 || ((ICharacter)obj).ThreadNum == threadNum) + MoveMax(obj, res); moveVecLength = 0; res = new XY(direction, moveVecLength); break; diff --git a/logic/Server/CopyInfo.cs b/logic/Server/CopyInfo.cs index 1e12971..d6a1423 100644 --- a/logic/Server/CopyInfo.cs +++ b/logic/Server/CopyInfo.cs @@ -272,7 +272,7 @@ namespace Server Y = chest.Position.y } }; - int progress = (chest.WhoOpen!=null) ? ((time - chest.OpenStartTime) * chest.WhoOpen.SpeedOfOpenChest) : 0; + int progress = (chest.WhoOpen != null) ? ((time - chest.OpenStartTime) * chest.WhoOpen.SpeedOfOpenChest) : 0; msg.ChestMessage.Progress = (progress > GameData.degreeOfOpenedChest) ? GameData.degreeOfOpenedChest : progress; return msg; } diff --git a/logic/cmd/gameServerAndClient.cmd b/logic/cmd/gameServerAndClient.cmd index 71f90c7..125b391 100644 --- a/logic/cmd/gameServerAndClient.cmd +++ b/logic/cmd/gameServerAndClient.cmd @@ -1,6 +1,6 @@ @echo off -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 +start cmd /k ..\Server\bin\Debug\net6.0\Server.exe --ip 0.0.0.0 --port 8888 --studentCount 0 --trickerCount 1 --gameTimeInSecond 600 --fileName test ping -n 2 127.0.0.1 > NUL diff --git a/resource/vector.png b/resource/vector.png new file mode 100644 index 0000000..72d1987 Binary files /dev/null and b/resource/vector.png differ