public ConnectionWindow(Settings dmpSettings, OptionsWindow optionsWindow, ServersWindow serversWindow, ServerListDisclaimerWindow serverListDisclaimerWindow) { this.dmpSettings = dmpSettings; this.optionsWindow = optionsWindow; this.serversWindow = serversWindow; this.serverListDisclaimerWindow = serverListDisclaimerWindow; }
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!"); }
public void SetDependancy(ServersWindow serversWindow) { this.serversWindow = serversWindow; }