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


C# ConfigNode.HasNode方法代码示例

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


在下文中一共展示了ConfigNode.HasNode方法的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: Load

        public void Load(ConfigNode node)
        {
            unlocked = false;

            node.TryGetValue("name", ref name);

            double cost = 0d;
            node.TryGetValue("cost", ref cost);

            node.TryGetValue("entryCost", ref entryCost);
            if(double.IsNaN(entryCost))
                entryCost = Math.Max(0d, cost * RFSettings.Instance.configEntryCostMultiplier);

            node.TryGetValue("sciEntryCost", ref sciEntryCost);
            if(double.IsNaN(sciEntryCost))
                sciEntryCost = Math.Max(0d, cost * RFSettings.Instance.configScienceCostMultiplier);

            node.TryGetValue("unlocked", ref unlocked);

            node.TryGetValue("techRequired", ref techRequired);

            if (node.HasNode("entryCostMultipliers"))
                LoadMultipliers(node.GetNode("entryCostMultipliers"));

            if (node.HasNode("entryCostSubtractors"))
                LoadSubtractors(node.GetNode("entryCostSubtractors"));

            node.TryGetValue("maxSubtraction", ref maxSubtraction);
        }
开发者ID:Kerbas-ad-astra,项目名称:ModularFuelSystem,代码行数:29,代码来源:EngineConfigUpgrade.cs

示例3: OnLoad

 public override void OnLoad(ConfigNode node)
 {
     try
     {
         if (!vessel.isEVA)
         {
             foreach (ProtoCrewMember crewmember in part.protoModuleCrew)
             {
                 if (!VanAllen.crew_rad_exposure.ContainsKey(crewmember.name))
                 {
                     if (node.HasNode("KERBAL_RADIATION_" + crewmember.name))
                     {
                         ConfigNode rad_node = node.GetNode("KERBAL_RADIATION_" + crewmember.name);
                         if (rad_node.HasValue("lifetimeDose"))
                             VanAllen.crew_rad_exposure.Add(crewmember.name, double.Parse(rad_node.GetValue("lifetimeDose")));
                     }
                 }
             }
         }
         else
         {
             if (!VanAllen.crew_rad_exposure.ContainsKey(vessel.vesselName))
             {
                 if (node.HasNode("KERBAL_RADIATION_" + vessel.vesselName))
                 {
                     ConfigNode rad_node = node.GetNode("KERBAL_RADIATION_" + vessel.vesselName);
                     if (rad_node.HasValue("lifetimeDose"))
                         VanAllen.crew_rad_exposure.Add(vessel.vesselName, double.Parse(rad_node.GetValue("lifetimeDose")));
                 }
             }
         }
     }
     catch (Exception ex) { }
 }
开发者ID:droric,项目名称:KSPInterstellar,代码行数:34,代码来源:FNModuleRadiation.cs

示例4: OnLoad

        public override void OnLoad(ConfigNode gameNode)
        {
            //reset the list here
            //KerbalAlarmClock.alarms = new KACAlarmList();
            KerbalAlarmClock.alarms.RemoveRange(0,KerbalAlarmClock.alarms.Count);

            base.OnLoad(gameNode);
            MonoBehaviourExtended.LogFormatted("BaseLoadDone. Alarms Count (Should be 0):{0}", KerbalAlarmClock.alarms.Count);

            MonoBehaviourExtended.LogFormatted_DebugOnly("OnLoad: ");
            MonoBehaviourExtended.LogFormatted_DebugOnly("{0}",gameNode);

            if (gameNode.HasNode("KerbalAlarmClockScenario")) MonoBehaviourExtended.LogFormatted_DebugOnly("Found {0}","KerbalAlarmClockScenario");
            if (gameNode.HasNode("KACAlarmListStorage")) MonoBehaviourExtended.LogFormatted_DebugOnly("Found {0}", "KACAlarmListStorage");
            if(gameNode.HasNode("KACAlarmListStorage"))
            {
                KerbalAlarmClock.alarms.DecodeFromCN(gameNode.GetNode("KACAlarmListStorage"));

                foreach (KACAlarm a in KerbalAlarmClock.alarms)
                {
                    if (!a.AlarmActionConverted) {
                        a.AlarmActionConvert = a.AlarmAction;
                        a.AlarmAction = KACAlarm.AlarmActionEnum.Converted;
                        a.AlarmActionConverted = true;
                    }
                }
            }

            MonoBehaviourExtended.LogFormatted("ScenarioLoadDone. Alarms Count:{0}", KerbalAlarmClock.alarms.Count);
            //{MonoBehaviourExtended.LogFormatted_DebugOnly("A");} else {MonoBehaviourExtended.LogFormatted_DebugOnly("B");}
            //KerbalAlarmClock.alarms.DecodeFromCN(gameNode.GetNode(this.GetType().Name));
        }
开发者ID:Kerbas-ad-astra,项目名称:KerbalAlarmClock,代码行数:32,代码来源:KerbalAlarmClock_ScenarioModule.cs

示例5: OnLoad

 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     if (node.HasNode("RENAME") || node.HasNode("DISABLE"))
     {
         configNodeData = node.ToString();
     }
 }
开发者ID:Joshg213,项目名称:SSTULabs,代码行数:8,代码来源:SSTUEventRename.cs

示例6: OnLoad

 public override void OnLoad(ConfigNode node)
 {
     if (node.HasNode("library"))
     {
         library.Load(node.GetNode("library"));
     }
 }
开发者ID:ec429,项目名称:kpu_mod,代码行数:7,代码来源:KPUCore.cs

示例7: Load

        public void Load(ConfigNode node)
        {
            if (node.HasNode(configNodeName))
            {
                ConfigNode settingsNode = node.GetNode(configNodeName);

                settingsNode.TryGetValue("IsNewSave", ref IsNewSave);

                knownCrew.Clear();
                var crewNodes = settingsNode.GetNodes(CrewMemberInfo.ConfigNodeName);
                foreach (ConfigNode crewNode in crewNodes)
                {
                    CrewMemberInfo crewMemberInfo = CrewMemberInfo.Load(crewNode);
                    knownCrew[crewMemberInfo.name] = crewMemberInfo;
                }

                knownVessels.Clear();
                var vesselNodes = settingsNode.GetNodes(VesselInfo.ConfigNodeName);
                foreach (ConfigNode vesselNode in vesselNodes)
                {
                    if (vesselNode.HasValue("Guid"))
                    {
                        Guid id = new Guid(vesselNode.GetValue("Guid"));
                        VesselInfo vesselInfo = VesselInfo.Load(vesselNode);
                        knownVessels[id] = vesselInfo;
                    }
                }
            }
        }
开发者ID:KSP-RO,项目名称:TacLifeSupport,代码行数:29,代码来源:GameSettings.cs

示例8: Awake

        public void Awake()
        {
            //            Debug.Log("********************************************************************" + HighLogic.LoadedScene + "*********************************************************************");
            settings = ConfigNode.Load("GameData/CustomerSatisfactionProgram/Config.cfg");

            if (settings.HasNode("SETTINGS")) {
                Debug.Log("Loading Settings");
                settings = settings.GetNode("SETTINGS");

                if (settings.HasValue("VERSION")) {
                    version = (settings.GetValue("VERSION"));
                }
                if (settings.HasValue("CAP")) {
                    cap = (int.Parse(settings.GetValue("CAP")));
                }
                if (settings.HasValue("CLEANUP")) {
                    cleanup = (int.Parse(settings.GetValue("CLEANUP")));
                    if (cleanup == 2) {
                        settings.AddValue("CLEANUP", 0);
                    }
                }
            }

            GameEvents.onKerbalRemoved.Add(OnKerbalRemoved);
            GameEvents.onKerbalAdded.Add(OnKerbalAdded);
            GameEvents.onKerbalTypeChange.Add(OnKerbalTypeChange);
            GameEvents.onGameSceneLoadRequested.Add(OnGameSceneLoadRequested);
        }
开发者ID:SpareToast,项目名称:CustomerSatisfactionProgram,代码行数:28,代码来源:CustomerManager.cs

示例9: OnLoad

        //load scenario
        public override void OnLoad(ConfigNode node)
        {
            try {
            if (node.HasNode(CONFIG_NODENAME)) {
              //load
              Debug.Log("StateFundingScenario loading from persistence");
              ConfigNode loadNode = node.GetNode(CONFIG_NODENAME);
              ConfigNode.LoadObjectFromConfig(data, loadNode);
              isInit = true;
            }
            else {
              Debug.Log("StateFundingScenario default init");
              //default init
              var NewView = new NewInstanceConfigView ();
              NewView.OnCreate ((InstanceData Inst) => {
            data = Inst;
            ReviewMgr.CompleteReview ();
              });
              isInit = true;
            }

            for (int i = 0; i < StateFundingGlobal.fetch.Governments.ToArray ().Length; i++) {
              Government Gov = StateFundingGlobal.fetch.Governments.ToArray () [i];
              if (Gov.name == data.govName) {
            data.Gov = Gov;
              }
            }

              }
              catch {

              }
        }
开发者ID:iamchairs,项目名称:StateFunding,代码行数:34,代码来源:StateFundingScenario.cs

示例10: OnLoad

 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     if (node.HasNode("LOOK_CONST") || node.HasNode("POS_CONST"))
     {
         configNodeData = node.ToString();
     }
     if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneIsEditor)
     {
         initialize();
     }
     else
     {
         initializePrefab();
     }
 }
开发者ID:SixDasher,项目名称:SSTULabs,代码行数:16,代码来源:SSTUModelConstraint.cs

示例11: CheckForDataNodes

        private bool CheckForDataNodes(ConfigNode node)
        {
            foreach (string type in KRESUtils.types.Values)
            {
                if (!node.HasNode(type)) { goto Incomplete; }
                ConfigNode t = node.GetNode(type);
                foreach (CelestialBody body in KRESUtils.GetRelevantBodies(type))
                {
                    if (!t.HasNode(body.bodyName)) { goto Incomplete; }
                }
            }
            return true;

            Incomplete:
            {
                print("no nodes");
                node.ClearNodes();
                foreach(string type in KRESUtils.types.Values)
                {
                    ConfigNode t = node.AddNode(type);
                    foreach(CelestialBody body in KRESUtils.GetRelevantBodies(type))
                    {
                        ConfigNode b = t.AddNode(body.bodyName);
                        b.AddValue("currentError", 1d);
                    }
                }
                return false;
            }
        }
开发者ID:CYBUTEK,项目名称:KRES,代码行数:29,代码来源:DataManager.cs

示例12: GameSaveTrigger

 //called on GameSave event, refresh all data from loaded vessels and save to .sfs
 private void GameSaveTrigger(ConfigNode node)
 {
     //need to call save routines here
     if (node.HasNode("VMSNode")) //note that we do not load data at this point, our data storage is static so we know what's in the save file is old, invalid data
     {
         node.RemoveNodes("VMSNode"); //should only ever be on VMSnode in a file, remove all nodes to error trap it
     }
     node.AddNode(VesselModuleStaticData.SaveRoutine());
 }
开发者ID:SirDiazo,项目名称:VesselModuleSave,代码行数:10,代码来源:Manager.cs

示例13: OnLoad

 public override void OnLoad(ConfigNode node)
 {
     if (node.HasNode("ScienceData"))
     {
         ConfigNode storedDataNode = node.GetNode("ScienceData");
         ImpactScienceData data = new ImpactScienceData(storedDataNode);
         result=data;
     }
 }
开发者ID:Kerbas-ad-astra,项目名称:kerbal-impact,代码行数:9,代码来源:Spectrometer.cs

示例14: OnLoad

 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     if (node.HasNode("TEXTURESET"))
     {
         configNodeData = node.ToString();
     }
     initialize();
 }
开发者ID:SixDasher,项目名称:SSTULabs,代码行数:9,代码来源:SSTUTextureSwitch.cs

示例15: Load

 public void Load(ConfigNode node)
 {
     if (!HighLogic.LoadedSceneIsEditor && node.HasNode("UllageSim"))
     {
     #if DEBUG
         MonoBehaviour.print("*U* Ullage load called on " + engine.part.name);
     #endif
         ullageSim.Load(node.GetNode("UllageSim"));
     }
 }
开发者ID:Kerbas-ad-astra,项目名称:ModularFuelSystem,代码行数:10,代码来源:UllageSet.cs


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