當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。