コード例 #1
0
        private void writeConfig(Config config)
        {
            ConfigNode root = new ConfigNode ();
            ConfigNode top = new ConfigNode (WASD_NODENAME);
            root.SetNode (WASD_NODENAME, top, true);
            top.SetValue ("defaultCamera", config.defaultCamera.ToString (), true);
            top.SetValue ("mouseWheelActive", config.mouseWheelActive.ToString (), true);
            top.SetValue ("enableExperimentalEditorExtensionsCompatibility", config.enableExperimentalEditorExtensionsCompatibility.ToString (), true);
            top.SetValue ("enforceBounds", config.enforceBounds.ToString (), true);
            top.SetValue ("sensitivity", config.sensitivity.ToString (), true);
            top.SetValue ("acceleration", config.acceleration.ToString (), true);
            top.SetValue ("mouseWheelAcceleration", config.mouseWheelAcceleration.ToString (), true);
            top.SetValue ("friction", config.friction.ToString (), true);
            top.SetValue ("runMultiplier", config.runMultiplier.ToString (), true);
            top.SetValue ("sneakMultiplier", config.sneakMultiplier.ToString (), true);

            ConfigNode keysNode = new ConfigNode ("KEYS");
            top.SetNode ("KEYS", keysNode, true);

            keysNode.SetValue ("forward", config.keyForward.ToString (), true);
            keysNode.SetValue ("back", config.keyBack.ToString (), true);
            keysNode.SetValue ("right", config.keyRight.ToString (), true);
            keysNode.SetValue ("left", config.keyLeft.ToString (), true);
            keysNode.SetValue ("up", config.keyUp.ToString (), true);
            keysNode.SetValue ("down", config.keyDown.ToString (), true);
            keysNode.SetValue ("switchMode", config.keySwitchMode.ToString (), true);
            keysNode.SetValue ("run", config.keyRun.ToString (), true);
            keysNode.SetValue ("sneak", config.keySneak.ToString (), true);

            ConfigNode editorsNode = new ConfigNode ("EDITORS");
            top.SetNode ("EDITORS", editorsNode, true);
            ConfigNode vabNode = new ConfigNode ("VAB");
            editorsNode.SetNode ("VAB", vabNode, true);
            string s;

            s = config.vab.initialPosition.ToString ();
            s = s.TrimStart ('(');
            s = s.TrimEnd (')');
            vabNode.SetValue ("initialPosition", s, true);
            vabNode.SetValue ("initialPitch", config.vab.initialPitch.ToString (), true);
            vabNode.SetValue ("initialYaw", config.vab.initialYaw.ToString (), true);
            ConfigNode vabBoundsNode = new ConfigNode ("BOUNDS");
            vabNode.SetNode ("BOUNDS", vabBoundsNode, true);
            s = config.vab.bounds.min.ToString ();
            s = s.TrimStart ('(');
            s = s.TrimEnd (')');
            vabBoundsNode.SetValue ("min", s, true);
            s = config.vab.bounds.max.ToString ();
            s = s.TrimStart ('(');
            s = s.TrimEnd (')');
            vabBoundsNode.SetValue ("max", s, true);

            // need to do bounds

            ConfigNode sphNode = new ConfigNode ("SPH");
            editorsNode.SetNode ("SPH", sphNode, true);
            s = config.sph.initialPosition.ToString ();
            s = s.TrimStart ('(');
            s = s.TrimEnd (')');
            sphNode.SetValue ("initialPosition", s, true);
            sphNode.SetValue ("initialPitch", config.sph.initialPitch.ToString (), true);
            sphNode.SetValue ("initialYaw", config.sph.initialYaw.ToString (), true);
            // need to do bounds
            ConfigNode sphBoundsNode = new ConfigNode ("BOUNDS");
            sphNode.SetNode ("BOUNDS", sphBoundsNode, true);
            s = config.sph.bounds.min.ToString ();
            s = s.TrimStart ('(');
            s = s.TrimEnd (')');

            sphBoundsNode.SetValue ("min", s, true);
            s = config.sph.bounds.max.ToString ();
            s = s.TrimStart ('(');
            s = s.TrimEnd (')');
            sphBoundsNode.SetValue ("max", s, true);

            root.Save (WASD_CFG_FILE);

            WasdEditorCameraBehaviour.setConfig (root);
        }
コード例 #2
0
        /// <summary>
        /// Saves the original configNode <see cref="externalData"/> passed from the api
        /// to the persistent
        /// </summary>
        /// <param name="node">Node with the command infos to save in</param>
        /// <param name="computer">Current flightcomputer</param>
        public override void Save(ConfigNode node, FlightComputer computer)
        {
            base.Save(node, computer);

            node.AddNode("ExternalData");
            node.SetNode("ExternalData", this.externalData);
        }
コード例 #3
0
		public static bool saveData (Configuration.dataLevel type)
		{
			Log.Info ("saveData dataLevel: " + type.ToString ());
			string path = getDataFile (type);
			Log.Info ("saveData: " + path);
			if (path == "")
				return false;
			
			ConfigNode root = new ConfigNode ();
			ConfigNode top = new ConfigNode (FileOperations.TT_NODENAME);
			root.SetNode (FileOperations.TT_NODENAME, top, true);

			switch (type) {
			case Configuration.dataLevel.game:
				top.SetValue ("secInGame", TotalTime.secInGame.ToString (), true);
				break;
			case Configuration.dataLevel.install:
				top.SetValue ("secInInstall", TotalTime.secInInstall.ToString (), true);
				break;
			case Configuration.dataLevel.global:
				top.SetValue ("secTotal", TotalTime.secTotal.ToString (), true);
				break;
			}


			root.Save (path);
			return false;
		}
コード例 #4
0
        //save scenario
        public override void OnSave(ConfigNode node)
        {
            if (!isInit)
            return;

              Debug.Log("StateFundingScenario saving to persistence");
              ConfigNode saveNode = ConfigNode.CreateConfigFromObject(data);
              node.SetNode(CONFIG_NODENAME, saveNode, true);
        }
コード例 #5
0
ファイル: DangIt.cs プロジェクト: vzwick/DangIt
        public override void OnSave(ConfigNode node)
        {
            this.Log("Saving settings...");

            if (node.HasNode("SETTINGS"))
            {
                node.SetNode("SETTINGS", CurrentSettings.ToNode());
            }
            else
            {
                node.AddNode(CurrentSettings.ToNode());
            }
        }
コード例 #6
0
        public void SaveConfiguration()
        {
            Log.Info ("SaveConfiguration");
            ConfigNode root = new ConfigNode ();
            ConfigNode top = new ConfigNode (FileOperations.TT_NODENAME);
            root.SetNode (FileOperations.TT_NODENAME, top, true);

            top.SetValue ("totalTimeDataPath", totalTimeDataPath.ToString (), true);

            top.SetValue ("logGameTime", logGameTime.ToString (), true);
            top.SetValue ("logInstallTime", logInstallTime.ToString (), true);
            top.SetValue ("logGlobalTime", logGlobalTime.ToString (), true);
            top.SetValue ("updateInterval", interval.ToString (), true);

            top.SetValue ("displayGameTime", displayGameTime.ToString (), true);
            top.SetValue ("displayInstallTime", displayInstallTime.ToString (), true);
            top.SetValue ("displayGlobalTime", displayGlobalTime.ToString (), true);
            top.SetValue ("displaySessionTime", displaySessionTime.ToString (), true);
            top.SetValue ("includePauseTime", includePauseTime.ToString (), true);
            top.SetValue ("enableEscapePause", enableEscapePause.ToString (), true);

            top.SetValue ("displayOnScreen", displayOnScreen.ToString (), true);
            top.SetValue ("displayInWindow", displayInWindow.ToString (), true);

            root.Save (FileOperations.TT_CFG_FILE);
            TotalTime.setConfig (root);
        }