當前位置: 首頁>>代碼示例>>C#>>正文


C# BinaryReader.ReadSingle方法代碼示例

本文整理匯總了C#中System.IO.BinaryReader.ReadSingle方法的典型用法代碼示例。如果您正苦於以下問題:C# BinaryReader.ReadSingle方法的具體用法?C# BinaryReader.ReadSingle怎麽用?C# BinaryReader.ReadSingle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.IO.BinaryReader的用法示例。


在下文中一共展示了BinaryReader.ReadSingle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ReadFrom

 internal override void ReadFrom(BinaryReader reader)
 {
     Id = reader.ReadInt32();
     float x = reader.ReadSingle();
     float y = reader.ReadSingle();
     Position = new Vector2(x, y);
 }
開發者ID:NobodysNightmare,項目名稱:BlockDefender,代碼行數:7,代碼來源:PlayerSpawnPacket.cs

示例2: ReadPoint

 private Point3D ReadPoint(BinaryReader reader)
 {
     var x = reader.ReadSingle();
     var y = reader.ReadSingle();
     var z = reader.ReadSingle();
     return new Point3D(x, y, z);
 }
開發者ID:bgbock,項目名稱:Hexenstein,代碼行數:7,代碼來源:PartMesh.cs

示例3: Read

        public IList<IFace> Read(BinaryReader reader)
        {
            int numFaces = reader.ReadInt32();

            for (int i = 0; i < numFaces; i++)
            {
                float materialRotation = reader.ReadSingle();
                float u = reader.ReadSingle();
                float v = reader.ReadSingle();
                float uScale = reader.ReadSingle();
                float vScale = reader.ReadSingle();
                int unknown = reader.ReadInt32();
                int materialIndex = reader.ReadInt32();
                int unknown2 = reader.ReadInt32();

                int numVertices = reader.ReadInt32();

                for (int j = 0; j < numVertices; j++)
                {
                    int unknown3 = reader.ReadInt32();
                    int indice = reader.ReadInt32();
                }

                IFace face = new Face();
                face.MaterialRotation =
                face.U = u;
            }
        }
開發者ID:DamienHauta,項目名稱:NS2-Map-Extract,代碼行數:28,代碼來源:FaceSerializer.cs

示例4: RestoreState

 public void RestoreState(BinaryReader reader)
 {
     var curName = reader.ReadString();
     if (curName != "")
     {
         var loop = reader.ReadBoolean();
         current = new LinearSequence(anims[curName], loop)
                       {
                           Speed = reader.ReadSingle(),
                           Time = reader.ReadSingle()
                       };
     }
     var backupName = reader.ReadString();
     if (backupName != "")
     {
         var loop = reader.ReadBoolean();
         backup = new LinearSequence(anims[backupName], loop)
         {
             Speed = reader.ReadSingle(),
             Time = reader.ReadSingle()
         };
     }
     fadeLeft = reader.ReadSingle();
     fadeTime = reader.ReadSingle();
 }
開發者ID:jyunfan2015,項目名稱:Calcifer,代碼行數:25,代碼來源:BlendAnimationController.cs

示例5: Read

        public static Image Read(BinaryReader Reader)
        {
            Image I = new Image();

              I.m_Width = Reader.ReadInt32();
              I.m_Height = Reader.ReadInt32();

              Reader.ReadSingle();
              Reader.ReadSingle();

              Reader.ReadSingle();
              Reader.ReadSingle();

              I.m_HorizontalFieldOfView = Reader.ReadSingle();
              I.m_VerticalFieldOfView = Reader.ReadSingle();
              long l = Reader.ReadInt64();
              I.m_AquiredOn = DateTime.Now; //= new DateTime(l);
              I.m_SequenceNumber = Reader.ReadInt32();

              I.m_RawPixels = Reader.ReadBytes(I.m_Width * I.m_Height * 3);

              I.m_Pixels = new Color[I.m_Width * I.m_Height];
              for (int i = 0; i < I.m_Pixels.Length; i++)
            I.m_Pixels[i] = Color.FromArgb(I.m_RawPixels[3 * i], I.m_RawPixels[3 * i+1], I.m_RawPixels[3 * i + 2]);

              return I;
        }
開發者ID:anareboucas,項目名稱:nanook,代碼行數:27,代碼來源:Image.cs

示例6: parse

        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|-----|" + ChunkHeader.W3D_CHUNK_DEFORM_DATA);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_DEFORM_DATA;
            HeaderName = ChunkHeader.W3D_CHUNK_DEFORM_DATA.ToString();

            for (int i = 0; i < chunkLength / 28; i++)
            {
                vertex_index = br.ReadInt32();
                position = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());

                int R = br.ReadByte();
                int G = br.ReadByte();
                int B = br.ReadByte();
                int A = br.ReadByte();

                color = Color.FromArgb(A, R, G, B);

                //reserved
                for (int i2 = 0; i2 < 2; i2++)
                {
                    reserved[i2] = br.ReadInt32();
                }
            }
        }
開發者ID:RavenB,項目名稱:Earth-and-Beyond-server,代碼行數:26,代碼來源:DeformDataChunk.cs

示例7: ReadFromStream

 /// <summary>
 /// </summary>
 /// <param name="stream">
 /// </param>
 public void ReadFromStream(Stream stream)
 {
     BinaryReader br = new BinaryReader(stream);
     this.X = br.ReadSingle();
     this.Y = br.ReadSingle();
     this.Z = br.ReadSingle();
 }
開發者ID:gordonc64,項目名稱:CellAO.Tools,代碼行數:11,代碼來源:FlatCoordinate.cs

示例8: DeserializeUpdate

        /// <summary>
        /// Deserialisiert Update Daten.
        /// </summary>
        public override void DeserializeUpdate(BinaryReader reader)
        {
            base.DeserializeUpdate(reader);

            // Velocity wieder deserialisieren
            Velocity = new Vector2(reader.ReadSingle(), reader.ReadSingle());
        }
開發者ID:tomwendel,項目名稱:RheinwerkAdventure,代碼行數:10,代碼來源:Character.cs

示例9: Read

 /// <summary>
 /// Reads object data from given BinaryReader.
 /// </summary>
 public void Read(BinaryReader br)
 {
     R = br.ReadSingle();
     G = br.ReadSingle();
     B = br.ReadSingle();
     A = br.ReadSingle();
 }
開發者ID:habanero3d,項目名稱:ModelLoader,代碼行數:10,代碼來源:Color4F.cs

示例10: BuildObject

        private static GameObject BuildObject(Scene scene, BinaryReader reader)
        {
            var id = reader.ReadUInt32();
            var position = new Vector2f(reader.ReadSingle(), reader.ReadSingle());

            return ObjectsManager.Build(id, position);
        }
開發者ID:niemandkun,項目名稱:MiraiEngine,代碼行數:7,代碼來源:SceneManager.cs

示例11: parse

        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|----| " + ChunkHeader.W3D_CHUNK_STAGE_TEXCOORDS);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_STAGE_TEXCOORDS;
            HeaderName = ChunkHeader.W3D_CHUNK_STAGE_TEXCOORDS.ToString();

            int NumTexCoords = chunkLength / 8;
            object[] uv = new object[2];
            tex_coord_data = new object[NumTexCoords][];

            for (int i = 0; i < NumTexCoords; i++)
            {
                uv[0] = br.ReadSingle();
                uv[1] = br.ReadSingle();

                tex_coord_data[i] = uv;

                if (dbg)
                {
                    Console.Out.WriteLine("\t Tex Coord #" + i);
                    Console.Out.WriteLine("\t U: " + uv[0] + " V: " + uv[1]);
                }
            }
        }
開發者ID:RavenB,項目名稱:Earth-and-Beyond-server,代碼行數:25,代碼來源:StageTexCoordsChunk.cs

示例12: MagicInfo

        public MagicInfo (BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
        {
            Name = reader.ReadString();
            Spell = (Spell)reader.ReadByte();
            BaseCost = reader.ReadByte();
            LevelCost = reader.ReadByte();
            Icon = reader.ReadByte();
            Level1 = reader.ReadByte();
            Level2 = reader.ReadByte();
            Level3 = reader.ReadByte();
            Need1 = reader.ReadUInt16();
            Need2 = reader.ReadUInt16();
            Need3 = reader.ReadUInt16();
            DelayBase = reader.ReadUInt32();
            DelayReduction = reader.ReadUInt32();
            PowerBase = reader.ReadUInt16();
            PowerBonus = reader.ReadUInt16();
            MPowerBase = reader.ReadUInt16();
            MPowerBonus = reader.ReadUInt16();

            if (version > 66)
                Range = reader.ReadByte();
            if (version > 70)
            {
                MultiplierBase = reader.ReadSingle();
                MultiplierBonus = reader.ReadSingle();
            }
        }
開發者ID:Pete107,項目名稱:Mir2,代碼行數:28,代碼來源:MagicInfo.cs

示例13: FromNetwork

 /// <summary>
 /// 
 /// </summary>
 /// <param name="reader"></param>
 public override void FromNetwork(BinaryReader reader)
 {
     VelocityX = reader.ReadSingle();
     VelocityY = reader.ReadSingle();
     X = reader.ReadSingle();
     Y = reader.ReadSingle();
 }
開發者ID:hussein-aitlahcen,項目名稱:heroesrpg,代碼行數:11,代碼來源:MovableEntityPart.cs

示例14: ReadFromFile

        public static void ReadFromFile(string file, out LineSet lineset)
        {
            Line[] lines;

            // Open the file. If it already exists, overwrite.
            using (FileStream fs = File.Open(@file, FileMode.Open))
            {
                using (BinaryReader reader = new BinaryReader(fs))
                {
                    // Write number of lines.
                    lines = new Line[reader.ReadInt32()];

                    // Write line lengths in order.
                    for (int l = 0; l < lines.Length; ++l)
                        lines[l] = new Line() { Positions = new Vector3[reader.ReadInt32()] };

                    // Write positions.
                    float x, y, z;
                    foreach (Line line in lines)
                    {
                        for(int v = 0; v < line.Length; ++v)
                        {
                            x = reader.ReadSingle();
                            y = reader.ReadSingle();
                            z = reader.ReadSingle();
                            line[v] = new Vector3(x, y, z);
                        }
                    }

                }
            }

            lineset = new LineSet(lines);
        }
開發者ID:AnkeAnke,項目名稱:FlowSharp,代碼行數:34,代碼來源:GeometryWriter.cs

示例15: ReadHeader

 /// <inheritdoc></inheritdoc>
 public override void ReadHeader()
 {
     string location = FileIsEmbedded ? ManifestResourceString : GridFilePath;
     Name = Path.GetFileNameWithoutExtension(location);
     using (Stream str = GetStream())
     {
         if (str == null) return;
         using (BinaryReader br = new BinaryReader(str))
         {
             // read past 64 bytes of strings/nulls at start of file
             br.BaseStream.Seek(64, SeekOrigin.Begin);
             NumLambdas = br.ReadInt32();
             NumPhis = br.ReadInt32();
             br.ReadInt32(); // num z values: always 1
             PhiLam ll;
             ll.Lambda = br.ReadSingle() * DEG_TO_RAD;
             PhiLam cs;
             cs.Lambda = br.ReadSingle() * DEG_TO_RAD;
             ll.Phi = br.ReadSingle() * DEG_TO_RAD;
             LowerLeft = ll;
             cs.Phi = br.ReadSingle() * DEG_TO_RAD;
             CellSize = cs;
             Filled = false;
         }
     }
 }
開發者ID:DIVEROVIEDO,項目名稱:DotSpatial,代碼行數:27,代碼來源:LasLosNadTable.cs


注:本文中的System.IO.BinaryReader.ReadSingle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。