Пример #1
0
        protected override bool DeserializeSection(string name, XmlReader reader)
        {
            switch (name)
            {
            case "tags":
                this.FuelType = FuelTypeEx.Parse(reader.ReadString());
                return(true);

            case "power":
                reader.Read(out _horsePower);
                return(true);

            case "fireStartingChance":
                reader.Read(out _fireChance);
                return(true);

            case "sound":
                return(false);

            default:
                if (base.DeserializeSection(name, reader))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Пример #2
0
            public bool DeserializeSection(string name, XmlReader reader)
            {
                switch (name)
                {
                case "nations":
                    var nations = reader.ReadString().Trim();
                    if (nations.Length > 0)
                    {
                        this.Nations = new HashSet <string>(nations.Split(' '));
                    }
                    return(true);

                case "vehicle":
                    VehicleRule vehicleRule;
                    reader.Read(out vehicleRule);
                    if (vehicleRule.Tags != null)
                    {
                        this.VehicleTags = new HashSet <string>(vehicleRule.Tags);
                    }
                    this.MaxLevel = vehicleRule.MaxLevel;
                    this.MinLevel = vehicleRule.MinLevel;
                    return(true);

                case "engine":
                    reader.ReadStartElement("tags");
                    this.EngineFuelType = FuelTypeEx.Parse(reader.ReadString());
                    reader.ReadEndElement();
                    return(true);

                case SectionDeserializableImpl.TitleToken:
                    return(false);

                default:
                    return(false);
                }
            }