本文整理汇总了C#中Server.GenericReader.ReadEntity方法的典型用法代码示例。如果您正苦于以下问题:C# GenericReader.ReadEntity方法的具体用法?C# GenericReader.ReadEntity怎么用?C# GenericReader.ReadEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.GenericReader
的用法示例。
在下文中一共展示了GenericReader.ReadEntity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeserializePlayerScores
private static bool DeserializePlayerScores(GenericReader reader)
{
reader.GetVersion();
reader.ReadBlockDictionary(
() =>
{
IEntity e = reader.ReadEntity();
Dictionary<Mobile, double> list = reader.ReadBlockDictionary(
() =>
{
Mobile k = reader.ReadMobile();
double v = reader.ReadDouble();
return new KeyValuePair<Mobile, double>(k, v);
});
return new KeyValuePair<IEntity, Dictionary<Mobile, double>>(e, list);
},
Registry);
return true;
}
示例2: Deserialize
//.........这里部分代码省略.........
goto case 4;
}
case 4:
{
m_WalkingRange = reader.ReadInt();
goto case 3;
}
case 3:
case 2:
{
m_WayPoint = reader.ReadItem() as WayPoint;
goto case 1;
}
case 1:
{
m_Group = reader.ReadBool();
goto case 0;
}
case 0:
{
m_MinDelay = reader.ReadTimeSpan();
m_MaxDelay = reader.ReadTimeSpan();
m_Count = reader.ReadInt();
m_Team = reader.ReadInt();
m_HomeRange = reader.ReadInt();
m_Running = reader.ReadBool();
TimeSpan ts = TimeSpan.Zero;
if ( m_Running )
ts = reader.ReadDeltaTime() - DateTime.Now;
if ( version < 7 )
{
int size = reader.ReadInt();
bool addentries = m_Entries.Count == 0;
for ( int i = 0; i < size; ++i )
{
string typeName = reader.ReadString();
if ( addentries )
m_Entries.Add( new SpawnerEntry( typeName, 100, 1 ) );
else
m_Entries[i].CreaturesName = typeName;
if ( SpawnerType.GetType( typeName ) == null )
{
if ( m_WarnTimer == null )
m_WarnTimer = new WarnTimer();
m_WarnTimer.Add( Location, Map, typeName );
}
}
int count = reader.ReadInt();
for ( int i = 0; i < count; ++i )
{
IEntity e = reader.ReadEntity();
if ( e != null )
{
if ( e is BaseCreature )
((BaseCreature)e).RemoveIfUntamed = true;
if ( e is Item )
((Item)e).Spawner = this;
else if ( e is Mobile )
((Mobile)e).Spawner = this;
for ( int j = 0;j < m_Entries.Count; j++ )
{
if ( SpawnerType.GetType( m_Entries[j].CreaturesName ) == e.GetType() )
{
m_Entries[j].Creatures.Add( e );
m_Creatures.Add( e, m_Entries[j] );
break;
}
}
}
}
}
DoTimer( ts );
break;
}
}
if ( version < 4 )
m_WalkingRange = m_HomeRange;
}
示例3: SpawnerEntry
public SpawnerEntry( Spawner parent, GenericReader reader )
{
int version = reader.ReadInt();
m_CreaturesName = reader.ReadString();
m_CreaturesProbability = reader.ReadInt();
m_CreaturesMaxCount = reader.ReadInt();
m_Properties = reader.ReadString();
m_Parameters = reader.ReadString();
int count = reader.ReadInt();
m_Creatures = new List<IEntity>( count );
for ( int i = 0; i < count; ++i )
{
//IEntity e = World.FindEntity( reader.ReadInt() );
IEntity e = reader.ReadEntity();
if ( e != null )
{
if ( e is Item )
((Item)e).Spawner = parent;
else if ( e is Mobile )
{
((Mobile)e).Spawner = parent;
if ( e is BaseCreature )
((BaseCreature)e).RemoveIfUntamed = true;
}
m_Creatures.Add( e );
if ( !parent.Creatures.ContainsKey( e ) )
parent.Creatures.Add( e, this );
}
}
}
示例4: Remove
public static void Remove( GenericReader reader, int version )
{
int count = reader.ReadInt();
for ( int i = 0; i < count; i++ )
{
//int serial = reader.ReadInt();
//IEntity entity = World.FindEntity( serial );
IEntity entity = reader.ReadEntity();
if ( entity != null )
{
if ( m_RemoveList == null )
m_RemoveList = new List<IEntity>();
m_RemoveList.Add( entity );
}
}
reader.ReadBool(); // m_Running
if ( reader.ReadBool() )
reader.ReadDeltaTime(); // m_NextSpawn
}
示例5: Deserialize
public void Deserialize( GenericReader reader, int version )
{
int count = reader.ReadInt();
for ( int i = 0; i < count; i++ )
{
ISpawnable spawnableEntity = reader.ReadEntity() as ISpawnable;
if (spawnableEntity != null)
Add(spawnableEntity);
}
m_Running = reader.ReadBool();
if ( reader.ReadBool() )
{
m_NextSpawn = reader.ReadDeltaTime();
if ( this.Spawning )
{
if ( m_SpawnTimer != null )
m_SpawnTimer.Stop();
TimeSpan delay = m_NextSpawn - DateTime.UtcNow;
m_SpawnTimer = Timer.DelayCall( delay > TimeSpan.Zero ? delay : TimeSpan.Zero, new TimerCallback( TimerCallback ) );
}
}
CheckTimer();
}
示例6: SpawnerEntry
public SpawnerEntry( Spawner parent, GenericReader reader )
{
int version = reader.ReadInt();
m_SpawnedName = reader.ReadString();
m_SpawnedProbability = reader.ReadInt();
m_SpawnedMaxCount = reader.ReadInt();
m_Properties = reader.ReadString();
m_Parameters = reader.ReadString();
int count = reader.ReadInt();
m_Spawned = new List<ISpawnable>( count );
for ( int i = 0; i < count; ++i )
{
//IEntity e = World.FindEntity( reader.ReadInt() );
ISpawnable e = reader.ReadEntity() as ISpawnable;
if ( e != null )
{
e.Spawner = parent;
if ( e is BaseCreature )
((BaseCreature)e).RemoveIfUntamed = true;
m_Spawned.Add( e );
if ( !parent.Spawned.ContainsKey( e ) )
parent.Spawned.Add( e, this );
}
}
}