示例#1
0
        public void SettingsApplied()
        {
            if (HighLogic.CurrentGame != null)
            {
                settings = HighLogic.CurrentGame.Parameters.CustomParams <StatsGameSettings>();
            }

            if (settings == null)
            {
                return;
            }

            if (settings.UseAsDefault)
            {
                ShowAlways       = settings.AlwaysShow;
                UseIcon          = settings.UseIcon;
                ExtendedTooltips = settings.ExtendedTooltips;
                HoverHighlight   = settings.HoverHighlight;
                TransferButton   = settings.TransferButton;
                ReloadDelay      = settings.ReloadDelay;

                if (Save())
                {
                    PortraitStats.log("Settings file saved");
                }
            }
        }
示例#2
0
        private void Start()
        {
            instance = this;

            CacheStrings();

            GameEvents.onVesselWasModified.Add(vesselCheck);
            GameEvents.onVesselChange.Add(vesselChange);
            GameEvents.OnCameraChange.Add(cameraChange);
            GameEvents.onCrewTransferred.Add(crewTransfer);
            GameEvents.Contract.onContractsLoaded.Add(onContractsLoaded);
            GameEvents.Contract.onParameterChange.Add(onContractParamModified);
            GameEvents.Contract.onAccepted.Add(onContractChange);

            careerMode = HighLogic.CurrentGame.Mode == Game.Modes.CAREER;

            reload = true;

            if (!loaded)
            {
                loaded = true;
                ctiOk  = CTIWrapper.initCTIWrapper() && CTIWrapper.CTI.Loaded;
            }

            StatsGameSettings settings = HighLogic.CurrentGame.Parameters.CustomParams <StatsGameSettings>();

            showAlways       = settings.AlwaysShow;
            useIcon          = settings.UseIcon;
            extendedTooltips = settings.ExtendedTooltips;
            hoverHighlight   = settings.HoverHighlight;
            transferButton   = settings.TransferButton;

            if (useIcon && !ctiOk)
            {
                // fail gracefully if CTI missing or failed to load
                log("useIcon is true, but Community Trait Icons could not be found or failed to load! Turning icons off.");
                useIcon = false;
            }
        }