本文整理汇总了C#中Lidgren.Network.NetBuffer.ReadRangedSingle方法的典型用法代码示例。如果您正苦于以下问题:C# NetBuffer.ReadRangedSingle方法的具体用法?C# NetBuffer.ReadRangedSingle怎么用?C# NetBuffer.ReadRangedSingle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lidgren.Network.NetBuffer
的用法示例。
在下文中一共展示了NetBuffer.ReadRangedSingle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//.........这里部分代码省略.........
throw new Exception("Ack thphth 2");
if (msg.ReadSingle() != -42.8f)
throw new Exception("Ack thphth 3");
if (msg.ReadString() != "duke of earl")
throw new Exception("Ack thphth 4");
if (msg.ReadVariableInt32() != -1) throw new Exception("ReadVariableInt32 failed 1");
if (msg.ReadVariableInt32() != 5) throw new Exception("ReadVariableInt32 failed 2");
if (msg.ReadVariableInt32() != -18) throw new Exception("ReadVariableInt32 failed 3");
if (msg.ReadVariableInt32() != 42) throw new Exception("ReadVariableInt32 failed 4");
if (msg.ReadVariableInt32() != -420) throw new Exception("ReadVariableInt32 failed 5");
if (msg.ReadUInt32() != 9991)
throw new Exception("Ack thphth 4.5");
if (msg.ReadBoolean() != true)
throw new Exception("Ack thphth 5");
if (msg.ReadUInt32(5) != (uint)3)
throw new Exception("Ack thphth 6");
if (msg.ReadSingle() != 8.111f)
throw new Exception("Ack thphth 7");
if (msg.ReadString() != "again")
throw new Exception("Ack thphth 8");
byte[] rrr = msg.ReadBytes(4);
if (rrr[0] != arr[0] || rrr[1] != arr[1] || rrr[2] != arr[2] || rrr[3] != arr[3])
throw new Exception("Ack thphth 9");
if (msg.ReadByte(7) != 7)
throw new Exception("Ack thphth 10");
if (msg.ReadInt32() != Int32.MinValue)
throw new Exception("Ack thphth 11");
if (msg.ReadUInt32() != UInt32.MaxValue)
throw new Exception("Ack thphth 12");
float v = msg.ReadRangedSingle(-10, 50, 12);
// v should be close to, but not necessarily exactly, 21.0f
if ((float)Math.Abs(21.0f - v) > 0.1f)
throw new Exception("Ack thphth *RangedSingle() failed");
if (msg.ReadInt32(5) != 15)
throw new Exception("Ack thphth ReadInt32 1");
if (msg.ReadInt32(5) != 2)
throw new Exception("Ack thphth ReadInt32 2");
if (msg.ReadInt32(5) != 0)
throw new Exception("Ack thphth ReadInt32 3");
if (msg.ReadInt32(5) != -1)
throw new Exception("Ack thphth ReadInt32 4");
if (msg.ReadInt32(5) != -2)
throw new Exception("Ack thphth ReadInt32 5");
if (msg.ReadInt32(5) != -15)
throw new Exception("Ack thphth ReadInt32 6");
UInt64 longVal = msg.ReadUInt64();
if (longVal != UInt64.MaxValue)
throw new Exception("Ack thphth UInt64");
if (msg.ReadInt64() != Int64.MaxValue)
throw new Exception("Ack thphth Int64");
if (msg.ReadInt64() != Int64.MinValue)
throw new Exception("Ack thphth Int64");
if (msg.ReadInt32() != 42)
throw new Exception("Ack thphth end");
msg.SkipPadBits();
if (msg.ReadRangedInteger(0, 10) != 5)
throw new Exception("Ack thphth ranged integer");