Write() 공개 메소드

Writes an endpoint description
public Write ( IPEndPoint endPoint ) : void
endPoint System.Net.IPEndPoint
리턴 void
 public override void Encode(NetOutgoingMessage msg)
 {
     msg.Write(findSixes);
     msg.Write((byte)nPosition.Count);
     foreach (byte p in nPosition)
         msg.Write(p);
 }
예제 #2
0
 public void SendMovementUpdate()
 {
     _outmsg = _client.CreateMessage();
     _outmsg.Write((byte)PacketType.PlayerMovementUpdate);
     _outmsg.Write(_pbag.Player.Position);
     _client.SendMessage(_outmsg, NetDeliveryMethod.ReliableOrdered);
 }
 public void WriteToMessage(NetOutgoingMessage message)
 {
     message.Write(SessionID);
     message.Write(ID);
     message.Write(IsValid);
     message.Write(PlayerIndex);
 }
예제 #4
0
 public void Write(NetOutgoingMessage packet)
 {
     packet.Write(this.Slot);
     packet.Write((Byte)this.Team);
     packet.Write(this.Callsign);
     packet.Write(this.Tag);
 }
 public static void ToNetMsg(string sender, string group, string message, ref NetOutgoingMessage netMsg)
 {
     netMsg.Write((byte)NetDataType.eDATA_GROUP_MSG);
     netMsg.Write(sender);
     netMsg.Write(group);
     netMsg.Write(message);
 }
예제 #6
0
 public void Write(NetOutgoingMessage packet)
 {
     packet.Write(Slot);
     packet.Write((Byte)Team);
     packet.Write(Callsign);
     packet.Write(Tag);
 }
예제 #7
0
 internal override void Write(NetOutgoingMessage Message)
 {
     base.Write(Message);
     Message.Write(Language.ToString());
     Message.Write(Location.ToString());
     Message.Write(Source);
 }
예제 #8
0
 public void SendPlayerInWorld()
 {
     _outmsg = _client.CreateMessage();
     _outmsg.Write((byte)PacketType.PlayerInWorld);
     _outmsg.Write(true);
     _client.SendMessage(_outmsg, NetDeliveryMethod.ReliableOrdered);
 }
예제 #9
0
 protected override void Write(NetOutgoingMessage message)
 {
     message.Write(body.Position.X * Constants.PixelsPerMeter);
     message.Write(body.Position.Y * Constants.PixelsPerMeter);
     message.Write(body.Rotation.ToNetworkRotation());
     message.Write(type);
 }
예제 #10
0
 public void W(NetOutgoingMessage om)
 {
     om.Write(Uid);
     om.Write(X);
     om.Write(Y);
     om.Write(SpriteId);
 }
 public static void ToNetMsg(long serverUUID, IPEndPoint clientInternal, string token, ref NetOutgoingMessage netMsg)
 {
     netMsg.Write((byte)NetDataType.eDATA_REQUEST_INTRODUCTION);
     netMsg.Write(serverUUID);
     netMsg.Write(clientInternal);
     netMsg.Write(token);
 }
 public void Encode(NetOutgoingMessage om)
 {
     om.Write(this.MessageTime);
     om.Write(this.Id);
     om.Write(this.EquipmentPosition);
     om.Write(this.InventoryPosition);
 }
예제 #13
0
 /// <summary>
 /// write to the message
 /// </summary>
 /// <param name="message">message to write to</param>
 public void OnSerialize(NetOutgoingMessage message)
 {
     message.Write(X);
     message.Write(Y);
     message.Write(Z);
     message.Write(W);
 }
예제 #14
0
 public void Encode(NetOutgoingMessage om)
 {
     om.Write(this.BlockID);
     om.Write(this.X);
     om.Write(this.Y);
     om.Write(this.Z);
 }
예제 #15
0
 public void Encode(NetOutgoingMessage om)
 {
     om.Write((int) Value);
        om.Write(Text);
        om.Write(Row);
        om.Write(Col);
 }
예제 #16
0
 public override void Write(NetOutgoingMessage msg)
 {
     msg.Write(Id);
     msg.Write(Cards.Count);
     foreach(string value in Cards)
         msg.Write(value);
 }
 public static void Write(NetOutgoingMessage msg, Quaternion data)
 {
     msg.Write(data.x);
     msg.Write(data.y);
     msg.Write(data.z);
     msg.Write(data.w);
 }
예제 #18
0
 public void WriteType(NetOutgoingMessage Message, AttributeTypeID Type, object Data)
 {
     switch (Type) {
         case AttributeTypeID.Float:
             Message.Write((float)Data);
             break;
         case AttributeTypeID.Int:
             Message.Write((int)Data);
             break;
         case AttributeTypeID.List:
             Console.WriteLine("Engine unable to serialize list objects");
             break;
         case AttributeTypeID.Long:
             Message.Write((long)Data);
             break;
         case AttributeTypeID.Rectangle:
             Message.WriteRectangle((Rectangle)Data);
             break;
         case AttributeTypeID.String:
             Message.Write((string)Data);
             break;
         case AttributeTypeID.Vector2:
             Message.WriteVector2((Vector2)Data);
             break;
         case AttributeTypeID.Bool:
             Message.Write((bool)Data);
             break;
         default:
             Console.WriteLine("AttributeSystem Unrecognised Type In AttributeSystem Type: {0}", Type.ToString());
             break;
     }
 }
예제 #19
0
 public NetOutgoingMessage Pack(NetOutgoingMessage msg)
 {
     msg.Write((byte)packetType);
     msg.Write(username);
     msg.Write(message);
     return msg;
 }
예제 #20
0
 public void Encode(NetOutgoingMessage om)
 {
     om.Write(Shots);
        om.Write(Hits);
        om.Write(Misses);
        om.Write(ShipsKilled);
 }
예제 #21
0
 public void SendCurrentWorld(ServerPlayer player)
 {
     _outmsg = _netserver.CreateMessage();
     _outmsg.Write((byte)PacketType.WorldMapSize);
     _outmsg.Write(_mineserver.MapManager.Mapsize);
     _netserver.SendMessage(_outmsg, player.NetConn, NetDeliveryMethod.ReliableOrdered);
 }
 public void Encode(NetOutgoingMessage om)
 {
     om.Write(this.MessageTime);
     om.Write(this.Id);
     om.Write(this.OldPosition);
     om.Write(this.NewPosition);
 }
예제 #23
0
 public void SendBlockSet(BlockTypes type,Vector3 pos)
 {
     _outmsg = _client.CreateMessage();
     _outmsg.Write((byte)PacketType.PlayerBlockSet);
     _outmsg.Write(pos);
     _outmsg.Write((byte)type);
 }
예제 #24
0
 public void Encode(NetOutgoingMessage om)
 {
     om.Write(this.Id);
     om.Write(this.MessageTime);
     om.Write(this.Health);
     om.Write(this.MaxHealth);
 }
예제 #25
0
 protected override void WriteData(NetOutgoingMessage Message)
 {
     texture.Write(Message);
     byte[] data = GetBytes(texture.Texture);
     Message.Write((Int32)data.Length);
     Message.Write(data);
 }
 public void WriteToMessage(NetOutgoingMessage message)
 {
     message.Write(SessionID);
     message.Write(ID);
     message.Write(IsValid);
     message.Write(Position);
     message.Write(Angle);
 }
예제 #27
0
 public void WriteDelta(NetOutgoingMessage message)
 {
     message.Write(Sequence);
     message.Write(FromSequence);
     byte[] bytes = deltaBytes.ToArray();
     message.Write(bytes.Length);
     message.Write(bytes);
 }
예제 #28
0
파일: NetShip.cs 프로젝트: Rohansi/Programe
 protected override void Write(NetOutgoingMessage message)
 {
     message.Write(ship.Name);
     message.Write(ship.Body.Position.X * Constants.PixelsPerMeter);
     message.Write(ship.Body.Position.Y * Constants.PixelsPerMeter);
     message.Write(ship.Body.Rotation.ToNetworkRotation());
     message.Write((byte)(ship.Health * byte.MaxValue));
 }
예제 #29
0
 /// <summary>
 /// Writes the contents of this type to the transport.
 /// </summary>
 public void WritePayload(NetOutgoingMessage message)
 {
     message.Write(Identity);
     message.Write(NovaId);
     message.Write(PasswordHash);
     message.Write(PublicEndPoint);
     message.Write(PrivateEndPoint);
 }
 public override void WritePayload(NetOutgoingMessage message)
 {
     base.WritePayload(message);
     message.Write(Image.Length);
     message.Write(Image);
     message.Write(Number);
     message.Write(SendIndex);
 }
예제 #31
0
        /// <summary>
        /// serialize to the message
        /// </summary>
        /// <param name="message"></param>
        public void OnSerialize(Lidgren.Network.NetOutgoingMessage message)
        {
            message.Write(dictionary.Count);

            foreach (var kvp in dictionary)
            {
                message.Write(kvp.Key);
                message.Write(kvp.Value);
            }
        }
예제 #32
0
        public override void WriteOutUpdateData(Lidgren.Network.NetOutgoingMessage om)
        {
            base.WriteOutUpdateData(om);


            om.Write(this.elapsedTime);
        }
예제 #33
0
        /// <summary>
        /// Serialize the array to the message
        /// </summary>
        /// <param name="message"></param>
        public void OnSerialize(Lidgren.Network.NetOutgoingMessage message)
        {
            if (items == null || items.Length == 0)
            {
                return;
            }

            message.Write(items.Length);
            foreach (var item in items)
            {
                item.OnSerialize(message);
            }
        }
예제 #34
0
        static void Main(string[] args)
        {
            var config = new NetPeerConfiguration("ConquerLeague")
            {
                Port = 47410
            };

            config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest);
            server = new NetServer(config);
            server.Start();

            SessionManager sessionManager = new SessionManager();

            while (true)
            {
                NetIncomingMessage message;
                while ((message = server.ReadMessage()) != null)
                {
                    switch (message.MessageType)
                    {
                    case NetIncomingMessageType.DiscoveryRequest:
                        NetOutgoingMessage response = server.CreateMessage();           // Create a response and write some example data to it
                        response.Write("ConquerLeagueServer");
                        server.SendDiscoveryResponse(response, message.SenderEndPoint); // Send the response to the sender of the request
                        break;

                    case NetIncomingMessageType.Data:
                        var dataLength = message.ReadInt32();
                        var data       = message.ReadBytes(dataLength);
                        sessionManager.ForwardMessageToSession(message.SenderConnection, dataLength, data);
                        break;

                    case NetIncomingMessageType.StatusChanged:
                        Console.WriteLine(message.SenderConnection.Status);
                        switch (message.SenderConnection.Status)
                        {
                        case NetConnectionStatus.Connected:
                            Console.WriteLine("Client " + message.SenderConnection.RemoteEndPoint.ToString() + " connected!");
                            sessionManager.AddPlayerToMatchmaking(message.SenderConnection);
                            break;

                        case NetConnectionStatus.RespondedConnect:
                            Console.WriteLine(message.SenderConnection.Status.ToString());
                            break;

                        default:
                            Console.WriteLine("Unhandled status change with type: " + message.SenderConnection.Status.ToString());
                            break;
                        }

                        break;

                    case NetIncomingMessageType.ConnectionApproval:
                        message.SenderConnection.Approve();
                        break;

                    case NetIncomingMessageType.DebugMessage:
                        Console.WriteLine(message.ReadString());
                        break;

                    case NetIncomingMessageType.WarningMessage:
                        Console.WriteLine("Warning: " + message.ReadString());
                        break;

                    default:
                        Console.WriteLine("unhandled message with type: " + message.MessageType);
                        break;
                    }

                    server.Recycle(message);
                }
            }
        }