示例#1
0
        private void ReadSettings()
        {
            DistantObjectSettings.LoadConfig();

            // Create local copies of the values, so we're not editing the
            // config file until the user presses "Apply"
            flaresEnabled     = DistantObjectSettings.DistantFlare.flaresEnabled;
            flareSaturation   = DistantObjectSettings.DistantFlare.flareSaturation;
            flareSize         = DistantObjectSettings.DistantFlare.flareSize;
            flareBrightness   = DistantObjectSettings.DistantFlare.flareBrightness;
            ignoreDebrisFlare = DistantObjectSettings.DistantFlare.ignoreDebrisFlare;
            debrisBrightness  = DistantObjectSettings.DistantFlare.debrisBrightness;
            showNames         = DistantObjectSettings.DistantFlare.showNames;

            renderVessels = DistantObjectSettings.DistantVessel.renderVessels;
            maxDistance   = DistantObjectSettings.DistantVessel.maxDistance;
            renderMode    = DistantObjectSettings.DistantVessel.renderMode;
            ignoreDebris  = DistantObjectSettings.DistantVessel.ignoreDebris;

            changeSkybox  = DistantObjectSettings.SkyboxBrightness.changeSkybox;
            maxBrightness = DistantObjectSettings.SkyboxBrightness.maxBrightness;

            debugMode         = DistantObjectSettings.debugMode;
            useToolbar        = DistantObjectSettings.useToolbar;
            useAppLauncher    = DistantObjectSettings.useAppLauncher || !ToolbarManager.ToolbarAvailable;
            onlyInSpaceCenter = DistantObjectSettings.onlyInSpaceCenter;
        }
示例#2
0
        private void ApplySettings()
        {
            // Apply our local values to the settings file object, and then
            // save it.
            DistantObjectSettings.DistantFlare.flaresEnabled     = flaresEnabled;
            DistantObjectSettings.DistantFlare.flareSaturation   = flareSaturation;
            DistantObjectSettings.DistantFlare.flareSize         = flareSize;
            DistantObjectSettings.DistantFlare.flareBrightness   = flareBrightness;
            DistantObjectSettings.DistantFlare.ignoreDebrisFlare = ignoreDebrisFlare;
            DistantObjectSettings.DistantFlare.debrisBrightness  = debrisBrightness;
            DistantObjectSettings.DistantFlare.showNames         = showNames;

            DistantObjectSettings.DistantVessel.renderVessels = renderVessels;
            DistantObjectSettings.DistantVessel.maxDistance   = maxDistance;
            DistantObjectSettings.DistantVessel.renderMode    = renderMode;
            DistantObjectSettings.DistantVessel.ignoreDebris  = ignoreDebris;

            DistantObjectSettings.SkyboxBrightness.changeSkybox  = changeSkybox;
            DistantObjectSettings.SkyboxBrightness.maxBrightness = maxBrightness;

            DistantObjectSettings.debugMode         = debugMode;
            DistantObjectSettings.useToolbar        = useToolbar;
            DistantObjectSettings.useAppLauncher    = useAppLauncher;
            DistantObjectSettings.onlyInSpaceCenter = onlyInSpaceCenter;

            DistantObjectSettings.SaveConfig();
        }
示例#3
0
        //--------------------------------------------------------------------
        // Awake()
        // Load configs, set up the callback,
        private void Awake()
        {
            DistantObjectSettings.LoadConfig();

            Dictionary <string, Vessel.Situations> namedSituations = new Dictionary <string, Vessel.Situations> {
                { Vessel.Situations.LANDED.ToString(), Vessel.Situations.LANDED },
                { Vessel.Situations.SPLASHED.ToString(), Vessel.Situations.SPLASHED },
                { Vessel.Situations.PRELAUNCH.ToString(), Vessel.Situations.PRELAUNCH },
                { Vessel.Situations.FLYING.ToString(), Vessel.Situations.FLYING },
                { Vessel.Situations.SUB_ORBITAL.ToString(), Vessel.Situations.SUB_ORBITAL },
                { Vessel.Situations.ORBITING.ToString(), Vessel.Situations.ORBITING },
                { Vessel.Situations.ESCAPING.ToString(), Vessel.Situations.ESCAPING },
                { Vessel.Situations.DOCKED.ToString(), Vessel.Situations.DOCKED },
            };

            List <string> situationStrings = DistantObjectSettings.DistantFlare.situations.Split(',').ToList();

            foreach (string sit in situationStrings)
            {
                if (namedSituations.ContainsKey(sit))
                {
                    situations.Add(namedSituations[sit]);
                }
                else
                {
                    Debug.LogWarning(Constants.DistantObject + " -- Unable to find situation '" + sit + "' in my known situations atlas");
                }
            }

            if (DistantObjectSettings.DistantFlare.flaresEnabled)
            {
                Debug.Log(Constants.DistantObject + " -- FlareDraw enabled");
            }
            else
            {
                Debug.Log(Constants.DistantObject + " -- FlareDraw disabled");
            }

            GenerateBodyFlares();

            // Remove Vessels from our dictionaries just before they are destroyed.
            // After they are destroyed they are == null and this confuses Dictionary.
            GameEvents.onVesselWillDestroy.Add(RemoveVesselFlare);

            // Cache a list of the scaledTransforms so we know which worlds
            // are being rendered.
            scaledTransforms =
                ScaledSpace.Instance.scaledSpaceTransforms
                .Where(ss => ss.GetComponent <ScaledSpaceFader>() != null)
                .ToList();

            //--- HACK++
            //foreach(Transform sst in scaledTransforms)
            //{
            //    Debug.Log(string.Format("xform {0} @ {1}, which is {2}", sst.name, sst.position, ScaledSpace.ScaledToLocalSpace(sst.position)));
            //}
        }
示例#4
0
        public void Awake()
        {
            //Load settings
            DistantObjectSettings.LoadConfig();

            meshListLookup.Clear();
            referencePart.Clear();
            vesselIsBuilt.Clear();
            watchList.Clear();
            partModelNameLookup.Clear();

            if (DistantObjectSettings.DistantVessel.renderVessels)
            {
                bool sawErrors = false;
                foreach (UrlDir.UrlConfig urlConfig in GameDatabase.Instance.GetConfigs("PART"))
                {
                    ConfigNode cfgNode = ConfigNode.Load(urlConfig.parent.fullPath);
                    foreach (ConfigNode node in cfgNode.nodes)
                    {
                        if (node.GetValue("name") == urlConfig.name)
                        {
                            cfgNode = node;
                            break;
                        }
                    }

                    if (cfgNode.HasValue("name"))
                    {
                        string url   = urlConfig.parent.url.Substring(0, urlConfig.parent.url.LastIndexOf("/"));
                        string model = System.IO.Path.GetFileNameWithoutExtension(cfgNode.GetValue("mesh"));
                        if (!partModelNameLookup.ContainsKey(urlConfig.name))
                        {
                            partModelNameLookup.Add(urlConfig.name, url + "/" + model);
                        }
                    }
                    else
                    {
                        if (DistantObjectSettings.debugMode)
                        {
                            Debug.LogError(Constants.DistantObject + " -- Could not find ConfigNode for part " + urlConfig.name + ".  Part will not render for VesselDraw.");
                        }
                        sawErrors = true;
                    }
                }

                print(Constants.DistantObject + " -- VesselDraw initialized");
                if (sawErrors)
                {
                    Debug.LogError(Constants.DistantObject + " -- Some parts do not have ConfigNode entries in the game database.  Some distant vessels will be missing pieces.");
                }
            }
            else if (DistantObjectSettings.debugMode)
            {
                print(Constants.DistantObject + " -- VesselDraw disabled");
            }
        }
示例#5
0
        //--------------------------------------------------------------------
        // Awake()
        // Load configs, set up the callback,
        private void Awake()
        {
            DistantObjectSettings.LoadConfig();

            Dictionary <string, Vessel.Situations> namedSituations = new Dictionary <string, Vessel.Situations> {
                { Vessel.Situations.LANDED.ToString(), Vessel.Situations.LANDED },
                { Vessel.Situations.SPLASHED.ToString(), Vessel.Situations.SPLASHED },
                { Vessel.Situations.PRELAUNCH.ToString(), Vessel.Situations.PRELAUNCH },
                { Vessel.Situations.FLYING.ToString(), Vessel.Situations.FLYING },
                { Vessel.Situations.SUB_ORBITAL.ToString(), Vessel.Situations.SUB_ORBITAL },
                { Vessel.Situations.ORBITING.ToString(), Vessel.Situations.ORBITING },
                { Vessel.Situations.ESCAPING.ToString(), Vessel.Situations.ESCAPING },
                { Vessel.Situations.DOCKED.ToString(), Vessel.Situations.DOCKED },
            };

            string[] situationStrings = DistantObjectSettings.DistantFlare.situations.Split(',');

            foreach (string sit in situationStrings)
            {
                if (namedSituations.ContainsKey(sit))
                {
                    situations.Add(namedSituations[sit]);
                }
                else
                {
                    UnityEngine.Debug.LogWarning(Constants.DistantObject + " -- Unable to find situation '" + sit + "' in my known situations atlas");
                }
            }

            if (DistantObjectSettings.DistantFlare.flaresEnabled)
            {
                UnityEngine.Debug.Log(Constants.DistantObject + " -- FlareDraw enabled");
            }
            else
            {
                UnityEngine.Debug.Log(Constants.DistantObject + " -- FlareDraw disabled");
            }

            sunRadiusSquared = FlightGlobals.Bodies[0].Radius * FlightGlobals.Bodies[0].Radius;
            GenerateBodyFlares();

            // Remove Vessels from our dictionaries just before they are destroyed.
            // After they are destroyed they are == null and this confuses Dictionary.
            GameEvents.onVesselWillDestroy.Add(RemoveVesselFlare);
        }
示例#6
0
        public void Awake()
        {
            restorableGalaxyCube = false;

            DistantObjectSettings.LoadConfig();

            if (GalaxyCubeControl.Instance != null)
            {
                restorableGalaxyCube = true;
                galaxyColor          = GalaxyCubeControl.Instance.maxGalaxyColor;
                glareFadeLimit       = GalaxyCubeControl.Instance.glareFadeLimit;

                if (DistantObjectSettings.SkyboxBrightness.changeSkybox)
                {
                    GalaxyCubeControl.Instance.maxGalaxyColor = new Color(DistantObjectSettings.SkyboxBrightness.maxBrightness, DistantObjectSettings.SkyboxBrightness.maxBrightness, DistantObjectSettings.SkyboxBrightness.maxBrightness);
                    GalaxyCubeControl.Instance.glareFadeLimit = 1f;
                }
            }
        }