ReadFloat() public method

Reads a 32 bit floating point value written using Write(Single)
public ReadFloat ( ) : float
return float
コード例 #1
0
ファイル: SerializedStructs.cs プロジェクト: traleven/PNet
 /// <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();
 }
コード例 #2
0
ファイル: Msg_AgarPlayInfo.cs プロジェクト: xxy1991/cozy
 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();
         }
     }
 }
コード例 #3
0
ファイル: Line.cs プロジェクト: yegorf1/Circles
        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;
        }
コード例 #4
0
 public void Decode(NetIncomingMessage im)
 {
     this.Id = im.ReadInt32();
     this.MessageTime = im.ReadDouble();
     this.Health = im.ReadFloat();
     this.MaxHealth = im.ReadFloat();
 }
コード例 #5
0
ファイル: Package.cs プロジェクト: andva/Eulerian-ShootEmUp
        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);
        }
コード例 #6
0
ファイル: NetAsteroid.cs プロジェクト: Rohansi/Programe
 protected override void Read(NetIncomingMessage message)
 {
     x = message.ReadFloat();
     y = message.ReadFloat();
     rotation = message.ReadUInt16().FromNetworkRotation() * (180f / (float)Math.PI);
     type = message.ReadByte();
 }
コード例 #7
0
 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());
 }
コード例 #8
0
 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();
 }
コード例 #9
0
ファイル: NetShip.cs プロジェクト: Rohansi/Programe
 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;
 }
コード例 #10
0
 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;
 }
コード例 #11
0
 public void Decode(NetIncomingMessage im)
 {
     Hour = im.ReadFloat();
     Day = im.ReadFloat();
     Month = im.ReadFloat();
     Year = im.ReadFloat();
     TimeScale = im.ReadFloat();
     Weather = im.ReadInt32();
 }
コード例 #12
0
    public static Vector3 ReadVector3(NetIncomingMessage msg)
    {
        Vector3 data;

        data.x = msg.ReadFloat();
        data.y = msg.ReadFloat();
        data.z = msg.ReadFloat();

        return data;
    }
コード例 #13
0
        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;
        }
コード例 #14
0
        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);
        }
コード例 #15
0
 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);
 }
コード例 #16
0
 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;
 }
コード例 #17
0
    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;
    }
コード例 #18
0
        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;
            }
        }
コード例 #19
0
 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())));
         }
     }
 }
コード例 #20
0
ファイル: Msg_AgarFixedBall.cs プロジェクト: xxy1991/cozy
 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();
     }
 }
コード例 #21
0
ファイル: Scene.cs プロジェクト: Rohansi/Programe
        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));
            }
        }
コード例 #22
0
ファイル: Msg_AgarFixBallPack.cs プロジェクト: xxy1991/cozy
 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));
     }
 }
コード例 #23
0
ファイル: Msg_AgarPlayInfoPack.cs プロジェクト: xxy1991/cozy
 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));
     }
 }
コード例 #24
0
ファイル: Package.cs プロジェクト: andva/Eulerian-ShootEmUp
 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;
 }
コード例 #25
0
ファイル: Package.cs プロジェクト: andva/Eulerian-ShootEmUp
 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;
 }
コード例 #26
0
ファイル: Msg_AgarSelf.cs プロジェクト: xxy1991/cozy
 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();
     }
 }
コード例 #27
0
 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);
     }
 }
コード例 #29
0
ファイル: Attribute.cs プロジェクト: fusspawn/sobriety
 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();
 }
コード例 #31
0
ファイル: ActionCenter.cs プロジェクト: preetum/archive
        public override void ReadInUpdateData(Lidgren.Network.NetIncomingMessage im)
        {
            base.ReadInUpdateData(im);

            elapsedTime = im.ReadFloat();

            updateMenu();
        }