本文整理汇总了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);
}
}
示例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: 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) { }
}
示例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));
}
示例5: OnLoad
public override void OnLoad(ConfigNode node)
{
base.OnLoad(node);
if (node.HasNode("RENAME") || node.HasNode("DISABLE"))
{
configNodeData = node.ToString();
}
}
示例6: OnLoad
public override void OnLoad(ConfigNode node)
{
if (node.HasNode("library"))
{
library.Load(node.GetNode("library"));
}
}
示例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: 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);
}
示例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 {
}
}
示例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();
}
}
示例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;
}
}
示例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());
}
示例13: OnLoad
public override void OnLoad(ConfigNode node)
{
if (node.HasNode("ScienceData"))
{
ConfigNode storedDataNode = node.GetNode("ScienceData");
ImpactScienceData data = new ImpactScienceData(storedDataNode);
result=data;
}
}
示例14: OnLoad
public override void OnLoad(ConfigNode node)
{
base.OnLoad(node);
if (node.HasNode("TEXTURESET"))
{
configNodeData = node.ToString();
}
initialize();
}
示例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"));
}
}