本文整理汇总了C#中IValueReader类的典型用法代码示例。如果您正苦于以下问题:C# IValueReader类的具体用法?C# IValueReader怎么用?C# IValueReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IValueReader类属于命名空间,在下文中一共展示了IValueReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadPayload
public override void ReadPayload(IValueReader reader)
{
this.NetworkID = reader.ReadUInt32();
this.CharacterName = reader.ReadString();
this.Action = (PlayerUpdateAction)reader.ReadByte();
}
示例2: SkeletonFrame
/// <summary>
/// Initializes a new instance of the <see cref="SkeletonFrame"/> class.
/// </summary>
/// <param name="reader">The <see cref="IValueReader"/> to read from.</param>
/// <param name="contentPath">The <see cref="ContentPaths"/> to use to load from.</param>
/// <exception cref="InvalidOperationException">The <see cref="Skeleton"/> failed to load.</exception>
public SkeletonFrame(IValueReader reader, ContentPaths contentPath)
{
Read(reader, contentPath);
if (Skeleton == null)
throw new InvalidOperationException("Skeleton failed to load.");
}
示例3: StartTracking
public virtual InternalEntityEntry StartTracking(IEntityType entityType, object entity, IValueReader valueReader)
{
// TODO: Perf: Pre-compute this for speed
var keyProperties = entityType.GetPrimaryKey().Properties;
var keyValue = _keyFactorySource.GetKeyFactory(keyProperties).Create(entityType, keyProperties, valueReader);
if (keyValue == EntityKey.InvalidEntityKey)
{
throw new InvalidOperationException(Strings.InvalidPrimaryKey(entityType.DisplayName()));
}
var existingEntry = TryGetEntry(keyValue);
if (existingEntry != null)
{
if (existingEntry.Entity != entity)
{
throw new InvalidOperationException(Strings.IdentityConflict(entityType.DisplayName()));
}
return existingEntry;
}
var newEntry = _subscriber.SnapshotAndSubscribe(_factory.Create(this, entityType, entity, valueReader));
_identityMap.Add(keyValue, newEntry);
_entityReferenceMap[entity] = newEntry;
newEntry.SetEntityState(EntityState.Unchanged);
return newEntry;
}
示例4: ServerInfo
internal ServerInfo(ISerializationContext context, IValueReader reader)
{
if (reader == null)
throw new ArgumentNullException ("reader");
Deserialize (context, reader);
}
示例5: ChannelChangeInfo
public ChannelChangeInfo(ISerializationContext context, IValueReader reader)
{
if (reader == null)
throw new ArgumentNullException("reader");
Deserialize (context, reader);
}
示例6: ReadNextEvent
private IEventCommand ReadNextEvent(IValueReader reader, ScriptCommandType commandType)
{
IEventCommand command = null;
switch(commandType)
{
case ScriptCommandType.Jump:
command = new JumpCommand ();
break;
case ScriptCommandType.Lock:
command = new LockCommand ();
break;
case ScriptCommandType.Pause:
command = new PauseCommand ();
break;
case ScriptCommandType.PauseEvent:
command = new PauseEventCommand ();
break;
case ScriptCommandType.ApplyMovement:
command = new ApplyMovementCommand ();
break;
case ScriptCommandType.Release:
command = new ReleaseCommand ();
break;
default:
break;
}
if(command == null)
throw new ArgumentOutOfRangeException ("commandType", "The specified event was not found.");
command.Deserialize (reader);
return command;
}
示例7: Create
public override EntityKey Create(
IEntityType entityType, IReadOnlyList<IProperty> properties, IValueReader valueReader)
{
var components = new object[properties.Count];
for (var i = 0; i < properties.Count; i++)
{
var index = properties[i].Index;
if (valueReader.IsNull(index))
{
return EntityKey.InvalidEntityKey;
}
var value = _boxedValueReaders[i].ReadValue(valueReader, index);
if (Equals(value, _sentinels[i]))
{
return EntityKey.InvalidEntityKey;
}
components[i] = value;
}
return new CompositeEntityKey(entityType, components);
}
示例8: 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;
}
示例9: ReadPayload
public override void ReadPayload(ISerializationContext context, IValueReader reader)
{
AudioSource[] sourceInfos = new AudioSource[reader.ReadInt32()];
for (int i = 0; i < sourceInfos.Length; ++i)
sourceInfos[i] = new AudioSource (context, reader);
this.Sources = sourceInfos;
}
示例10: ReadPayload
public override void ReadPayload(ISerializationContext context, IValueReader reader)
{
int[] sourceIds = new int[reader.ReadInt32()];
for (int i = 0; i < sourceIds.Length; ++i)
sourceIds[i] = reader.ReadInt32();
this.SourceIds = sourceIds;
}
示例11: ReadPayload
public override void ReadPayload(IValueReader reader)
{
base.ReadPayload(reader);
var internalEndPointAddress = new IPAddress(reader.ReadBytes());
InternalOwnEndPoint = new IPEndPoint(internalEndPointAddress, reader.ReadInt32());
var externalEndPointAddress = new IPAddress(reader.ReadBytes());
ExternalPeerEndPoint = new IPEndPoint(externalEndPointAddress, reader.ReadInt32());
}
示例12: ReadPayload
public override void ReadPayload (ISerializationContext context, IValueReader reader)
{
if (reader.ReadBool())
SenderId = reader.ReadString();
GroupId = reader.ReadInt32();
Text = reader.ReadString();
}
示例13: Read
public void Read(IValueReader reader)
{
GrhIndex = reader.ReadGrhIndex(_grhIndexValueKey);
_sourceName = reader.ReadString(_sourceValueKey);
_destName = reader.ReadString(_destValueKey);
Offset = reader.ReadVector2(_offsetValueKey);
Origin = reader.ReadVector2(_originValueKey);
}
示例14: ReadFilter
/// <summary>
/// Reads a filter from an <see cref="IValueReader"/>.
/// </summary>
/// <param name="reader">The <see cref="IValueReader"/> to read from.</param>
/// <returns>The name of the filter and the filter object.</returns>
static KeyValuePair<string, MapDrawFilterHelper> ReadFilter(IValueReader reader)
{
var key = reader.ReadString(_filterKeyValueName);
var valueReader = reader.ReadNode(_filterValueValueName);
var value = new MapDrawFilterHelper(valueReader);
return new KeyValuePair<string, MapDrawFilterHelper>(key, value);
}
示例15: Deserialize
public void Deserialize(IValueReader reader)
{
this.NonCharacter = reader.ReadBool();
this.PlayerID = reader.ReadInt32 ();
int count = reader.ReadInt32 ();
for(int i = 0; i < count; i++)
this.path.Add ((Directions) reader.ReadInt32 ());
}