当前位置: 首页>>代码示例>>C#>>正文


C# NetBuffer.ReadInt64方法代码示例

本文整理汇总了C#中Lidgren.Network.NetBuffer.ReadInt64方法的典型用法代码示例。如果您正苦于以下问题:C# NetBuffer.ReadInt64方法的具体用法?C# NetBuffer.ReadInt64怎么用?C# NetBuffer.ReadInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lidgren.Network.NetBuffer的用法示例。


在下文中一共展示了NetBuffer.ReadInt64方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

 public void Read(NetBuffer im)
 {
     MessagePacketId = im.ReadInt64();
     Number          = im.ReadInt32();
     int length      = im.ReadInt32();
     if (length != 0)
     {
         Bytes = im.ReadBytes(length);
     }
 }
开发者ID:xxy1991,项目名称:cozy,代码行数:10,代码来源:PacketMessage.cs

示例2: Main


//.........这里部分代码省略.........
				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");
			}

			// test writevariableuint64
			NetBuffer largeBuffer = new NetBuffer(100 * 8);
			UInt64[] largeNumbers = new ulong[100];
			for (int i = 0; i < 100; i++)
			{
				largeNumbers[i] = ((ulong)NetRandom.Instance.NextUInt() << 32) | (ulong)NetRandom.Instance.NextUInt();
				largeBuffer.WriteVariableUInt64(largeNumbers[i]);
			}

			largeBuffer.Position = 0;
			for (int i = 0; i < 100; i++)
			{
				UInt64 ln = largeBuffer.ReadVariableUInt64();
				if (ln != largeNumbers[i])
					throw new Exception("large fail");
			}

			//
			// Extended tests on padbits
开发者ID:marvel54,项目名称:lidgren-network,代码行数:67,代码来源:Program.cs

示例3: Read

 public void Read(NetBuffer im)
 {
     UniqueIdentifier    = im.ReadInt64();
     MessagePacketId     = im.ReadInt64();
 }
开发者ID:xxy1991,项目名称:cozy,代码行数:5,代码来源:SendPacketMessageRecv.cs

示例4: SkipReadyFlags

 protected void SkipReadyFlags(NetBuffer buffer)
 {
     int playersCount = buffer.ReadByte();
     buffer.ReadInt64(playersCount);
 }
开发者ID:bbqchickenrobot,项目名称:atomic-bomberman-xna,代码行数:5,代码来源:GameControllerNetwork.cs

示例5: Read

 public void Read(NetBuffer im)
 {
     UniqueIdentifier    = im.ReadInt64();
     TargetSize          = im.ReadInt32();
 }
开发者ID:xxy1991,项目名称:cozy,代码行数:5,代码来源:SendPacketMessage.cs


注:本文中的Lidgren.Network.NetBuffer.ReadInt64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。