本文整理汇总了C#中System.ConfigNode.GetNode方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigNode.GetNode方法的具体用法?C# ConfigNode.GetNode怎么用?C# ConfigNode.GetNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ConfigNode
的用法示例。
在下文中一共展示了ConfigNode.GetNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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) { }
}
示例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);
}
示例3: Load
public override void Load(ConfigNode node)
{
ConfigNode metric_node = node.GetNode("METRIC");
vessel_node = node.GetNode("VESSEL");
metric = new Metric(metric_node);
name = node.GetValue("name");
flag = node.GetValue("flag");
id = new Guid(node.GetValue("id"));
}
示例4: Load
public void Load (ConfigNode node)
{
var req = node.GetNode ("Required");
foreach (var r in req.GetNodes ("BuildResrouce")) {
var res = new BuildResource ();
res.Load (r);
required.Add (res);
}
var opt = node.GetNode ("Optional");
foreach (var r in opt.GetNodes ("BuildResrouce")) {
var res = new BuildResource ();
res.Load (r);
optional.Add (res);
}
}
示例5: 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 {
}
}
示例6: KIS_Item
/// <summary>Creates a new part from save.</summary>
public KIS_Item(AvailablePart availablePart, ConfigNode itemNode, ModuleKISInventory inventory,
float quantity = 1)
{
// Get part node
this.availablePart = availablePart;
partNode = new ConfigNode();
itemNode.GetNode("PART").CopyTo(partNode);
// init config
this.InitConfig(availablePart, inventory, quantity);
// Get mass
if (itemNode.HasValue("resourceMass")) {
resourceMass = float.Parse(itemNode.GetValue("resourceMass"));
} else {
resourceMass = availablePart.partPrefab.GetResourceMass();
}
if (itemNode.HasValue("contentMass")) {
contentMass = float.Parse(itemNode.GetValue("contentMass"));
}
if (itemNode.HasValue("contentCost")) {
contentCost = float.Parse(itemNode.GetValue("contentCost"));
}
if (itemNode.HasValue("inventoryName")) {
inventoryName = itemNode.GetValue("inventoryName");
}
}
示例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;
}
}
}
}
示例8: OnLoad
protected override void OnLoad(ConfigNode configNode)
{
base.OnLoad(configNode);
cutSceneDefinition = new CutSceneDefinition();
cutSceneDefinition.OnLoad(configNode.GetNode("CUTSCENE_DEFINITION"));
}
示例9: OnLoad
public override void OnLoad(ConfigNode node)
{
base.OnLoad(node);
//get settings node and kerbal node
try
{
ConfigNode DataNode = node.GetNode("TerminusData");
if (DataNode != null)
{
ConfigNode TLS_Kerbals = DataNode.GetNode("TLS_Kerbals");
if (TLS_Kerbals != null)
{
Terminus_Life_Support.TrackedKerbals.Clear();
foreach (ConfigNode kiNode in TLS_Kerbals.GetNodes("KerbalInfo"))
{
KerbalInfo ki = new KerbalInfo();
ki.FromConfigNode(kiNode);
if (ki.Name != "")
Terminus_Life_Support.TrackedKerbals.Add(ki);
}
Terminus_Life_Support.UpdateKerbalList(true);
}
}
}
catch (Exception e)
{
UnityEngine.Debug.LogException(e);
}
}
示例10: 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;
}
}
示例11: 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));
}
示例12: 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);
}
示例13: getFilePaths
internal static ConfigNode getFilePaths()
{
if (FilePaths==null)
{
if (RRSettings == null)
{
if (RRSettingsController.load())
{
RRSettings = root.GetNode("RRSettings");
FilePaths = RRSettings.GetNode("FilePaths");
return FilePaths;
}
else
{
return null;
}
}
else
{
FilePaths = RRSettings.GetNode("FilePaths");
return FilePaths;
}
}
else
{
return FilePaths;
}
}
示例14: 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();
}
示例15: OnLoad
protected override void OnLoad(ConfigNode node)
{
Debug.Log("CurrencyOperationRandomized.OnLoad");
base.OnLoad(node);
initialSetupDone = true;
valueCache.Load(node.GetNode("VALUES"));
}