• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Networking.NetworkWriter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Serialize

 public override void Serialize(NetworkWriter writer)
 {
     writer.WritePackedUInt32((uint) this.oldServerConnectionId);
     writer.Write((ushort) this.peers.Length);
     for (int i = 0; i < this.peers.Length; i++)
     {
         this.peers[i].Serialize(writer);
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:9,代码来源:PeerListMessage.cs


示例17: Serialize

 public override void Serialize(NetworkWriter writer)
 {
     base.Serialize(writer);
     writer.Write(_instructionBase);
     writer.Write(_variantReplacements.Length);
     foreach (string replacement in _variantReplacements) {
         writer.Write(replacement);
     }
 }
开发者ID:imclab,项目名称:SpaceLeap,代码行数:9,代码来源:ReplacementPanelActionSet.cs


示例18: Serialize

 public override void Serialize(NetworkWriter writer)
 {
     writer.Write(ChannelId);
     writer.Write(SenderUserId);
     writer.Write(SenderUserName);
     writer.Write(Message);
     var json = JsonWrapper.SerializeObject(Timestamp);
     writer.Write(json);
 }
开发者ID:PlayFab,项目名称:PlayFabGameServer,代码行数:9,代码来源:MessageModels.cs


示例19: Awake

 private void Awake()
 {
     this.m_PrevPosition = this.m_Target.localPosition;
     this.m_PrevRotation = this.m_Target.localRotation;
     if (base.localPlayerAuthority)
     {
         this.m_LocalTransformWriter = new NetworkWriter();
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:9,代码来源:NetworkTransformChild.cs


示例20: Serialize

 public override void Serialize(NetworkWriter writer)
 {
     writer.Write((ushort) this.scripts.Length);
     for (int i = 0; i < this.scripts.Length; i++)
     {
         writer.Write(this.scripts[i].name);
         writer.Write(this.scripts[i].channel);
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:9,代码来源:CRCMessage.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Rendering.CommandBuffer类代码示例发布时间:2022-05-26
下一篇:
C# Networking.NetworkInstanceId类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap