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


C# NetworkWriter.WriteBytesFull方法代码示例

本文整理汇总了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);
 }
开发者ID:dgkae,项目名称:unityassets,代码行数:7,代码来源:VoiceChatPacketMessage.cs

示例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);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:7,代码来源:OverrideTransformMessage.cs

示例3: Serialize

 public override void Serialize(NetworkWriter writer)
 {
     writer.Write(this.netId);
     writer.Write(this.sceneId);
     writer.Write(this.position);
     writer.WriteBytesFull(this.payload);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:7,代码来源:ObjectSpawnSceneMessage.cs

示例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);
	}
开发者ID:NickPowers43,项目名称:SW,代码行数:38,代码来源:ServerVC.cs

示例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));
        }
    }
开发者ID:Ragzouken,项目名称:smooltool,代码行数:51,代码来源:Test.cs

示例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();
    }
开发者ID:Ragzouken,项目名称:smooltool,代码行数:33,代码来源:Test.cs

示例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();
    }
开发者ID:Ragzouken,项目名称:smooltool,代码行数:30,代码来源:Test.cs

示例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);
 }
开发者ID:bpeake13,项目名称:UnityChildSpawning,代码行数:8,代码来源:ChildSpawnMessage.cs


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