예제 #1
0
        public void saveMainSettingsIfChanged()
        {
            UrlDir.UrlConfig[] baseConfigs = GameDatabase.Instance.GetConfigs("Scatterer_config");

            if (baseConfigs.Length == 0)
            {
                Utils.LogDebug("No config file found, check your install");
                return;
            }

            if (baseConfigs.Length > 1)
            {
                Utils.LogDebug("Multiple config files detected, check your install");
            }

            MainSettingsReadWrite OldConfig = new MainSettingsReadWrite();

            ConfigNode.LoadObjectFromConfig(OldConfig, (baseConfigs [0]).config);

            bool configChanged =
                (OldConfig.autosavePlanetSettingsOnSceneChange != autosavePlanetSettingsOnSceneChange ||
                 OldConfig.disableAmbientLight != disableAmbientLight ||
                 OldConfig.integrateWithEVEClouds != integrateWithEVEClouds ||
                 OldConfig.overrideNearClipPlane != overrideNearClipPlane ||
                 OldConfig.nearClipPlane != nearClipPlane ||
                 OldConfig.useOceanShaders != useOceanShaders ||
                 OldConfig.shadowsOnOcean != shadowsOnOcean ||
                 OldConfig.oceanSkyReflections != oceanSkyReflections ||
                 OldConfig.oceanRefraction != oceanRefraction ||
                 OldConfig.oceanCaustics != oceanCaustics ||
                 OldConfig.oceanPixelLights != oceanPixelLights ||
                 OldConfig.fullLensFlareReplacement != fullLensFlareReplacement ||
                 OldConfig.sunlightExtinction != sunlightExtinction ||
                 OldConfig.underwaterLightDimming != underwaterLightDimming ||
                 OldConfig.showMenuOnStart != showMenuOnStart ||
                 OldConfig.useEclipses != useEclipses ||
                 OldConfig.useRingShadows != useRingShadows ||
                 OldConfig.terrainShadows != terrainShadows ||
                 OldConfig.shadowNormalBias != shadowNormalBias ||
                 OldConfig.shadowBias != shadowBias ||
                 OldConfig.shadowsDistance != shadowsDistance ||
                 OldConfig.m_fourierGridSize != m_fourierGridSize) ||
                OldConfig.RSSMode != RSSMode;

            if (configChanged)
            {
                Utils.LogDebug("Main config changed");

                baseConfigs [0].config      = ConfigNode.CreateConfigFromObject(this);
                baseConfigs [0].config.name = "Scatterer_config";
                Utils.LogDebug("Saving settings to: " + baseConfigs [0].parent.url + ".cfg");
                baseConfigs [0].parent.SaveConfigs();
            }
            else
            {
                Utils.LogDebug("No changes to main config, skipping saving.");
            }
        }