private void writeConfig(WasdEditorCameraBehaviour.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); }
private void writeConfig(WasdEditorCameraBehaviour.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); }