diff --git a/dependency/proto/Message2Clients.proto b/dependency/proto/Message2Clients.proto index d918778..51e581b 100755 --- a/dependency/proto/Message2Clients.proto +++ b/dependency/proto/Message2Clients.proto @@ -123,6 +123,7 @@ message MessageOfDoor int32 y = 2; bool is_open = 3; int32 number = 4; + int32 progress = 5; } message MessageOfChest diff --git a/dependency/proto/MessageType.proto b/dependency/proto/MessageType.proto index 0187d6f..16f06b6 100755 --- a/dependency/proto/MessageType.proto +++ b/dependency/proto/MessageType.proto @@ -24,8 +24,10 @@ enum PlaceType // 地图中的所有物件类型 GATE = 5; HIDDEN_GATE = 6; WINDOW = 7; - DOOR = 8; - CHEST = 9; + DOOR3 = 8; + DOOR5 = 9; + DOOR6 = 10; + CHEST = 11; // 待补充有特殊效果的地形 } diff --git a/logic/Client/MainWindow.xaml.cs b/logic/Client/MainWindow.xaml.cs index 5c741ed..50257a3 100644 --- a/logic/Client/MainWindow.xaml.cs +++ b/logic/Client/MainWindow.xaml.cs @@ -848,11 +848,11 @@ namespace Client }; if (data.IsOpen) { - icon.Text = Convert.ToString("开"); + icon.Text = Convert.ToString("1"); } else { - icon.Text = Convert.ToString("闭"); + icon.Text = Convert.ToString("0"); } UpperLayerOfMap.Children.Add(icon); } diff --git a/logic/Client/StatusBarOfSurvivor.xaml.cs b/logic/Client/StatusBarOfSurvivor.xaml.cs index bf19b79..8b35d13 100644 --- a/logic/Client/StatusBarOfSurvivor.xaml.cs +++ b/logic/Client/StatusBarOfSurvivor.xaml.cs @@ -83,9 +83,12 @@ namespace Client break; }//不完全 scores.Text = "Scores:" + obj.Score; - skillprogress0.Value = 100 - obj.TimeUntilSkillAvailable[0] / coolTime * 100; - skillprogress1.Value = 100 - obj.TimeUntilSkillAvailable[1] / coolTime * 100; - skillprogress2.Value = 100 - obj.TimeUntilSkillAvailable[2] / coolTime * 100; + if (obj.TimeUntilSkillAvailable[0]>=0) + skillprogress0.Value = 100 - obj.TimeUntilSkillAvailable[0] / coolTime * 100; + if(obj.TimeUntilSkillAvailable[1] >= 0) + skillprogress1.Value = 100 - obj.TimeUntilSkillAvailable[1] / coolTime * 100; + if(obj.TimeUntilSkillAvailable[2] >= 0) + skillprogress2.Value = 100 - obj.TimeUntilSkillAvailable[2] / coolTime * 100; if (obj.PlayerState == PlayerState.Quit) { skillprogress0.Value = skillprogress1.Value = skillprogress2.Value = 0; diff --git a/logic/GameClass/GameObj/Character/Character.cs b/logic/GameClass/GameObj/Character/Character.cs index 0aa7b1f..0fcfec4 100644 --- a/logic/GameClass/GameObj/Character/Character.cs +++ b/logic/GameClass/GameObj/Character/Character.cs @@ -175,7 +175,7 @@ namespace GameClass.GameObj public Dictionary BgmDictionary { get => bgmDictionary; - set + private set { lock (gameObjLock) { @@ -183,6 +183,12 @@ namespace GameClass.GameObj } } } + public void AddBgm(BgmType bgm, double value) + { + if (BgmDictionary.ContainsKey(bgm)) + BgmDictionary[bgm] = value; + else BgmDictionary.Add(bgm, value); + } private int alertnessRadius; public int AlertnessRadius diff --git a/logic/GameClass/GameObj/Map/Door.cs b/logic/GameClass/GameObj/Map/Door.cs new file mode 100644 index 0000000..fd95768 --- /dev/null +++ b/logic/GameClass/GameObj/Map/Door.cs @@ -0,0 +1,46 @@ +using Preparation.Interface; +using Preparation.Utility; + +namespace GameClass.GameObj +{ + /// + /// 门 + /// + public class Door : GameObj + { + public Door(XY initPos, PlaceType placeType) : + base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.Door) + { + this.place = placeType; + this.CanMove = false; + } + public override bool IsRigid => true; + public override ShapeType Shape => ShapeType.Square; + protected override bool IgnoreCollideExecutor(IGameObj targetObj) + { + return isOpen; + } + + private bool isOpen = false; + public bool IsOpen + { + get => isOpen; + set + { + lock (gameObjLock) + isOpen = value; + } + } + + private int openOrLockDegree = 0; + public int OpenOrLockDegree + { + get => openOrLockDegree; + set + { + lock (gameObjLock) + openOrLockDegree = (value > 0) ? value : 0; + } + } + } +} diff --git a/logic/GameClass/GameObj/Map/Map.cs b/logic/GameClass/GameObj/Map/Map.cs index 98b079c..ed9d445 100644 --- a/logic/GameClass/GameObj/Map/Map.cs +++ b/logic/GameClass/GameObj/Map/Map.cs @@ -190,6 +190,26 @@ namespace GameClass.GameObj Add(new Chest(GameData.GetCellCenterPos(i, j))); break; } + case (uint)PlaceType.Door3: + { + Add(new Door(GameData.GetCellCenterPos(i, j), PlaceType.Door3)); + break; + } + case (uint)PlaceType.Door5: + { + Add(new Door(GameData.GetCellCenterPos(i, j), PlaceType.Door5)); + break; + } + case (uint)PlaceType.Door6: + { + Add(new Door(GameData.GetCellCenterPos(i, j), PlaceType.Door6)); + break; + } + case (uint)PlaceType.Window: + { + Add(new Window(GameData.GetCellCenterPos(i, j))); + break; + } case (uint)PlaceType.BirthPoint1: case (uint)PlaceType.BirthPoint2: case (uint)PlaceType.BirthPoint3: diff --git a/logic/GameClass/GameObj/Map/MapInfo.cs b/logic/GameClass/GameObj/Map/MapInfo.cs index 6859637..89cc8a6 100644 --- a/logic/GameClass/GameObj/Map/MapInfo.cs +++ b/logic/GameClass/GameObj/Map/MapInfo.cs @@ -13,11 +13,11 @@ namespace GameClass.GameObj /// public static uint[,] defaultMap = new uint[,] { { 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, 13, 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 }, - { 6, 0, 1, 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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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 } }; } diff --git a/logic/GameClass/GameObj/Map/Window.cs b/logic/GameClass/GameObj/Map/Window.cs index 1d1e814..71690db 100644 --- a/logic/GameClass/GameObj/Map/Window.cs +++ b/logic/GameClass/GameObj/Map/Window.cs @@ -4,7 +4,7 @@ using Preparation.Utility; namespace GameClass.GameObj { /// - /// 出口 + /// 窗 /// public class Window : GameObj { @@ -18,50 +18,21 @@ namespace GameClass.GameObj public override ShapeType Shape => ShapeType.Square; protected override bool IgnoreCollideExecutor(IGameObj targetObj) { - if (targetObj.Type != GameObjType.Character) - return true; // 非玩家不碰撞 - else if (!((Character)targetObj).IsGhost()) - return true; // 不是鬼不碰撞 + if (targetObj == whoIsClimbing) + return true; return false; } - private bool powerSupply = false; - public bool PowerSupply + private Character? whoIsClimbing = null; + public Character? WhoIsClimbing { - get => powerSupply; + get => whoIsClimbing; set { lock (gameObjLock) - powerSupply = value; + whoIsClimbing = value; } } - private bool isOpening = false; - public bool IsOpening - { - get => isOpening; - set - { - lock (gameObjLock) - isOpening = value; - } - } - - private int openDegree = 0; - public int OpenDegree - { - get => openDegree; - set - { - if (value > 0) - lock (gameObjLock) - openDegree = (value < GameData.degreeOfOpenedDoorway) ? value : GameData.degreeOfOpenedDoorway; - else - lock (gameObjLock) - openDegree = 0; - } - } - - public bool IsOpen() => (OpenDegree == GameData.degreeOfOpenedDoorway); } } diff --git a/logic/GameEngine/MoveEngine.cs b/logic/GameEngine/MoveEngine.cs index 0f728ff..020c6e4 100644 --- a/logic/GameEngine/MoveEngine.cs +++ b/logic/GameEngine/MoveEngine.cs @@ -1,4 +1,5 @@ using System; +using System.Numerics; using System.Threading; using Preparation.Interface; using Preparation.Utility; @@ -60,14 +61,11 @@ namespace GameEngine /// 移动的位移向量 private void MoveMax(IMoveable obj, XY moveVec) { - /*由于四周是墙,所以人物永远不可能与越界方块碰撞*/ XY nextPos = obj.Position + moveVec; - //double maxLen - _ = collisionChecker.FindMax(obj, nextPos, moveVec); - //maxLen = Math.Min(maxLen, obj.MoveSpeed / GameData.numOfStepPerSecond); - - obj.MovingSetPos(moveVec, GetPlaceType(nextPos)); + double maxLen = collisionChecker.FindMax(obj, nextPos, moveVec); + maxLen = Math.Min(maxLen, obj.MoveSpeed / GameData.numOfStepPerSecond); + obj.MovingSetPos(new XY(moveVec.Angle(), maxLen), GetPlaceType(nextPos)); } public void MoveObj(IMoveable obj, int moveTime, double direction) diff --git a/logic/Gaming/ActionManager.cs b/logic/Gaming/ActionManager.cs index 9372b5f..a62b3bc 100644 --- a/logic/Gaming/ActionManager.cs +++ b/logic/Gaming/ActionManager.cs @@ -288,25 +288,7 @@ namespace Gaming { if ((!player.Commandable()) || player.PlayerState == PlayerStateType.IsOpeningTheChest) return false; - Chest? chestToOpen = null; - - - gameMap.GameObjLockDict[GameObjType.Chest].EnterReadLock(); - try - { - foreach (Chest chest in gameMap.GameObjDict[GameObjType.Chest]) - { - if (GameData.ApproachToInteract(chest.Position, player.Position)) - { - chestToOpen = chest; - break; - } - } - } - finally - { - gameMap.GameObjLockDict[GameObjType.Chest].ExitReadLock(); - } + Chest? chestToOpen = (Chest?)gameMap.OneForInteract(player.Position, GameObjType.Chest); if (chestToOpen == null || chestToOpen.IsOpen) return false; diff --git a/logic/Gaming/Game.cs b/logic/Gaming/Game.cs index d11a9c6..074819f 100644 --- a/logic/Gaming/Game.cs +++ b/logic/Gaming/Game.cs @@ -111,7 +111,7 @@ namespace Gaming } } if (bgmVolume > 0) - newPlayer.BgmDictionary.Add(BgmType.StudentIsApproaching, bgmVolume); + newPlayer.AddBgm(BgmType.StudentIsApproaching, bgmVolume); } else { @@ -120,7 +120,7 @@ namespace Gaming if (person.IsGhost()) { if (XY.Distance(newPlayer.Position, person.Position) <= (newPlayer.AlertnessRadius / person.Concealment)) - newPlayer.BgmDictionary.Add(BgmType.GhostIsComing, (double)newPlayer.AlertnessRadius / XY.Distance(newPlayer.Position, person.Position)); + newPlayer.AddBgm(BgmType.GhostIsComing, (double)newPlayer.AlertnessRadius / XY.Distance(newPlayer.Position, person.Position)); break; } } @@ -144,7 +144,7 @@ namespace Gaming } } if (bgmVolume > 0) - newPlayer.BgmDictionary.Add(BgmType.StudentIsApproaching, bgmVolume); + newPlayer.AddBgm(BgmType.StudentIsApproaching, bgmVolume); } diff --git a/logic/Preparation/Utility/EnumType.cs b/logic/Preparation/Utility/EnumType.cs index 80d97b4..5eb3376 100644 --- a/logic/Preparation/Utility/EnumType.cs +++ b/logic/Preparation/Utility/EnumType.cs @@ -125,8 +125,10 @@ namespace Preparation.Utility Doorway = 9, EmergencyExit = 10, Window = 11, - Door = 12, - Chest = 13, + Door3 = 12, + Door5 = 13, + Door6 = 14, + Chest = 15, } public enum BgmType { diff --git a/logic/Preparation/Utility/GameData.cs b/logic/Preparation/Utility/GameData.cs index e965bc1..cbbc52a 100644 --- a/logic/Preparation/Utility/GameData.cs +++ b/logic/Preparation/Utility/GameData.cs @@ -106,6 +106,7 @@ namespace Preparation.Utility public const double basicBulletBombRange = 3000; // 基本子弹爆炸范围 #endregion #region 技能相关 + public const int maxNumOfSkill = 3; public const int commonSkillCD = 30000; // 普通技能标准冷却时间 public const int commonSkillTime = 10000; // 普通技能标准持续时间 /// diff --git a/logic/Server/CopyInfo.cs b/logic/Server/CopyInfo.cs index 6cdc4c1..5072caf 100644 --- a/logic/Server/CopyInfo.cs +++ b/logic/Server/CopyInfo.cs @@ -21,8 +21,12 @@ namespace Server return Protobuf.PlaceType.Gate; case Preparation.Utility.PlaceType.Chest: return Protobuf.PlaceType.Chest; - case Preparation.Utility.PlaceType.Door: - return Protobuf.PlaceType.Door; + case Preparation.Utility.PlaceType.Door3: + return Protobuf.PlaceType.Door3; + case Preparation.Utility.PlaceType.Door5: + return Protobuf.PlaceType.Door5; + case Preparation.Utility.PlaceType.Door6: + return Protobuf.PlaceType.Door6; case Preparation.Utility.PlaceType.Generator: return Protobuf.PlaceType.Classroom; case Preparation.Utility.PlaceType.Grass: @@ -196,9 +200,11 @@ namespace Server foreach (var keyValue in player.TimeUntilActiveSkillAvailable) msg.StudentMessage.TimeUntilSkillAvailable.Add(keyValue.Value); + for (int i = 0; i < GameData.maxNumOfSkill - player.TimeUntilActiveSkillAvailable.Count(); ++i) + msg.StudentMessage.TimeUntilSkillAvailable.Add(-1); - foreach (var Value in player.PropInventory) - msg.StudentMessage.Prop.Add(ToPropType(Value.GetPropType())); + foreach (var value in player.PropInventory) + msg.StudentMessage.Prop.Add(ToPropType(value.GetPropType())); msg.StudentMessage.Place = ToPlaceType(player.Place); msg.StudentMessage.Guid = player.ID; @@ -237,9 +243,12 @@ namespace Server msg.TrickerMessage.Speed = player.MoveSpeed; foreach (var keyValue in player.TimeUntilActiveSkillAvailable) msg.TrickerMessage.TimeUntilSkillAvailable.Add(keyValue.Value); + for (int i = 0; i < GameData.maxNumOfSkill - player.TimeUntilActiveSkillAvailable.Count(); ++i) + msg.StudentMessage.TimeUntilSkillAvailable.Add(-1); + msg.TrickerMessage.Place = ToPlaceType(player.Place); - foreach (var Value in player.PropInventory) - msg.StudentMessage.Prop.Add(ToPropType(Value.GetPropType())); + foreach (var value in player.PropInventory) + msg.StudentMessage.Prop.Add(ToPropType(value.GetPropType())); msg.TrickerMessage.TrickerType = ToTrickerType(player.CharacterType); msg.TrickerMessage.Guid = player.ID; diff --git a/logic/Server/GameServer.cs b/logic/Server/GameServer.cs index 2106336..5aa96be 100644 --- a/logic/Server/GameServer.cs +++ b/logic/Server/GameServer.cs @@ -211,8 +211,10 @@ namespace Server case 9: return Protobuf.PlaceType.Gate; case 10: return Protobuf.PlaceType.HiddenGate; case 11: return Protobuf.PlaceType.Window; - case 12: return Protobuf.PlaceType.Door; - case 13: return Protobuf.PlaceType.Chest; + case 12: return Protobuf.PlaceType.Door3; + case 13: return Protobuf.PlaceType.Door5; + case 14: return Protobuf.PlaceType.Door6; + case 15: return Protobuf.PlaceType.Chest; default: return Protobuf.PlaceType.NullPlaceType; } } diff --git a/logic/规则Logic.md b/logic/规则Logic.md index 20185e4..19fb557 100644 --- a/logic/规则Logic.md +++ b/logic/规则Logic.md @@ -28,7 +28,7 @@ - 只展示外部需要的属性,部分属性被省略 ### BgmType -- 枚举类BgmType +- *枚举类BgmType* 1. 不详的感觉:监管者进入(求生者的警戒半径/监管者的隐蔽度)时,求生者收到;监管者距离求生者越近,Bgm音量越大。bgmVolume=(警戒半径/二者距离) 2. 期待搞事的感觉:求生者进入(监管者的警戒半径/求生者的隐蔽度)时,监管者收到;监管者距离求生者越近,Bgm音量越大。bgmVolume=(警戒半径/可被发觉的最近的求生者距离) 3. 修理电机的声音: 监管者警戒半径内有电机正在被修理时收到;bgmVolume=(警戒半径*电机修理程度/二者距离)/10300000 @@ -135,7 +135,7 @@ - 沉迷游戏程度 - 最大沉迷游戏程度 - 被治疗程度 -- *(去)救援(别人)程度* +- *被救援程度* ### 搞蛋鬼:人物 无 @@ -186,12 +186,11 @@ ### 箱子:物体 - *是否开启* - *开箱进度* -- *是否正在被开启* ### 门:物体 - *属于那个教学区* - *是否锁上* -- *是否正在被锁* +- *开锁门进度* - 不提供是否可以锁上的属性 ### 电机(建议称为homework):物体 @@ -237,6 +236,9 @@ - *当门所在格子内有人时,无法锁门(必须从门外锁门)* - *锁门时其他人可以进入门所在格子,锁门过程中断* - *钥匙只会出现在箱子中,每个教学区都有2把钥匙* +- *一扇门只允许同时一个人开锁门* +- *开锁门未完成前,门状态表现为原来的状态* +- *开锁门进度中断后清空* ### 窗 - *求生者和监管者都可以翻越窗户,但通常情况下监管者翻越窗户的速度**高于**求生者。*