private void SessionChanged(ITorchSession session, TorchSessionState state) { ServerRunning = state == TorchSessionState.Loaded; switch (state) { case TorchSessionState.Loaded: IsRunning = true; MP = Torch.CurrentSession.Managers.GetManager <MultiplayerManagerBase>(); ChatManager = Torch.CurrentSession.Managers.GetManager <ChatManagerServer>(); PluginManager Plugins = Torch.CurrentSession.Managers.GetManager <PluginManager>(); BlockLimiterConnection(Plugins); GridBackupConnection(Plugins); Tracker.ServerStarted(Config.FolderDirectory); if (Config.GridMarketEnabled) { Market.InitilizeComms(ChatManager, MP); } AutoHangarStamp = DateTime.Now; break; case TorchSessionState.Unloading: PluginDispose(); break; } }
public void InitilizeComms(ChatManagerServer ChatServer, MultiplayerManagerBase Multiplayer) { Comms = new Comms(this); Comms.RegisterHandlers(); _ChatManager = ChatServer; _MP = Multiplayer; //initilize PlayerWatcher MP.PlayerJoined += MP_PlayerJoined; MP.PlayerLeft += MP_PlayerLeft; }