本文整理汇总了C#中System.ConfigNode.GetValueOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigNode.GetValueOrDefault方法的具体用法?C# ConfigNode.GetValueOrDefault怎么用?C# ConfigNode.GetValueOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ConfigNode
的用法示例。
在下文中一共展示了ConfigNode.GetValueOrDefault方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public void Load(ConfigNode node)
{
if (node.HasNode("PartCommanderGameSettings"))
{
SettingsNode = node.GetNode("PartCommanderGameSettings");
windowDefaultX = Mathf.Clamp(SettingsNode.GetValueOrDefault("windowDefaultX", windowDefaultX), 0, Screen.width - 50);
windowDefaultY = Mathf.Clamp(SettingsNode.GetValueOrDefault("windowDefaultY", windowDefaultY), 0, Screen.height - 50);
windowDefaultWidth = Mathf.Clamp(SettingsNode.GetValueOrDefault("windowDefaultWidth", windowDefaultWidth), 50, Screen.width);
windowDefaultHeight = Mathf.Clamp(SettingsNode.GetValueOrDefault("windowDefaultHeight", windowDefaultHeight), 50, Screen.height);
windowDefaultRect = new Rect(windowDefaultX, windowDefaultY, windowDefaultWidth, windowDefaultHeight);
visibleWindow = SettingsNode.GetValueOrDefault("visibleWindow", visibleWindow);
if (SettingsNode.HasNode("Vessels"))
{
foreach (ConfigNode vesselNode in SettingsNode.GetNode("Vessels").nodes)
{
Guid vesselId = new Guid(vesselNode.name);
uint partId = vesselNode.GetValueOrDefault("currentPartId", 0u);
foreach (Vessel v in FlightGlobals.Vessels)
{
if (v.id == vesselId)
{
vesselWindows[vesselId] = new PCWindow(vesselNode.GetValueOrDefault("windowX", windowDefaultX), vesselNode.GetValueOrDefault("windowY", windowDefaultY), vesselNode.GetValueOrDefault("windowWidth", windowDefaultWidth), vesselNode.GetValueOrDefault("windowHeight", windowDefaultHeight), false);
vesselWindows[vesselId].symLock = vesselNode.GetValueOrDefault("symLock", true);
vesselWindows[vesselId].showPartSelector = false;
vesselWindows[vesselId].showResources = vesselNode.GetValueOrDefault("showResources", true);
vesselWindows[vesselId].showTemp = vesselNode.GetValueOrDefault("showTemp", false);
vesselWindows[vesselId].showAero = vesselNode.GetValueOrDefault("showAero", false);
vesselWindows[vesselId].currentPartId = partId;
if (vesselNode.HasNode("PartWindows"))
{
foreach (ConfigNode pwNode in vesselNode.GetNode("PartWindows").nodes)
{
int windowId = int.Parse(pwNode.name);
PCWindow pow = new PCWindow(pwNode.GetValueOrDefault("windowX", windowDefaultX), pwNode.GetValueOrDefault("windowY", windowDefaultY), pwNode.GetValueOrDefault("windowWidth", windowDefaultWidth), pwNode.GetValueOrDefault("windowHeight", windowDefaultHeight), true);
pow.windowId = windowId;
pow.currentPartId = pwNode.GetValueOrDefault("currentPartId", 0u);
pow.symLock = pwNode.GetValueOrDefault("symLock", true);
pow.showResources = pwNode.GetValueOrDefault("showResources", true);
pow.showTemp = pwNode.GetValueOrDefault("showTemp", false);
pow.showAero = pwNode.GetValueOrDefault("showAero", false);
vesselWindows[vesselId].partWindows.Add(windowId, pow);
}
}
break;
}
}
}
}
if (PartCommander.Instance.launcherButton != null)
{
if (visibleWindow)
{
PartCommander.Instance.launcherButton.SetTrue();
}
else
{
PartCommander.Instance.launcherButton.SetFalse();
}
}
else
{
if (visibleWindow)
{
PartCommander.Instance.showWindow();
}
else
{
PartCommander.Instance.hideWindow();
}
}
}
else
{
windowDefaultRect = new Rect(windowDefaultX, windowDefaultY, windowDefaultWidth, windowDefaultHeight);
}
}