本文整理汇总了C#中Server.Mobiles.Spawner.AddEntry方法的典型用法代码示例。如果您正苦于以下问题:C# Spawner.AddEntry方法的具体用法?C# Spawner.AddEntry怎么用?C# Spawner.AddEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Mobiles.Spawner
的用法示例。
在下文中一共展示了Spawner.AddEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateArray
public void CreateArray( RelayInfo info, Mobile from, Spawner spawner )
{
int ocount = spawner.Entries.Count;
List<SpawnerEntry> rementries = new List<SpawnerEntry>();
for ( int i = 0;i < 13; i++ )
{
int index = i * 5;
int entryindex = ( m_Page * 13 ) + i;
TextRelay cte = info.GetTextEntry( index );
TextRelay mte = info.GetTextEntry( index + 1 );
TextRelay poste = info.GetTextEntry( index + 2 );
TextRelay parmte = info.GetTextEntry( index + 3 );
TextRelay propte = info.GetTextEntry( index + 4 );
if ( cte != null )
{
string str = cte.Text.Trim().ToLower();
if ( str.Length > 0 )
{
Type type = SpawnerType.GetType( str );
if ( type != null )
{
SpawnerEntry entry = null;
if ( entryindex < ocount )
{
entry = spawner.Entries[entryindex];
entry.SpawnedName = str;
if ( mte != null )
entry.SpawnedMaxCount = Utility.ToInt32( mte.Text.Trim() );
if ( poste != null )
entry.SpawnedProbability = Utility.ToInt32( poste.Text.Trim() );
}
else
{
int maxcount = 1;
int probcount = 100;
if ( mte != null )
maxcount = Utility.ToInt32( mte.Text.Trim() );
if ( poste != null )
probcount = Utility.ToInt32( poste.Text.Trim() );
entry = spawner.AddEntry( str, probcount, maxcount );
}
if ( parmte != null )
entry.Parameters = parmte.Text.Trim();
if ( propte != null )
entry.Properties = propte.Text.Trim();
}
else
from.SendMessage( "{0} is not a valid type name for entry #{1}.", str, i );
}
else if ( entryindex < ocount && spawner.Entries[entryindex] != null )
rementries.Add( spawner.Entries[entryindex] );
}
}
if ( rementries.Count > 0 )
for ( int i = 0; i < rementries.Count; i++ )
spawner.RemoveEntry( rementries[i] );
if ( ocount == 0 && spawner.Entries.Count > 0 )
spawner.Start();
}