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


C# World.LoadMap方法代码示例

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


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

示例1: Main

        static void Main( string[] args ) {
            World world = new World( "" );
            world.OnLog += Log;
            world.OnURLChange += SetURL;

            if( world.Init() ) {
                if( args.Length == 1 ) {
                    world.LoadMap( args[0] );
                } else {
                    world.LoadMap( Map.DefaultFileName );
                }

                UpdaterResult update = Updater.CheckForUpdates( world );
                if( update.UpdateAvailable ) {
                    Console.WriteLine( "** A new version of fCraft is available: v{0:0.000}, released {1:0} day(s) ago. **",
                                       Decimal.Divide( update.NewVersionNumber, 1000 ),
                                       DateTime.Now.Subtract( update.ReleaseDate ).TotalDays );
                }

                System.Diagnostics.Process.GetCurrentProcess().PriorityClass = world.config.GetBasePriority();

                if( world.Start() ) {
                    Console.Title = "fCraft " + Updater.GetVersionString() + " - " + world.config.GetString( "ServerName" );
                    string input = "";
                    Console.WriteLine( "** To shut down the server, type /exit **" );
                    while( (input = Console.ReadLine()) != "/exit" ) {
                        Player.Console.ParseMessage( input, true );
                    }
                    world.ShutDown();
                } else {
                    Console.WriteLine( "** Failed to start the server **" );
                    world.ShutDown();
                    Console.ReadLine();
                }
            } else {
                Console.WriteLine( "** Failed to initialize the server **" );
                world.ShutDown();
                Console.ReadLine();
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:40,代码来源:Program.cs

示例2: AddWorld

        public static World AddWorld( string name, Map map, bool neverUnload )
        {
            lock( worldListLock ) {
                if( worlds.ContainsKey( name ) ) return null;
                if( !Player.IsValidName( name ) ) return null;
                World newWorld = new World( name );
                newWorld.neverUnload = neverUnload;

                if( map != null ) {
                    // if a map is given
                    newWorld.map = map;
                    if( !neverUnload ) {
                        newWorld.UnloadMap();// UnloadMap also saves the map
                    } else {
                        newWorld.SaveMap( null );
                    }

                } else {
                    // generate default map
                    if( neverUnload ) newWorld.LoadMap();
                }
                worlds.Add( name, newWorld );

                newWorld.updateTaskId = AddTask( UpdateBlocks, Config.GetInt( ConfigKey.TickInterval ), newWorld );

                if( Config.GetInt( ConfigKey.SaveInterval ) > 0 ) {
                    int saveInterval = Config.GetInt( ConfigKey.SaveInterval ) * 1000;
                    newWorld.saveTaskId = AddTask( SaveMap, saveInterval, newWorld, saveInterval );
                }

                if( Config.GetInt( ConfigKey.BackupInterval ) > 0 ) {
                    int backupInterval = Config.GetInt( ConfigKey.BackupInterval ) * 1000 * 60;
                    newWorld.backupTaskId = AddTask( AutoBackup, backupInterval, newWorld, (Config.GetBool( ConfigKey.BackupOnStartup ) ? 0 : backupInterval) );
                }

                newWorld.UpdatePlayerList();

                return newWorld;
            }
        }
开发者ID:asiekierka,项目名称:afCraft,代码行数:40,代码来源:Server.cs

示例3: Start

 public static void Start( Player player )
 {
     Map map = MapGeneratorOld.GenerateEmpty( 64, 128, 16 );
     map.Save( "maps/minefield.fcm" );
     if ( _world != null ) {
         WorldManager.RemoveWorld( _world );
     }
     WorldManager.AddWorld( Player.Console, "Minefield", map, true );
     _map = map;
     _world = WorldManager.FindWorldExact( "Minefield" );
     SetUpRed();
     SetUpMiddleWater();
     SetUpGreen();
     SetUpMines();
     _map.Spawn = new Position( _map.Width / 2, 5, _ground + 3 ).ToVector3I().ToPlayerCoords();
     _world.LoadMap();
     _world.gameMode = GameMode.MineField;
     _world.EnableTNTPhysics( Player.Console, false );
     Server.Message( "{0}&S started a game of MineField on world Minefield!", player.ClassyName );
     WorldManager.SaveWorldList();
     Server.RequestGC();
 }
开发者ID:GlennMR,项目名称:800craft,代码行数:22,代码来源:MineField.cs

示例4: AddWorld

        public static World AddWorld( Player player, string name, Map map, bool neverUnload ) {
            if( name == null ) throw new ArgumentNullException( "name" );

            if( !World.IsValidName( name ) ) {
                throw new WorldOpException( name, WorldOpExceptionCode.InvalidWorldName );
            }

            lock( WorldListLock ) {
                if( Worlds.ContainsKey( name.ToLower() ) ) {
                    throw new WorldOpException( name, WorldOpExceptionCode.DuplicateWorldName );
                }

                if( RaiseWorldCreatingEvent( player, name, map ) ) {
                    throw new WorldOpException( name, WorldOpExceptionCode.PluginDenied );
                }

                World newWorld = new World( name, neverUnload );

                if( map != null ) {
                    newWorld.Map = map;
                    map.World = newWorld;

                    /*
                    string accessSecurityString = map.GetMeta( "security", "access" );
                    if( accessSecurityString != null ) {
                        try {
                            newWorld.AccessSecurity = new SecurityController( XElement.Parse( accessSecurityString ) );
                        } catch( XmlException ex ) {
                            Logger.Log( "WorldManager.AddWorld: Error loading stored access permissions: {0}", LogType.Error, ex );
                        }
                    }

                    string buildSecurityString = map.GetMeta( "security", "build" );
                    if( buildSecurityString != null ) {
                        try {
                            newWorld.BuildSecurity = new SecurityController( XElement.Parse( buildSecurityString ) );
                        } catch( XmlException ex ) {
                            Logger.Log( "WorldManager.AddWorld: Error loading stored build permissions: {0}", LogType.Error, ex );
                        }
                    }
                    */

                    // if a map is given
                    if( neverUnload ) {
                        newWorld.StartTasks();
                    }else{
                        newWorld.UnloadMap( false );
                    }

                } else if( neverUnload ){
                    newWorld.LoadMap();
                    map = newWorld.Map;
                }

                Worlds.Add( name.ToLower(), newWorld );
                UpdateWorldList();

                RaiseWorldCreatedEvent( player, newWorld );

                return newWorld;
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:62,代码来源:WorldManager.cs

示例5: Init

		static void Init(Player player) {
			world = player.World;
			if (!GameRunning)
				return;
			
			//bool foundBackup = true; //not used
			try {
				Map backupMap = MapConversion.MapUtility.Load("./maps/CTFBackup.fcm");
				world.MapChangedBy = player.Name;
				world = world.ChangeMap(backupMap);
			} catch (Exception ex) {
				player.Message( "Could not load CTF backup map.");
				Logger.Log(LogType.Error,
				           "Error loading CTF backup map: {0}", ex.Message);
				//foundBackup = false;
				map = world.LoadMap();
			}
			
			InitProperties();
			Player.PlacingBlock += PlayerPlacing;
			Player.JoinedWorld += PlayerChangedWorld;
			Player.Moved += PlayerMoved;
			RedTeam.RoundsWon = 0;
			BlueTeam.RoundsWon = 0;
			InitZones();
		}
开发者ID:Magi1053,项目名称:ProCraft,代码行数:26,代码来源:CtfGame.cs


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