Exemplo n.º 1
0
        private void Awake()
        {
            if (Instance != null && Instance != this)
            {
                Destroy(this);
                //DestroyImmediate(this);
                return;
            }

            DontDestroyOnLoad(this);
            Instance = this;
        }
Exemplo n.º 2
0
        public override void SetDifficultyPreset(GameParameters.Preset preset)
        {
            string filename = SpaceProgramFunding.SettingsFilename(preset);

            if (!File.Exists(filename))
            {
                return;
            }
            var settings = ConfigNode.Load(filename);

            int.TryParse(settings.GetValue(nameof(launchCostsLaunchPad)), out launchCostsLaunchPad);
            int.TryParse(settings.GetValue(nameof(launchCostsRunway)), out launchCostsRunway);
            int.TryParse(settings.GetValue(nameof(activeVesselCost)), out activeVesselCost);
            int.TryParse(settings.GetValue(nameof(baseKerbalWage)), out baseKerbalWage);
            int.TryParse(settings.GetValue(nameof(assignedKerbalWage)), out assignedKerbalWage);
            int.TryParse(settings.GetValue(nameof(bigProjectMultiple)), out bigProjectMultiple);
            float.TryParse(settings.GetValue(nameof(bigProjectFee)), out bigProjectFee);
            bool.TryParse(settings.GetValue(nameof(isScienceAllowed)), out isScienceAllowed);
            int.TryParse(settings.GetValue(nameof(sciencePointCost)), out sciencePointCost);
        }
        public override void SetDifficultyPreset(GameParameters.Preset preset)
        {
            string filename = SpaceProgramFunding.SettingsFilename(preset);

            if (!File.Exists(filename))
            {
                return;
            }
            var settings = ConfigNode.Load(filename);

            int.TryParse(settings.GetValue(nameof(fundingIntervalDays)), out fundingIntervalDays);
            int.TryParse(settings.GetValue(nameof(fundingRepMultiplier)), out fundingRepMultiplier);
            bool.TryParse(settings.GetValue(nameof(isContractInterceptor)), out isContractInterceptor);
            int.TryParse(settings.GetValue(nameof(repDecayRate)), out repDecayRate);
            int.TryParse(settings.GetValue(nameof(minimumRep)), out minimumRep);
            int.TryParse(settings.GetValue(nameof(kerbalDeathPenalty)), out kerbalDeathPenalty);
            int.TryParse(settings.GetValue(nameof(fundsPerRep)), out fundsPerRep);
            bool.TryParse(settings.GetValue(nameof(isCostsCovered)), out isCostsCovered);
            bool.TryParse(settings.GetValue(nameof(isReputationAllowed)), out isReputationAllowed);
        }
Exemplo n.º 4
0
        public override void SetDifficultyPreset(GameParameters.Preset preset)
        {
            string filename = SpaceProgramFunding.SettingsFilename(preset);

            if (!File.Exists(filename))
            {
                return;
            }
            var settings = ConfigNode.Load(filename);

            bool.TryParse(settings.GetValue(nameof(isBuildingCostsEnabled)), out isBuildingCostsEnabled);
            int.TryParse(settings.GetValue(nameof(structureCostSph)), out structureCostSph);
            int.TryParse(settings.GetValue(nameof(structureCostMissionControl)), out structureCostMissionControl);
            int.TryParse(settings.GetValue(nameof(structureCostAstronautComplex)), out structureCostAstronautComplex);
            int.TryParse(settings.GetValue(nameof(structureCostAdministration)), out structureCostAdministration);
            int.TryParse(settings.GetValue(nameof(structureCostVab)), out structureCostVab);
            int.TryParse(settings.GetValue(nameof(structureCostTrackingStation)), out structureCostTrackingStation);
            int.TryParse(settings.GetValue(nameof(structureCostRnD)), out structureCostRnD);
            int.TryParse(settings.GetValue(nameof(structureCostOtherFacility)), out structureCostOtherFacility);
        }
Exemplo n.º 5
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;
        }