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


C# PluginManager.Init方法代码示例

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


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

示例1: StartUp

 /// <summary>
 /// Start up and run the server.
 /// </summary>
 public void StartUp(Action loaded = null)
 {
     CurThread = Thread.CurrentThread;
     SysConsole.Written += OnConsoleWritten;
     SysConsole.Output(OutputType.INIT, "Launching as new server, this is " + (this == Central ? "" : "NOT ") + "the Central server.");
     SysConsole.Output(OutputType.INIT, "Loading console input handler...");
     ConsoleHandler.Init();
     ConsoleHandler.OnCommandInput += CommandInputHandle;
     SysConsole.Output(OutputType.INIT, "Loading command engine...");
     Commands = new ServerCommands();
     Commands.Init(new ServerOutputter(this), this);
     SysConsole.Output(OutputType.INIT, "Loading CVar engine...");
     CVars = new ServerCVar();
     CVars.Init(this, Commands.Output);
     SysConsole.Output(OutputType.INIT, "Loading default settings...");
     Config = new FDSSection(Files.ReadText("server_config.fds"));
     if (Files.Exists("serverdefaultsettings.cfg"))
     {
         string contents = Files.ReadText("serverdefaultsettings.cfg");
         Commands.ExecuteCommands(contents);
     }
     if (Files.Exists("server_eid.txt"))
     {
         cID = long.Parse(Files.ReadText("server_eid.txt") ?? "1");
     }
     SysConsole.Output(OutputType.INIT, "Loading player command engine...");
     PCEngine = new PlayerCommandEngine();
     SysConsole.Output(OutputType.INIT, "Loading item registry...");
     ItemInfos = new ItemInfoRegistry();
     Items = new ItemRegistry(this);
     Recipes = new RecipeRegistry() { TheServer = this };
     SysConsole.Output(OutputType.INIT, "Loading model handler...");
     Models = new ModelEngine(this);
     SysConsole.Output(OutputType.INIT, "Loading animation handler...");
     Animations = new AnimationEngine();
     SysConsole.Output(OutputType.INIT, "Preparing networking...");
     Networking = new NetworkBase(this);
     Networking.Init();
     SysConsole.Output(OutputType.INIT, "Loading plugins...");
     Plugins = new PluginManager(this);
     Plugins.Init();
     SysConsole.Output(OutputType.INIT, "Loading scripts...");
     AutorunScripts();
     SysConsole.Output(OutputType.INIT, "Building initial world(s)...");
     foreach (string str in Config.GetStringList("server.worlds") ?? new List<string>())
     {
         LoadWorld(str.ToLowerFast());
     }
     SysConsole.Output(OutputType.INIT, "Preparing block image system...");
     BlockImages = new BlockImageManager();
     BlockImages.Init(this);
     if (loaded != null)
     {
         loaded.Invoke();
     }
     SysConsole.Output(OutputType.INIT, "Ticking...");
     // Tick
     double TARGETFPS = 30d;
     Stopwatch Counter = new Stopwatch();
     Stopwatch DeltaCounter = new Stopwatch();
     DeltaCounter.Start();
     double TotalDelta = 0;
     double CurrentDelta = 0d;
     double TargetDelta = 0d;
     int targettime = 0;
     try
     {
         while (true)
         {
             // Update the tick time usage counter
             Counter.Reset();
             Counter.Start();
             // Update the tick delta counter
             DeltaCounter.Stop();
             // Delta time = Elapsed ticks * (ticks/second)
             CurrentDelta = ((double)DeltaCounter.ElapsedTicks) / ((double)Stopwatch.Frequency);
             // Begin the delta counter to find out how much time is /really/ slept+ticked for
             DeltaCounter.Reset();
             DeltaCounter.Start();
             // How much time should pass between each tick ideally
             TARGETFPS = CVars.g_fps.ValueD;
             if (TARGETFPS < 1 || TARGETFPS > 600)
             {
                 CVars.g_fps.Set("30");
                 TARGETFPS = 30;
             }
             TargetDelta = (1d / TARGETFPS);
             // How much delta has been built up
             TotalDelta += CurrentDelta;
             while (TotalDelta > TargetDelta * 3)
             {
                 // Lagging - cheat to catch up!
                 TargetDelta *= 2;
             }
             // As long as there's more delta built up than delta wanted, tick
             while (TotalDelta > TargetDelta)
             {
//.........这里部分代码省略.........
开发者ID:Morphan1,项目名称:Voxalia,代码行数:101,代码来源:ServerBase.cs


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