コード例 #1
0
 public PacketShoot(Bullet obj, IPEndPoint destination)
     : base("PACKET:SHOOT", destination)
 {
     string parameters = obj.ID + ":" + (int)obj.BulletType + ":" + obj.Shooter + ":" + obj.Area.X + ":" + obj.Area.Y + ":" + obj.Destination.X + ":" + obj.Destination.Y + ":" + obj.Speed;
     this.SetData(new PacketData(this, parameters));
     this.Object = obj;
 }
コード例 #2
0
 protected override PacketData ParseData(string data)
 {
     string messageCode = data.Split('{')[1].Split('}')[0];
     string[] infoSplit = messageCode.Split(':');
     var obj = new Bullet(-1, Bullet.Type.Small, -1, -1, -1, new System.Drawing.Point(), 0);
     if (infoSplit.Length > 4)
         obj = new Bullet(Convert.ToInt32(infoSplit[0]), (Bullet.Type)Convert.ToInt16(infoSplit[1]), Convert.ToInt16(infoSplit[2]), (float)Convert.ToDouble(infoSplit[3]), (float)Convert.ToDouble(infoSplit[4]), new System.Drawing.Point(Convert.ToInt32(infoSplit[5]), Convert.ToInt32(infoSplit[6])), Convert.ToInt32(infoSplit[7]));
     return new PacketData(new PacketShoot(obj, null), obj);
 }
コード例 #3
0
 public PacketHit(int bulletID, Bullet.Type bulletType, int targetID, System.Net.IPEndPoint destination)
     : base("PACKET:HIT", destination)
 {
     this.BulletID = bulletID;
     this.BulletType = bulletType;
     this.TargetID = targetID;
     string parameters = bulletID + ":" + bulletType + ":" + targetID;
     this.SetData(new PacketData(this, parameters));
 }