|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543 |
- using Protobuf;
- using System.Collections.Generic;
- using GameClass.GameObj;
-
- namespace Server
- {
-
- public static class CopyInfo
- {
- // 下面赋值为0的大概率是还没写完 2023-03-03
- private static MessageOfStudent Human(Character player)
- {
- MessageOfStudent msg = new MessageOfStudent();
- if (player.IsGhost()) return null;
-
- msg.X = player.Position.x;
- msg.Y = player.Position.y;
- msg.Speed = player.MoveSpeed;
- msg.Determination = player.HP;
- msg.FailNum = 0;
- msg.TimeUntilSkillAvailable = 0;
- //msg.Place = 0; 下面写了
- msg.StudentType = StudentType.NullStudentType; // 下面写
- msg.Guid = 0;
- msg.State = StudentState.NullStatus;
- msg.FailTime = 0;
- msg.EmoTime = 0;
- msg.PlayerId = 0;
- msg.ViewRange = 0;
- msg.Radius = 0;
- //msg.Buff[0] = StudentBuffType.NullSbuffType; 下面写了
-
- /* THUAI5中的内容
- msg.BulletNum = player.BulletNum;
- msg.CanMove = player.CanMove;
- msg.CD = player.CD;
- msg.GemNum = player.GemNum;
- msg.Guid = player.ID;
- msg.IsResetting = player.IsResetting;
-
- msg.LifeNum = player.DeathCount + 1;
- msg.Radius = player.Radius;
-
- msg.TimeUntilCommonSkillAvailable = player.TimeUntilCommonSkillAvailable;
- msg.TeamID = player.TeamID;
- msg.PlayerID = player.PlayerID;
- msg.IsInvisible = player.IsInvisible;
- msg.FacingDirection = player.FacingDirection;
-
- //应该要发队伍分数,这里先发个人分数
- msg.MessageOfHuman.Score = player.Score;
-
- //这条暂时没啥用
- msg.MessageOfHuman.TimeUntilUltimateSkillAvailable = 0;
-
- msg.MessageOfHuman.Vampire = player.Vampire;*/
-
- foreach (KeyValuePair<Preparation.Utility.BuffType, bool> kvp in player.Buff)
- {
- if (kvp.Value)
- {
- switch (kvp.Key) // StudentBuffType具体内容待定
- {
- case Preparation.Utility.BuffType.Spear:
- msg.Buff.Add(StudentBuffType.NullSbuffType);
- break;
- case Preparation.Utility.BuffType.AddLIFE:
- msg.Buff.Add(StudentBuffType.NullSbuffType);
- break;
- case Preparation.Utility.BuffType.Shield:
- msg.Buff.Add(StudentBuffType.NullSbuffType);
- break;
- case Preparation.Utility.BuffType.AddSpeed:
- msg.Buff.Add(StudentBuffType.NullSbuffType);
- break;
- default:
- break;
- }
- }
- }
- /*switch (player.Place)
- {
- case Preparation.Utility.PlaceType.Land:
- msg.Place = PlaceType.Land;
- break;
- case Preparation.Utility.PlaceType.Grass1:
- msg.Place = PlaceType.Grass;
- break;
- case Preparation.Utility.PlaceType.Grass2:
- msg.Place = PlaceType.Grass;
- break;
- case Preparation.Utility.PlaceType.Grass3:
- msg.Place = PlaceType.Grass;
- break;
- // case Preparation.Utility.PlaceType.Invisible:
- // msg.MessageOfHuman.Place = Communication.Proto.PlaceType.Invisible;
- // break;
- default:
- msg.Place = PlaceType.NullPlaceType;
- break;
- }*/
-
- //Character的储存方式可能得改,用enum type存道具和子弹,不应该用对象
- //现在懒得改了,有时间再重整一波
- /*if (player.PropInventory == null)
- msg.Prop = PropType.NullPropType;
- else
- {
- switch (player.PropInventory.GetPropType())
- {
- case Preparation.Utility.PropType.Gem:
- msg.Prop = PropType.NullPropType;
- break;
- case Preparation.Utility.PropType.addLIFE:
- msg.MessageOfHuman.Prop = Communication.Proto.PropType.AddLife;
- break;
- case Preparation.Utility.PropType.addSpeed:
- msg.MessageOfHuman.Prop = Communication.Proto.PropType.AddSpeed;
- break;
- case Preparation.Utility.PropType.Shield:
- msg.MessageOfHuman.Prop = Communication.Proto.PropType.Shield;
- break;
- case Preparation.Utility.PropType.Spear:
- msg.MessageOfHuman.Prop = Communication.Proto.PropType.Spear;
- break;
- default:
- msg.Prop = PropType.NullPropType;
- break;
- }
- }*/
- /*switch (player.PassiveSkillType) 需要对接一下,proto里似乎没有这个
- {
- case Preparation.Utility.PassiveSkillType.RecoverAfterBattle:
- msg.MessageOfHuman.PassiveSkillType = Communication.Proto.PassiveSkillType.RecoverAfterBattle;
- break;
- case Preparation.Utility.PassiveSkillType.SpeedUpWhenLeavingGrass:
- msg.MessageOfHuman.PassiveSkillType = Communication.Proto.PassiveSkillType.SpeedUpWhenLeavingGrass;
- break;
- case Preparation.Utility.PassiveSkillType.Vampire:
- msg.MessageOfHuman.PassiveSkillType = Communication.Proto.PassiveSkillType.Vampire;
- break;
- default:
- msg.MessageOfHuman.PassiveSkillType = Communication.Proto.PassiveSkillType.NullPassiveSkillType;
- break;
- }
-
- switch (player.CommonSkillType)
- {
- case Preparation.Utility.ActiveSkillType.BecomeAssassin:
- msg.MessageOfHuman.ActiveSkillType = Communication.Proto.ActiveSkillType.BecomeAssassin;
- break;
- case Preparation.Utility.ActiveSkillType.BecomeVampire:
- msg.MessageOfHuman.ActiveSkillType = Communication.Proto.ActiveSkillType.BecomeVampire;
- break;
- case Preparation.Utility.ActiveSkillType.NuclearWeapon:
- msg.MessageOfHuman.ActiveSkillType = Communication.Proto.ActiveSkillType.NuclearWeapon;
- break;
- case Preparation.Utility.ActiveSkillType.SuperFast:
- msg.MessageOfHuman.ActiveSkillType = Communication.Proto.ActiveSkillType.SuperFast;
- break;
- default:
- msg.MessageOfHuman.ActiveSkillType = Communication.Proto.ActiveSkillType.NullActiveSkillType;
- break;
- }
-
- switch (player.BulletOfPlayer)
- {
- case Preparation.Utility.BulletType.AtomBomb:
- msg.MessageOfHuman.BulletType = Communication.Proto.BulletType.AtomBomb;
- break;
- case Preparation.Utility.BulletType.OrdinaryBullet:
- msg.MessageOfHuman.BulletType = Communication.Proto.BulletType.OrdinaryBullet;
- break;
- case Preparation.Utility.BulletType.FastBullet:
- msg.MessageOfHuman.BulletType = Communication.Proto.BulletType.FastBullet;
- break;
- case Preparation.Utility.BulletType.LineBullet:
- msg.MessageOfHuman.BulletType = Communication.Proto.BulletType.LineBullet;
- break;
- default:
- msg.MessageOfHuman.BulletType = Communication.Proto.BulletType.NullBulletType;
- break;
- }*/
-
- return msg;
- }
-
- private static MessageOfTricker Butcher(Character player)
- {
- MessageOfTricker msg = new MessageOfTricker();
- if (!player.IsGhost()) return null;
-
- msg.X = player.Position.x;
- msg.Y = player.Position.y;
- msg.Speed = player.MoveSpeed;
- msg.Damage = 0;
- msg.TimeUntilSkillAvailable = 0;
- //msg.Place = 0; 下面写了
- //msg.Prop = PropType.NullPropType; // 下面写
- msg.TrickerType = TrickerType.NullTrickerType; // 下面写
- msg.Guid = 0;
- msg.Movable = false;
- msg.PlayerId = 0;
- msg.ViewRange = 0;
- msg.Radius = 0;
- //msg.Buff[0] = ButcherBuffType.NullSbuffType; 下面写了
-
- /* THUAI5中的内容
- msg.BulletNum = player.BulletNum;
- msg.CanMove = player.CanMove;
- msg.CD = player.CD;
- msg.GemNum = player.GemNum;
- msg.Guid = player.ID;
- msg.IsResetting = player.IsResetting;
-
- msg.LifeNum = player.DeathCount + 1;
- msg.Radius = player.Radius;
-
- msg.TimeUntilCommonSkillAvailable = player.TimeUntilCommonSkillAvailable;
- msg.TeamID = player.TeamID;
- msg.PlayerID = player.PlayerID;
- msg.IsInvisible = player.IsInvisible;
- msg.FacingDirection = player.FacingDirection;
-
- //应该要发队伍分数,这里先发个人分数
- msg.MessageOfHuman.Score = player.Score;
-
- //这条暂时没啥用
- msg.MessageOfHuman.TimeUntilUltimateSkillAvailable = 0;
-
- msg.MessageOfHuman.Vampire = player.Vampire;*/
-
- foreach (KeyValuePair<Preparation.Utility.BuffType, bool> kvp in player.Buff)
- {
- if (kvp.Value)
- {
- switch (kvp.Key) // ButcherBuffType具体内容待定
- {
- case Preparation.Utility.BuffType.Spear:
- msg.Buff.Add(TrickerBuffType.NullTbuffType);
- break;
- case Preparation.Utility.BuffType.AddLIFE:
- msg.Buff.Add(TrickerBuffType.NullTbuffType);
- break;
- case Preparation.Utility.BuffType.Shield:
- msg.Buff.Add(TrickerBuffType.NullTbuffType);
- break;
- case Preparation.Utility.BuffType.AddSpeed:
- msg.Buff.Add(TrickerBuffType.NullTbuffType);
- break;
- default:
- break;
- }
- }
- }
- /*switch (player.Place)
- {
- case Preparation.Utility.PlaceType.Land:
- msg.Place = PlaceType.Land;
- break;
- case Preparation.Utility.PlaceType.Grass1:
- msg.Place = PlaceType.Grass;
- break;
- case Preparation.Utility.PlaceType.Grass2:
- msg.Place = PlaceType.Grass;
- break;
- case Preparation.Utility.PlaceType.Grass3:
- msg.Place = PlaceType.Grass;
- break;
- // case Preparation.Utility.PlaceType.Invisible:
- // msg.MessageOfHuman.Place = Communication.Proto.PlaceType.Invisible;
- // break;
- default:
- msg.Place = PlaceType.NullPlaceType;
- break;
- }*/
-
- //Character的储存方式可能得改,用enum type存道具和子弹,不应该用对象
- //现在懒得改了,有时间再重整一波
- /*if (player.PropInventory == null)
- msg.Prop = PropType.NullPropType;
- else
- {
- switch (player.PropInventory.GetPropType())
- {
- case Preparation.Utility.PropType.Gem:
- msg.Prop = PropType.NullPropType;
- break;
- case Preparation.Utility.PropType.addLIFE:
- msg.MessageOfHuman.Prop = Communication.Proto.PropType.AddLife;
- break;
- case Preparation.Utility.PropType.addSpeed:
- msg.MessageOfHuman.Prop = Communication.Proto.PropType.AddSpeed;
- break;
- case Preparation.Utility.PropType.Shield:
- msg.MessageOfHuman.Prop = Communication.Proto.PropType.Shield;
- break;
- case Preparation.Utility.PropType.Spear:
- msg.MessageOfHuman.Prop = Communication.Proto.PropType.Spear;
- break;
- default:
- msg.Prop = PropType.NullPropType;
- break;
- }
- }*/
- /*switch (player.PassiveSkillType) 需要对接一下,proto里似乎没有这个
- {
- case Preparation.Utility.PassiveSkillType.RecoverAfterBattle:
- msg.MessageOfHuman.PassiveSkillType = Communication.Proto.PassiveSkillType.RecoverAfterBattle;
- break;
- case Preparation.Utility.PassiveSkillType.SpeedUpWhenLeavingGrass:
- msg.MessageOfHuman.PassiveSkillType = Communication.Proto.PassiveSkillType.SpeedUpWhenLeavingGrass;
- break;
- case Preparation.Utility.PassiveSkillType.Vampire:
- msg.MessageOfHuman.PassiveSkillType = Communication.Proto.PassiveSkillType.Vampire;
- break;
- default:
- msg.MessageOfHuman.PassiveSkillType = Communication.Proto.PassiveSkillType.NullPassiveSkillType;
- break;
- }
-
- switch (player.CommonSkillType)
- {
- case Preparation.Utility.ActiveSkillType.BecomeAssassin:
- msg.MessageOfHuman.ActiveSkillType = Communication.Proto.ActiveSkillType.BecomeAssassin;
- break;
- case Preparation.Utility.ActiveSkillType.BecomeVampire:
- msg.MessageOfHuman.ActiveSkillType = Communication.Proto.ActiveSkillType.BecomeVampire;
- break;
- case Preparation.Utility.ActiveSkillType.NuclearWeapon:
- msg.MessageOfHuman.ActiveSkillType = Communication.Proto.ActiveSkillType.NuclearWeapon;
- break;
- case Preparation.Utility.ActiveSkillType.SuperFast:
- msg.MessageOfHuman.ActiveSkillType = Communication.Proto.ActiveSkillType.SuperFast;
- break;
- default:
- msg.MessageOfHuman.ActiveSkillType = Communication.Proto.ActiveSkillType.NullActiveSkillType;
- break;
- }
-
- switch (player.BulletOfPlayer)
- {
- case Preparation.Utility.BulletType.AtomBomb:
- msg.MessageOfHuman.BulletType = Communication.Proto.BulletType.AtomBomb;
- break;
- case Preparation.Utility.BulletType.OrdinaryBullet:
- msg.MessageOfHuman.BulletType = Communication.Proto.BulletType.OrdinaryBullet;
- break;
- case Preparation.Utility.BulletType.FastBullet:
- msg.MessageOfHuman.BulletType = Communication.Proto.BulletType.FastBullet;
- break;
- case Preparation.Utility.BulletType.LineBullet:
- msg.MessageOfHuman.BulletType = Communication.Proto.BulletType.LineBullet;
- break;
- default:
- msg.MessageOfHuman.BulletType = Communication.Proto.BulletType.NullBulletType;
- break;
- }*/
-
- return msg;
- }
-
- /*private static MessageToClient.Types.GameObjMessage Bullet(Bullet bullet)
- {
- MessageToClient.Types.GameObjMessage msg = new MessageToClient.Types.GameObjMessage();
- msg.MessageOfBullet = new MessageOfBullet();
- msg.MessageOfBullet.FacingDirection = bullet.FacingDirection;
- msg.MessageOfBullet.Guid = bullet.ID;
- msg.MessageOfBullet.BombRange = BulletFactory.BulletBombRange(bullet.TypeOfBullet);
- switch (bullet.TypeOfBullet)
- {
- case Preparation.Utility.BulletType.AtomBomb:
- msg.MessageOfBullet.Type = Communication.Proto.BulletType.AtomBomb;
- break;
- case Preparation.Utility.BulletType.OrdinaryBullet:
- msg.MessageOfBullet.Type = Communication.Proto.BulletType.OrdinaryBullet;
- break;
- case Preparation.Utility.BulletType.FastBullet:
- msg.MessageOfBullet.Type = Communication.Proto.BulletType.FastBullet;
- break;
- case Preparation.Utility.BulletType.LineBullet:
- msg.MessageOfBullet.Type = Communication.Proto.BulletType.LineBullet;
- break;
- default:
- msg.MessageOfBullet.Type = Communication.Proto.BulletType.NullBulletType;
- break;
- }
- msg.MessageOfBullet.X = bullet.Position.x;
- msg.MessageOfBullet.Y = bullet.Position.y;
- if (bullet.Parent != null)
- msg.MessageOfBullet.ParentTeamID = bullet.Parent.TeamID;
- switch (bullet.Place)
- {
- case Preparation.Utility.PlaceType.Null:
- msg.MessageOfBullet.Place = Communication.Proto.PlaceType.Null;
- break;
- case Preparation.Utility.PlaceType.Grass:
- msg.MessageOfBullet.Place = Communication.Proto.PlaceType.Grass;
- break;
- case Preparation.Utility.PlaceType.Grass:
- msg.MessageOfBullet.Place = Communication.Proto.PlaceType.Grass;
- break;
- case Preparation.Utility.PlaceType.Grass:
- msg.MessageOfBullet.Place = Communication.Proto.PlaceType.Grass;
- break;
- default:
- msg.MessageOfBullet.Place = Communication.Proto.PlacccceType.NullPlaceType;
- break;
- }
- return msg;
- }*/
-
- private static MessageOfProp Prop(Prop prop)
- {
- MessageOfProp msg = new MessageOfProp();
- //msg.Type = PropType.NullPropType; 下面写
- msg.X = prop.Position.x;
- msg.Y = prop.Position.y;
- msg.FacingDirection = 0;
- msg.Guid = 0;
- msg.Place = PlaceType.NullPlaceType;
- msg.Size = 0;
- msg.IsMoving = false;
- /* THUAI5中的内容
- msg.MessageOfProp.FacingDirection = prop.FacingDirection;
- msg.MessageOfProp.Guid = prop.ID;
- msg.MessageOfProp.IsMoving = prop.IsMoving;*/
-
- switch (prop.GetPropType())
- {
- /*case Preparation.Utility.PropType.Gem:
- msg.Type = PropType.Gem;
- break;
- case Preparation.Utility.PropType.addLIFE:
- msg.Type = PropType.AddLife;
- break;
- case Preparation.Utility.PropType.addSpeed:
- msg.Type = PropType.AddSpeed;
- break;
- case Preparation.Utility.PropType.Shield:
- msg.Type = PropType.Shield;
- break;
- case Preparation.Utility.PropType.Spear:
- msg.Type = PropType.Spear;
- break;*/
- default:
- msg.Type = PropType.NullPropType;
- break;
- }
-
- /*if(prop is Gem)
- {
- msg.MessageOfProp.Size = ((Gem)prop).Size;
- }
- else
- {
- msg.MessageOfProp.Size = 1;
- }
- switch (prop.Place)
- {
- case Preparation.Utility.PlaceType.Null:
- msg.MessageOfProp.Place = Communication.Proto.PlaceType.Null;
- break;
- case Preparation.Utility.PlaceType.Grass:
- msg.MessageOfProp.Place = Communication.Proto.PlaceType.Grass;
- break;
- case Preparation.Utility.PlaceType.Grass:
- msg.MessageOfProp.Place = Communication.Proto.PlaceType.Grass;
- break;
- case Preparation.Utility.PlaceType.Grass:
- msg.MessageOfProp.Place = Communication.Proto.PlaceType.Grass;
- break;
- default:
- msg.MessageOfProp.Place = Communication.Proto.PlacccceType.NullPlaceType;
- break;
- }*/
- return msg;
- }
-
- /*private static MessageOfBombedBullet BombedBullet(BombedBullet bombedBullet)
- {
- MessageOfBombedBullet msg = new MessageOfBombedBullet;
-
- msg.FacingDirection = bombedBullet.FacingDirection;
- msg.X = bombedBullet.bulletHasBombed.Position.x;
- msg.Y = bombedBullet.bulletHasBombed.Position.y;
- msg.MappingID = bombedBullet.MappingID;
- msg.BombRange = BulletFactory.BulletBombRange(bombedBullet.bulletHasBombed.TypeOfBullet);
- switch (bombedBullet.bulletHasBombed.TypeOfBullet)
- {
- case Preparation.Utility.BulletType.OrdinaryBullet:
- msg.MessageOfBombedBullet.Type = Communication.Proto.BulletType.OrdinaryBullet;
- break;
- case Preparation.Utility.BulletType.AtomBomb:
- msg.MessageOfBombedBullet.Type = Communication.Proto.BulletType.AtomBomb;
- break;
- case Preparation.Utility.BulletType.FastBullet:
- msg.MessageOfBombedBullet.Type = Communication.Proto.BulletType.FastBullet;
- break;
- case Preparation.Utility.BulletType.LineBullet:
- msg.MessageOfBombedBullet.Type = Communication.Proto.BulletType.LineBullet;
- break;
- default:
- msg.MessageOfBombedBullet.Type = Communication.Proto.BulletType.NullBulletType;
- break;
- }
- return msg;
- }*/
-
- /*private static MessageToClient.Types.GameObjMessage PickedProp(PickedProp pickedProp)
- {
- MessageToClient.Types.GameObjMessage msg = new MessageToClient.Types.GameObjMessage();
- msg.MessageOfPickedProp = new MessageOfPickedProp();
-
- 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;
- }
- return msg;
- }*/
- }
- }
|