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


C# Networking.NetworkWriter类代码示例

本文整理汇总了C#中UnityEngine.Networking.NetworkWriter的典型用法代码示例。如果您正苦于以下问题:C# NetworkWriter类的具体用法?C# NetworkWriter怎么用?C# NetworkWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NetworkWriter类属于UnityEngine.Networking命名空间,在下文中一共展示了NetworkWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Serialize

 public override void Serialize(NetworkWriter writer)
 {
     writer.Write(this.netId);
     writer.WritePackedUInt32((uint) this.stateHash);
     writer.Write(this.normalizedTime);
     writer.WriteBytesAndSize(this.parameters, this.parameters.Length);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:7,代码来源:AnimationMessage.cs

示例2: AddOurselves

    public void AddOurselves(ClientPlayer player, NetworkWriter nw)
    {
        player.currentVessel = this;
        player.ChunkI = WorldToChunkI((Vector2)player.transform.position);

        int rangeT = (PLAYER_CHUNK_RANGE * 2) + 1;

        nw.Write((ushort)ClientMessageType.RequestChunk);
        nw.Write((ushort)(rangeT * rangeT));

        for (int i = 0; i < rangeT; i++) {
            for (int j = 0; j < rangeT; j++) {

                Vec2i temp = player.ChunkI + new Vec2i(i - PLAYER_CHUNK_RANGE, j - PLAYER_CHUNK_RANGE);
                if (!((temp - player.ChunkI) <= PLAYER_CHUNK_RANGE)) {
                    VesselChunk temp2 = chunks.TryGet(temp.x, temp.y);

                    nw.Write(temp.x);
                    nw.Write(temp.y);

                    if (temp2 != null) {
                        nw.Write(temp2.version);
                    } else {
                        nw.Write((uint)uint.MaxValue);
                    }
                }
            }
        }
    }
开发者ID:NickPowers43,项目名称:SW,代码行数:29,代码来源:ClientVessel.cs

示例3: 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

示例4: OutputMessage

 public OutputMessage(NetworkWriter data, int connectionID, int channelID)
 {
     Data = data;
     ConnectionID = connectionID;
     Type = MessageType.Reply;
     ChannelID = channelID;
 }
开发者ID:ChaseHuegel,项目名称:LLApi-Basic-Implementation,代码行数:7,代码来源:OutputMessage.cs

示例5: 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

示例6: Serialize

 public override void Serialize(NetworkWriter writer)
 {
     base.Serialize(writer);
     writer.Write(Polyline.Count);
     foreach (var vector3 in Polyline)
         writer.Write(vector3);
 }
开发者ID:yuta0023,项目名称:demo,代码行数:7,代码来源:EditorMessages.cs

示例7: PostInternalMessage

 private void PostInternalMessage(short msgType)
 {
     NetworkWriter writer = new NetworkWriter();
     writer.StartMessage(msgType);
     writer.FinishMessage();
     this.PostInternalMessage(writer.AsArray(), 0);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:7,代码来源:LocalClient.cs

示例8: Serialize

 public override void Serialize(NetworkWriter writer)
 {
     writer.WritePackedUInt32((uint) this.oldConnectionId);
     writer.WritePackedUInt32((uint) this.playerControllerId);
     writer.Write(this.netId);
     writer.WriteBytesAndSize(this.msgData, this.msgSize);
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:7,代码来源:ReconnectMessage.cs

示例9: OnSerialize

 public override bool OnSerialize(NetworkWriter writer, bool initialState)
 {
     var serialized = base.OnSerialize (writer, initialState);
     var time = animator.playbackTime;
     writer.Write (time);
     return serialized;
 }
开发者ID:doctorpangloss,项目名称:Cordon2,代码行数:7,代码来源:SyncAnimatorOnLoad.cs

示例10: 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

示例11: Serialize

 public static byte[] Serialize(INetMsg msg)
 {
     var networkWriter = new NetworkWriter();
     uint index = GetMsgIndexFromType( msg.GetType() );
     networkWriter.WritePackedUInt32( index );
     ((MessageBase)msg).Serialize(networkWriter);
     return networkWriter.AsArray();
 }
开发者ID:Zammy,项目名称:ProjectSpaceship,代码行数:8,代码来源:Messages.cs

示例12: OnSerialize

    /// <summary>
    /// Server: Serialize the state over network
    /// </summary>
    /// <param name="writer"></param>
    /// <param name="initialState"></param>
    /// <returns></returns>
    public override bool OnSerialize(NetworkWriter writer, bool initialState)
    {
        writer.Write(serverLastState.state);
        writer.Write(serverLastState.position);
        writer.Write(serverLastState.rotation);

        return true;
    }
开发者ID:atrakeur,项目名称:unity-unet-authoritative-networking,代码行数:14,代码来源:CharacterNetworkSync.cs

示例13: Serialize

 public override void Serialize(NetworkWriter writer)
 {
     writer.WritePackedUInt32((uint) this.connectionId);
     writer.Write(this.address);
     writer.WritePackedUInt32((uint) this.port);
     writer.Write(this.isHost);
     writer.Write(this.isYou);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:8,代码来源:PeerInfoMessage.cs

示例14: InvokeHandlerOnClient

 internal void InvokeHandlerOnClient(short msgType, MessageBase msg, int channelId)
 {
     NetworkWriter writer = new NetworkWriter();
     writer.StartMessage(msgType);
     msg.Serialize(writer);
     writer.FinishMessage();
     this.InvokeBytesOnClient(writer.AsArray(), channelId);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:8,代码来源:LocalClient.cs

示例15: Serialize

 public override void Serialize(NetworkWriter writer)
 {
     writer.Write((ushort) this.peers.Length);
     foreach (PeerInfoMessage message in this.peers)
     {
         message.Serialize(writer);
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:8,代码来源:PeerListMessage.cs


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