diff --git a/dependency/proto/Message2Clients.proto b/dependency/proto/Message2Clients.proto index c5e216f..d918778 100755 --- a/dependency/proto/Message2Clients.proto +++ b/dependency/proto/Message2Clients.proto @@ -84,8 +84,6 @@ message MessageOfProp // 可拾取道具的信息 double facing_direction = 4; int64 guid = 5; PlaceType place = 6; - int32 size = 7; - bool is_moving = 8; } diff --git a/logic/Server/CopyInfo.cs b/logic/Server/CopyInfo.cs index 946b056..22cecd6 100644 --- a/logic/Server/CopyInfo.cs +++ b/logic/Server/CopyInfo.cs @@ -40,7 +40,6 @@ namespace Server return Protobuf.PlaceType.NullPlaceType; } } - private static Protobuf.PropType ToPropType(Preparation.Utility.PropType prop) { switch (prop) @@ -55,7 +54,6 @@ namespace Server return Protobuf.PropType.NullPropType; } } - private static Protobuf.PlayerState ToPlayerState(Preparation.Utility.PlayerStateType playerState) { switch (playerState) @@ -97,7 +95,6 @@ namespace Server return PlayerState.NullStatus; } } - private static Protobuf.StudentBuffType ToStudentBuffType(Preparation.Utility.BuffType buffType) { switch (buffType) @@ -107,7 +104,15 @@ namespace Server return Protobuf.StudentBuffType.NullSbuffType; } } - + private static Protobuf.TrickerBuffType ToTrickerBuffType(Preparation.Utility.BuffType buffType) + { + switch (buffType) + { + case Preparation.Utility.BuffType.Null: + default: + return Protobuf.TrickerBuffType.NullTbuffType; + } + } private static Protobuf.BulletType ToBulletType(Preparation.Utility.BulletType bulletType) { switch (bulletType) @@ -227,89 +232,23 @@ namespace Server foreach (var Value in player.PropInventory) msg.StudentMessage.Prop.Add(ToPropType(Value.GetPropType())); - msg.TrickerMessage.TrickerType = ToTrickerType(player.CharacterType); // 下面写 + msg.TrickerMessage.TrickerType = ToTrickerType(player.CharacterType); msg.TrickerMessage.Guid = player.ID; msg.TrickerMessage.Score = player.Score; msg.TrickerMessage.PlayerId = player.PlayerID; msg.TrickerMessage.ViewRange = player.ViewRange; msg.TrickerMessage.Radius = player.Radius; - //msg.TrickerMessage.Buff[0] = ButcherBuffType.NullSbuffType; 下面写了 - - - + msg.TrickerMessage.PlayerState = ToPlayerState(player.PlayerState); + msg.TrickerMessage.TrickDesire = (player.BgmDictionary.ContainsKey(BgmType.StudentIsApproaching)) ? player.BgmDictionary[BgmType.StudentIsApproaching] : 0; + msg.TrickerMessage.ClassVolume = (player.BgmDictionary.ContainsKey(BgmType.GeneratorIsBeingFixed)) ? player.BgmDictionary[BgmType.GeneratorIsBeingFixed] : 0; + msg.TrickerMessage.FacingDirection = player.FacingDirection.Angle(); + msg.TrickerMessage.BulletType = ToBulletType(player.BulletOfPlayer); foreach (KeyValuePair kvp in player.Buff) { if (kvp.Value) - { - switch (kvp.Key) // ButcherBuffType具体内容待定 - { - case Preparation.Utility.BuffType.Spear: - msg.TrickerMessage.Buff.Add(TrickerBuffType.NullTbuffType); - break; - case Preparation.Utility.BuffType.AddLIFE: - msg.TrickerMessage.Buff.Add(TrickerBuffType.NullTbuffType); - break; - case Preparation.Utility.BuffType.Shield: - msg.TrickerMessage.Buff.Add(TrickerBuffType.NullTbuffType); - break; - case Preparation.Utility.BuffType.AddSpeed: - msg.TrickerMessage.Buff.Add(TrickerBuffType.NullTbuffType); - break; - default: - break; - } - } + msg.TrickerMessage.Buff.Add(ToTrickerBuffType(kvp.Key)); } - /*switch (player.Place) - { - case Preparation.Utility.PlaceType.Land: - msg.TrickerMessage.Place = PlaceType.Land; - break; - case Preparation.Utility.PlaceType.Grass1: - msg.TrickerMessage.Place = PlaceType.Grass; - break; - case Preparation.Utility.PlaceType.Grass2: - msg.TrickerMessage.Place = PlaceType.Grass; - break; - case Preparation.Utility.PlaceType.Grass3: - msg.TrickerMessage.Place = PlaceType.Grass; - break; - // case Preparation.Utility.PlaceType.Invisible: - // msg.TrickerMessage.MessageOfHuman.Place = Communication.Proto.PlaceType.Invisible; - // break; - default: - msg.TrickerMessage.Place = PlaceType.NullPlaceType; - break; - }*/ - //Character的储存方式可能得改,用enum type存道具和子弹,不应该用对象 - //现在懒得改了,有时间再重整一波 - /*if (player.PropInventory == null) - msg.TrickerMessage.Prop = PropType.NullPropType; - else - { - switch (player.PropInventory.GetPropType()) - { - case Preparation.Utility.PropType.Gem: - msg.TrickerMessage.Prop = PropType.NullPropType; - break; - case Preparation.Utility.PropType.addLIFE: - msg.TrickerMessage.MessageOfHuman.Prop = Communication.Proto.PropType.AddLife; - break; - case Preparation.Utility.PropType.addSpeed: - msg.TrickerMessage.MessageOfHuman.Prop = Communication.Proto.PropType.AddSpeed; - break; - case Preparation.Utility.PropType.Shield: - msg.TrickerMessage.MessageOfHuman.Prop = Communication.Proto.PropType.Shield; - break; - case Preparation.Utility.PropType.Spear: - msg.TrickerMessage.MessageOfHuman.Prop = Communication.Proto.PropType.Spear; - break; - default: - msg.TrickerMessage.Prop = PropType.NullPropType; - break; - } - }*/ return msg; } @@ -320,49 +259,12 @@ namespace Server msg.BulletMessage = new(); msg.BulletMessage.X = bullet.Position.x; msg.BulletMessage.Y = bullet.Position.y; - //msg.BulletMessage.FacingDirection = bullet.FacingDirection; // XY转double? + msg.BulletMessage.FacingDirection = bullet.FacingDirection.Angle(); msg.BulletMessage.Guid = bullet.ID; - msg.BulletMessage.Team = PlayerType.NullPlayerType; - msg.BulletMessage.Place = PlaceType.NullPlaceType; - msg.BulletMessage.BombRange = 0; - switch (bullet.TypeOfBullet) - { - case Preparation.Utility.BulletType.AtomBomb: - msg.BulletMessage.Type = BulletType.AtomBomb; - break; - case Preparation.Utility.BulletType.OrdinaryBullet: - msg.BulletMessage.Type = BulletType.OrdinaryBullet; - break; - case Preparation.Utility.BulletType.FastBullet: - msg.BulletMessage.Type = BulletType.FastBullet; - break; - case Preparation.Utility.BulletType.LineBullet: - msg.BulletMessage.Type = BulletType.LineBullet; - break; - default: - msg.BulletMessage.Type = BulletType.NullBulletType; - break; - } - //if (bullet.Parent != null) - //msg.BulletMessage.MessageOfBullet.ParentTeamID = bullet.Parent.TeamID; - /*switch (bullet.Place) - { - case Preparation.Utility.PlaceType.Null: - msg.BulletMessage.MessageOfBullet.Place = Communication.Proto.PlaceType.Null; - break; - case Preparation.Utility.PlaceType.Grass: - msg.BulletMessage.MessageOfBullet.Place = Communication.Proto.PlaceType.Grass; - break; - case Preparation.Utility.PlaceType.Grass: - msg.BulletMessage.MessageOfBullet.Place = Communication.Proto.PlaceType.Grass; - break; - case Preparation.Utility.PlaceType.Grass: - msg.BulletMessage.MessageOfBullet.Place = Communication.Proto.PlaceType.Grass; - break; - default: - msg.BulletMessage.MessageOfBullet.Place = Communication.Proto.PlacccceType.NullPlaceType; - break; - }*/ + msg.BulletMessage.Team = (bullet.Parent.IsGhost()) ? PlayerType.TrickerPlayer : PlayerType.StudentPlayer; + msg.BulletMessage.Place = ToPlaceType(bullet.Place); + msg.BulletMessage.BombRange = bullet.BulletBombRange; + msg.BulletMessage.Speed = bullet.Speed; return msg; } @@ -370,63 +272,12 @@ namespace Server { MessageOfObj msg = new MessageOfObj(); msg.PropMessage = new(); - //msg.PropMessage.Type = PropType.NullPropType; 下面写 + msg.PropMessage.Type = ToPropType(prop.GetPropType()); msg.PropMessage.X = prop.Position.x; msg.PropMessage.Y = prop.Position.y; - msg.PropMessage.FacingDirection = 0; - msg.PropMessage.Guid = 0; - msg.PropMessage.Place = PlaceType.NullPlaceType; - msg.PropMessage.Size = 0; - msg.PropMessage.IsMoving = false; - - switch (prop.GetPropType()) - { - /*case Preparation.Utility.PropType.Gem: - msg.PropMessage.Type = PropType.Gem; - break; - case Preparation.Utility.PropType.addLIFE: - msg.PropMessage.Type = PropType.AddLife; - break; - case Preparation.Utility.PropType.addSpeed: - msg.PropMessage.Type = PropType.AddSpeed; - break; - case Preparation.Utility.PropType.Shield: - msg.PropMessage.Type = PropType.Shield; - break; - case Preparation.Utility.PropType.Spear: - msg.PropMessage.Type = PropType.Spear; - break;*/ - default: - msg.PropMessage.Type = PropType.NullPropType; - break; - } - - /*if(prop is Gem) - { - msg.PropMessage.MessageOfProp.Size = ((Gem)prop).Size; - } - else - { - msg.PropMessage.MessageOfProp.Size = 1; - } - switch (prop.Place) - { - case Preparation.Utility.PlaceType.Null: - msg.PropMessage.MessageOfProp.Place = Communication.Proto.PlaceType.Null; - break; - case Preparation.Utility.PlaceType.Grass: - msg.PropMessage.MessageOfProp.Place = Communication.Proto.PlaceType.Grass; - break; - case Preparation.Utility.PlaceType.Grass: - msg.PropMessage.MessageOfProp.Place = Communication.Proto.PlaceType.Grass; - break; - case Preparation.Utility.PlaceType.Grass: - msg.PropMessage.MessageOfProp.Place = Communication.Proto.PlaceType.Grass; - break; - default: - msg.PropMessage.MessageOfProp.Place = Communication.Proto.PlacccceType.NullPlaceType; - break; - }*/ + msg.PropMessage.FacingDirection = prop.FacingDirection.Angle(); + msg.PropMessage.Guid = prop.ID; + msg.PropMessage.Place = ToPlaceType(prop.Place); return msg; } @@ -436,27 +287,9 @@ namespace Server msg.BombedBulletMessage = new(); msg.BombedBulletMessage.X = bombedBullet.bulletHasBombed.Position.x; msg.BombedBulletMessage.Y = bombedBullet.bulletHasBombed.Position.y; - //msg.BombedBulletMessage.FacingDirection = bombedBullet.FacingDirection; XY类型转double? + msg.BombedBulletMessage.FacingDirection = bombedBullet.FacingDirection.Angle(); msg.BombedBulletMessage.MappingId = bombedBullet.MappingID; - msg.BombedBulletMessage.BombRange = BulletFactory.BulletRadius(bombedBullet.bulletHasBombed.TypeOfBullet); // 待确认 - switch (bombedBullet.bulletHasBombed.TypeOfBullet) - { - case Preparation.Utility.BulletType.OrdinaryBullet: - msg.BombedBulletMessage.Type = BulletType.OrdinaryBullet; - break; - case Preparation.Utility.BulletType.AtomBomb: - msg.BombedBulletMessage.Type = BulletType.AtomBomb; - break; - case Preparation.Utility.BulletType.FastBullet: - msg.BombedBulletMessage.Type = BulletType.FastBullet; - break; - case Preparation.Utility.BulletType.LineBullet: - msg.BombedBulletMessage.Type = BulletType.LineBullet; - break; - default: - msg.BombedBulletMessage.Type = BulletType.NullBulletType; - break; - } + msg.BombedBulletMessage.BombRange = bombedBullet.bulletHasBombed.BulletBombRange; return msg; } @@ -468,29 +301,8 @@ namespace Server msg.MessageOfPickedProp.MappingID = pickedProp.MappingID; msg.MessageOfPickedProp.X = pickedProp.PropHasPicked.Position.x; msg.MessageOfPickedProp.Y = pickedProp.PropHasPicked.Position.y; - msg.MessageOfPickedProp.FacingDirection = pickedProp.PropHasPicked.FacingDirection; - switch (pickedProp.PropHasPicked.GetPropType()) - { - case Preparation.Utility.PropType.Gem: - msg.MessageOfPickedProp.Type = Communication.Proto.PropType.Gem; - break; - case Preparation.Utility.PropType.addLIFE: - msg.MessageOfPickedProp.Type = Communication.Proto.PropType.AddLife; - break; - case Preparation.Utility.PropType.addSpeed: - msg.MessageOfPickedProp.Type = Communication.Proto.PropType.AddSpeed; - break; - case Preparation.Utility.PropType.Shield: - msg.MessageOfPickedProp.Type = Communication.Proto.PropType.Shield; - break; - case Preparation.Utility.PropType.Spear: - msg.MessageOfPickedProp.Type = Communication.Proto.PropType.Spear; - break; - default: - msg.MessageOfPickedProp.Type = Communication.Proto.PropType.NullPropType; - break; - }*/ + msg.MessageOfPickedProp.FacingDirection = pickedProp.PropHasPicked.FacingDirection;*/ return msg; } } -} +} \ No newline at end of file diff --git a/logic/规则Logic.md b/logic/规则Logic.md index 6d3c244..298854d 100644 --- a/logic/规则Logic.md +++ b/logic/规则Logic.md @@ -31,7 +31,7 @@ - 枚举类BgmType 1. 不详的感觉:监管者进入(求生者的警戒半径/监管者的隐蔽度)时,求生者收到;监管者距离求生者越近,Bgm音量越大。bgmVolume=(警戒半径/二者距离) 2. 期待搞事的感觉:求生者进入(监管者的警戒半径/求生者的隐蔽度)时,监管者收到;监管者距离求生者越近,Bgm音量越大。bgmVolume=(警戒半径/可被发觉的最近的求生者距离) - 3. 修理电机的声音: 警戒半径内有电机正在被修理时收到;bgmVolume=(警戒半径*电机修理程度/二者距离)/10300000 + 3. 修理电机的声音: 监管者警戒半径内有电机正在被修理时收到;bgmVolume=(警戒半径*电机修理程度/二者距离)/10300000 ~~~csharp public enum BgmType {