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


C# Spawner.GetType方法代码示例

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


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

示例1: WriteSpawner

		public static void WriteSpawner( XmlTextWriter xml, Spawner spawner )
		{
			xml.WriteStartElement( "Spawner" );

			if ( spawner is ProximitySpawner || spawner is MasterDistSpawner )
				xml.WriteAttributeString( "Type", spawner.GetType().Name );

			//xml.WriteAttributeString( "Active", spawner.Running.ToString() );

			if ( !String.IsNullOrEmpty( spawner.Name ) && spawner.Name != "Spawner" && spawner.Name != spawner.DefaultName )
			{
				xml.WriteStartElement( "Name" );
				xml.WriteString( spawner.Name );
				xml.WriteEndElement();
			}

			if ( spawner.Team != 0 )
			{
				xml.WriteStartElement( "Team" );
				xml.WriteString( spawner.Team.ToString() );
				xml.WriteEndElement();
			}

			xml.WriteStartElement( "HomeRange" );
			xml.WriteString( spawner.HomeRange.ToString() );
			xml.WriteEndElement();

			xml.WriteStartElement( "Count" );
			xml.WriteString( spawner.Count.ToString() );
			xml.WriteEndElement();

			if ( spawner.WalkingRange >= 0 )
			{
				xml.WriteStartElement( "WalkingRange" );
				xml.WriteString( spawner.WalkingRange.ToString() );
				xml.WriteEndElement();
			}

			xml.WriteStartElement( "MinDelay" );
			xml.WriteString( spawner.MinDelay.ToString() );
			xml.WriteEndElement();

			xml.WriteStartElement( "MaxDelay" );
			xml.WriteString( spawner.MinDelay.ToString() );
			xml.WriteEndElement();

			xml.WriteStartElement( "Location" );
			xml.WriteString( spawner.Location.ToString() );
			xml.WriteEndElement();

			xml.WriteStartElement( "Map" );
			xml.WriteString( spawner.Map.ToString() );
			xml.WriteEndElement();

			if ( spawner.WayPoint != null )
			{
				xml.WriteStartElement( "WayPoint" );
				xml.WriteString( spawner.WayPoint.Serial.ToString() );
				xml.WriteEndElement();
			}

			if ( spawner is ProximitySpawner )
			{
				ProximitySpawner prox = spawner as ProximitySpawner;

				xml.WriteAttributeString( "InstantFlag", prox.InstantFlag.ToString() );

				xml.WriteStartElement( "TriggerRange" );
				xml.WriteString( prox.TriggerRange.ToString() );
				xml.WriteEndElement();

				if ( prox.SpawnMessage != null )
				{
					xml.WriteStartElement( "SpawnMessage" );
					xml.WriteAttributeString( "Local", prox.SpawnMessage.Number.ToString() );
					xml.WriteString( prox.SpawnMessage.String );
					xml.WriteEndElement();
				}
			}
			else if ( spawner is MasterDistSpawner )
			{
				MasterDistSpawner master = spawner as MasterDistSpawner;

				xml.WriteStartElement( "IsChild" );
				xml.WriteString( master.IsChild.ToString() );
				xml.WriteEndElement();

				xml.WriteStartElement( "Children" );
				xml.WriteAttributeString( "Count", (master.Children.Count - ( master.IsChild ? 1 : 0 )).ToString() );

				foreach ( IChildDistSpawner child in master.Children )
					if ( child != spawner && child is ChildDistSpawner )
						WriteChildDistSpawner( xml, (ChildDistSpawner)child );

				xml.WriteEndElement(); // Children
			}

			xml.WriteStartElement( "Entries" );
			xml.WriteAttributeString( "Count", spawner.Entries.Count.ToString() );

//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:101,代码来源:ExportSpawners.cs


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