當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。