Esempio n. 1
0
        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;
        }
Esempio n. 2
0
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 ///     Executes the settings applied action which occurs at campaign start or when the player changes
 ///     the settings within the game.
 /// </summary>
 private void OnSettingsApplied()
 {
     settings    = HighLogic.CurrentGame.Parameters.CustomParams <FundingParameters>();
     maintenance = HighLogic.CurrentGame.Parameters.CustomParams <MaintenanceParameters>();
     misc        = HighLogic.CurrentGame.Parameters.CustomParams <MiscParameters>();
 }