本文整理匯總了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)
{
//.........這裏部分代碼省略.........