当前位置: 首页>>代码示例>>C#>>正文


C# ConfigNode.GetNodes方法代码示例

本文整理汇总了C#中System.ConfigNode.GetNodes方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigNode.GetNodes方法的具体用法?C# ConfigNode.GetNodes怎么用?C# ConfigNode.GetNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ConfigNode的用法示例。


在下文中一共展示了ConfigNode.GetNodes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConfigNode

        /*public override void OnSave(ConfigNode node)
        {
            Debug.Log("# OnSave " + node);
            return;
            base.OnSave(node);
            Debug.Log("# Saving hatches");
            ConfigNode hatchNode = new ConfigNode("Hatch");
            foreach (Hatch h in Hatches)
            {
                hatchNode.AddValue("attachNodeId", h.AttachNodeId);
                hatchNode.AddValue("position", h.Position.x + ", " +  h.Position.y + ", " + h.Position.z);
                hatchNode.AddValue("scale", h.Scale.x + ", " + h.Scale.y + ", " + h.Scale.z);
            }
            Debug.Log("# Adding hatch node " + hatchNode);
            node.AddNode(hatchNode);
        }*/
        public override void OnLoad(ConfigNode node)
        {
            if (node.HasValue("CanIva"))
                CanIva = bool.Parse(node.GetValue("CanIva"));

            if (node.HasNode("Hatch"))
            {
                ConfigNode[] hatchNodes = node.GetNodes("Hatch");
                foreach (var hn in hatchNodes)
                {
                    Hatch h = ParseHatch(hn);
                    if (h != null)
                    {
                        Hatches.Add(h);
                        if (h.Collider != null)
                            InternalColliders.Add(h.Collider);
                    }
                }
                PersistenceManager.instance.AddHatches(part.name, Hatches);
            }
            Debug.Log("# Hatches loaded from config for part " + part.name + ": " + Hatches.Count);

            if (node.HasNode("InternalCollider"))
            {
                ConfigNode[] colliderNodes = node.GetNodes("InternalCollider");
                foreach (var cn in colliderNodes)
                {
                    InternalCollider ic = ParseInternalCollider(cn);
                    if (ic != null)
                        InternalColliders.Add(ic);
                }
                PersistenceManager.instance.AddInternalColliders(part.name, InternalColliders);
                Debug.Log("# Internal colliders loaded from config for part " + part.name + ": " + InternalColliders.Count);
            }
        }
开发者ID:Charon77,项目名称:FreeIVA,代码行数:51,代码来源:ModuleFreeIva.cs

示例2: SSTUEngineLayout

        public SSTUEngineLayout(ConfigNode node)
        {
            name = node.GetStringValue("name");
            mountSizeMult = node.GetFloatValue("mountSizeMult", mountSizeMult);
            defaultUpperStageMount = node.GetStringValue("defaultUpperStageMount", defaultUpperStageMount);
            defaultLowerStageMount = node.GetStringValue("defaultLowerStageMount", defaultLowerStageMount);

            ConfigNode[] posNodes = node.GetNodes("POSITION");
            int len = posNodes.Length;
            for (int i = 0; i < len; i++)
            {
                positions.Add(new SSTUEnginePosition(posNodes[i]));
            }

            ConfigNode[] mountNodes = node.GetNodes("MOUNT");
            len = mountNodes.Length;
            List<SSTUEngineLayoutMountOption> mountOptionsList = new List<SSTUEngineLayoutMountOption>();

            string mountName;
            ModelDefinition md;
            for (int i = 0; i < len; i++)
            {
                mountName = mountNodes[i].GetStringValue("name");
                md = SSTUModelData.getModelDefinition(mountName);
                if (md != null)
                {
                    mountOptionsList.Add(new SSTUEngineLayoutMountOption(mountNodes[i]));
                }
                else
                {
                    MonoBehaviour.print("ERROR: Could not locate mount model data for name: " + mountName + " -- please check your configs for errors.");
                }
            }
            mountOptions = mountOptionsList.ToArray();
        }
开发者ID:shadowmage45,项目名称:SSTULabs,代码行数:35,代码来源:SSTUEngineLayout.cs

示例3: OnLoad

        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            ConfigNode[] efficiencyNodes = node.GetNodes(kEfficiencyData);
            ConfigNode[] toolTipsShown = node.GetNodes(kToolTip);
            string value = node.GetValue("reputationIndex");

            if (string.IsNullOrEmpty(value) == false)
                reputationIndex = int.Parse(value);

            foreach (ConfigNode efficiencyNode in efficiencyNodes)
            {
                EfficiencyData efficiencyData = new EfficiencyData();
                efficiencyData.Load(efficiencyNode);
                efficiencyDataMap.Add(efficiencyData.Key, efficiencyData);
            }

            foreach (ConfigNode toolTipNode in toolTipsShown)
            {
                if (toolTipNode.HasValue("name") == false)
                    continue;
                value = toolTipNode.GetValue("name");

                if (toolTips.ContainsKey(value))
                    toolTips[value] = toolTipNode;
                else
                    toolTips.Add(value, toolTipNode);
            }
        }
开发者ID:PalverZ,项目名称:Pathfinder,代码行数:29,代码来源:WBIPathfinderScenario.cs

示例4: OnLoad

        public override void OnLoad(ConfigNode node)
        {
            try
            {
                foreach (ConfigNode child in node.GetNodes("CONTRACT"))
                {
                    ConfiguredContract contract = null;
                    try
                    {
                        contract = new ConfiguredContract();
                        Contract.Load(contract, child);
                    }
                    catch (Exception e)
                    {
                        LoggingUtil.LogWarning(this, "Ignored an exception while trying to load a pre-loaded contract:");
                        LoggingUtil.LogException(e);
                    }

                    if (contract != null && contract.contractType != null)
                    {
                        contract.preLoaded = true;
                        contracts.Add(contract);
                    }
                }
            }
            catch (Exception e)
            {
                LoggingUtil.LogError(this, "Error loading ContractPreLoader from persistance file!");
                LoggingUtil.LogException(e);
                ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_LOAD, e, "ContractPreLoader");
            }
        }
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:32,代码来源:ContractPreLoader.cs

示例5: AddGrabModule

        private void AddGrabModule(ConfigNode node)
        {
            foreach (ConfigNode grabNode in node.GetNodes("GRAB"))
            {
                // Check if the node has value
                if (!grabNode.HasValue("stockPartName"))
                {
                    KAS_Shared.DebugWarning("AddGrabModule(AddModule) Missing stockPartName node !");
                    continue;
                }
                // Add and Retrieve the module
                string partName = grabNode.GetValue("stockPartName").Replace('_', '.');
                AvailablePart aPart = PartLoader.getPartInfoByName(partName);
                if (aPart == null)
                {
                    KAS_Shared.DebugError("AddModule(AddModule) - " + partName + " not found in partloader");
                    continue;
                }

                // get or add grab module
                KASModuleGrab grabModule = aPart.partPrefab.GetComponent<KASModuleGrab>();
                if (grabModule)
                {
                    KAS_Shared.DebugWarning("AddModule(AddModule) - KASModuleGrab already added to " + partName);
                }
                else
                {
                    grabModule = aPart.partPrefab.AddModule("KASModuleGrab") as KASModuleGrab;
                    if (!grabModule)
                    {
                        KAS_Shared.DebugError("AddGrabModule(AddModule) Error when adding module !");
                        continue;
                    }
                }

                // Configure the module
                if (grabNode.HasValue("evaPartPos")) grabModule.evaPartPos = KAS_Shared.ParseCfgVector3(grabNode.GetValue("evaPartPos"));
                if (grabNode.HasValue("evaPartDir")) grabModule.evaPartDir = KAS_Shared.ParseCfgVector3(grabNode.GetValue("evaPartDir"));
                if (grabNode.HasValue("customGroundPos")) grabModule.customGroundPos = bool.Parse(grabNode.GetValue("customGroundPos"));
                if (grabNode.HasValue("dropPartPos")) grabModule.dropPartPos = KAS_Shared.ParseCfgVector3(grabNode.GetValue("dropPartPos"));
                if (grabNode.HasValue("dropPartRot")) grabModule.dropPartRot = KAS_Shared.ParseCfgVector3(grabNode.GetValue("dropPartRot"));
                if (grabNode.HasValue("physicJoint")) grabModule.physicJoint = bool.Parse(grabNode.GetValue("physicJoint"));
                if (grabNode.HasValue("addPartMass")) grabModule.addPartMass = bool.Parse(grabNode.GetValue("addPartMass"));
                if (grabNode.HasValue("storable")) grabModule.storable = bool.Parse(grabNode.GetValue("storable"));
                if (grabNode.HasValue("storedSize")) grabModule.storedSize = int.Parse(grabNode.GetValue("storedSize"));
                if (grabNode.HasValue("bayType")) grabModule.bayType = grabNode.GetValue("bayType").ToString();
                if (grabNode.HasValue("bayNode")) grabModule.bayNode = grabNode.GetValue("bayNode").ToString();
                if (grabNode.HasValue("bayRot")) grabModule.bayRot = KAS_Shared.ParseCfgVector3(grabNode.GetValue("bayRot"));
                if (grabNode.HasValue("grabSndPath")) grabModule.grabSndPath = grabNode.GetValue("grabSndPath").ToString();
                if (grabNode.HasValue("attachMaxDist")) grabModule.attachMaxDist = float.Parse(grabNode.GetValue("attachMaxDist"));
                if (grabNode.HasValue("attachOnPart")) grabModule.attachOnPart = bool.Parse(grabNode.GetValue("attachOnPart"));
                if (grabNode.HasValue("attachOnEva")) grabModule.attachOnEva = bool.Parse(grabNode.GetValue("attachOnEva"));
                if (grabNode.HasValue("attachOnStatic")) grabModule.attachOnStatic = bool.Parse(grabNode.GetValue("attachOnStatic"));
                if (grabNode.HasValue("attachSendMsgOnly")) grabModule.attachSendMsgOnly = bool.Parse(grabNode.GetValue("attachSendMsgOnly"));
                if (grabNode.HasValue("attachPartSndPath")) grabModule.attachPartSndPath = grabNode.GetValue("attachPartSndPath").ToString();
                if (grabNode.HasValue("attachStaticSndPath")) grabModule.attachStaticSndPath = grabNode.GetValue("attachStaticSndPath").ToString();
                if (grabNode.HasValue("detachSndPath")) grabModule.detachSndPath = grabNode.GetValue("detachSndPath").ToString();
                KAS_Shared.DebugLog("AddGrabModule(AddModule) Module successfully configured on " + partName);
            }
        }
开发者ID:ErzengelLichtes,项目名称:KAS,代码行数:60,代码来源:KASAddonAddModule.cs

示例6: loadFromNode

 public ConverterRecipe loadFromNode(ConfigNode node)
 {
     ConfigNode[] inputNodes = node.GetNodes("RECIPEINPUT");
     ConfigNode[] outputNodes = node.GetNodes("RECIPEOUTPUT");
     int len = inputNodes.Length;
     for (int i = 0; i < len; i++)
     {
         inputs.Add(new ConverterResourceEntry().loadFromNode(inputNodes[i]));
     }
     len = outputNodes.Length;
     for (int i = 0; i < len; i++)
     {
         outputs.Add(new ConverterResourceEntry().loadFromNode(outputNodes[i]));
     }
     return this;
 }
开发者ID:SixDasher,项目名称:SSTULabs,代码行数:16,代码来源:ConverterRecipe.cs

示例7: SelectVariable

        internal SelectVariable(ConfigNode node, RasterPropMonitorComputer rpmComp)
        {
            name = node.GetValue("name");

            foreach (ConfigNode sourceVarNode in node.GetNodes("VARIABLE_DEFINITION"))
            {
                bool reverseVal;
                VariableOrNumberRange vonr = ProcessSourceNode(sourceVarNode, rpmComp, out reverseVal);

                sourceVariables.Add(vonr);
                reverse.Add(reverseVal);

                VariableOrNumber val = rpmComp.InstantiateVariableOrNumber(sourceVarNode.GetValue("value"));
                result.Add(val);
            }

            if (node.HasValue("defaultValue"))
            {
                VariableOrNumber val = rpmComp.InstantiateVariableOrNumber(node.GetValue("defaultValue"));
                result.Add(val);
            }
            else
            {
                throw new Exception(string.Format("Select variable {0} is missing its defaultValue", name));
            }

            if (sourceVariables.Count == 0)
            {
                throw new ArgumentException("Did not find any VARIABLE_DEFINITION nodes in RPM_SELECT_VARIABLE", name);
            }
        }
开发者ID:Kerbas-ad-astra,项目名称:RasterPropMonitor,代码行数:31,代码来源:SelectVariable.cs

示例8: OnLoad

        public void OnLoad(ConfigNode configNode)
        {
            name = ConfigNodeUtil.ParseValue<string>(configNode, "name");
            aspectRatio = ConfigNodeUtil.ParseValue<float>(configNode, "aspectRatio");

            foreach (ConfigNode child in configNode.GetNodes())
            {
                Type nodeType = ConfigNodeUtil.ParseTypeValue(child.name);
                if (nodeType.IsSubclassOf(typeof(CutSceneCamera)))
                {
                    CutSceneCamera cameraDefinition = Activator.CreateInstance(nodeType) as CutSceneCamera;
                    cameraDefinition.OnLoad(child);
                    cameras.Add(cameraDefinition);
                }
                else if (nodeType.IsSubclassOf(typeof(Actor)))
                {
                    Actor actor = Activator.CreateInstance(nodeType) as Actor;
                    actor.OnLoad(child);
                    actors.Add(actor);
                }
                else if (nodeType.IsSubclassOf(typeof(CutSceneAction)))
                {
                    CutSceneAction action = Activator.CreateInstance(nodeType) as CutSceneAction;
                    action.cutSceneDefinition = this;
                    action.OnLoad(child);
                    actions.Add(action);
                }
                else
                {
                    LoggingUtil.LogError(this, "Couldn't load CutSceneDefinition - unknown type '" + child.name + "'.");
                }
            }
        }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:33,代码来源:CutSceneDefinition.cs

示例9: Chapter

        public Chapter(ConfigNode configNode)
        {
            this.Id = configNode.GetValue("id");

            var instructor = configNode.GetNode("INSTRACTOR");
            this.InstructorName = instructor.GetValue("name");
            this.InstractorType = instructor.GetValue("type");

            this.Title = configNode.GetValue("title");
            this.Story = configNode.GetValue("story").Replace("\\n", "\n");

            this.Difficulty = configNode.GetValue("difficulty").ToEnum<Contract.ContractPrestige>();
            this.Science = Int32.Parse(configNode.GetValue("science"));
            this.Reputation = Int32.Parse(configNode.GetValue("reputation"));
            var funds = configNode.GetValue("funds").Split(',');
            this.AdvanceFunds = Int32.Parse(funds[0]);
            this.CompletionFunds = Int32.Parse(funds[1]);
            this.FailureFunds = Int32.Parse(funds[2]);

            this.ContractParameters = configNode.GetNodes("PARAM").Select(node => {
                var paramName = node.GetValue("name");
                var parameterType = ContractSystem.GetParameterType(paramName);
                var contractParameter = (ContractParameter)Activator.CreateInstance(parameterType);
                contractParameter.Load(node);
                return contractParameter;
            }).ToList();
        }
开发者ID:madguy,项目名称:KerbalStory,代码行数:27,代码来源:Chapter.cs

示例10: ProcessNodeAsFloatCurve

 public FloatCurve ProcessNodeAsFloatCurve(ConfigNode node)
 {
     FloatCurve resultCurve = new FloatCurve();
     ConfigNode[] moduleNodeArray = node.GetNodes(nodeName);
     debugMessage("ProcessNodeAsFloatCurve: moduleNodeArray.length " + moduleNodeArray.Length);
     for (int k = 0; k < moduleNodeArray.Length; k++)
     {
         debugMessage("found node");
         string[] valueArray = moduleNodeArray[k].GetValues(valueName);
         debugMessage("found " + valueArray.Length + " values");
         for (int l = 0; l < valueArray.Length; l++)
         {
             string[] splitString = valueArray[l].Split(' ');
             try
             {
                 Vector2 v2 = new Vector2(float.Parse(splitString[0]), float.Parse(splitString[1]));
                 resultCurve.Add(v2.x, v2.y, 0, 0);
             }
             catch
             {
                 Debug.Log("Error parsing vector2");
             }
         }
     }
     return resultCurve;
 }
开发者ID:Yitscar,项目名称:KSPInterstellar,代码行数:26,代码来源:InterstellarNodeLoader.cs

示例11: CustomVariable

        public CustomVariable(ConfigNode node)
        {
            name = node.GetValue("name");

            foreach (ConfigNode sourceVarNode in node.GetNodes("SOURCE_VARIABLE")) {
                SourceVariable sourceVar = new SourceVariable(sourceVarNode);

                sourceVariables.Add(sourceVar);
            }

            if(sourceVariables.Count == 0) {
                throw new ArgumentException("Did not find any SOURCE_VARIABLE nodes in RPM_CUSTOM_VARIABLE", name);
            }

            string oper = node.GetValue("operator");
            if (oper == Operator.NONE.ToString()) {
                op = Operator.NONE;
            } else if (oper == Operator.AND.ToString()) {
                op = Operator.AND;
            } else if (oper == Operator.OR.ToString()) {
                op = Operator.OR;
            } else if (oper == Operator.XOR.ToString()) {
                op = Operator.XOR;
            } else {
                throw new ArgumentException("Found an invalid operator type in RPM_CUSTOM_VARIABLE", oper);
            }
        }
开发者ID:Tahvohck,项目名称:RasterPropMonitor,代码行数:27,代码来源:CustomVariable.cs

示例12: BitmapFont

        public BitmapFont(ConfigNode node, string nodeUrl)
        {
            id = node.GetValue("id");
            name = node.GetValue("name");
            displayName = node.GetValue("displayName");
            size = int.Parse(node.GetValue("size"));

            UnityEngine.Texture2D texture = Utils.LoadTexture("GameData/" + nodeUrl + ".pngmap", false);

            characterMap = new Dictionary<char, BitmapChar>();
            float h = 0;
            foreach(ConfigNode n in node.GetNodes("ASP_BITMAP_CHAR"))
            {
                BitmapChar cMap = new BitmapChar(n, texture);

                characterMap[cMap.character] = cMap;

                // vh is -ve
                if (cMap.vh < height) h = cMap.vh;
            }

            height = (int) Math.Abs(h);

            UnityEngine.Object.Destroy(texture);
        }
开发者ID:panteras1000,项目名称:TheWriteStuff,代码行数:25,代码来源:BitmapFont.cs

示例13: Load

        public void Load(ConfigNode node)
        {
            ConfigNode[] converterNodes = node.GetNodes("KolonyConverter");
            KolonyConverter converter;

            if (converterNodes == null)
            {
                Log("converter nodes are null");
                return;
            }

            //Clear the list of converters (if any)
            Clear();

            //Go through all the nodes, create a new converter, and tell it to load its data.
            foreach (ConfigNode converterNode in converterNodes)
            {
                //Create the converter
                converter = (KolonyConverter)this.part.AddModule("KolonyConverter");

                //Load its data from the node
                LoadFromNode(converter, converterNode);

                //Remove its gui elements?
                converter.ShowGUI(_showGUI);

                //Add to the list
                converters.Add(converter);
            }
        }
开发者ID:Kerbas-ad-astra,项目名称:Kolonization,代码行数:30,代码来源:MultiConverterModel.cs

示例14: DefaultBody

 public DefaultBody(ConfigNode configNode, Random random)
 {
     configNode.TryGetValue("name", ref this.name);
     foreach (ConfigNode resourceNode in configNode.GetNodes("KRES_RESOURCE"))
     {
         this.resources.Add(new DefaultResource(resourceNode, random));
     }
 }
开发者ID:CYBUTEK,项目名称:KRES,代码行数:8,代码来源:DefaultBody.cs

示例15: Load

 public void Load(ConfigNode node)
 {
     foreach (ConfigNode pn in node.GetNodes("PROGRAM"))
     {
         Program prog = new Program();
         prog.Load(pn);
         putProgram(prog);
     }
 }
开发者ID:ec429,项目名称:kpu_mod,代码行数:9,代码来源:Library.cs


注:本文中的System.ConfigNode.GetNodes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。