本文整理汇总了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)
{
//.........这里部分代码省略.........