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


C# MiniYaml.ContainsKey方法代码示例

本文整理汇总了C#中OpenRA.FileFormats.MiniYaml.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# MiniYaml.ContainsKey方法的具体用法?C# MiniYaml.ContainsKey怎么用?C# MiniYaml.ContainsKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenRA.FileFormats.MiniYaml的用法示例。


在下文中一共展示了MiniYaml.ContainsKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Manifest

        public Manifest(string mod)
        {
            var path = new[] { "mods", mod, "mod.yaml" }.Aggregate(Path.Combine);
            var yaml = new MiniYaml(null, MiniYaml.FromFile(path)).NodesDict;

            Mod = FieldLoader.Load<Mod>(yaml["Metadata"]);
            Mod.Id = mod;

            // TODO: Use fieldloader
            Folders = YamlList(yaml, "Folders");
            MapFolders = YamlList(yaml, "MapFolders");
            Packages = yaml["Packages"].NodesDict.ToDictionary(x => x.Key, x => x.Value.Value);
            Rules = YamlList(yaml, "Rules");
            ServerTraits = YamlList(yaml, "ServerTraits");
            Sequences = YamlList(yaml, "Sequences");
            VoxelSequences = YamlList(yaml, "VoxelSequences");
            Cursors = YamlList(yaml, "Cursors");
            Chrome = YamlList(yaml, "Chrome");
            Assemblies = YamlList(yaml, "Assemblies");
            ChromeLayout = YamlList(yaml, "ChromeLayout");
            Weapons = YamlList(yaml, "Weapons");
            Voices = YamlList(yaml, "Voices");
            Notifications = YamlList(yaml, "Notifications");
            Music = YamlList(yaml, "Music");
            Movies = YamlList(yaml, "Movies");
            Translations = YamlList(yaml, "Translations");
            TileSets = YamlList(yaml, "TileSets");
            ChromeMetrics = YamlList(yaml, "ChromeMetrics");
            PackageContents = YamlList(yaml, "PackageContents");
            LuaScripts = YamlList(yaml, "LuaScripts");

            LoadScreen = yaml["LoadScreen"];
            LobbyDefaults = yaml["LobbyDefaults"];
            Fonts = yaml["Fonts"].NodesDict.ToDictionary(x => x.Key,
                x => Pair.New(x.Value.NodesDict["Font"].Value,
                    int.Parse(x.Value.NodesDict["Size"].Value)));

            if (yaml.ContainsKey("TileSize"))
                TileSize = int.Parse(yaml["TileSize"].Value);

            // Allow inherited mods to import parent maps.
            var compat = new List<string>();
            compat.Add(mod);

            if (yaml.ContainsKey("SupportsMapsFrom"))
                foreach (var c in yaml["SupportsMapsFrom"].Value.Split(','))
                    compat.Add(c.Trim());

            MapCompatibility = compat.ToArray();
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:50,代码来源:Manifest.cs

示例2: Manifest

        public Manifest(string[] mods)
        {
            Mods = mods;
            var yaml = new MiniYaml(null, mods
                .Select(m => MiniYaml.FromFile("mods/" + m + "/mod.yaml"))
                .Aggregate(MiniYaml.MergeLiberal)).NodesDict;

            // TODO: Use fieldloader
            Folders = YamlList(yaml, "Folders");
            Packages = YamlList(yaml, "Packages");
            Rules = YamlList(yaml, "Rules");
            ServerTraits = YamlList(yaml, "ServerTraits");
            Sequences = YamlList(yaml, "Sequences");
            Cursors = YamlList(yaml, "Cursors");
            Chrome = YamlList(yaml, "Chrome");
            Assemblies = YamlList(yaml, "Assemblies");
            ChromeLayout = YamlList(yaml, "ChromeLayout");
            Weapons = YamlList(yaml, "Weapons");
            Voices = YamlList(yaml, "Voices");
            Notifications = YamlList(yaml, "Notifications");
            Music = YamlList(yaml, "Music");
            Movies = YamlList(yaml, "Movies");
            TileSets = YamlList(yaml, "TileSets");
            ChromeMetrics = YamlList(yaml, "ChromeMetrics");

            LoadScreen = yaml["LoadScreen"];
            Fonts = yaml["Fonts"].NodesDict.ToDictionary(x => x.Key,
                x => Pair.New(x.Value.NodesDict["Font"].Value,
                    int.Parse(x.Value.NodesDict["Size"].Value)));

            if (yaml.ContainsKey("TileSize"))
                TileSize = int.Parse(yaml["TileSize"].Value);
        }
开发者ID:Tsher,项目名称:OpenRA,代码行数:33,代码来源:Manifest.cs


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