本文整理汇总了C#中NetworkMessage.PeekUInt16方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkMessage.PeekUInt16方法的具体用法?C# NetworkMessage.PeekUInt16怎么用?C# NetworkMessage.PeekUInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkMessage
的用法示例。
在下文中一共展示了NetworkMessage.PeekUInt16方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseMessage
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination, NetworkMessage outMsg)
{
if (msg.GetByte() != (byte)IncomingPacketType.TileUpdate)
return false;
Destination = destination;
Type = IncomingPacketType.TileUpdate;
outMsg.AddByte((byte)Type);
Objects.Location pos = msg.GetLocation();
outMsg.AddLocation(pos);
ushort thingId = msg.PeekUInt16();
if (thingId == 0xFF01)
{
outMsg.AddUInt16(msg.GetUInt16());
}
else
{
ParseTileDescription(msg, pos, outMsg);
outMsg.AddUInt16(msg.GetUInt16());
}
return true;
}
示例2: ParseFloorDescription
protected bool ParseFloorDescription(NetworkMessage msg, int x, int y, int z, int width, int height, int offset, NetworkMessage outMsg)
{
ushort skipTiles;
for (int nx = 0; nx < width; nx++)
{
for (int ny = 0; ny < height; ny++)
{
if (m_skipTiles == 0)
{
ushort tileOpt = msg.PeekUInt16();
//Decide if we have to skip tiles
// or if it is a real tile
if (tileOpt >= 0xFF00)
{
skipTiles = msg.GetUInt16();
outMsg.AddUInt16(skipTiles);
m_skipTiles = (short)(skipTiles & 0xFF);
}
else
{
//real tile so read tile
Objects.Location pos = new Pokemon.Objects.Location(x + nx + offset, y + ny + offset, z);
if (!ParseTileDescription(msg, pos, outMsg))
{
return false;
}
//read skip tiles info
skipTiles = msg.GetUInt16();
outMsg.AddUInt16(skipTiles);
m_skipTiles = (short)(skipTiles & 0xFF);
}
}
//skipping tiles...
else
{
m_skipTiles--;
}
}
}
return true;
}
示例3: ParseTileDescription
protected bool ParseTileDescription(NetworkMessage msg, Objects.Location pos, NetworkMessage outMsg)
{
int n = 0;
bool ret = true;
Tile tile = new Tile(Client, 0, pos);
while (true)
{
ushort inspectTileId = msg.PeekUInt16();
if (inspectTileId >= 0xFF00)
{
//end of the tile
ret = true;
break;
}
else
{
if (n > 10)
{
ret = false;
break;
}
//read tile things: items and creatures
ParseThing(msg, pos, tile, n, outMsg);
}
n++;
}
tiles.Add(tile);
return ret;
}