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


C# World.Init方法代码示例

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


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

示例1: StartUp

        void StartUp( object sender, EventArgs a ) {
            world = new World( "" );

            world.OnLog += Log;
            world.OnURLChange += SetURL;
            world.OnPlayerListChange += UpdatePlayerList;


            if( world.Init() ) {
                Text = "fCraft " + Updater.GetVersionString() + " - " + world.config.GetString( "ServerName" );

                UpdaterResult update = Updater.CheckForUpdates( world );
                if( update.UpdateAvailable ) {
                    if( world.config.GetString( "AutomaticUpdates" ) == "Notify" ) {
                        Log( String.Format( Environment.NewLine +
                                            "*** A new version of fCraft is available: v{0:0.000}, released {1:0} day(s) ago. ***"+
                                            Environment.NewLine,
                                            Decimal.Divide( update.NewVersionNumber, 1000 ),
                                            DateTime.Now.Subtract( update.ReleaseDate ).TotalDays ), LogType.ConsoleOutput );
                        StartServer();
                    } else {
                        UpdateWindow updateWindow = new UpdateWindow( update, this, world.config.GetString( "AutomaticUpdates" ) == "Auto" );
                        updateWindow.StartPosition = FormStartPosition.CenterParent;
                        updateWindow.ShowDialog();
                    }
                } else {
                    StartServer();
                }
            } else {
                world.log.Log( "---- Could Not Initialize World ----", LogType.FatalError );
                world = null;
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:33,代码来源:UI.cs

示例2: 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


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