本文整理汇总了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);
}
}
示例2: WritePayload
public override void WritePayload(ISerializationContext context, IValueWriter writerm)
{
writerm.WriteUInt16 ((ushort)this.DeniedMessage);
}
示例3: WritePayload
public override void WritePayload(ISerializationContext context, IValueWriter writer)
{
writer.WriteUInt16 (OriginalMessageId);
writer.WriteByte (Count);
writer.WriteBytes (Payload, this.offset, this.length);
}
示例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());
}
}
示例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]);
}