本文整理汇总了C#中UnityEngine.Networking.NetworkWriter.WriteBytesFull方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkWriter.WriteBytesFull方法的具体用法?C# NetworkWriter.WriteBytesFull怎么用?C# NetworkWriter.WriteBytesFull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Networking.NetworkWriter
的用法示例。
在下文中一共展示了NetworkWriter.WriteBytesFull方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialize
public override void Serialize(NetworkWriter writer)
{
writer.Write(proxyId);
writer.Write((short)packet.Compression);
writer.Write(packet.Length);
writer.WriteBytesFull(packet.Data);
}
示例2: Serialize
public override void Serialize(NetworkWriter writer)
{
writer.Write(this.netId);
writer.WriteBytesFull(this.payload);
writer.Write(this.teleport);
writer.WritePackedUInt32((uint) this.time);
}
示例3: Serialize
public override void Serialize(NetworkWriter writer)
{
writer.Write(this.netId);
writer.Write(this.sceneId);
writer.Write(this.position);
writer.WriteBytesFull(this.payload);
}
示例4: WriteSetChunk
public void WriteSetChunk(NetworkWriter nw)
{
if (updateMessageBytes) {
NetworkWriter temp = new NetworkWriter();
temp.Write(index.x);
temp.Write(index.y);
temp.Write(version);
temp.Write(tileCount);
for (int i = 0; i < VesselChunk.SIZE; i++) {
for (int j = 0; j < VesselChunk.SIZE; j++) {
VesselTile tile = TileAt(i, j);
if (tile != null) {
temp.Write(i);
temp.Write(j);
temp.Write((byte)tile.floor0);
temp.Write((byte)tile.floor1);
temp.Write((byte)tile.wallMask);
temp.Write(tile.wallNode);
}
}
}
messageBytes = temp.ToArray();
updateMessageBytes = false;
}
nw.WriteBytesFull(messageBytes);
}
示例5: SendWorld
private IEnumerator SendWorld(int connectionID, World world)
{
{
var writer = new NetworkWriter();
writer.Write((byte) Type.Tilemap);
writer.WriteBytesFull(world.tilemap);
Send(connectionID, writer.AsArray());
}
{
var writer = new NetworkWriter();
writer.Write((byte) Type.Palette);
for (int i = 0; i < 16; ++i) writer.Write((Color32) world.palette[i]);
Send(connectionID, writer.AsArray());
}
{
var writer = new NetworkWriter();
writer.Write((byte) Type.Walls);
writer.WriteBytesFull(world.walls.ToArray());
Send(connectionID, writer.AsArray());
}
foreach (var avatar in world.avatars)
{
Send(connectionID, ReplicateAvatarMessage(avatar));
if (avatar.id == connectionID)
{
Send(connectionID, GiveAvatarMessage(avatar));
}
else
{
Send(connectionID, AvatarInChunksMessages(world, avatar));
}
}
for (int i = 0; i < maxTiles; ++i)
{
yield return new WaitForSeconds(0.125f);
Send(connectionID, TileInChunksMessages(world, (byte) i));
}
}
示例6: TileInChunksMessages
private byte[][] TileInChunksMessages(World world,
byte tile,
int size = 128)
{
int x = tile % 16;
int y = tile / 16;
Color[] colors = world.tileset.GetPixels(x * 32, y * 32, 32, 32);
byte[] bytes = colors.Select(c => world.ColorToPalette(c, true)).ToArray();
byte[] chunk;
int offset = 0;
var messages = new List<byte[]>();
while (bytes.Any())
{
chunk = bytes.Take(size).ToArray();
bytes = bytes.Skip(size).ToArray();
var writer = new NetworkWriter();
writer.Write((byte) Type.TileChunk);
writer.Write(tile);
writer.Write(offset);
writer.WriteBytesFull(CrunchBytes(chunk));
messages.Add(writer.AsArray());
offset += size;
}
return messages.ToArray();
}
示例7: AvatarInChunksMessages
private byte[][] AvatarInChunksMessages(World world,
World.Avatar avatar,
int size = 128)
{
Color32[] colors = avatar.graphic.texture.GetPixels32();
byte[] bytes = colors.Select(c => world.ColorToPalette(c, true)).ToArray();
byte[] chunk;
int offset = 0;
var messages = new List<byte[]>();
while (bytes.Any())
{
chunk = bytes.Take(size).ToArray();
bytes = bytes.Skip(size).ToArray();
var writer = new NetworkWriter();
writer.Write((byte) Type.AvatarChunk);
writer.Write(avatar.id);
writer.Write(offset);
writer.WriteBytesFull(CrunchBytes(chunk));
messages.Add(writer.AsArray());
offset += size;
}
return messages.ToArray();
}
示例8: Serialize
public override void Serialize(NetworkWriter writer)
{
writer.Write(m_id);
writer.Write(m_parentId);
writer.Write(m_childId);
writer.Write(m_position);
writer.WriteBytesFull(m_payload);
}