本文整理汇总了C#中System.ConfigNode.GetInt方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigNode.GetInt方法的具体用法?C# ConfigNode.GetInt怎么用?C# ConfigNode.GetInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ConfigNode
的用法示例。
在下文中一共展示了ConfigNode.GetInt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MonitorPage
public MonitorPage(int idNum, ConfigNode node, RasterPropMonitor thatMonitor)
{
ourMonitor = thatMonitor;
screenWidth = ourMonitor.screenWidth;
screenHeight = ourMonitor.screenHeight;
cameraAspect = ourMonitor.cameraAspect;
cameraObject = thatMonitor.cameraStructure;
defaultColor = ourMonitor.defaultFontTintValue;
screenXMin = 0;
screenYMin = 0;
pageNumber = idNum;
isMutable = false;
if (!node.HasData)
{
throw new ArgumentException("Empty page?");
}
if (node.HasValue("name"))
{
string value = node.GetValue("name").Trim();
if (!IsValidPageName(value))
{
JUtil.LogMessage(ourMonitor, "Warning, name given for page #{0} is invalid, ignoring.", pageNumber);
}
else
{
name = value;
}
}
else
{
JUtil.LogMessage(ourMonitor, "Warning, page #{0} has no name. It's much better if it does.", pageNumber);
}
isDefault |= node.HasValue("default");
if (node.HasValue("button"))
{
SmarterButton.CreateButton(thatMonitor.internalProp, node.GetValue("button"), this, thatMonitor.PageButtonClick);
}
// Page locking system -- simple locking:
simpleLockingPage |= node.HasValue("lockingPage");
// and name-based locking.
if (node.HasValue("disableSwitchingTo"))
{
string[] tokens = node.GetValue("disableSwitchingTo").Split(',');
foreach (string token in tokens)
{
disableSwitchingTo.Add(token.Trim());
}
}
unlocker |= node.HasValue("unlockerPage");
if (node.HasValue("localMargins"))
{
Vector4 margindata = ConfigNode.ParseVector4(node.GetValue("localMargins"));
screenXMin = (int)margindata.x;
screenYMin = (int)margindata.y;
screenWidth = screenWidth - (int)margindata.z - screenXMin;
screenHeight = screenHeight - (int)margindata.w - screenYMin;
}
pageFont = node.GetInt("defaultFontNumber") ?? 0;
if (node.HasValue("defaultFontTint"))
{
defaultColor = ConfigNode.ParseColor32(node.GetValue("defaultFontTint"));
}
if (node.HasValue("techsRequired"))
{
techsRequired = node.GetValue("techsRequired").Split(new[] { ' ', ',', ';', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).ToList();
}
if (node.HasValue("fallbackOnNoTech"))
{
fallbackPageName = node.GetValue("fallbackOnNoTech").Trim();
}
if (node.HasNode("CONTEXTREDIRECT"))
{
foreach (string content in node.GetNode("CONTEXTREDIRECT").GetValues("redirect"))
{
string[] tokens = content.Split(',');
if (tokens.Length > 2 || !IsValidPageName(tokens[0].Trim()) || !IsValidPageName(tokens[1].Trim()))
{
JUtil.LogMessage(ourMonitor, "Warning, invalid page redirect statement on page #{0}.", pageNumber);
continue;
}
redirectPages[tokens[0].Trim()] = tokens[1].Trim();
}
const string valueError = "Warning, invalid global button redirect statement on page #{0}: {1}";
foreach (string content in node.GetNode("CONTEXTREDIRECT").GetValues("renumber"))
{
string[] tokens = content.Split(',');
if (tokens.Length > 2)
{
//.........这里部分代码省略.........