示例#1
0
        private static IEnumerable <TroopDefinition> ReadDefinitions(LineReader reader)
        {
            Trace.WriteLine($"Loading {reader.FileName}", nameof(TroopDefinitions));

            reader.Expected("troopsfile version 2");
            var count = reader.ReadFields <int>(allowMore: false);

            for (int i = 0; i < count; ++i)
            {
                if (i != 0)
                {
                    reader.Expected("");
                }
                var(id, name, plural, _, flags) = reader.ReadFields <string, string, string, object, TroopFlags>();
                reader.SkipLine(5);
                yield return(new TroopDefinition(i, id, name, plural, flags));
            }
        }
示例#2
0
        private static IEnumerable <QuestDefinition> ReadDefinitions(LineReader reader)
        {
            Trace.WriteLine($"Loading {reader.FileName}", nameof(SceneDefinitions));

            reader.Expected("questsfile version 1");
            var count = reader.ReadFields <int>(allowMore: false);

            for (int i = 0; i < count; ++i)
            {
                var(id, title) = reader.ReadFields <string, string>();
                yield return(new QuestDefinition(i, id, title));
            }
        }
示例#3
0
        private static IEnumerable <PartyDefinition> ReadDefinitions(LineReader reader)
        {
            Trace.WriteLine($"Loading {reader.FileName}", nameof(PartyDefinitions));

            reader.Expected("partiesfile version 1");
            var(count, _) = reader.ReadFields <int, int>(allowMore: false);
            for (int i = 0; i < count; ++i)
            {
                var(_, _, _, id, name) = reader.ReadFields <int, int, int, string, string>();
                reader.SkipLine();
                yield return(new PartyDefinition(i, id, name));
            }
        }
示例#4
0
        private static IEnumerable <ParticleSystemDefinition> ReadDefinitions(LineReader reader)
        {
            Trace.WriteLine($"Loading {reader.FileName}", nameof(ParticleSystemDefinitions));

            reader.Expected("particle_systemsfile version 1");
            var count = reader.ReadFields <int>(allowMore: false);

            for (int i = 0; i < count; ++i)
            {
                var id = reader.ReadFields <string>();
                reader.SkipLine(7);
                yield return(new ParticleSystemDefinition(i, id));
            }
        }
示例#5
0
        private static IEnumerable <ItemKindDefinition> ReadDefinitions(LineReader reader)
        {
            Trace.WriteLine($"Loading {reader.FileName}", nameof(ItemKindDefinitions));

            reader.Expected("itemsfile version 3");
            var count = reader.ReadFields <int>(allowMore: false);

            for (int i = 0; i < count; ++i)
            {
                var(id, name) = reader.ReadFields <string, string>();
                var n = reader.ReadFields <int>(allowMore: false);
                if (n != 0)
                {
                    reader.SkipLine();
                }

                n = reader.ReadFields <int>(allowMore: false);
                reader.SkipLine(n);

                reader.Expected("");
                yield return(new ItemKindDefinition(i, id, name));
            }
        }
示例#6
0
        private static IEnumerable <MapIconDefinition> ReadDefinitions(LineReader reader)
        {
            Trace.WriteLine($"Loading {reader.FileName}", nameof(MapIconDefinitions));

            reader.Expected("map_icons_file version 1");
            var count = reader.ReadFields <int>(allowMore: false);

            for (int i = 0; i < count; ++i)
            {
                var id = reader.ReadFields <string>();
                var s  = reader.ReadLine();
                reader.SkipLine(string.IsNullOrEmpty(s) ? 1 : 2);
                yield return(new MapIconDefinition(i, id));
            }
        }
示例#7
0
        private static IEnumerable <FactionDefinition> ReadDefinitions(LineReader reader)
        {
            Trace.WriteLine($"Loading {reader.FileName}", nameof(FactionDefinitions));

            reader.Expected("factionsfile version 1");
            var count = reader.ReadFields <int>(allowMore: false);

            for (int i = 0; i < count; ++i)
            {
                string id, name;
                if (i == 0)
                {
                    (id, name) = reader.ReadFields <string, string>();
                }
                else
                {
                    (_, id, name) = reader.ReadFields <object, string, string>();
                }
                reader.SkipLine();
                yield return(new FactionDefinition(i, id, name));
            }
        }