当前位置: 首页>>代码示例>>C#>>正文


C# ConfigNode.GetInt方法代码示例

本文整理汇总了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)
                    {
//.........这里部分代码省略.........
开发者ID:Tahvohck,项目名称:RasterPropMonitor,代码行数:101,代码来源:MonitorPage.cs


注:本文中的System.ConfigNode.GetInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。