public void Start() { TimingManager.FixedUpdateAdd(TimingManager.TimingStage.BetterLateThanNever, TimingManagerFixedUpdate); dmpDir = Path.Combine(Path.Combine(Path.Combine(KSPUtil.ApplicationRootPath, "GameData"), "DarkMultiPlayer"), "Plugins"); dmpDataDir = Path.Combine(dmpDir, "Data"); gameDataDir = Path.Combine(KSPUtil.ApplicationRootPath, "GameData"); kspRootPath = KSPUtil.ApplicationRootPath; //Fix DarkLog time/thread marker in the log during init. DarkLog.SetMainThread(); lastClockTicks = DateTime.UtcNow.Ticks; lastRealTimeSinceStartup = 0f; dmpClient = this; dmpSettings = new Settings(); toolbarSupport = new ToolbarSupport(dmpSettings); universeSyncCache = new UniverseSyncCache(dmpSettings); modWindow = new ModWindow(); modWorker = new ModWorker(modWindow); modWindow.SetDependenices(modWorker); universeConverter = new UniverseConverter(dmpSettings); universeConverterWindow = new UniverseConverterWindow(universeConverter); optionsWindow = new OptionsWindow(dmpSettings, universeSyncCache, modWorker, universeConverterWindow, toolbarSupport); connectionWindow = new ConnectionWindow(dmpSettings, optionsWindow); disclaimerWindow = new DisclaimerWindow(dmpSettings); dmpModInterface = new DMPModInterface(); SafetyBubble.RegisterDefaultLocations(); if (!CompatibilityChecker.IsCompatible() || !InstallChecker.IsCorrectlyInstalled()) { modDisabled = true; } if (dmpSettings.disclaimerAccepted != 1) { modDisabled = true; disclaimerWindow.SpawnDialog(); } Profiler.DMPReferenceTime.Start(); DontDestroyOnLoad(this); // Prevents symlink warning for development. SetupDirectoriesIfNeeded(); // UniverseSyncCache needs to run expiry here universeSyncCache.ExpireCache(); GameEvents.onHideUI.Add(() => { showGUI = false; }); GameEvents.onShowUI.Add(() => { showGUI = true; }); HandleCommandLineArgs(); DarkLog.Debug("DarkMultiPlayer " + Common.PROGRAM_VERSION + ", protocol " + Common.PROTOCOL_VERSION + " Initialized!"); }
public void Start() { if (!CompatibilityChecker.IsCompatible() || !InstallChecker.IsCorrectlyInstalled()) { modDisabled = true; } if (dmpSettings.disclaimerAccepted != 1) { modDisabled = true; disclaimerWindow.SpawnDialog(); } Profiler.DMPReferenceTime.Start(); DontDestroyOnLoad(this); // Prevents symlink warning for development. SetupDirectoriesIfNeeded(); // UniverseSyncCache needs to run expiry here universeSyncCache.ExpireCache(); GameEvents.onHideUI.Add(() => { showGUI = false; }); GameEvents.onShowUI.Add(() => { showGUI = true; }); HandleCommandLineArgs(); long testTime = Compression.TestSysIOCompression(); DarkLog.Debug("System.IO compression works: " + Compression.sysIOCompressionWorks + ", test time: " + testTime + " ms."); DarkLog.Debug("DarkMultiPlayer " + Common.PROGRAM_VERSION + ", protocol " + Common.PROTOCOL_VERSION + " Initialized!"); }
public void Awake() { DarkLog.SetMainThread(); if (!CompatibilityChecker.IsCompatible() || !InstallChecker.IsCorrectlyInstalled()) { modDisabled = true; } if (Settings.fetch.disclaimerAccepted != 1) { modDisabled = true; DisclaimerWindow.SpawnDialog(); } Profiler.DMPReferenceTime.Start(); DontDestroyOnLoad(this); // Prevents symlink warning for development. SetupDirectoriesIfNeeded(); // UniverseSyncCache needs to run expiry here UniverseSyncCache.fetch.ExpireCache(); // Register events needed to bootstrap the workers. lock (eventLock) { resetEvent.Add(LockSystem.Reset); resetEvent.Add(AdminSystem.Reset); resetEvent.Add(AsteroidWorker.Reset); resetEvent.Add(ChatWorker.Reset); resetEvent.Add(CraftLibraryWorker.Reset); resetEvent.Add(DebugWindow.Reset); resetEvent.Add(DynamicTickWorker.Reset); resetEvent.Add(FlagSyncer.Reset); resetEvent.Add(HackyInAtmoLoader.Reset); resetEvent.Add(KerbalReassigner.Reset); resetEvent.Add(PlayerColorWorker.Reset); resetEvent.Add(PlayerStatusWindow.Reset); resetEvent.Add(PlayerStatusWorker.Reset); resetEvent.Add(PartKiller.Reset); resetEvent.Add(ScenarioWorker.Reset); resetEvent.Add(ScreenshotWorker.Reset); resetEvent.Add(TimeSyncer.Reset); resetEvent.Add(ToolbarSupport.Reset); resetEvent.Add(VesselWorker.Reset); resetEvent.Add(WarpWorker.Reset); GameEvents.onHideUI.Add(() => { showGUI = false; }); GameEvents.onShowUI.Add(() => { showGUI = true; }); } FireResetEvent(); HandleCommandLineArgs(); long testTime = Compression.TestSysIOCompression(); DarkLog.Debug("System.IO compression works: " + Compression.sysIOCompressionWorks + ", test time: " + testTime + " ms."); DarkLog.Debug("DarkMultiPlayer " + Common.PROGRAM_VERSION + ", protocol " + Common.PROTOCOL_VERSION + " Initialized!"); }
public void Start() { //Set buffered UDPMesh UDPMeshLib.UdpMeshCommon.USE_BUFFERS = true; //Set pool sizes for ByteRecycler ByteRecycler.AddPoolSize(SMALL_MESSAGE_SIZE); ByteRecycler.AddPoolSize(MEDIUM_MESSAGE_SIZE); ByteRecycler.AddPoolSize(LARGE_MESSAGE_SIZE); MessageWriter.RegisterType <ByteArray>(WriteByteArrayToStream); MessageReader.RegisterType <ByteArray>(ReadByteArrayFromStream); //Prevent loads if multiple copies of DMP are installed. KSP will instantate us twice. if (dmpClient != null) { warnDuplicateInstall = true; return; } if (!CompatibilityChecker.IsCompatible() || !InstallChecker.IsCorrectlyInstalled()) { modDisabled = true; enabled = false; return; } TimingManager.FixedUpdateAdd(TimingManager.TimingStage.BetterLateThanNever, TimingManagerFixedUpdate); dmpDir = Path.Combine(Path.Combine(Path.Combine(KSPUtil.ApplicationRootPath, "GameData"), "DarkMultiPlayer"), "Plugins"); dmpDataDir = Path.Combine(dmpDir, "Data"); gameDataDir = Path.Combine(KSPUtil.ApplicationRootPath, "GameData"); kspRootPath = KSPUtil.ApplicationRootPath; //Fix DarkLog time/thread marker in the log during init. DarkLog.SetMainThread(); lastClockTicks = DateTime.UtcNow.Ticks; lastRealTimeSinceStartup = 0f; dmpClient = this; profiler = new Profiler(); kspTime = profiler.GetCurrentTime; kspMemory = profiler.GetCurrentMemory; dmpSettings = new Settings(); toolbarSupport = new ToolbarSupport(dmpSettings); universeSyncCache = new UniverseSyncCache(dmpSettings); modWindow = new ModWindow(); modWorker = new ModWorker(modWindow); modWindow.SetDependenices(modWorker); universeConverter = new UniverseConverter(dmpSettings); universeConverterWindow = new UniverseConverterWindow(universeConverter); serverListDisclaimerWindow = new ServerListDisclaimerWindow(dmpSettings); optionsWindow = new OptionsWindow(dmpSettings, universeSyncCache, modWorker, universeConverterWindow, toolbarSupport, serverListDisclaimerWindow); serverListConnection = new ServerListConnection(dmpSettings); serversWindow = new ServersWindow(dmpSettings, optionsWindow, serverListConnection); serverListConnection.SetDependancy(serversWindow); connectionWindow = new ConnectionWindow(dmpSettings, optionsWindow, serversWindow, serverListDisclaimerWindow); disclaimerWindow = new DisclaimerWindow(dmpSettings); dmpModInterface = new DMPModInterface(); //SafetyBubble.RegisterDefaultLocations(); if (dmpSettings.disclaimerAccepted != 1) { modDisabled = true; disclaimerWindow.SpawnDialog(); } Application.wantsToQuit += WantsToQuit; DontDestroyOnLoad(this); // Prevents symlink warning for development. SetupDirectoriesIfNeeded(); // UniverseSyncCache needs to run expiry here universeSyncCache.ExpireCache(); GameEvents.onHideUI.Add(() => { showGUI = false; }); GameEvents.onShowUI.Add(() => { showGUI = true; }); HandleCommandLineArgs(); DarkLog.Debug("DarkMultiPlayer " + Common.PROGRAM_VERSION + ", protocol " + Common.PROTOCOL_VERSION + " Initialized!"); }