private void Start() { if (_initialized) { return; } _budgetDialogPosition.width = _budgetWidth; _budgetDialogPosition.height = _budgetHeight; _budgetDialogPosition.x = (Screen.width - _budgetDialogPosition.width) / 2; _budgetDialogPosition.y = (Screen.height - _budgetDialogPosition.height) / 2; _settingsDialogPosition.height = BudgetSettings._settingsHeight; _settingsDialogPosition.height = BudgetSettings._settingsWidth; _settingsDialogPosition = _budgetDialogPosition; _settingsDialogPosition.x = _budgetDialogPosition.x + _budgetDialogPosition.width; KACWrapper.InitKACWrapper(); PopulateHomeWorldData(); // Fetch Space Center structure enums into an array. This eases traversing through all Space Center structures. _facilities = (SpaceCenterFacility[])Enum.GetValues(typeof(SpaceCenterFacility)); GameEvents.OnVesselRollout.Add(OnVesselRollout); //GameEvents.onGameSceneSwitchRequested.Add(OnSceneSwitch); GameEvents.onHideUI.Add(OnHideUI); GameEvents.onShowUI.Add(OnShowUI); GameEvents.onGameSceneLoadRequested.Add(OnGameSceneLoad); _initialized = true; }
private void Start() { if (_initialized) { return; } settings = HighLogic.CurrentGame.Parameters.CustomParams <FundingParameters>(); maintenance = HighLogic.CurrentGame.Parameters.CustomParams <MaintenanceParameters>(); misc = HighLogic.CurrentGame.Parameters.CustomParams <MiscParameters>(); if (settings == null || maintenance == null || misc == null) { Instance = null; Destroy(this); return; } _closeIcon = GameDatabase.Instance.GetTexture("SpaceProgramFunding/Icons/close", false); //_settingsIcon = GameDatabase.Instance.GetTexture("SpaceProgramFunding/Icons/settings", false); _fundingDialogPosition.width = _fundingWidth; _fundingDialogPosition.height = _fundingHeight; _fundingDialogPosition.x = (Screen.width - _fundingDialogPosition.width) / 2; _fundingDialogPosition.y = (Screen.height - _fundingDialogPosition.height) / 2; KACWrapper.InitKACWrapper(); PopulateHomeWorldData(); // Fetch Space Center structure enums into an array. This eases traversing through all Space Center structures. _facilities = (SpaceCenterFacility[])Enum.GetValues(typeof(SpaceCenterFacility)); GameEvents.OnVesselRollout.Add(OnVesselRollout); GameEvents.onHideUI.Add(OnHideUI); GameEvents.onShowUI.Add(OnShowUI); GameEvents.onGameSceneLoadRequested.Add(OnGameSceneLoad); GameEvents.OnGameSettingsApplied.Add(OnSettingsApplied); _initialized = true; }