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


C# MegaSpawner.Start方法代码示例

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


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

示例1: Deserialize


//.........这里部分代码省略.........
                                    for ( int j = 6; j < settingCount; j++ )
                                    {
                                        ArrayList ItemsList = new ArrayList();

                                        ItemsList.Add( reader.ReadString() );
                                        ItemsList.Add( reader.ReadInt() );
                                        ItemsList.Add( reader.ReadInt() );

                                        List.Add( ItemsList );
                                    }

                                    break;
                                }
                            }

                            megaSpawner.SettingsList.Add( List );
                        }
                    }
                    else
                    {
                        for ( int i = 0; i < settingsCount; i++ )
                            megaSpawner.SettingsList.Add( reader.ReadString() );

                        megaSpawner.ConvertOldSettings();
                    }
                }

                if ( megaSpawner.Workspace )
                {
                    megaSpawner.Delete();
                }
                else
                {
                    megaSpawner.MoveToWorld( location, map );
                    megaSpawner.Start();

                    if ( megaSpawner.Imported != "" )
                        MC.FileImportAdd( megaSpawner.Imported, megaSpawner.ImportVersion );

                    megaSpawner.CompileSettings();
                    megaSpawner.CheckEntryErrors();

                    megaSpawner.SettingsList.Sort( new MC.SettingsSorter() );

                    if ( megaSpawner.OverrideIndividualEntries )
                    {
                        for ( int i = 0; i < megaSpawner.OverrideAmount; i++ )
                        {
                            megaSpawner.OverrideRespawnEntryList.Add( "" );
                            megaSpawner.OverrideRespawnTimeList.Add( 0 );
                            megaSpawner.OverrideSpawnCounterList.Add( DateTime.Now );
                            megaSpawner.OverrideSpawnTimeList.Add( 0 );
                            megaSpawner.OverrideDespawnTimeList.Add( 0 );
                        }
                    }
                    else
                    {
                        for ( int i = 0; i < megaSpawner.EntryList.Count; i++ )
                        {
                            ArrayList respawnEntryList = new ArrayList();
                            ArrayList respawnTimeList = new ArrayList();
                            ArrayList spawnCounterList = new ArrayList();
                            ArrayList spawnTimeList = new ArrayList();
                            ArrayList respawnOnSaveList = new ArrayList();
                            ArrayList despawnTimeList = new ArrayList();

                            for ( int j = 0; j < (int) megaSpawner.AmountList[i]; j++ )
                            {
                                respawnEntryList.Add( (string) megaSpawner.EntryList[i] );
                                respawnTimeList.Add( 0 );
                                spawnCounterList.Add( DateTime.Now );
                                spawnTimeList.Add( 0 );
                                respawnOnSaveList.Add( (bool) false );
                                despawnTimeList.Add( 0 );
                            }

                            megaSpawner.RespawnEntryList.Add( respawnEntryList );
                            megaSpawner.RespawnTimeList.Add( respawnTimeList );
                            megaSpawner.SpawnCounterList.Add( spawnCounterList );
                            megaSpawner.SpawnTimeList.Add( spawnTimeList );
                            megaSpawner.RespawnOnSaveList.Add( respawnOnSaveList );
                            megaSpawner.DespawnTimeList.Add( despawnTimeList );
                            megaSpawner.SpawnedEntries.Add( new ArrayList() );
                            megaSpawner.LastMovedList.Add( new ArrayList() );
                        }
                    }

                    megaSpawner.Respawn();
                }

                success = true;
            }
            catch
            {
                if ( megaSpawner != null )
                    megaSpawner.Delete();
            }

            return success;
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:101,代码来源:BackupSystem.cs

示例2: TimerTick

		public static void TimerTick( MegaSpawner megaSpawner, int delay )
		{
			CheckEntries( megaSpawner );

			SpawnType st = megaSpawner.OverrideSpawnType;

			CheckTimeExpire( megaSpawner, st );

			int countDown = FindFirstSpawn( megaSpawner );
			int entryCount = CountEntries( megaSpawner );

			if ( countDown <= 0 && !IsFull( megaSpawner ) )
			{
				switch ( st )
				{
					case SpawnType.Regular:
					{
						Spawn( megaSpawner );

						break;
					}
					case SpawnType.Proximity:
					{
						megaSpawner.OverrideTriggerEventNow = true;

						break;
					}
					case SpawnType.GameTimeBased:
					{
						int UOHour, UOMinute, time;

						Server.Items.Clock.GetTime( megaSpawner.Map, megaSpawner.X, megaSpawner.Y, out UOHour, out UOMinute );

						if ( UOHour == 24 )
							UOHour = 0;

						time = ( UOHour * 60 ) + UOMinute;

						CheckSpawnTime( megaSpawner, time );

						break;
					}
					case SpawnType.RealTimeBased:
					{
						int time = ( DateTime.Now.Hour * 60 ) + DateTime.Now.Minute;

						CheckSpawnTime( megaSpawner, time );

						break;
					}
					case SpawnType.Speech:
					{
						megaSpawner.OverrideTriggerEventNow = true;

						break;
					}
				}
			}

			if ( megaSpawner.OverrideDespawn )
				TickDespawn( megaSpawner, delay );

			if ( megaSpawner.OverrideGroupSpawn && entryCount != 0 )
			{}
			else if ( !IsFull( megaSpawner ) )
				TickDown( megaSpawner, delay );

			megaSpawner.Start();
		}
开发者ID:brodock,项目名称:genova-project,代码行数:69,代码来源:MegaSpawnerOverride.cs

示例3: Importv1


//.........这里部分代码省略.........
                    megaSpawner.GroupSpawnList.Add( (bool) false );						// Group Spawn List
                    megaSpawner.MinStackAmountList.Add( 0 );
                    megaSpawner.MaxStackAmountList.Add( 0 );
             		megaSpawner.MovableList.Add( (bool) true );
                    megaSpawner.MinDespawnList.Add( 1800 );
                    megaSpawner.MaxDespawnList.Add( 3600 );
                    megaSpawner.DespawnList.Add( (bool) false );
                    megaSpawner.DespawnGroupList.Add( (bool) false );
                    megaSpawner.DespawnTimeExpireList.Add( (bool) true );

                    ArrayList respawnEntryList = new ArrayList();
                    ArrayList respawnTimeList = new ArrayList();
                    ArrayList spawnCounterList = new ArrayList();
                    ArrayList spawnTimeList = new ArrayList();
                    ArrayList respawnOnSaveList = new ArrayList();
                    ArrayList despawnTimeList = new ArrayList();

                    for ( int j = 0; j < (int) megaSpawner.AmountList[cnt]; j++ )
                    {
                        respawnEntryList.Add( (string) megaSpawner.EntryList[cnt] );
                        respawnTimeList.Add( 0 );
                        spawnCounterList.Add( DateTime.Now );
                        spawnTimeList.Add( 0 );
                        respawnOnSaveList.Add( (bool) false );
                        despawnTimeList.Add( 0 );
                    }

                    megaSpawner.RespawnEntryList.Add( respawnEntryList );
                    megaSpawner.RespawnTimeList.Add( respawnTimeList );
                    megaSpawner.SpawnCounterList.Add( spawnCounterList );
                    megaSpawner.SpawnTimeList.Add( spawnTimeList );
                    megaSpawner.RespawnOnSaveList.Add( respawnOnSaveList );
                    megaSpawner.DespawnTimeList.Add( despawnTimeList );
                    megaSpawner.SpawnedEntries.Add( new ArrayList() );
                    megaSpawner.LastMovedList.Add( new ArrayList() );
                }

                if ( errors > 0 )
                {
                    megaSpawner.Delete();

                    amountOfSpawners--;
                }
                else
                {
                    SpawnerList.Add( megaSpawner );

                    megaSpawner.MoveToWorld( new Point3D( locX, locY, locZ ), spawnerMap );

                    if ( megaSpawner.Active )
                    {
                        megaSpawner.Start();
                        megaSpawner.Respawn();
                    }

                    HideSpawnerList.Add( (bool) false );
                    MSGCheckBoxesList.Add( (bool) false );

                    MC.FileImportAdd( megaSpawner.Imported, megaSpawner.ImportVersion );
                }
            }

            r.Close();

            TimeSpan finishTime = DateTime.Now - beginTime;

            MessagesTitle = "Import Spawners";

            if ( amountOfSpawners > 0 )
            {
                Messages = String.Format( "File type identified as a Mega Spawner v1 file. {0} Mega Spawner{1} imported. The process took {2} second{3}.", amountOfSpawners, amountOfSpawners == 1 ? "" : "s", (int) finishTime.TotalSeconds, (int) finishTime.TotalSeconds == 1 ? "" : "s" );
            }
            else
            {
                Messages = String.Format( "File type identified as a Mega Spawner v1 file. No Mega Spawners were imported due to errors in the file. The process took {0} second{1}.", (int) finishTime.TotalSeconds, (int) finishTime.TotalSeconds == 1 ? "" : "s" );

                MC.FileImportRemove( CropDirectory( fileName ) );
            }

            DateTime beginDupeTime = DateTime.Now;

            Messages = DupeSpawnerCheck( SpawnerList, Messages );

            TimeSpan finishDupeTime = DateTime.Now - beginDupeTime;

            Messages = String.Format( "{0} The duped spawner check process took {1} second{2}.", Messages, (int) finishDupeTime.TotalSeconds, (int) finishDupeTime.TotalSeconds == 1 ? "" : "s" );

            if ( totalErrors > 0 )
                Messages = String.Format( "{0} {1} error{2} been detected.", Messages, totalErrors, totalErrors == 1 ? " has" : "s have" );

            MC.CheckFileImportList( fileName );

            ArgsList[2] = MessagesTitle;
            ArgsList[4] = Messages;
            ArgsList[6] = HideSpawnerList;
            ArgsList[13] = MSGCheckBoxesList;

            mobile.CloseGump( typeof ( LoadFileGump ) );
            mobile.SendGump( new FileMenuGump( mobile, ArgsList ) );
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:101,代码来源:ImportOlderVersion.cs

示例4: ConvertDistroSpawner


//.........这里部分代码省略.........
                        else
                            megaSpawner.AmountList.Add( (int) ( spawner.Count / count ) + 1 );

                        calcMinDelay = ( spawner.MinDelay.Hours * 3600 ) + ( spawner.MinDelay.Minutes * 60 ) + spawner.MinDelay.Seconds;
                        calcMaxDelay = ( spawner.MaxDelay.Hours * 3600 ) + ( spawner.MaxDelay.Minutes * 60 ) + spawner.MaxDelay.Seconds;

                        Type entryType = ScriptCompiler.FindTypeByName( (string) spawner.CreaturesName[i] );

                        if ( entryType != null )
                        {
                            Item toAdd = null;

                            try
                            {
                                toAdd = (Item) Activator.CreateInstance( entryType );
                                movable = toAdd.Movable;
                            }
                            catch{}

                            if ( toAdd != null )
                                toAdd.Delete();
                        }

                        megaSpawner.MinDelayList.Add( calcMinDelay );
                        megaSpawner.MaxDelayList.Add( calcMaxDelay );
                        megaSpawner.SpawnTypeList.Add( SpawnType.Regular );
                        megaSpawner.ActivatedList.Add( (bool) true );
                        megaSpawner.EventRangeList.Add( 10 );
                        megaSpawner.EventKeywordList.Add( "" );
                        megaSpawner.KeywordCaseSensitiveList.Add( (bool) false );
                        megaSpawner.TriggerEventNowList.Add( (bool) true );
                        megaSpawner.EventAmbushList.Add( (bool) true );
                        megaSpawner.BeginTimeBasedList.Add( 0 );
                        megaSpawner.EndTimeBasedList.Add( 0 );
                        megaSpawner.GroupSpawnList.Add( spawner.Group );
                        megaSpawner.MinStackAmountList.Add( 1 );
                        megaSpawner.MaxStackAmountList.Add( 1 );
                        megaSpawner.MovableList.Add( movable );
                        megaSpawner.MinDespawnList.Add( 1800 );
                        megaSpawner.MaxDespawnList.Add( 3600 );
                        megaSpawner.DespawnList.Add( (bool) false );
                        megaSpawner.DespawnGroupList.Add( (bool) false );
                        megaSpawner.DespawnTimeExpireList.Add( (bool) true );
                    }
                }

                ArrayList settingList = new ArrayList();

                settingList.Add( Setting.OverrideIndividualEntries );
                settingList.Add( spawner.HomeRange );
                settingList.Add( walkRange );
                settingList.Add( spawner.Count );
                settingList.Add( calcMinDelay );
                settingList.Add( calcMaxDelay );
                settingList.Add( spawner.Group );
                settingList.Add( (bool) true );
                settingList.Add( SpawnType.Regular );
                settingList.Add( "" );
                settingList.Add( (bool) false );
                settingList.Add( 10 );
                settingList.Add( 0 );
                settingList.Add( 0 );
                settingList.Add( 0 );
                settingList.Add( 0 );
                settingList.Add( 1800 );
                settingList.Add( 3600 );
                settingList.Add( (bool) false );
                settingList.Add( (bool) false );
                settingList.Add( (bool) true );

                megaSpawner.SettingsList.Add( settingList );

                megaSpawner.CompileSettings();

                megaSpawner.SettingsList.Sort( new MC.SettingsSorter() );

                for ( int j = 0; j < megaSpawner.OverrideAmount; j++ )
                {
                    megaSpawner.OverrideRespawnEntryList.Add( "" );
                    megaSpawner.OverrideRespawnTimeList.Add( 0 );
                    megaSpawner.OverrideSpawnCounterList.Add( DateTime.Now );
                    megaSpawner.OverrideSpawnTimeList.Add( 0 );
                    megaSpawner.OverrideDespawnTimeList.Add( 0 );
                }

                megaSpawner.MoveToWorld( spawner.Location, spawner.Map );

                if ( megaSpawner.Active )
                {
                    MegaSpawnerOverride.CheckDupedEntries( megaSpawner );

                    megaSpawner.Start();
                    megaSpawner.Respawn();
                }

                HideSpawnerList.Add( (bool) false );
                MSGCheckBoxesList.Add( (bool) false );

                spawner.Delete();
            }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:101,代码来源:ConfirmConvertSpawnersGump.cs


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