本文整理匯總了C#中Pdelvo.Minecraft.Network.BigEndianStream.ReadSingle方法的典型用法代碼示例。如果您正苦於以下問題:C# BigEndianStream.ReadSingle方法的具體用法?C# BigEndianStream.ReadSingle怎麽用?C# BigEndianStream.ReadSingle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pdelvo.Minecraft.Network.BigEndianStream
的用法示例。
在下文中一共展示了BigEndianStream.ReadSingle方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
if (version >= 32)
{
byte dataByte = reader.ReadByte ();
Flying = (dataByte & 0x1) != 0;
InstantBuild = (dataByte & 0x2) != 0;
MayFly = (dataByte & 0x4) != 0;
Invulnerable = (dataByte & 0x8) != 0;
FlyingSpeed = version >= 72 ? reader.ReadSingle() : reader.ReadByte() /255f;
WalkSpeed = version >= 72 ? reader.ReadSingle() : reader.ReadByte() / 255f;
}
else
{
Flying = reader.ReadBoolean ();
InstantBuild = reader.ReadBoolean ();
MayFly = reader.ReadBoolean ();
Invulnerable = reader.ReadBoolean ();
FlyingSpeed = version >= 72 ? 15 : 15 / 255f;
WalkSpeed = version >= 72 ? 25 : 25 / 255f;
}
}
示例2: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
Yaw = reader.ReadSingle ();
Pitch = reader.ReadSingle ();
OnGround = reader.ReadBoolean ();
}
示例3: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
Health = version >= 72 ? reader.ReadSingle() : reader.ReadInt16();
Food = reader.ReadInt16();
FoodSaturation = reader.ReadSingle();
}
示例4: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
Sideways = reader.ReadSingle();
Forward = reader.ReadSingle();
Jump = reader.ReadBoolean();
Unmount = reader.ReadBoolean();
}
示例5: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="version">The version.</param>
/// <remarks></remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new System.ArgumentNullException("reader");
Unknown1 = reader.ReadSingle();
Unknown2 = reader.ReadSingle();
Unknown3 = reader.ReadSingle();
Unknown4 = reader.ReadSingle();
Unknown5 = reader.ReadBoolean();
Unknown6 = reader.ReadBoolean();
}
示例6: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="version">The version.</param>
/// <remarks></remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new System.ArgumentNullException("reader");
PositionX = reader.ReadDouble();
PositionY = reader.ReadDouble();
Stance = reader.ReadDouble();
PositionZ = reader.ReadDouble();
Yaw = reader.ReadSingle();
Pitch = reader.ReadSingle();
OnGround = reader.ReadBoolean();
}
示例7: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="version">The version.</param>
/// <remarks></remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new System.ArgumentNullException("reader");
PositionX = reader.ReadDouble();
PositionY = reader.ReadDouble();
PositionZ = reader.ReadDouble();
Radius = reader.ReadSingle();
var records = new ExplosionRecord[RecordCount = reader.ReadInt32()];
for (int i = 0; i < RecordCount; i++)
{
var record = new ExplosionRecord();
record.OffsetX = reader.ReadByte();
record.OffsetY = reader.ReadByte();
record.OffsetZ = reader.ReadByte();
records[i] = record;
}
Records = records;
if (version >= 36)
{
VelocityX = reader.ReadSingle();
VelocityY = reader.ReadSingle();
VelocityZ = reader.ReadSingle();
}
}
示例8: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
CurrentExperience = reader.ReadSingle ();
Level = reader.ReadInt16 ();
TotalExperience = reader.ReadInt16 ();
}
示例9: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="version">The version.</param>
/// <remarks></remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new System.ArgumentNullException("reader");
Name = reader.ReadString16();
PositionX = reader.ReadInt32();
PositionY = reader.ReadInt32();
PositionZ = reader.ReadInt32();
if (version >= 37)
Volume = reader.ReadSingle();
else
Volume = reader.ReadByte();
Pitch = reader.ReadByte();
}
示例10: Read
public static MetadataInfo Read(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
byte b = 0;
var data = new Dictionary<byte, object> ();
while ((b = reader.ReadByte ()) != 127)
{
switch (b >> 5)
{
case 0:
data.Add(b, reader.ReadByte ());
break;
case 1:
data.Add(b, reader.ReadInt16 ());
break;
case 2:
data.Add(b, reader.ReadInt32 ());
break;
case 3:
data.Add(b, reader.ReadSingle ());
break;
case 4:
data.Add(b, reader.ReadString16 ());
break;
case 5:
data.Add(b, ItemStack.Read(reader));
break;
case 6:
data.Add(b,
new EntityInformation
{
Data1 = reader.ReadInt32 (),
Data2 = reader.ReadInt32 (),
Data3 = reader.ReadInt32 ()
});
break;
default:
break;
}
}
return new MetadataInfo {Data = data};
}
示例11: SingleTest
public void SingleTest()
{
MemoryStream memStream = new MemoryStream();
BigEndianStream bigEndianStream = new BigEndianStream(memStream);
var testByte1 = float.MaxValue;
var testByte2 = float.MinValue;
bigEndianStream.Write(testByte1);
bigEndianStream.Write(testByte2);
memStream.Seek(0, SeekOrigin.Begin);
Assert.AreEqual(bigEndianStream.ReadSingle(), testByte1);
Assert.AreEqual(bigEndianStream.ReadSingle(), testByte2);
Assert.AreEqual(memStream.Position, memStream.Length);
}