コード例 #1
0
ファイル: CFC.cs プロジェクト: net-lisias-ksph/Guybrush101
        void Start()
        {
            if (!GTIConfig.CameraFocusChanger.Activate || PluginExists("CameraFocusChanger"))
            {
                Destroy(this);
                return;
            }

            GTIDebug.Log("Starting GTI_CameraFocusChanger");

            //DebugPrint("Starting Camera Focus Changer");
            flightCamera            = FlightCamera.fetch;
            pivotTranslateSharpness = 0.5f;
            hasReachedTarget        = false;
            isFocusing = false;

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

            config.load();
            actionKey         = config.GetValue <KeyCode>("actionKey", KeyCode.O);
            showUpdateMessage = config.GetValue <bool>("showUpdateMessage", true);

            GameEvents.OnCameraChange.Add(OnCameraChange);
            GameEvents.onVesselChange.Add(OnVesselChange);
            GameEvents.onVesselWillDestroy.Add(OnVesselWillDestroy);
            GameEvents.onVesselGoOnRails.Add(OnVesselGoOnRails);
            GameEvents.onStageSeparation.Add(OnStageSeparation);
            GameEvents.onUndock.Add(OnUndock);

            API.SetInstance(this);
        }
コード例 #2
0
        private void Start()
        {
            available = (PSystemSetup.Instance.GetSpaceCenterFacility("TrackingStation").GetFacilityLevel() > 0);
            lastTime  = DateTime.Now;
            config    = PluginConfiguration.CreateForType <FlightPlan> ();
            config.load();

            UI = new UICore.UICore();
            UI.LoadConfig("GameData/FlightPlan/Skin/FlightPlan.cfg");

            winId    = GUIUtility.GetControlID(FocusType.Passive);
            winRect  = config.GetValue <Rect> (this.name, new Rect(0, 0, Screen.width / 2, Screen.height / 2));
            showAsUT = config.GetValue <bool> ("showAsUT", false);

            GameEvents.onGUIApplicationLauncherReady.Add(CreateLauncher);
            GameEvents.onHideUI.Add(OnHide);
            GameEvents.onShowUI.Add(OnUnHide);
            GameEvents.onGamePause.Add(OnHide);
            GameEvents.onGameUnpause.Add(OnUnHide);

            KACWrapper.InitKACWrapper();
            if (KACWrapper.APIReady)
            {
                KACWrapper.KAC.onAlarmStateChanged += KACWrapper_KAC_onAlarmStateChanged;
            }
        }
コード例 #3
0
ファイル: Class1.cs プロジェクト: Fengist/CVFlightDeck
        public static void Getconfig()
        {
            PluginConfiguration cfg = PluginConfiguration.CreateForType <CVConfig>();

            cfg.load();
            MPWLog  = cfg.GetValue <bool>("MPWLog", true);
            KSPWLog = cfg.GetValue <bool>("KSPWLog", false);
        }
コード例 #4
0
        private void LoadConfigFile()
        {
            PluginConfiguration config = PluginConfiguration.CreateForType <ExLaunchPad>();

            config.load();
            uis.windowpos         = config.GetValue <Rect>("Window Position");
            uis.showbuilduionload = config.GetValue <bool>("Show Build Menu on StartUp");
        }
コード例 #5
0
 void Awake()
 {
     cfg = PluginConfiguration.CreateForType <Config>();
     cfg.load();
     TCPPort           = cfg.GetValue <int>("TCPPort", 9999);
     UpdatesPerSecond  = cfg.GetValue <int>("UpdatesPerSecond", 0);
     OrbitPlanSkipRate = cfg.GetValue <int>("OrbitPlanSkipRate", 1);
 }
コード例 #6
0
        private static void LoadConfigs()
        {
            PluginConfiguration config = FARDebugAndSettings.config;

            mainGuiRect     = config.GetValue("flight_mainGuiRect", new Rect());
            dataGuiRect     = config.GetValue("flight_dataGuiRect", new Rect());
            settingsGuiRect = config.GetValue("flight_settingsGuiRect", new Rect());
        }
コード例 #7
0
        static private void readConfiguration()
        {
            config.load();

            // Read the port out of the config file
            int port = config.GetValue <int>("PORT");

            if (port != 0 && port.IsPortNumber())
            {
                serverConfig.port = port;
            }
            else if (!port.IsPortNumber())
            {
                PluginLogger.print("Port specified in configuration file '" + serverConfig.port + "' must be a value between 1 and 65535 inclusive");
            }
            else
            {
                PluginLogger.print("No port in configuration file - using default of " + serverConfig.port.ToString());
            }

            // Read a specific IP address to bind to
            string ip = config.GetValue <String>("IPADDRESS");

            if (ip != null)
            {
                IPAddress ipAddress = null;
                if (IPAddress.TryParse(ip, out ipAddress))
                {
                    serverConfig.ipAddress = ipAddress;
                }
                else
                {
                    PluginLogger.print("Invalid IP address in configuration file, falling back to default");
                }
            }
            else
            {
                PluginLogger.print("No IP address in configuration file.");
            }

            // Fill the serverconfig list of addresses.... if IPAddress.Any, then enumerate them
            if (serverConfig.ipAddress == IPAddress.Any)
            {
                // Build a list of addresses we will be able to recieve at
                serverConfig.ValidIpAddresses.Add(IPAddress.Loopback);
                serverConfig.ValidIpAddresses.AddRange(Dns.GetHostAddresses(Dns.GetHostName()));
            }
            else
            {
                serverConfig.ValidIpAddresses.Add(serverConfig.ipAddress);
            }

            serverConfig.version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            serverConfig.name    = "Telemachus";

            isPartless = config.GetValue <int>("PARTLESS") == 0 ? false : true;
            PluginLogger.print("Partless:" + isPartless);
        }
コード例 #8
0
        public override void OnLoad(ConfigNode node)
        {
            PluginConfiguration config = PluginConfiguration.CreateForType <LaunchUI>();

            config.load();
            _windowsPosition = config.GetValue <Rect>("Window Position");
            _audioSet        = config.GetValue("_audioSet", 0);
            _debug           = config.GetValue("_debug", false);
        }
コード例 #9
0
ファイル: Values.cs プロジェクト: taniwha/NavHud
        private Color GetColor(PluginConfiguration config, string text)
        {
            float r = (float)config.GetValue <double>(text + "R");
            float g = (float)config.GetValue <double>(text + "G");
            float b = (float)config.GetValue <double>(text + "B");
            float a = (float)config.GetValue <double>(text + "A", 1.0d);

            return(new Color(r, g, b, a));
        }
コード例 #10
0
 internal void Load()
 {
     CONFIG.load();
     this.enableHotKey = CONFIG.GetValue <bool>("enableHotKey", this.enableHotKey);
     this.hotKey       = CONFIG.GetValue <KeyCode>("hotKey", this.hotKey);
     this.hideUnAct    = CONFIG.GetValue <bool>("hideUnAct", this.hideUnAct);
     this.altSkin      = CONFIG.GetValue <bool>("altSkin", this.altSkin);
     this.fontSize     = CONFIG.GetValue <int>("fontSize", this.fontSize);
 }
コード例 #11
0
        private void LoadConfig()
        {
            PluginConfiguration config = PluginConfiguration.CreateForType <AltimeterAutoHide>();

            config.load();
            activationPadding = config.GetValue <Vector2>("activationPadding", activationPadding);
            stickyOnLoad      = config.GetValue <bool>("stickyOnLoad", stickyOnLoad);
            config.save();
        }
コード例 #12
0
        public static void LoadConfiguration()
        {
            string[] namesTmp = Enum.GetNames(typeof(KSPActionGroup));
            var      names    = new string[namesTmp.Length - 1];

            for (int i = 0; i < namesTmp.Length - 1; ++i)
            {
                names[i] = namesTmp[i];
            }
            var agTypes = new KSPActionGroup[names.Length];

            actionGroupDropDown = new GUIDropDown <KSPActionGroup> [3];

            for (int i = 0; i < agTypes.Length; i++)
            {
                agTypes[i] = (KSPActionGroup)Enum.Parse(typeof(KSPActionGroup), names[i]);
            }
            // straight forward, reading the (action name, action group) tuples
            PluginConfiguration config = FARDebugAndSettings.config;

            for (int i = 0; i < ACTION_COUNT; ++i)
            {
                try
                {
                    // don't forget to initialize the gui
                    string currentGuiString = currentGuiStrings[i] = id2actionGroup[i].ToString();
                    id2actionGroup[i] =
                        (KSPActionGroup)Enum.Parse(typeof(KSPActionGroup),
                                                   config.GetValue(configKeys[i], currentGuiString));
                    FARLogger.Info($"Loaded AG {configKeys[i]} as {currentGuiString}");
                }
                catch (Exception e)
                {
                    FARLogger.Warning("Error reading config key '" +
                                      configKeys[i] +
                                      "' with value '" +
                                      config.GetValue(configKeys[i], "n/a") +
                                      "' gave " +
                                      e);
                }

                int initIndex = 0;
                for (int j = 0; j < agTypes.Length; j++)
                {
                    if (id2actionGroup[i] != agTypes[j])
                    {
                        continue;
                    }
                    initIndex = j;
                    break;
                }

                var dropDown = new GUIDropDown <KSPActionGroup>(names, agTypes, initIndex);
                actionGroupDropDown[i] = dropDown;
            }
        }
コード例 #13
0
        public void CanClearValues()
        {
            var config = new PluginConfiguration();

            config.AddConfigurationSetting("foo", "bar");
            Assert.That(config.GetValue("foo"), Is.EqualTo("bar"));

            config.ClearAllValues();
            Assert.Null(config.GetValue("foo"));
        }
コード例 #14
0
        public void CanSetValue()
        {
            var config = new PluginConfiguration();

            config.AddConfigurationSetting("foo", "bar");
            Assert.That(config.GetValue("foo"), Is.EqualTo("bar"));

            config.SetValue("foo", "none");
            Assert.That(config.GetValue("foo"), Is.EqualTo("none"));
        }
コード例 #15
0
        public void loadConfigXML()
        {
            PluginConfiguration config = PluginConfiguration.CreateForType <MuMechGUI>();

            config.load();
            editorWinPos      = config.GetValue <Rect>("editorWinPos");
            tweakWinPos       = config.GetValue <Rect>("tweakWinPos");
            controlWinPos     = config.GetValue <Rect>("controlWinPos");
            groupEditorWinPos = config.GetValue <Rect>("groupEditorWinPos");
        }
コード例 #16
0
        /// <summary>
        /// Loads stored configuration from file (and/or initializes default values)
        /// </summary>
        private void InitSettings()
        {
            // default keycode for kiss
            kissKeyCode    = KeyCode.F8;
            kissKeyCaption = "F8";

            windowPosSize = new Rect(0, 0, 400, 500);
            isVisible     = false;

            showSettings     = false;
            kissTooltip      = string.Empty;
            dblClicked       = false;
            selectedFileName = string.Empty;

            config = PluginConfiguration.CreateForType <KerbalImprovedSaveSystem>();
            config.load();

            windowPosSize        = config.GetValue <Rect>("Window Position", windowPosSize.CenterScreen());
            confirmOverwrite     = config.GetValue <bool>("confirmOverwrite", false);
            confirmDelete        = config.GetValue <bool>("confirmDelete", true);
            useGameTime          = config.GetValue <bool>("useGameTime", false);
            reverseOrder         = config.GetValue <bool>("reverseOrder", false);
            selectedDfltSaveName = config.GetValue <int>("selectedDfltSaveNameInt", 0);
            quickSaveMode        = config.GetValue <bool>("quickSaveMode", false);
            kissKeyCode          = config.GetValue <KeyCode>("kissKeyCode", KeyCode.F8);
            kissKeyCaption       = config.GetValue <string>("kissKeyCaption", "F8");
        }
コード例 #17
0
ファイル: DevHelper.cs プロジェクト: hrobertson/DevHelper
        public void loadConfigXML()
        {
            PluginConfiguration config = PluginConfiguration.CreateForType <DevHelper>();

            config.load();

            autoLoadSave      = config.GetValue <bool>("autoLoadSave");
            autoLoadSaveName  = config.GetValue <string>("autoLoadSaveName");
            autoLoadScene     = config.GetValue <bool>("autoLoadScene");
            autoLoadSceneName = config.GetValue <string>("autoLoadSceneName");
        }
コード例 #18
0
        void readGUIConfig()
        {
            main._windowsPosition        = cfg.GetValue <Rect>("gui_position");
            main._windowsPosition.height = 10;


            string guiMode = cfg.GetValue <string>("gui_mode", PluginModes.PART_COLORING.ToString());

            main.pluginMode = (PluginModes)Enum.Parse(typeof(PluginModes), guiMode);

            NiceColorGenerator.isRainbow = cfg.GetValue <bool>("IsRainbow");
        }
コード例 #19
0
        private static void LoadWindowData()
        {
            _config = PluginConfiguration.CreateForType <DockCamToolbarButton>();
            _config.load();
            var defaultWindow = new Rect();

            _windowPosition = _config.GetValue("toolbarWindowPosition", defaultWindow);
            _shadersToUse0  = _config.GetValue("shadersToUse0", _shadersToUse0);
            _shadersToUse1  = _config.GetValue("shadersToUse1", _shadersToUse1);
            _shadersToUse2  = _config.GetValue("shadersToUse2", _shadersToUse2);
            FCS             = _config.GetValue("FCS", FCS);
        }
コード例 #20
0
        private static void LoadWindowData()
        {
            config = PluginConfiguration.CreateForType <DockCamToolbarButton>(null);
            config.load();
            Rect rect = default(Rect);

            toolbarWindowPosition = config.GetValue <Rect>("toolbarWindowPosition", rect);
            shadersToUse0         = config.GetValue <bool>("shadersToUse0", shadersToUse0);
            shadersToUse1         = config.GetValue <bool>("shadersToUse1", shadersToUse1);
            shadersToUse2         = config.GetValue <bool>("shadersToUse2", shadersToUse2);
            FCS = config.GetValue <bool>("FCS", FCS);
        }
コード例 #21
0
        static private void readConfiguration()
        {
            config.load();

            int port = config.GetValue <int>("PORT");

            if (port != 0)
            {
                serverConfig.port = port;
            }
            else
            {
                PluginLogger.print("No port in configuration file.");
            }

            String ip = config.GetValue <String>("IPADDRESS");

            if (ip != null)
            {
                try
                {
                    serverConfig.addIPAddressAsString(ip);
                }
                catch
                {
                    PluginLogger.print("Invalid IP address in configuration file, falling back to find.");
                }
            }
            else
            {
                PluginLogger.print("No IP address in configuration file.");
            }


            serverConfig.maxRequestLength = config.GetValue <int>("MAXREQUESTLENGTH");

            if (serverConfig.maxRequestLength < 8000)
            {
                PluginLogger.print("No max request length specified, setting to 8000.");
                serverConfig.maxRequestLength = 10000;
            }
            else
            {
                PluginLogger.print("Max request length set to:" + serverConfig.maxRequestLength);
            }

            serverConfig.version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            serverConfig.name    = "Telemachus";
            serverConfig.backLog = 1000;

            isPartless = config.GetValue <int>("PARTLESS") == 0 ? false : true;
            PluginLogger.print("Partless:" + isPartless);
        }
コード例 #22
0
ファイル: STAXKConfig.cs プロジェクト: zer0Kerbal/STAXK
        public STAXKConfig(PluginConfiguration config)
        {
            try {
                string tmp = config.GetValue <string>("DebugLevel", Enum.GetName(typeof(DebugLevel), DebugLevel.ERROR));
                debugLevel = (DebugLevel)Enum.Parse(typeof(DebugLevel), tmp);
            }
            catch (Exception) {
                debugLevel = DebugLevel.ERROR;
            }

            testconfig1 = config.GetValue <bool>("testconfig1", true);
            testconfig2 = config.GetValue <bool>("testconfig2", true);
        }
コード例 #23
0
 public override void load(PluginConfiguration config)
 {
     windowPosition = config.GetValue <Rect>("RadarPosition");
     isMinimized    = config.GetValue <bool>("RadarMinimized");
     redLight       = config.GetValue <int>("RadarRedLight", 10);
     yellowLight    = config.GetValue <int>("RadarYellowLight", 100);
     greenLight     = config.GetValue <int>("RadarGreenLight", 1000);
     Scale          = (float)config.GetValue <double>("RadarScale", 0.5f);
     calibration    = config.GetValue <int>("RadarCalibration", 0);
     auto_burn      = config.GetValue <bool>("RadarAutoBurn", false);
     contact_stop   = config.GetValue <bool>("RadarContactStop", false);
     contact_alt    = config.GetValue <int>("RadarContactAlt", 1);
 }
コード例 #24
0
        public AddonConfig(PluginConfiguration config)
        {
            try {
                string tmp = config.GetValue <string>("DebugLevel", Enum.GetName(typeof(DebugLevel), DebugLevel.ERROR));
                debugLevel = (DebugLevel)Enum.Parse(typeof(DebugLevel), tmp);
            }
            catch (Exception) {
                debugLevel = DebugLevel.ERROR;
            }

            solarOrientationMatters = config.GetValue <bool>("SolarOrientationMatters", true);
            solarTemperatureMatters = config.GetValue <bool>("SolarTemperatureMatters", true);
        }
コード例 #25
0
ファイル: MPFunctions.cs プロジェクト: Fengist/MPUtils
        public static void Getconfig()
        {
            Debug.Log("[Maritime Pack] : cfg file loading...");
            PluginConfiguration cfg = PluginConfiguration.CreateForType <MPConfig>();

            cfg.load();
            MPWLog      = cfg.GetValue <bool>("MPWLog", false);
            KSPWLog     = cfg.GetValue <bool>("KSPWLog", false);
            MPDepthWarn = cfg.GetValue <bool>("MPDepthWarn", false);
            MPMaxDepth  = cfg.GetValue <float>("MPMaxDepth", 990.00f);
            MPLoadIcons = cfg.GetValue <bool>("MPLoadIcons", true);
            Debug.Log("[Maritime Pack] : cfg file loaded.");
        }
コード例 #26
0
ファイル: BonVoyage.cs プロジェクト: ntwest/KSP-BonVoyage
        /// <summary>
        /// Instead of constructor.
        /// </summary>
        public void Awake()
        {
            if (Instance != null)
            {
                Destroy(this);
                return;
            }
            Instance = this;

            toolbarButton = null;
            guiVisible    = false;
            rcVisible     = false;
            globalHidden  = false;
            gamePaused    = false;

            guiId   = GUIUtility.GetControlID(FocusType.Passive);
            rcGuiId = GUIUtility.GetControlID(FocusType.Passive);
            config  = PluginConfiguration.CreateForType <BonVoyage>();
            config.load();
            autoDewarp = config.GetValue <bool>("autoDewarp", false);

            activeRovers = new List <ActiveRover>();
            wayPoints    = new List <Vector3d> ();

            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));
            sample.width  = 400;
            sample.height = 500;
            sample.center = new Vector2(Screen.width / 2, Screen.height / 2);
            rcRect        = config.GetValue <Rect> ("rcRect", new Rect(sample));
            useKSPSkin    = config.GetValue <bool> ("useKSPSkin", false);
            useToolbar    = config.GetValue <bool> ("useToolbar", false);
            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);
        }
コード例 #27
0
        // Called after the scene is loaded.
        public void Awake()
        {
            ASPConsoleStuff.AAprint("Awake()");

                        #if DEBUG
            // don't load configs because KramaxReload screws up PluginConfiguration
                        #else
            PluginConfiguration config = PluginConfiguration.CreateForType <AutoAsparagus> ();
            config.load();
            vizualize         = config.GetValue <bool> ("vizualize");
            stageParachutes   = config.GetValue <bool> ("stageParachutes");
            stageLaunchClamps = config.GetValue <bool> ("stageLaunchClamps");
            launchClampsStage = config.GetValue <int> ("launchClampsStage");
            stagesepratrons   = config.GetValue <bool> ("stagesepratrons");
            useSmartStage     = config.GetValue <bool> ("useSmartStage");
            windowRect.x      = (float)config.GetValue <int> ("windowRectX");
            windowRect.y      = (float)config.GetValue <int> ("windowRectY");
            if ((windowRect.x == 0) && (windowRect.y == 0))
            {
                windowRect.x = Screen.width * 0.35f;
                windowRect.y = Screen.height * 0.1f;
            }
                        #endif

            ASPConsoleStuff.AAprint("Add onEditorShipModified hook");
            GameEvents.onEditorShipModified.Add(onCraftChange);
            ASPConsoleStuff.AAprint("End of Awake()");
        }
コード例 #28
0
ファイル: KompLogsSettings.cs プロジェクト: KSatNet/KompLog
        /// <summary>
        /// Start this instance.
        /// </summary>
        public void Start()
        {
            if (_instance)
            {
                Destroy(_instance);
            }
            _instance = this;
            _winID    = GUIUtility.GetControlID(FocusType.Passive);
            PluginConfiguration config = PluginConfiguration.CreateForType <KompLogSettings> ();

            config.load();
            _openFlightDataOnDestroyed = config.GetValue <bool> ("OpenFlightData", true);
            _autoHide = config.GetValue <bool> ("AutoHide", true);
        }
コード例 #29
0
        /// <summary>
        /// Start this instance.
        /// </summary>
        public void Start()
        {
            if (_instance)
            {
                Destroy(_instance);
            }
            _instance = this;
            _winID    = GUIUtility.GetControlID(FocusType.Passive);
            PluginConfiguration config = PluginConfiguration.CreateForType <KartographSettings> ();

            config.load();
            _autoHide      = config.GetValue <bool> ("AutoHide", true);
            _disableKraken = config.GetValue <bool> ("KrakenDisable", false);
        }
コード例 #30
0
 public void load_settings()
 {
     if (conf == null)
     {
         conf = PluginConfiguration.CreateForType <ResonantOrbitCalculator>();
     }
     try
     {
         conf.load();
         Debug.Log("[ResonantOrbitCalculator]: deserializing");
         wnd_rect.x = float.Parse(conf.GetValue <string>("x"));
         wnd_rect.y = float.Parse(conf.GetValue <string>("y"));
     }
     catch (Exception) { }
 }
コード例 #31
0
        public static void LoadConfigs()
        {
            config = KSP.IO.PluginConfiguration.CreateForType<FAREditorGUI>();
            config.load();
            FARDebugValues.displayForces = Convert.ToBoolean(config.GetValue("displayForces", "false"));
            FARDebugValues.displayCoefficients = Convert.ToBoolean(config.GetValue("displayCoefficients", "false"));
            FARDebugValues.displayShielding = Convert.ToBoolean(config.GetValue("displayShielding", "false"));

            FAREditorGUI.windowPos = config.GetValue("windowPos", new Rect());
            FAREditorGUI.minimize = config.GetValue("EditorGUIBool", true);
            if (FAREditorGUI.windowPos.y < 75)
                FAREditorGUI.windowPos.y = 75;

            FARPartClassification.LoadClassificationTemplates();
            FARAeroUtil.LoadAeroDataFromConfig();
        }
コード例 #32
0
ファイル: Configuration.cs プロジェクト: TheDutchDevil/KerLog
        public Configuration()
        {
            _plugConf = PluginConfiguration.CreateForType<Configuration>();
            _plugConf.load();
            PropertyChanged += Configuration_PropertyChanged;
            string rawPersistedFlights = _plugConf.GetValue<string>("persistedFlights");
            _iP = _plugConf.GetValue<string>("iP");
            _port = _plugConf.GetValue<int>("port",-1);
            _persistedFlightsLock = new object();

            if(_port == -1)
            {
                log.Debug("Port was not found in the configuration");
                Port = 10000;
            }

            if (_iP == null)
            {
                log.Debug("IP was not found in the configuration");
                IP = "192.168.1.7";
            }
            if (rawPersistedFlights == null)
            {
                log.Debug("Persisted flights was not found in the configuration");
                PersistedFlights = new List<string>();
            }
            else
            {
                try
                {
                    _persistedFlights = rawPersistedFlights.Split('|').Reverse().ToList<string>();
                }
                catch (Exception ex)
                {
                    log.Info(string.Format("Could not format persisted flights into an array, resetting it to default value. Persistedflights value is {0}", rawPersistedFlights), ex);
                    PersistedFlights = new List<string>();
                }
            }
        }
コード例 #33
0
ファイル: Values.cs プロジェクト: RealGrep/NavHud
 private Color GetColor(PluginConfiguration config, string text)
 {
     float r = (float)config.GetValue<double>(text + "R");
     float g = (float)config.GetValue<double>(text + "G");
     float b = (float)config.GetValue<double>(text + "B");
     float a = (float)config.GetValue<double>(text + "A", 1.0d);
     return new Color(r, g, b, a);
 }
コード例 #34
0
ファイル: Values.cs プロジェクト: RealGrep/NavHud
 public void Load(PluginConfiguration config)
 {
     _hudTextColor = GetColor(config, "hudTextColor");
     _upperHalfColor = GetColor(config, "upperHalfColor");
     _lowerHalfColor = GetColor(config, "lowerHalfColor");
     _horizonColor = GetColor(config, "horizonColor");
     _azimuthColor = GetColor(config, "azimuthColor");
     _northColor = GetColor(config, "northColor");
     _eastColor = GetColor(config, "eastColor");
     _southColor = GetColor(config, "southColor");
     _westColor = GetColor(config, "westColor");
     _headingColor = GetColor(config, "headingColor");
     _alignmentColor = GetColor(config, "alignmentColor");
     _progradeColor = GetColor(config, "progradeColor");
     _normalColor = GetColor(config, "normalColor");
     _radialColor = GetColor(config, "radialColor");
     _targetColor = GetColor(config, "targetColor");
     _maneuverColor = GetColor(config, "maneuverColor");
     _numberZenithLinesHalf = config.GetValue<int>("numberZenithLinesHalf");
     _numberAzimuthLinesQuarter = config.GetValue<int>("numberAzimuthLinesQuarter");
     _numberZenithVerts = config.GetValue<int>("numberZenithVerts");
     _numberAzimuthVerts = config.GetValue<int>("numberAzimuthVerts");
     _vectorSize = (float)config.GetValue<double>("vectorSize");
     _lineWidth = (float)config.GetValue<double>("lineWidth");
     _distance = config.GetValue<double>("distance");
     _iChanged = true;
 }
コード例 #35
0
ファイル: NodeSelect.cs プロジェクト: voneiden/ksp-nodetool
        // 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");
                }
                */
            }
        }
コード例 #36
0
        public static void LoadConfigs()
        {
            config = KSP.IO.PluginConfiguration.CreateForType<FAREditorGUI>();
            config.load();
            FARControlSys.windowPos = config.GetValue("FlightWindowPos", new Rect(100, 100, 150, 100));
            FARControlSys.AutopilotWinPos = config.GetValue("AutopilotWinPos", new Rect());
            FARControlSys.HelpWindowPos = config.GetValue("HelpWindowPos", new Rect());
            FARControlSys.FlightDataPos = config.GetValue("FlightDataPos", new Rect());
            FARControlSys.FlightDataHelpPos = config.GetValue("FlightDataHelpPos", new Rect());
            FARControlSys.AirSpeedPos = config.GetValue("AirSpeedPos", new Rect());
            FARControlSys.AirSpeedHelpPos = config.GetValue("AirSpeedHelpPos", new Rect());
            FARControlSys.minimize = config.GetValue<bool>("FlightGUIBool", false);
            FARControlSys.k_wingleveler_str = config.GetValue("k_wingleveler", "0.05");
            FARControlSys.k_wingleveler = Convert.ToDouble(FARControlSys.k_wingleveler_str);
            FARControlSys.kd_wingleveler_str = config.GetValue("kd_wingleveler", "0.002");
            FARControlSys.kd_wingleveler = Convert.ToDouble(FARControlSys.kd_wingleveler_str);
            FARControlSys.k_yawdamper_str = config.GetValue("k_yawdamper", "0.1");
            FARControlSys.k_yawdamper = Convert.ToDouble(FARControlSys.k_yawdamper_str);
            FARControlSys.k_pitchdamper_str = config.GetValue("k_pitchdamper", "0.25f");
            FARControlSys.k_pitchdamper = Convert.ToDouble(FARControlSys.k_pitchdamper_str);
            FARControlSys.scaleVelocity_str = config.GetValue("scaleVelocity", "150");
            FARControlSys.scaleVelocity = Convert.ToDouble(FARControlSys.scaleVelocity_str);
            FARControlSys.alt_str = config.GetValue("alt", "0");
            FARControlSys.alt = Convert.ToDouble(FARControlSys.alt_str);
            FARControlSys.upperLim_str = config.GetValue("upperLim", "25");
            FARControlSys.upperLim = Convert.ToDouble(FARControlSys.upperLim_str);
            FARControlSys.lowerLim_str = config.GetValue("lowerLim", "-25");
            FARControlSys.lowerLim = Convert.ToDouble(FARControlSys.lowerLim_str);
            FARControlSys.k_limiter_str = config.GetValue("k_limiter", "0.25f");
            FARControlSys.k_limiter = Convert.ToDouble(FARControlSys.k_limiter_str);

            FARControlSys.unitMode = (FARControlSys.SurfaceVelUnit)config.GetValue("unitMode", 0);
            FARControlSys.velMode = (FARControlSys.SurfaceVelMode)config.GetValue("velMode", 0);

            FARDebugValues.displayForces = Convert.ToBoolean(config.GetValue("displayForces", "false"));
            FARDebugValues.displayCoefficients = Convert.ToBoolean(config.GetValue("displayCoefficients", "false"));
            FARDebugValues.displayShielding = Convert.ToBoolean(config.GetValue("displayShielding", "false"));
            FARDebugValues.useSplinesForSupersonicMath = Convert.ToBoolean(config.GetValue("useSplinesForSupersonicMath", "true"));
            FARDebugValues.allowStructuralFailures = Convert.ToBoolean(config.GetValue("allowStructuralFailures", "true"));

            FARAeroStress.LoadStressTemplates();
            FARPartClassification.LoadClassificationTemplates();
            FARAeroUtil.LoadAeroDataFromConfig();
        }
コード例 #37
0
        private void loadConfig()
        {
            Debug.Log("Loading PartDamage settings.");
            if(!configLoaded) {
                config = KSP.IO.PluginConfiguration.CreateForType<PartDamage>(null);
                config.load();
                configLoaded = true;

                try {
                    checkInterval = config.GetValue<double>("checkInterval", 10.0);
                    checkThreshold = config.GetValue<double>("checkThreshold", 0.9);
                    randomTries = config.GetValue<int>("randomTries", 5);
                } catch(ArgumentException) {
                    // do nothing here, the defaults are already set
                }
            }
        }
コード例 #38
0
        /// <summary>
        /// Load any saved configuration from file.
        /// </summary>
        private void loadConfig()
        {
            Debug.Log("Loading PreciseNode settings.");
            if(!configLoaded) {
                config = KSP.IO.PluginConfiguration.CreateForType<PreciseNode>(null);
                config.load();
                configLoaded = true;

                try {
                    options.conicsMode = config.GetValue<int>("conicsMode", 3);
                    options.mainWindowPos.x = config.GetValue<int>("mainWindowX", Screen.width / 10);
                    options.mainWindowPos.y = config.GetValue<int>("mainWindowY", 20);
                    options.optionsWindowPos.x = config.GetValue<int>("optWindowX", Screen.width / 3);
                    options.optionsWindowPos.y = config.GetValue<int>("optWindowY", 20);
                    options.keymapperWindowPos.x = config.GetValue<int>("keyWindowX", Screen.width / 5);
                    options.keymapperWindowPos.y = config.GetValue<int>("keyWindowY", 20);
                    options.clockWindowPos.x = config.GetValue<int>("clockWindowX", Screen.width / 3);
                    options.clockWindowPos.y = config.GetValue<int>("clockWindowY", Screen.height / 2);
                    options.conicsWindowPos.x = config.GetValue<int>("conicsWindowX", Screen.width / 5);
                    options.conicsWindowPos.y = config.GetValue<int>("conicsWindowY", Screen.height / 2);
                    options.tripWindowPos.x = config.GetValue<int>("tripWindowX", Screen.width / 5);
                    options.tripWindowPos.y = config.GetValue<int>("tripWindowY", Screen.height / 5);
                    options.showClock = config.GetValue<bool>("showClock", false);
                    options.showEAngle = config.GetValue<bool>("showEAngle", true);
                    options.showConicsAlways = config.GetValue<bool>("showConicsAlways", false);
                    options.showOrbitInfo = config.GetValue<bool>("showOrbitInfo", false);
                    options.showUTControls = config.GetValue<bool>("showUTControls", false);
                    options.showManeuverPager = config.GetValue<bool>("showManeuverPager", true);
                    options.removeUsedNodes = config.GetValue<bool>("removeUsedNodes", false);
                    options.usedNodeThreshold = config.GetValue<double>("usedNodeThreshold", 0.5);
                    options.largeUTIncrement = config.GetValue<bool>("largeUTIncrement", false);

                    string temp = config.GetValue<String>("progInc", "Keypad8");
                    options.progInc = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("progDec", "Keypad5");
                    options.progDec = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("normInc", "Keypad9");
                    options.normInc = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("normDec", "Keypad7");
                    options.normDec = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("radiInc", "Keypad6");
                    options.radiInc = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("radiDec", "Keypad4");
                    options.radiDec = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("timeInc", "Keypad3");
                    options.timeInc = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("timeDec", "Keypad1");
                    options.timeDec = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("pageIncrement", "Keypad0");
                    options.pageIncrement = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("pageConics", "KeypadEnter");
                    options.pageConics = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("hideWindow", "P");
                    options.hideWindow = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("addWidget", "O");
                    options.addWidget = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                } catch(ArgumentException) {
                    // do nothing here, the defaults are already set
                }
            }
        }
コード例 #39
0
ファイル: Targetron.cs プロジェクト: BrutalRIP/targetron
        public void Start()
        {
            config = PluginConfiguration.CreateForType<Targetron>();
            config.load();
            //Load position and collapse state from config file
            pos = config.GetValue("pos", new Rect(Screen.width - windowWidth - 10, Screen.height / 3.0f - windowHeight / 2.0f, windowWidth, windowHeight));
            expand = config.GetValue("expand", true);
            toggleOn = config.GetValue("toggleOn", true);
            sortMode = config.GetValue("sortMode", 0);

            for (int i = 0; i < filters.Count; i++)
                filters[i].Enabled = config.GetValue("filter" + i, true);

            //Make sure width and height are within limits
            pos.width = Mathf.Clamp(pos.width, minWindowWidth, maxWindowWidth);
            pos.height = Mathf.Clamp(pos.height, minWindowHeight, maxWindowHeight);

            RenderingManager.AddToPostDrawQueue(0, OnDraw);

            if (!ToolbarManager.ToolbarAvailable) return;
            ToolbarButton = ToolbarManager.Instance.add("Targetron", "tgbutton");
            ToolbarButton.Text = "Targetron " + VERSION;
            ToolbarButton.ToolTip = "Targetron " + VERSION;
            ToolbarButton.TexturePath = "Targetron/Icons/targetron";
            ToolbarButton.Visibility = new GameScenesVisibility(GameScenes.FLIGHT);
            ToolbarButton.OnClick += e => toggleOn = !toggleOn;
        }