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


C# IValueWriter.WriteUInt16方法代码示例

本文整理汇总了C#中IValueWriter.WriteUInt16方法的典型用法代码示例。如果您正苦于以下问题:C# IValueWriter.WriteUInt16方法的具体用法?C# IValueWriter.WriteUInt16怎么用?C# IValueWriter.WriteUInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IValueWriter的用法示例。


在下文中一共展示了IValueWriter.WriteUInt16方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteEntity

        private void WriteEntity(NetworkEntity entity, ISerializationContext context, IValueWriter writer)
        {
            writer.WriteString (entity.EntityName);
            writer.WriteUInt16 ((UInt16)entity.NetworkID);
            writer.WriteUInt16 ((UInt16)entity.Fields.Count);

            foreach (var kvp in entity.Fields)
            {
                object fieldValue = kvp.Value.Value;

                writer.WriteString (kvp.Key);

                // Write the field type
                ushort typeID;
                context.TypeMap.GetTypeId (fieldValue.GetType (), out typeID);
                writer.WriteUInt16 (typeID);

                if (fieldValue is Vector2)
                    writer.Write (context, (Vector2)fieldValue, Vector2Serializer.Instance);
                else if (fieldValue is Vector3)
                    writer.Write (context, (Vector3)fieldValue, Vector3Serializer.Instance);
                else
                    writer.Write (context, fieldValue, kvp.Value.Type);
            }
        }
开发者ID:NullSoldier,项目名称:Cinco,代码行数:25,代码来源:EntitySnapshotMessage.cs

示例2: WritePayload

 public override void WritePayload(ISerializationContext context, IValueWriter writerm)
 {
     writerm.WriteUInt16 ((ushort)this.DeniedMessage);
 }
开发者ID:ermau,项目名称:Gablarski,代码行数:4,代码来源:PermissionDeniedMessage.cs

示例3: WritePayload

 public override void WritePayload(ISerializationContext context, IValueWriter writer)
 {
     writer.WriteUInt16 (OriginalMessageId);
     writer.WriteByte (Count);
     writer.WriteBytes (Payload, this.offset, this.length);
 }
开发者ID:ermau,项目名称:Tempest,代码行数:6,代码来源:PartialMessage.cs

示例4: Serialize

        public void Serialize(ISerializationContext context, IValueWriter writer)
        {
            if (this.map == null)
            {
                writer.WriteUInt16 (0);
                return;
            }

            lock (this.sync)
            {
                writer.WriteUInt16 ((ushort)this.map.Count);
                foreach (var kvp in this.map.OrderBy (kvp => kvp.Value))
                    writer.WriteString (kvp.Key.GetSimplestName());
            }
        }
开发者ID:ermau,项目名称:Tempest,代码行数:15,代码来源:TypeMap.cs

示例5: WritePayload

        public override void WritePayload(ISerializationContext context, IValueWriter writer)
        {
            writer.WriteByte ((byte)TargetType);

            writer.WriteUInt16 ((ushort)TargetIds.Length);
            for (int i = 0; i < TargetIds.Length; ++i)
                writer.WriteInt32 (TargetIds[i]);

            writer.WriteInt32 (Sequence);
            writer.WriteInt32 (SourceId);

            writer.WriteByte ((byte)Data.Length);
            for (int i = 0; i < Data.Length; ++i)
                writer.WriteBytes (Data[i]);
        }
开发者ID:ermau,项目名称:Gablarski,代码行数:15,代码来源:ClientAudioDataMessage.cs


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