Beispiel #1
0
 internal static StanceTemplate Parse(IniParser parser)
 {
     AttributeModifier.AttributeModifiers.Clear();
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #2
0
 internal static CommandSet Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable,
                new IniArbitraryFieldParserProvider <CommandSet>(
                    (x, name) => x.Buttons[int.Parse(name)] = parser.ParseAssetReference())));
 }
 internal static AutoResolveReinforcementSchedule Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable,
                new IniArbitraryFieldParserProvider <AutoResolveReinforcementSchedule>(
                    (x, id) => x.ArmyAvailableAt.Add(parser.ParseInteger()))));
 }
Beispiel #4
0
        internal static AudioEvent Parse(IniParser parser)
        {
            var audioEvent = parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable);

            // HACK for Generals: In order to know which sounds to localise, we need to check if the event was loaded from Voice.ini.
            // Most localised sounds have the Voice audio type flag, but many don't, so we need to make sure the flag is set.
            if (parser.CurrentPosition.File.EndsWith("Voice.ini"))
            {
                audioEvent.Type?.Set(AudioTypeFlags.Voice, true);
            }

            return(audioEvent);
        }
Beispiel #5
0
        internal static PlayerTemplate Parse(IniParser parser)
        {
            var startingUnits = new SortedDictionary <int, StartingUnit>();

            var startingUnitParser = new PartialFieldParserProvider <PlayerTemplate>(x => StartingUnitFieldRegex.IsMatch(x),
                                                                                     (iniParser, _, name) =>
            {
                var matches = StartingUnitFieldRegex.Matches(name);
                var field   = matches[0].Groups[1].ToString();
                var index   = int.Parse(matches[0].Groups[2].ToString());

                if (!startingUnits.ContainsKey(index))
                {
                    startingUnits[index] = new StartingUnit();
                }

                switch (field)
                {
                case "StartingUnit":
                    startingUnits[index].Unit = iniParser.ParseAssetReference();
                    break;

                case "StartingUnitOffset":
                    startingUnits[index].Offset = iniParser.ParseVector3();
                    break;

                default:
                    throw new IniParseException($"Unknown starting unit field: {field}",
                                                iniParser.CurrentPosition);
                }
            });

            var compositeParser = new CompositeFieldParserProvider <PlayerTemplate>(FieldParseTable, startingUnitParser);

            var playerTemplate = parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                compositeParser);

            playerTemplate.StartingUnits = startingUnits.Values.ToArray();

            return(playerTemplate);
        }
 internal static LivingWorldBuildPlotIcon Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
 internal static BuildPlotIconObject Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #8
0
 internal static AmbientStream Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #9
0
 internal static CrateData Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #10
0
 internal static LivingWorldCampaignAct Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #11
0
 internal static FactionVictoryData Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #12
0
 internal static Multisound Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #13
0
 internal static ExperienceScalarTable Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #14
0
 internal static ParticleSystemDefinition Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #15
0
 internal static ControlBarScheme Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
 internal static NotificationType Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #17
0
 internal static RoadTemplate Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #18
0
 internal static MeshNameMatches Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #19
0
 internal static DialogEvent Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #20
0
 internal static PlayerAIType Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #21
0
 internal static AutoResolveWeapon Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #22
0
 internal static CrowdResponse Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #23
0
 internal static WaterTextureList Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #24
0
 internal static EmotionNugget Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #25
0
 internal static WindowTransition Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #26
0
 internal static AISkirmishBuildList Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #27
0
 internal static AISideInfo Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #28
0
 internal static ObjectCreationList Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Name = name,
                FieldParseTable));
 }
Beispiel #29
0
 internal static AIStructure Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Key = name,
                FieldParseTable));
 }
Beispiel #30
0
 internal static DynamicGameLod Parse(IniParser parser)
 {
     return(parser.ParseNamedBlock(
                (x, name) => x.Level = (LodType)Enum.Parse(typeof(LodType), name),
                FieldParseTable));
 }