/// <summary> /// read the message /// </summary> /// <param name="message">message to read from</param> public void OnDeserialize(NetIncomingMessage message) { X = message.ReadFloat(); Y = message.ReadFloat(); Z = message.ReadFloat(); W = message.ReadFloat(); }
public void R(NetIncomingMessage im) { Operat = im.ReadByte(); UserId = im.ReadUInt32(); if (Operat == Add || Operat == Changed) { Tag = im.ReadUInt32(); if (GameMessageHelper.Is_Changed(Tag, GameMessageHelper.POSITION_TAG)) { X = im.ReadFloat(); Y = im.ReadFloat(); } if (GameMessageHelper.Is_Changed(Tag, GameMessageHelper.RADIUS_TAG)) { Radius = im.ReadInt32(); } if (GameMessageHelper.Is_Changed(Tag, GameMessageHelper.COLOR_TAG)) { Color = im.ReadUInt32(); } if (GameMessageHelper.Is_Changed(Tag, GameMessageHelper.NAME_TAG)) { Name = im.ReadString(); } } }
public static Line ReadLine(NetIncomingMessage message, bool isServer=false) { float removeAnimation = message.ReadFloat(); Vector2 animationEnd = message.ReadVector2(); int turn = message.ReadInt32(); bool wasGrowing = message.ReadBoolean(); Vector2 begin = message.ReadVector2(); Vector2 end = message.ReadVector2(); float thickness = message.ReadFloat(); if (!isServer) { animationEnd = Constants.FromField(animationEnd); begin = Constants.FromField(begin); end = Constants.FromField(end); } Line l = new Line (begin, end); l.removeAnimationTime = removeAnimation; l.animationEnd = animationEnd; l.turn = turn; l.color = Constants.COLORS[turn]; l.wasGrowing = wasGrowing; l.thickness = thickness; return l; }
public void Decode(NetIncomingMessage im) { this.Id = im.ReadInt32(); this.MessageTime = im.ReadDouble(); this.Health = im.ReadFloat(); this.MaxHealth = im.ReadFloat(); }
public static void ToOtherPlayers(NetIncomingMessage im, OtherPlayer[] d) { bool alive = im.ReadBoolean(); float xp = im.ReadFloat(); float yp = im.ReadFloat(); float zp = im.ReadFloat(); Int32 id = im.ReadInt32(); float xr = im.ReadFloat(); float yr = im.ReadFloat(); Int16 model = im.ReadInt16(); if (d[id] == null) { d[id] = new OtherPlayer(xp, yp, zp, id, model, xr, yr); } d[id].model = model; d[id].xr = xr; d[id].yr = yr; if (!alive) { d[id].ChangeLifeStatus(false); } d[id].position = new Vector3(xp, yp, zp); d[id].boundingSphere.Center = new Vector3(d[id].position.X, d[id].position.Y + Constants.HEADMAX/2, d[id].position.Z); }
protected override void Read(NetIncomingMessage message) { x = message.ReadFloat(); y = message.ReadFloat(); rotation = message.ReadUInt16().FromNetworkRotation() * (180f / (float)Math.PI); type = message.ReadByte(); }
public static void readBytes(NetIncomingMessage data, ref InputObject io) { data.ReadByte(); Console.WriteLine(io.HorizontalAxis = data.ReadFloat()); Console.WriteLine(io.VerticalAxis = data.ReadFloat()); Console.WriteLine(io.AmingAngle = data.ReadFloat()); Console.WriteLine(io.Buttons = data.ReadByte()); }
public static void readBytes(NetIncomingMessage data, ClientSprite cs) { data.ReadByte(); cs.ID = data.ReadUInt32(); cs.SpriteID = (SpriteIDs)data.ReadUInt16(); cs.Position = new Microsoft.Xna.Framework.Vector2(data.ReadFloat(),data.ReadFloat()); cs.Rotation = data.ReadFloat(); }
protected override void Read(NetIncomingMessage message) { Name = message.ReadString(); X = message.ReadFloat(); Y = message.ReadFloat(); rotation = message.ReadUInt16().FromNetworkRotation() * (180f / (float)Math.PI); Health = message.ReadByte() / (float)byte.MaxValue; }
public InterpolationPacket(NetIncomingMessage message) { float x = message.ReadFloat(); float y = message.ReadFloat(); float z = message.ReadFloat(); position = new Vector2(x, y); rotation = message.ReadFloat(); time = 0; }
public void Decode(NetIncomingMessage im) { Hour = im.ReadFloat(); Day = im.ReadFloat(); Month = im.ReadFloat(); Year = im.ReadFloat(); TimeScale = im.ReadFloat(); Weather = im.ReadInt32(); }
public static Vector3 ReadVector3(NetIncomingMessage msg) { Vector3 data; data.x = msg.ReadFloat(); data.y = msg.ReadFloat(); data.z = msg.ReadFloat(); return data; }
public static new Packet FromNetBuffer(NetIncomingMessage incomingMessage) { // Read values back in var velocity = new Vector2(incomingMessage.ReadFloat(), incomingMessage.ReadFloat()); var location = new Vector2(incomingMessage.ReadFloat(), incomingMessage.ReadFloat()); var id = incomingMessage.ReadUInt64(); var packet = new NotifyMovementPacket(velocity, location, id); return packet; }
public override void Decode(NetIncomingMessage msg) { base.Decode(msg); // opt - should probably use ints here float x = msg.ReadFloat(); float y = msg.ReadFloat(); float z = msg.ReadFloat(); Position = new Vector3(x, y, z); }
public InterpolationPacket(NetIncomingMessage message) { float x = message.ReadFloat(); float y = message.ReadFloat(); Position = new Vector2D(x, y); Rotation = message.ReadFloat(); Time = 0; Iterations = 0; Startposition = new Vector2D(1234, 1234); }
public void DecodeServerMessage(NetIncomingMessage im) { Vector2 pos; pos.X = im.ReadFloat(); pos.Y = im.ReadFloat(); this.ball.Position = pos; pos.X = this.paddle1.Position.X; pos.Y = im.ReadFloat(); this.paddle1.Position = pos; }
public static Quaternion ReadQuaternion(NetIncomingMessage msg) { Quaternion data; data.x = msg.ReadFloat(); data.y = msg.ReadFloat(); data.z = msg.ReadFloat(); data.w = msg.ReadFloat(); return data; }
protected override void IncomingGameState(NetIncomingMessage msg) { int who = msg.ReadInt32(); float x = msg.ReadFloat(); float y = msg.ReadFloat(); if (NetManager.connectedClients.ContainsKey(who)) { NetManager.connectedClients[who].X = x; NetManager.connectedClients[who].Y = y; } }
public override void OnAdvancedNetworkMessage(NetIncomingMessage msg) { if (msg.ReadByte() == 0) { this.lxLoot = new List<PreSeededLoot>(); byte byCount = msg.ReadByte(); for (int i = 0; i < (int)byCount; i++) { this.lxLoot.Add(new PreSeededLoot(msg.ReadUInt16(), (ItemCodex.ItemTypes)msg.ReadInt32(), new Vector2(msg.ReadFloat(), msg.ReadFloat()))); } } }
public void R(NetIncomingMessage im) { Operat = im.ReadByte(); BallId = im.ReadUInt32(); if(Operat == Add) { X = im.ReadFloat(); Y = im.ReadFloat(); Radius = im.ReadInt32(); Color = im.ReadUInt32(); } }
protected override void Read(NetIncomingMessage message) { Width = message.ReadFloat(); Height = message.ReadFloat(); Items.Clear(); var count = message.ReadUInt16(); for (var i = 0; i < count; i++) { Items.Add(NetObject.ReadFromMessage(message)); } }
public void R(NetIncomingMessage im) { int Count = im.ReadInt32(); for(int i = 0; i < Count; ++i) { uint uid = im.ReadUInt32(); float x = im.ReadFloat(); float y = im.ReadFloat(); int r = im.ReadInt32(); uint color = im.ReadUInt32(); FixedList.Add(Tuple.Create<uint, float, float, int, uint>(uid, x, y, r, color)); } }
public void R(NetIncomingMessage im) { int Count = im.ReadInt32(); for (int i = 0; i < Count; ++i) { uint uid = im.ReadUInt32(); float x = im.ReadFloat(); float y = im.ReadFloat(); int r = im.ReadInt32(); uint color = im.ReadUInt32(); string name = im.ReadString(); PLayerList.Add(Tuple.Create<uint, float, float, int, uint, string>(uid, x, y, r, color, name)); } }
public static OtherPlayer MsgToOtherPlayers(NetIncomingMessage im) { bool alive = im.ReadBoolean(); float xp = im.ReadFloat(); float yp = im.ReadFloat(); float zp = im.ReadFloat(); Int32 id = im.ReadInt32(); float xr = im.ReadFloat(); float yr = im.ReadFloat(); Int16 model = im.ReadInt16(); OtherPlayer d = new OtherPlayer(xp, yp, zp, id, xr, yr, false); d.model = model; return d; }
public static Player MsgToPlayer(NetIncomingMessage im, GraphicsDevice device) { bool alive = im.ReadBoolean(); float xp = im.ReadFloat(); float yp = im.ReadFloat(); float zp = im.ReadFloat(); Int32 id = im.ReadInt32(); float xr = im.ReadFloat(); xr = im.ReadFloat(); Int32 mo = im.ReadInt32(); Player d = new Player(xp, yp, zp, id, mo, device); Globals.player = d; return d; }
public void R(NetIncomingMessage im) { Operat = im.ReadByte(); if(Operat == GroupUp) { Radius = im.ReadInt32(); } else if(Operat == Born) { X = im.ReadFloat(); Y = im.ReadFloat(); Radius = im.ReadInt32(); Color = im.ReadUInt32(); } }
public void DecodeClientMessage(NetIncomingMessage im) { Vector2 pos; pos.X = this.paddle2.Position.X; pos.Y = im.ReadFloat(); this.paddle2.Position = pos; }
static object ReadArgument(NetIncomingMessage msg, Type type) { if (type == typeof(int)) { return msg.ReadInt32(); } else if (type == typeof(byte)) { return msg.ReadByte(); } else if (type == typeof(float)) { return msg.ReadFloat(); } else if (type == typeof(Vector3)) { return NetworkUtils.ReadVector3(msg); } else if (type == typeof(Quaternion)) { return NetworkUtils.ReadQuaternion(msg); } else if (type == typeof(string)) { return msg.ReadString(); } else { throw new Exception("Unsupported argument type " + type); } }
private void ReadData(AttributeTypeID Type, NetIncomingMessage Message) { switch(Type) { case AttributeTypeID.Float: Data = Message.ReadFloat(); break; case AttributeTypeID.Int: Data = Message.ReadInt32(); break; case AttributeTypeID.List: Console.WriteLine("AttributeSystem: List<> Type not supported on network sync"); break; case AttributeTypeID.Long: Data = Message.ReadInt64(); break; case AttributeTypeID.Rectangle: Data = Message.ReadRectangle(); break; case AttributeTypeID.String: Data = Message.ReadString(); break; case AttributeTypeID.Vector2: Data = Message.ReadVector2(); break; case AttributeTypeID.Bool: Data = Message.ReadBoolean(); break; default: Console.WriteLine("Invalid Attribute Type: {0}", Type.ToString()); break; } }
public HealthTransferableData(NetIncomingMessage message) { SessionID = message.ReadInt64(); ID = message.ReadInt32(); IsValid = message.ReadBoolean(); PlayerIndex = message.ReadInt32(); Value = message.ReadFloat(); }
public override void ReadInUpdateData(Lidgren.Network.NetIncomingMessage im) { base.ReadInUpdateData(im); elapsedTime = im.ReadFloat(); updateMenu(); }