Exemple #1
0
        private void Save()
        {
            string result = "";

            foreach (KeyValuePair <KeyCode, bool> kv in _modifiers)
            {
                if (kv.Value)
                {
                    result += kv.Key + "+";
                }
            }

            _config.SetValue(_name, result + _trigger);
            _config.save();
        }
Exemple #2
0
        public override void OnSave(ConfigNode node)
        {
            PluginConfiguration config = PluginConfiguration.CreateForType <Proximity>();

            config.SetValue("Window Position", windowPos);
            config.SetValue("Beep type", beepIndex);
            config.SetValue("Beep length", beepLength);
            config.SetValue("Visual type", visualIndex);
            config.SetValue("Activation height", ActivationHeight);
            config.SetValue("Distance Speed threshold", DSThreshold);
            config.SetValue("Show settings", showsettings);
            config.SetValue("Pitch", pitchIndex);
            config.SetValue("On Ascent", beepAscent);

            config.save();
        }
        private void SaveSettings()
        {
            print("[img_viewer.dll] Saving Config...");
            PluginConfiguration _configfile = PluginConfiguration.CreateForType <ImgViewer>();

            _configfile.SetValue("windowpos", _windowRect);
            _configfile.SetValue("windowpos2", _windowRect2);
            _configfile.SetValue("keybind", _keybind);
            _configfile.SetValue("version", _version);
            _configfile.SetValue("kspskin", _useKSPskin);
            _configfile.SetValue("visible", _visible);
            _configfile.SetValue("lastimage", _selectionGridInt);

            _configfile.save();
            print("[img_viewer.dll] Config Saved ");
        }
Exemple #4
0
        public void SaveConfiguration()
        {
            try
            {
                foreach (string key in _keys.Keys)
                {
                    _pluginConfiguration.SetValue(key, _keys[key].Value);
                }

                _pluginConfiguration.save();
            }
            catch (Exception ex)
            {
                Log.E(ex, "An exception occured!");
            }
        }
Exemple #5
0
        public void OnDestroy()
        {
            PluginConfiguration Config = PluginConfiguration.CreateForType <StationKeeping> ();

            //Debug.Log ("[StationKeeping] Saving " + WindowRect);
            Config.SetValue("RealSMA", RealSMA);
            Config.SetValue("Tolerance", Tolerance);
            Config.SetValue("WindowX", (double)WindowRect.x);
            Config.SetValue("WindowY", (double)WindowRect.y);
            //Debug.Log ("Saved WindowX: " + Config ["WindowX"]);
            //Debug.Log ("Saved WindowY: " + Config ["WindowY"]);
            Config.save();

            GameEvents.onGUIApplicationLauncherReady.Remove(OnGUIAppLauncherReady);
            ApplicationLauncher.Instance.RemoveModApplication(GUIButton);
        }
Exemple #6
0
 public void OnDestroy()
 {
     GameEvents.onGUIApplicationLauncherReady.Remove(onGUIApplicationLauncherReady);
     GameEvents.onGameSceneSwitchRequested.Remove(onGameSceneSwitchRequested);
     GameEvents.onLevelWasLoaded.Remove(onLevelWasLoaded);
     GameEvents.onVesselChange.Remove(onVesselChange);
     GameEvents.onHideUI.Remove(onHideUI);
     GameEvents.onShowUI.Remove(onShowUI);
     if (appLauncherButton != null)
     {
         ApplicationLauncher.Instance.RemoveModApplication(appLauncherButton);
     }
     config.SetValue("autoDewarp", autoDewarp);
     config.SetValue("guiRect", guiRect);
     config.save();
     InputLockManager.RemoveControlLock("BonVoyageInputLock");
 }
Exemple #7
0
        /// <summary>
        /// Callback for object destruction.
        /// </summary>
        public void OnDestroy()
        {
            RenderingManager.RemoveFromPostDrawQueue(0, OnDraw);
            PluginConfiguration config = PluginConfiguration.CreateForType <KartographSettings> ();

            config.load();
            config.SetValue("VesselWindowPos", _windowPos);
            config.SetValue("KrakenWarn", _krakenWarn);
            config.save();

            GameEvents.onVesselDestroy.Remove(VesselDestroyed);

            if (_instance == this)
            {
                _instance = null;
            }
        }
        /// <summary>
        /// Save our configuration to file.
        /// </summary>
        private void saveConfig()
        {
            Debug.Log("Saving PreciseNode settings.");
            PluginConfiguration config = KSP.IO.PluginConfiguration.CreateForType <PreciseNode>(null);

            config["conicsMode"]              = options.conicsMode;
            config["progInc"]                 = options.progInc.ToString();
            config["progDec"]                 = options.progDec.ToString();
            config["normInc"]                 = options.normInc.ToString();
            config["normDec"]                 = options.normDec.ToString();
            config["radiInc"]                 = options.radiInc.ToString();
            config["radiDec"]                 = options.radiDec.ToString();
            config["timeInc"]                 = options.timeInc.ToString();
            config["timeDec"]                 = options.timeDec.ToString();
            config["pageIncrement"]           = options.pageIncrement.ToString();
            config["pageConics"]              = options.pageConics.ToString();
            config["hideWindow"]              = options.hideWindow.ToString();
            config["addWidget"]               = options.addWidget.ToString();
            config["mainWindowX"]             = (int)options.mainWindowPos.x;
            config["mainWindowY"]             = (int)options.mainWindowPos.y;
            config["optWindowX"]              = (int)options.optionsWindowPos.x;
            config["optWindowY"]              = (int)options.optionsWindowPos.y;
            config["keyWindowX"]              = (int)options.keymapperWindowPos.x;
            config["keyWindowY"]              = (int)options.keymapperWindowPos.y;
            config["clockWindowX"]            = (int)options.clockWindowPos.x;
            config["clockWindowY"]            = (int)options.clockWindowPos.y;
            config["conicsWindowX"]           = (int)options.conicsWindowPos.x;
            config["conicsWindowY"]           = (int)options.conicsWindowPos.y;
            config["tripWindowX"]             = (int)options.tripWindowPos.x;
            config["tripWindowY"]             = (int)options.tripWindowPos.y;
            config["showClock"]               = options.showClock;
            config["showEAngle"]              = options.showEAngle;
            config["showConics"]              = options.showConics;
            config["showConicsAlways"]        = options.showConicsAlways;
            config["showOrbitInfo"]           = options.showOrbitInfo;
            config["showUTControls"]          = options.showUTControls;
            config["showManeuverPager"]       = options.showManeuverPager;
            config["intuitiveManeuverGizmos"] = options.intuitiveManeuverGizmos;
#if NODE_CLEANUP
            config["removeUsedNodes"]   = options.removeUsedNodes;
            config["usedNodeThreshold"] = options.usedNodeThreshold;
#endif
            config["largeUTIncrement"] = options.largeUTIncrement;

            config.save();
        }
        public void OnDestroy()
        {
            PluginConfiguration Config = PluginConfiguration.CreateForType <StationKeeping>();

            //Debug.Log ("[StationKeeping] Saving " + WindowRect);
            Config.SetValue("AltSkin", AltSkin);
            Config.SetValue("RCSOnly", RCSOnly);
            Config.SetValue("RealSMA", RealSMA);
            Config.SetValue("Tolerance", Tolerance);
            Config.SetValue("WindowX", (double)WindowRect.x);
            Config.SetValue("WindowY", (double)WindowRect.y);
            //Debug.Log ("Saved WindowX: " + Config ["WindowX"]);
            //Debug.Log ("Saved WindowY: " + Config ["WindowY"]);
            Config.save();

            toolbarControl.OnDestroy();
            Destroy(toolbarControl);
        }
        void SaveSettings()
        {
            string pumpings = "";

            foreach (var s in listSettings)
            {
                if (s.res.resourceName.GetHashCode() != idEvaPropellant)
                {
                    if (s.pumping != PumpingMode.NONE)
                    {
                        pumpings += s.res.resourceName + ":" + s.pumping.ToString() + ",";
                    }
                }
            }

            cfg["pumpings"] = pumpings;
            cfg.save();
        }
Exemple #11
0
        internal void saveConfig()
        {
            Debug.Log("Saving PreciseManeuver settings.");
            PluginConfiguration config = KSP.IO.PluginConfiguration.CreateForType <PreciseManeuver> (null);

            config["enabled"]    = _showMainWindow;
            config["background"] = isInBackground;

            foreach (HotkeyType type in Enum.GetValues(typeof(HotkeyType)))
            {
                config[type.ToString()] = hotkeys[(int)type].ToString();
            }

            foreach (ModuleType type in Enum.GetValues(typeof(ModuleType)))
            {
                config[type.ToString()] = moduleState[(int)type];
            }

            config["increment"]      = _increment;
            config["x10UTincrement"] = x10UTincrement;

            config["scale"]       = (int)(guiScale * 1000f);
            config["sensitivity"] = (int)(gizmoSensitivity * 10000f);

            config["mainWindowX"] = (int)_mainWindowPos.x;
            config["mainWindowY"] = (int)_mainWindowPos.y;
            config["keyWindowX"]  = (int)_keymapperWindowPos.x;
            config["keyWindowY"]  = (int)_keymapperWindowPos.y;

            // presets
            config["presetsCount"] = (int)presets.Count;
            int i = 0;

            foreach (KeyValuePair <string, Vector3d> item in presets)
            {
                config["preset" + i.ToString() + "name"] = item.Key;
                config["preset" + i.ToString() + "dx"]   = item.Value.x.ToString("G17");
                config["preset" + i.ToString() + "dy"]   = item.Value.y.ToString("G17");
                config["preset" + i.ToString() + "dz"]   = item.Value.z.ToString("G17");
                i++;
            }

            config.save();
        }
Exemple #12
0
        public static void save_settings()
        {
            if (conf == null)
            {
                conf = PluginConfiguration.CreateForType <CorrectCoL>();
            }
            Debug.Log("[CorrectCoL]: serializing");
            conf.SetValue("x", wnd_rect.x.ToString());
            conf.SetValue("y", wnd_rect.y.ToString());
            conf.SetValue("range", aoa_range.ToString());
            conf.save();

            // clear lock
            if (locked)
            {
                EditorLogic.fetch.Unlock("CorrectCoLWindow");
                locked = false;
            }
        }
Exemple #13
0
        /// <summary>
        /// Destroy this instance.
        /// </summary>
        public void OnDestroy()
        {
            ControlUnlock();
            PluginConfiguration config = PluginConfiguration.CreateForType <KartographSettings> ();

            config.load();
            config.SetValue("ManeuverWindowPos", _windowPos);
            config.save();

            GameEvents.onHideUI.Remove(Hide);
            GameEvents.onShowUI.Remove(UnHide);
            GameEvents.onGamePause.Remove(Hide);
            GameEvents.onGameUnpause.Remove(UnHide);

            if (_instance == this)
            {
                _instance = null;
            }
        }
Exemple #14
0
        static Configuration()
        {
            PluginConfiguration config = PluginConfiguration.CreateForType <ModuleControllableEmissive>();

            config.load();

            isVerbose = config.GetValue <bool>("VerboseLogging");

            toggleLEDColor = ParseColor(config, DefaultColor.ToggleLED);

            highResourceColor   = ParseColor(config, DefaultColor.HighResource);
            mediumResourceColor = ParseColor(config, DefaultColor.MediumResource);
            lowResourceColor    = ParseColor(config, DefaultColor.LowResource);

            reactionWheelNormalColor    = ParseColor(config, DefaultColor.ReactionWheelNormal);
            reactionWheelPilotOnlyColor = ParseColor(config, DefaultColor.ReactionWheelPilotOnly);
            reactionWheelSasOnlyColor   = ParseColor(config, DefaultColor.ReactionWheelSASOnly);

            dockingCrossfeedOnColor  = ParseColor(config, DefaultColor.DockingCrossfeedOn);
            dockingCrossfeedOffColor = ParseColor(config, DefaultColor.DockingCrossfeedOff);

            crewIndicatorDefaultStatus = config.GetValue("CrewIndicatorDefaultStatus", true);
            crewPilotColor             = ParseColor(config, DefaultColor.CrewPilot);
            crewEngineerColor          = ParseColor(config, DefaultColor.CrewEngineer);
            crewScientistColor         = ParseColor(config, DefaultColor.CrewScientist);
            crewTouristColor           = ParseColor(config, DefaultColor.CrewTourist);

            liquidFuelColor     = ParseColor(config, DefaultColor.ResourceLiquidFuel);
            oxidizerColor       = ParseColor(config, DefaultColor.ResourceOxidizer);
            lfoColor            = Color.Lerp(liquidFuelColor, oxidizerColor, 0.5f);
            monopropellantColor = ParseColor(config, DefaultColor.ResourceMonopropellant);

            highScienceColor   = ParseColor(config, DefaultColor.HighScience);
            mediumScienceColor = ParseColor(config, DefaultColor.MediumScience);
            lowScienceColor    = ParseColor(config, DefaultColor.LowScience);

            warningColor = ParseColor(config, DefaultColor.Warning);

            unknownColor = ParseColor(config, DefaultColor.Unknown);

            config.save();
        }
Exemple #15
0
        /// <summary>
        /// Closes the KISS window, unpauses the game and writes the specified reason into the Debug.Log.
        /// </summary>
        /// <param name="reason">Why/How was the window closed?</param>
        private void Close(string reason)
        {
            // save window position and current settings into config file
            config.SetValue("Window Position", windowPosSize);
            config.SetValue("confirmOverwrite", confirmOverwrite);
            config.SetValue("confirmDelete", confirmDelete);
            config.SetValue("useGameTime", useGameTime);
            config.SetValue("reverseOrder", reverseOrder);
            config.SetValue("selectedDfltSaveNameInt", selectedDfltSaveName);
            config.SetValue("quickSaveMode", quickSaveMode);
            config.SetValue("kissKeyCode", kissKeyCode);
            config.SetValue("kissKeyCaption", kissKeyCaption);

            config.save();

            // code to remove window from UI
            isVisible = false;
            Debug.Log(modLogTag + reason);
            FlightDriver.SetPause(false);
        }
Exemple #16
0
        private void Save()
        {
            PluginConfiguration config = PluginConfiguration.CreateForType <NavHud>();

            config.SetValue("version", _version);
            config.SetValue("main window position", _mainWindowPosition);
            config.SetValue("color window position", _colorWindowPosition);
            config.SetValue("hud text position", _hudTextWindowPosition);
            config.SetValue("enable text", _enableText);
            config.SetValue("lock text", _lockText);
            config.SetValue("toggle key", _toggleKey);
            config.SetValue("enabled", _enabled);
            config.SetValue("linesEnabled", _linesEnabled);
            config.SetValue("markersEnabled", _markersEnabled);
            //config.SetValue("waypointEnabled", _waypointEnabled); // Broken 1.1.3 waypoint code
            config.SetValue("enabledMap", _enableMap);
            config.SetValue("hideWithUI", _hideWithUI);
            _values.Save(config);
            config.save();
        }
Exemple #17
0
        private void OnDestroy()
        {
            config.SetValue(this.name, windowRect);
            config.save();

            GameEvents.onLevelWasLoaded.Remove(onLevelWasLoaded);
            GameEvents.onVesselChange.Remove(onVesselChange);
            GameEvents.onHideUI.Remove(onHideUI);
            GameEvents.onShowUI.Remove(onShowUI);
            GameEvents.onGamePause.Remove(onGamePause);
            GameEvents.onGameUnpause.Remove(onGameUnpause);

            UnlockControls();
            DestroyLauncher();

            if (instance == this)
            {
                instance = null;
            }
        }
Exemple #18
0
        /// <summary>
        /// Cleanup on destruction.
        /// </summary>
        public void OnDestroy()
        {
            GameEvents.onGUIApplicationLauncherReady.Remove(onGUIApplicationLauncherReady);
            GameEvents.onGameSceneSwitchRequested.Remove(onGameSceneSwitchRequested);
            GameEvents.onLevelWasLoaded.Remove(onLevelWasLoaded);
            GameEvents.onVesselChange.Remove(onVesselChange);
            GameEvents.onHideUI.Remove(onHideUI);
            GameEvents.onShowUI.Remove(onShowUI);
            GameEvents.onGamePause.Remove(onGamePause);
            GameEvents.onGameUnpause.Remove(onGameUnpause);

            DestroyLauncher();

            config.SetValue("autoDewarp", autoDewarp);
            config.SetValue("guiRect", guiRect);
            config.SetValue("rcRect", rcRect);
            config.SetValue("useKSPSkin", useKSPSkin);
            config.SetValue("useToolbar", useToolbar);
            config.save();
            InputLockManager.RemoveControlLock("BonVoyageInputLock");
        }
Exemple #19
0
        // Saves the settings.
        private void SaveSettings()
        {
            print("[notes.dll] Saving Config...");
            PluginConfiguration _configFile = PluginConfiguration.CreateForType <Notes>();

            _configFile.SetValue("main window position", _windowRect);
            _configFile.SetValue("list window position", _windowRect2);
            _configFile.SetValue("del dialog position", _windowRect3);
            _configFile.SetValue("keybind", _keybind);
            _configFile.SetValue("keybind2", _keybind2);
            _configFile.SetValue("version", _version);
            _configFile.SetValue("font size", _fontSize);
            _configFile.SetValue("last note opened", _file);
            _configFile.SetValue("use ksp skin", _useKspSkin);
            _configFile.SetValue("main window state", _visible);
            _configFile.SetValue("mouse button", _mouseButton);
            _configFile.SetValue("notesdir", _notesDir);

            _configFile.save();
            print("[notes.dll] Config Saved ");
        }
Exemple #20
0
        public override void OnSave(ConfigNode node)
        {
            //print("@@@OnSave");
            PluginConfiguration config = PluginConfiguration.CreateForType <Proximity>();

            config.SetValue("Window Position", windowPos);
            config.SetValue("Beep type", beepIndex);
            config.SetValue("Beep length", beepLength);
            config.SetValue("Visual type", visualIndex);
            config.SetValue("Activation height", ActivationHeight);
            config.SetValue("Distance Speed threshold", DSThreshold);
            config.SetValue("Show settings", UseToolbar ? ToolbarShowSettings: GUIShowSettings);
            config.SetValue("Pitch type", pitchIndex);
            config.SetValue("Off if parachute", deactivateOnParachute);
            config.SetValue("Off if rover", deactivateIfRover);
            config.SetValue("Volume", (int)(volume * 100));
#if PERSONAL_VERSION
            config.SetValue("Autodeploy parachute", autoParachute);
            config.SetValue("Autodeploy landing legs", autoExtendLandingLegs);
#endif
            config.save();
        }
Exemple #21
0
        internal void OnDestroy()
        {
            toolbarControl.OnDestroy();
            Destroy(toolbarControl);

            #if DEBUG
            // don't save configs because KramaxReload screws up PluginConfiguration
            #else
            PluginConfiguration config = PluginConfiguration.CreateForType <AutoAsparagus> ();
            config.SetValue("vizualize", vizualize);
            config.SetValue("stageParachutes", stageParachutes);
            config.SetValue("stageLaunchClamps", stageLaunchClamps);
            config.SetValue("launchClampsStage", launchClampsStage);
            config.SetValue("stagesepratrons", stagesepratrons);
            config.SetValue("useSmartStage", useSmartStage);
            config.SetValue("windowRectX", (int)windowRect.x);
            config.SetValue("windowRectY", (int)windowRect.y);
            config.save();
                        #endif

            GameEvents.onEditorShipModified.Remove(onCraftChange);
        }
        //Save persistant data to the config file
        public void SaveMe()
        {
            PluginConfiguration config = PluginConfiguration.CreateForType <SteamGauges>();

            //Save main info
            config.SetValue("WindowPosition", _windowPosition);
            config.SetValue("WindowMinimized", isMinimized);
            config.SetValue("GlobalAlpha", (double)Alpha);
            config.SetValue("AdvancedMinimized", advMinimized);
            config.SetValue("AdvancedPosition", _advwindowPosition);
            config.SetValue("DrawBezels", drawBezels);
            config.SetValue("WindowLock", windowLock);
            config.SetValue("AllToolbar", _allToolbar);
            config.SetValue("EnableAirGauge", enableAirGauge);
            config.SetValue("EnableElecGauge", enableElectricalGauge);
            config.SetValue("EnableFuelGauge", enableFuelGauge);
            config.SetValue("EnableCompass", enableCompass);
            config.SetValue("EnableHUD", enableHUDGauge);
            config.SetValue("EnableNodeGauge", enableNodeGauge);
            config.SetValue("EnableOrbitGauge", enableOrbitGauge);
            config.SetValue("EnableRadarAltimeter", enableRadarAltimeter);
            config.SetValue("EnableRZGauge", enableRZGauge);
            config.SetValue("EnableNavGauge", enableNavGauge);
            config.SetValue("EnableTempGAuge", enableTempGauge);
            //Save individual gauges
            radarAltimeter.save(config);
            compassGauge.save(config);
            electricalGauge.save(config);
            fuelGauge.save(config);
            orbitGauge.save(config);
            rzGauge.save(config);
            nodeGauge.save(config);
            hudGauge.save(config);
            airGauge.save(config);
            navGauge.save(config);
            tempGauge.save(config);
            config.save();
        }
Exemple #23
0
        public void Awake()
        {
            if (Instance != null)
            {
                Destroy(this);
                return;
            }
            Instance = this;

            guiVisible   = false;
            globalHidden = false;
            guiId        = GUIUtility.GetControlID(FocusType.Passive);
            config       = PluginConfiguration.CreateForType <BonVoyage>();
            config.load();
            autoDewarp   = config.GetValue <bool>("autoDewarp", false);
            activeRovers = new List <ActiveRover>();

            Rect sample = new Rect();

            sample.width  = 700;
            sample.height = 500;
            sample.center = new Vector2(Screen.width / 2, Screen.height / 2);
            guiRect       = config.GetValue <Rect>("guiRect", new Rect(sample));
            config.save();
            lastUpdated = DateTime.Now;
            mainWindowScrollPosition = new Vector2(0, 0);

            labelRect  = new Rect(0, 0, Screen.width, Screen.height / 2);
            labelStyle = new GUIStyle();
            labelStyle.stretchWidth     = true;
            labelStyle.stretchHeight    = true;
            labelStyle.alignment        = TextAnchor.MiddleCenter;
            labelStyle.fontSize         = Screen.height / 20;
            labelStyle.fontStyle        = FontStyle.Bold;
            labelStyle.normal.textColor = Color.red;

//			mapMarker = GameDatabase.Instance.GetTexture("BonVoyage/Textures/map-marker", false);
        }
        /// <summary>
        /// Hail to The King, baby
        /// </summary>
        public void OnDestroy()
        {
            GameEvents.onGUIApplicationLauncherReady.Remove(onGUIApplicationLauncherReady);
            GameEvents.onLevelWasLoaded.Remove(onLevelWasLoaded);
            GameEvents.onVesselChange.Remove(onVesselChange);
            GameEvents.onHideUI.Remove(onHideUI);
            GameEvents.onShowUI.Remove(onShowUI);
            GameEvents.onGamePause.Remove(onGamePause);
            GameEvents.onGameUnpause.Remove(onGameUnpause);

            UnlockControls();
            DestroyLauncher();

            config.SetValue("windowRect", windowRect);
            config.SetValue("useToolbar", useToolbar);
            config.SetValue("maximized", maximized);
            config.save();

            if (Instance == this)
            {
                Instance = null;
            }
        }
Exemple #25
0
        /// <summary>
        /// Called when this object is destroyed.
        /// </summary>
        public void OnDestroy()
        {
            ControlUnlock();

            PluginConfiguration config = PluginConfiguration.CreateForType <KartographSettings> ();

            config.load();
            config.SetValue("AppLaunchPos", _windowPos);
            config.save();

            DestroyButtons();

            GameEvents.onGUIApplicationLauncherReady.Remove(OnAppLaunchReady);
            GameEvents.onHideUI.Remove(Hide);
            GameEvents.onShowUI.Remove(UnHide);
            GameEvents.onGamePause.Remove(Hide);
            GameEvents.onGameUnpause.Remove(UnHide);

            if (_instance == this)
            {
                _instance = null;
            }
        }
Exemple #26
0
        /// <summary>
        /// Called when destroying this instance.
        /// </summary>
        public void OnDestroy()
        {
            ControlUnlock();
            PluginConfiguration config = PluginConfiguration.CreateForType <KartographSettings> ();

            config.load();
            config.SetValue("AutoHide", _autoHide);
            config.SetValue("KrakenDisable", _disableKraken);
            config.SetValue("UseKspSkin", _useKspSkin);
            config.SetValue("UseToolbar", _useToolbar);
            config.SetValue("SettingsWindowPos", _windowPos);
            config.save();

            GameEvents.onHideUI.Remove(Hide);
            GameEvents.onShowUI.Remove(UnHide);
            GameEvents.onGamePause.Remove(Hide);
            GameEvents.onGameUnpause.Remove(UnHide);

            if (_instance == this)
            {
                _instance = null;
            }
        }
Exemple #27
0
    public void Start()
    {
        PluginConfiguration cfg = KSP.IO.PluginConfiguration.CreateForType <NavBallDockingAlignmentIndicator>();

        cfg.load();
        Vector3 tmp = cfg.GetValue <Vector3>("alignmentmarkercolor", new Vector3(1f, 0f, 0f));                  //default: red
        Color   alignmentmarkercolor   = new Color(tmp.x, tmp.y, tmp.z);
        Vector2 alignmentmarkertexture = cfg.GetValue <Vector2>("alignmentmarkertexture", new Vector2(0f, 2f)); //default: prograde marker

        cfg.save();
        float texturescalefactor = 1f / 3f;

        //get navball object
        GameObject navBall = GameObject.Find("NavBall");
        Transform  navBallVectorsPivotTransform = navBall.transform.FindChild("vectorsPivot");

        navBallBehaviour = navBall.GetComponent <NavBall>();

        //get indicator texture (use the prograde marker, since it has a clear 'upwards' direction)
        ManeuverGizmo       maneuverGizmo       = MapView.ManeuverNodePrefab.GetComponent <ManeuverGizmo>();
        ManeuverGizmoHandle maneuverGizmoHandle = maneuverGizmo.handleNormal;
        Transform           transform           = maneuverGizmoHandle.flag;
        Renderer            renderer            = transform.renderer;
        Material            maneuverTexture     = renderer.sharedMaterial;

        //create alignment indicator game object
        indicator = Create2DObject(
            name: "navballalignmentindicator",
            size: 0.025f,             //the same size as all other markers
            col: alignmentmarkercolor,
            texture: maneuverTexture,
            textureScale: Vector2.one * texturescalefactor,
            textureOffset: alignmentmarkertexture * texturescalefactor,
            parentTransform: navBallVectorsPivotTransform,
            layer: 12             //the navball layer
            );
    }
        /** Called on destroy */
        public void OnDestroy()
        {
            debugPrint("OnDestroy()");

            /** Save to config */
            PluginConfiguration config = PluginConfiguration.CreateForType <ExperimentTracker>();

            config.SetValue("expGUI", expGUI);
            config.SetValue("expListRectX", (int)expListRect.x);
            config.SetValue("expListRectY", (int)expListRect.y);
            config.SetValue("infGUI", infGUI);
            config.SetValue("infRectX", (int)infRect.x);
            config.SetValue("infRectY", (int)infRect.y);
            config.save();

            /** Unregister for events */
            GameEvents.onGUIApplicationLauncherReady.Remove(setupButton);

            /** Remove button */
            if (etButton != null)
            {
                ApplicationLauncher.Instance.RemoveModApplication(etButton);
            }
        }
Exemple #29
0
        void SaveConfig()
        {
            // Save config
            PluginConfiguration config = KSP.IO.PluginConfiguration.CreateForType <Kerbulator>(null);

            config["mainWindowX"]        = (int)options.mainWindowPos.x;
            config["mainWindowY"]        = (int)options.mainWindowPos.y;
            config["mainWindowWidth"]    = (int)options.mainWindowPos.width;
            config["mainWindowHeight"]   = (int)options.mainWindowPos.height;
            config["editWindowX"]        = (int)options.editWindowPos.x;
            config["editWindowY"]        = (int)options.editWindowPos.y;
            config["editWindowWidth"]    = (int)options.editWindowPos.width;
            config["editWindowHeight"]   = (int)options.editWindowPos.height;
            config["runWindowX"]         = (int)options.runWindowPos.x;
            config["runWindowY"]         = (int)options.runWindowPos.y;
            config["runWindowWidth"]     = (int)options.runWindowPos.width;
            config["runWindowHeight"]    = (int)options.runWindowPos.height;
            config["repeatWindowX"]      = (int)options.repeatWindowPos.x;
            config["repeatWindowY"]      = (int)options.repeatWindowPos.y;
            config["repeatWindowWidth"]  = (int)options.repeatWindowPos.width;
            config["repeatWindowHeight"] = (int)options.repeatWindowPos.height;

            config.save();
        }
Exemple #30
0
 public override void OnSave(ConfigNode node)
 {
     pluginConfig.save();
 }
Exemple #31
0
        // Max patched conics buttons
        //private bool bMC_minus = false;
        //private bool bMC_plus = false;
        //private string bMC = FlightGlobals.ActiveVessel.patchedConicRenderer.
        // private double rad2deg = (180.0 / Math.PI);
        //private static Core _core;
        //private static bool _draw = true;
        public void Awake()
        {
            //DontDestroyOnLoad (this);
            CancelInvoke ();
            //InvokeRepeating ("ClockUpdate",0.2F,0.2F);
            Debug.Log ("NodeFreeze is alive");

            if (cfgLoaded == false) {
                Debug.Log ("Enabling cfg file");
                cfg = KSP.IO.PluginConfiguration.CreateForType<NodeSelect>(null);
                Debug.Log ("Loading cfg");
                cfg.load ();
                Debug.Log ("CFG loaded");
                cfgLoaded = true;
                try {
                    string cfgCycleKey = cfg.GetValue<String> ("cycleKey", "undefined");
                    if (cfgCycleKey.Equals ("undefined")) {
                        cfg ["cycleKey"] = "O";
                        cfgCycleKey = "O";
                        cfg.save ();
                    }
                    cycleKey = (KeyCode)Enum.Parse (typeof(KeyCode), "O");
                    Debug.Log ("Cycle key set through try");
                    string cfgConicsMode = cfg.GetValue<String> ("conicsMode", "3");
                } catch (ArgumentException) {
                    cycleKey = KeyCode.O;
                    Debug.Log ("Cycle key set through exception");
                }

                // Setting hide key
                /*
                try {
                    string cfgHideKey = cfg.GetValue<String> ("hideKey", "undefined");
                    if (cfgHideKey.Equals ("undefined")) {
                        cfg ["hideKey"] = "I";
                        cfgHideKey = "I";
                        cfg.save ();
                    }
                    hideKey = (KeyCode)Enum.Parse (typeof(KeyCode), cfgHideKey);
                    Debug.Log ("Hide key set through try");
                } catch (ArgumentException) {
                    hideKey = KeyCode.I;
                    Debug.Log ("Hide key set through exception");
                }
                */
            }
        }