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


C# IValueReader.ReadUInt16方法代码示例

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


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

示例1: ReadEntity

        private NetworkEntity ReadEntity(ISerializationContext context, IValueReader reader)
        {
            var entity = new NetworkEntity (reader.ReadString (), EntityType.Client);

            entity.NetworkID = reader.ReadUInt16 ();
            UInt16 fieldCount = reader.ReadUInt16 ();

            for (int f = 0; f < fieldCount; f++)
            {
                string name = reader.ReadString ();
                ushort typeID = reader.ReadUInt16 ();

                Type type;
                context.TypeMap.TryGetType (typeID, out type);

                object value;

                if (type == typeof (Vector2))
                    value = reader.Read (context, Vector2Serializer.Instance);
                else if (type == typeof (Vector3))
                    value = reader.Read (context, Vector3Serializer.Instance);
                else
                    value = reader.Read (context, type);

                entity.Fields.Add (name, new PropertyGroup (value, type));
            }

            return entity;
        }
开发者ID:NullSoldier,项目名称:Cinco,代码行数:29,代码来源:EntitySnapshotMessage.cs

示例2: Deserialize

        public void Deserialize(ISerializationContext context, IValueReader reader)
        {
            ushort count = reader.ReadUInt16();
            if (count == 0)
                return;

            lock (this.sync)
            {
                if (this.map == null)
                {
                    this.map = new Dictionary<Type, ushort>();
                    this.reverseMap = new Dictionary<ushort, Type>();
                    this.newMappings = new Dictionary<Type, ushort>();
                }

                for (ushort i = 0; i < count; ++i)
                {
                    Type t = Type.GetType (reader.ReadString());
                    this.map.Add (t, i);
                    this.reverseMap.Add (i, t);
                }
            }
        }
开发者ID:ermau,项目名称:Tempest,代码行数:23,代码来源:TypeMap.cs

示例3: ReadPayload

 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     DeniedMessage = (GablarskiMessageType)reader.ReadUInt16();
 }
开发者ID:ermau,项目名称:Gablarski,代码行数:4,代码来源:PermissionDeniedMessage.cs

示例4: ReadPayload

 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     OriginalMessageId = reader.ReadUInt16();
     Count = reader.ReadByte();
     Payload = reader.ReadBytes();
 }
开发者ID:ermau,项目名称:Tempest,代码行数:6,代码来源:PartialMessage.cs

示例5: ReadPayload

        public override void ReadPayload(ISerializationContext context, IValueReader reader)
        {
            this.TargetType = (TargetType)reader.ReadByte();

            ushort numTargets = reader.ReadUInt16();
            int[] targets = new int[numTargets];
            for (int i = 0; i < targets.Length; ++i)
                targets[i] = reader.ReadInt32();

            TargetIds = targets;

            Sequence = reader.ReadInt32();
            SourceId = reader.ReadInt32();

            byte frames = reader.ReadByte();
            Data = new byte[frames][];

            for (int i = 0; i < frames; ++i)
                Data[i] = reader.ReadBytes();
        }
开发者ID:ermau,项目名称:Gablarski,代码行数:20,代码来源:ClientAudioDataMessage.cs


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