本文整理汇总了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);
}
示例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);
}
示例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;
}
}
示例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();
}
示例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;
}
示例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();
}
}
}
示例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();
}
示例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());
}
示例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();
}
示例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);
}
示例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]);
}
}
}
示例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();
}
}
示例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();
}
示例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);
}
示例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;
}
}
}