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


C# FileFormats.MiniYaml类代码示例

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


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

示例1: LoadSequencesForCursor

        static void LoadSequencesForCursor(string cursorSrc, MiniYaml cursor)
        {
            Game.modData.LoadScreen.Display();

            foreach (var sequence in cursor.Nodes)
                cursors.Add(sequence.Key, new CursorSequence(cursorSrc, cursor.Value, sequence.Value));
        }
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:7,代码来源:CursorProvider.cs

示例2: MappedImage

 public MappedImage(string defaultSrc, MiniYaml info)
 {
     FieldLoader.LoadField(this, "rect", info.Value);
     FieldLoader.Load(this, info);
     if (src == null)
         src = defaultSrc;
 }
开发者ID:gitTerebi,项目名称:OpenRA,代码行数:7,代码来源:MappedImage.cs

示例3: 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

示例4: Sequence

        public Sequence(string unit, string name, MiniYaml info)
        {
            var srcOverride = info.Value;
            Name = name;
            var d = info.NodesDict;

            sprites = Game.modData.SpriteLoader.LoadAllSprites(srcOverride ?? unit);
            start = int.Parse(d["Start"].Value);

            if (!d.ContainsKey("Length"))
                length = 1;
            else if (d["Length"].Value == "*")
                length = sprites.Length - Start;
            else
                length = int.Parse(d["Length"].Value);

            if(d.ContainsKey("Facings"))
                facings = int.Parse(d["Facings"].Value);
            else
                facings = 1;

            if(d.ContainsKey("Tick"))
                tick = int.Parse(d["Tick"].Value);
            else
                tick = 40;

            if (start < 0 || start + facings * length > sprites.Length)
                throw new InvalidOperationException(
                    "{6}: Sequence {0}.{1} uses frames [{2}..{3}] of SHP `{4}`, but only 0..{5} actually exist"
                    .F(unit, name, start, start + facings * length - 1, srcOverride ?? unit, sprites.Length - 1,
                    info.Nodes[0].Location));
        }
开发者ID:JamesDunne,项目名称:OpenRA,代码行数:32,代码来源:Sequence.cs

示例5: GetInheritanceChain

 static IEnumerable<MiniYaml> GetInheritanceChain(MiniYaml node, Dictionary<string, MiniYaml> allUnits)
 {
     while (node != null)
     {
         yield return node;
         node = GetParent(node, allUnits);
     }
 }
开发者ID:katzsmile,项目名称:OpenRA,代码行数:8,代码来源:ActorInfo.cs

示例6: Load

 static Dictionary<string, string[]> Load( MiniYaml y, string name )
 {
     return y.NodesDict.ContainsKey( name )
         ? y.NodesDict[ name ].NodesDict.ToDictionary(
             a => a.Key,
             a => FieldLoader.GetValue<string[]>( "(value)", a.Value.Value ) )
         : new Dictionary<string, string[]>();
 }
开发者ID:JamesDunne,项目名称:OpenRA,代码行数:8,代码来源:VoiceInfo.cs

示例7: LoadSequencesForUnit

 static void LoadSequencesForUnit(string unit, MiniYaml sequences)
 {
     Game.modData.LoadScreen.Display();
     try {
         var seq = sequences.NodesDict.ToDictionary(x => x.Key, x => new Sequence(unit,x.Key,x.Value));
         units.Add(unit, seq);
     } catch (FileNotFoundException) {} // Do nothing; we can crash later if we actually wanted art
 }
开发者ID:katzsmile,项目名称:OpenRA,代码行数:8,代码来源:SequenceProvider.cs

示例8: ActorInfo

        public ActorInfo( string name, MiniYaml node, Dictionary<string, MiniYaml> allUnits )
        {
            var mergedNode = MergeWithParent( node, allUnits ).NodesDict;

            Name = name;
            foreach( var t in mergedNode )
                if( t.Key != "Inherits" && !t.Key.StartsWith("-") )
                    Traits.Add( LoadTraitInfo( t.Key.Split('@')[0], t.Value ) );
        }
开发者ID:pdovy,项目名称:OpenRA,代码行数:9,代码来源:ActorInfo.cs

示例9: LoadWaypoints

 static object LoadWaypoints( MiniYaml y )
 {
     var ret = new Dictionary<string, int2>();
     foreach( var wp in y.NodesDict[ "Waypoints" ].NodesDict )
     {
         string[] loc = wp.Value.Value.Split( ',' );
         ret.Add( wp.Key, new int2( int.Parse( loc[ 0 ] ), int.Parse( loc[ 1 ] ) ) );
     }
     return ret;
 }
开发者ID:pdovy,项目名称:OpenRA,代码行数:10,代码来源:MapStub.cs

示例10: Save

 public MiniYaml Save()
 {
     var ret = new MiniYaml( Type );
     foreach( var init in InitDict )
     {
         var initName = init.GetType().Name;
         ret.Nodes.Add( initName.Substring( 0, initName.Length - 4 ), FieldSaver.Save( init ) );
     }
     return ret;
 }
开发者ID:mgatland,项目名称:OpenRA,代码行数:10,代码来源:ActorReference.cs

示例11: MusicInfo

		public MusicInfo(string key, MiniYaml value)
		{
			Title = value.Value;

			var nd = value.ToDictionary();
			if (nd.ContainsKey("Hidden"))
				bool.TryParse(nd["Hidden"].Value, out Hidden);

			var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
			Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key) + "." + ext;
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:11,代码来源:MusicInfo.cs

示例12: VoiceInfo

        public VoiceInfo( MiniYaml y )
        {
            FieldLoader.Load( this, y );
            Variants = Load(y, "Variants");
            Voices = Load(y, "Voices");

            if (!Voices.ContainsKey("Attack"))
                Voices.Add("Attack", Voices["Move"]);

            Pools = Lazy.New(() => Voices.ToDictionary( a => a.Key, a => new VoicePool(a.Value) ));
        }
开发者ID:max621,项目名称:OpenRA,代码行数:11,代码来源:VoiceInfo.cs

示例13: MusicInfo

        public MusicInfo( string key, MiniYaml value )
        {
            Filename = key+".aud";
            Title = value.Value;

            if (!FileSystem.Exists(Filename))
                return;

            Exists = true;
            Length = (int)AudLoader.SoundLength(FileSystem.Open(Filename));
        }
开发者ID:patthoyts,项目名称:OpenRA,代码行数:11,代码来源:MusicInfo.cs

示例14: SoundInfo

        public SoundInfo( MiniYaml y )
        {
            FieldLoader.Load( this, y );
            Variants = Load(y, "Variants");
            Prefixes = Load(y, "Prefixes");
            Voices = Load(y, "Voices");
            Notifications = Load(y, "Notifications");

            VoicePools = Lazy.New(() => Voices.ToDictionary( a => a.Key, a => new SoundPool(a.Value) ));
            NotificationsPools = Lazy.New(() => Notifications.ToDictionary( a => a.Key, a => new SoundPool(a.Value) ));
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:11,代码来源:SoundInfo.cs

示例15: Initialize

        public static void Initialize(string[] sequenceFiles)
        {
            cursors = new Dictionary<string, CursorSequence>();
            var sequences = new MiniYaml(null, sequenceFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal));

            foreach (var s in sequences.NodesDict["Palettes"].Nodes)
                Game.modData.Palette.AddPalette(s.Key, new Palette(FileSystem.Open(s.Value.Value), false));

            foreach (var s in sequences.NodesDict["Cursors"].Nodes)
                LoadSequencesForCursor(s.Key, s.Value);
        }
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:11,代码来源:CursorProvider.cs


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