Exemplo n.º 1
0
        public MapUnitObjectData(params ObjectModification[] modifications)
            : this()
        {
            SetData(modifications);

            _fileFormatVersion = LatestVersion;
        }
 internal void ReadFrom(BinaryReader reader, ObjectDataFormatVersion formatVersion)
 {
     Id          = reader.ReadInt32();
     Type        = reader.ReadInt32 <ObjectDataType>();
     Value       = ReadValue(reader, formatVersion);
     SanityCheck = reader.ReadInt32();
 }
 internal void WriteTo(BinaryWriter writer, ObjectDataFormatVersion formatVersion)
 {
     writer.Write(Id);
     writer.Write((int)Type);
     WriteValue(writer, formatVersion);
     writer.Write(SanityCheck);
 }
Exemplo n.º 4
0
        public CampaignUpgradeObjectData(params ObjectModification[] modifications)
            : this()
        {
            SetData(modifications);

            _fileFormatVersion = LatestVersion;
        }
Exemplo n.º 5
0
        protected object ReadValue(BinaryReader reader, ObjectDataFormatVersion formatVersion)
        {
            return(Type switch
            {
                ObjectDataType.Int => reader.ReadInt32(),
                ObjectDataType.Real => reader.ReadSingle(),
                ObjectDataType.Unreal => reader.ReadSingle(),
                ObjectDataType.String => reader.ReadChars(),
                ObjectDataType.Bool => reader.ReadBoolean(),
                ObjectDataType.Char => reader.ReadChar(),

                _ => throw new InvalidEnumArgumentException(nameof(Type), (int)Type, typeof(ObjectDataType)),
            });
Exemplo n.º 6
0
        public CampaignObjectData(
            CampaignUnitObjectData?unitData = null,
            CampaignItemObjectData?itemData = null,
            CampaignDestructableObjectData?destructableData = null,
            CampaignDoodadObjectData?doodadData             = null,
            CampaignAbilityObjectData?abilityData           = null,
            CampaignBuffObjectData?buffData       = null,
            CampaignUpgradeObjectData?upgradeData = null)
        {
            _unitData         = unitData;
            _itemData         = itemData;
            _destructableData = destructableData;
            _doodadData       = doodadData;
            _abilityData      = abilityData;
            _buffData         = buffData;
            _upgradeData      = upgradeData;

            _fileFormatVersion = LatestVersion;
        }
Exemplo n.º 7
0
        public MapObjectData(
            MapUnitObjectData?unitData = null,
            MapItemObjectData?itemData = null,
            MapDestructableObjectData?destructableData = null,
            MapDoodadObjectData?doodadData             = null,
            MapAbilityObjectData?abilityData           = null,
            MapBuffObjectData?buffData       = null,
            MapUpgradeObjectData?upgradeData = null)
        {
            _unitData         = unitData;
            _itemData         = itemData;
            _destructableData = destructableData;
            _doodadData       = doodadData;
            _abilityData      = abilityData;
            _buffData         = buffData;
            _upgradeData      = upgradeData;

            _fileFormatVersion = LatestVersion;
        }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ObjectData"/> class.
 /// </summary>
 /// <param name="formatVersion"></param>
 public ObjectData(ObjectDataFormatVersion formatVersion)
 {
     FormatVersion = formatVersion;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MapDoodadObjectData"/> class.
 /// </summary>
 /// <param name="formatVersion"></param>
 public MapDoodadObjectData(ObjectDataFormatVersion formatVersion)
     : base(formatVersion)
 {
 }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CampaignUnitObjectData"/> class.
 /// </summary>
 /// <param name="formatVersion"></param>
 public CampaignUnitObjectData(ObjectDataFormatVersion formatVersion)
     : base(formatVersion)
 {
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MapBuffObjectData"/> class.
 /// </summary>
 /// <param name="formatVersion"></param>
 public MapBuffObjectData(ObjectDataFormatVersion formatVersion)
     : base(formatVersion)
 {
 }
Exemplo n.º 12
0
 internal UpgradeObjectData(ObjectDataFormatVersion formatVersion)
 {
     FormatVersion = formatVersion;
 }
Exemplo n.º 13
0
 public static VariationObjectDataModification ReadVariationObjectDataModification(this BinaryReader reader, ObjectDataFormatVersion formatVersion) => new VariationObjectDataModification(reader, formatVersion);
Exemplo n.º 14
0
 public static void Write(this BinaryWriter writer, LevelObjectDataModification levelObjectDataModification, ObjectDataFormatVersion formatVersion) => levelObjectDataModification.WriteTo(writer, formatVersion);
Exemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MapAbilityObjectData"/> class.
 /// </summary>
 /// <param name="formatVersion"></param>
 public MapAbilityObjectData(ObjectDataFormatVersion formatVersion)
     : base(formatVersion)
 {
 }
Exemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MapUpgradeObjectData"/> class.
 /// </summary>
 /// <param name="formatVersion"></param>
 public MapUpgradeObjectData(ObjectDataFormatVersion formatVersion)
     : base(formatVersion)
 {
 }
Exemplo n.º 17
0
 internal DoodadObjectData(ObjectDataFormatVersion formatVersion)
 {
     FormatVersion = formatVersion;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MapUnitObjectData"/> class.
 /// </summary>
 /// <param name="formatVersion"></param>
 public MapUnitObjectData(ObjectDataFormatVersion formatVersion)
     : base(formatVersion)
 {
 }
Exemplo n.º 19
0
 public static LevelObjectDataModification ReadLevelObjectDataModification(this BinaryReader reader, ObjectDataFormatVersion formatVersion) => new LevelObjectDataModification(reader, formatVersion);
Exemplo n.º 20
0
 public static void Write(this BinaryWriter writer, SimpleObjectDataModification simpleObjectDataModification, ObjectDataFormatVersion formatVersion) => simpleObjectDataModification.WriteTo(writer, formatVersion);
Exemplo n.º 21
0
 public static SimpleObjectDataModification ReadSimpleObjectDataModification(this BinaryReader reader, ObjectDataFormatVersion formatVersion) => new SimpleObjectDataModification(reader, formatVersion);
Exemplo n.º 22
0
 public static void Write(this BinaryWriter writer, VariationObjectDataModification variationObjectDataModification, ObjectDataFormatVersion formatVersion) => variationObjectDataModification.WriteTo(writer, formatVersion);
Exemplo n.º 23
0
 internal ItemObjectData(ObjectDataFormatVersion formatVersion)
 {
     FormatVersion = formatVersion;
 }
Exemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CampaignDoodadObjectData"/> class.
 /// </summary>
 /// <param name="formatVersion"></param>
 public CampaignDoodadObjectData(ObjectDataFormatVersion formatVersion)
     : base(formatVersion)
 {
 }
Exemplo n.º 25
0
 internal SimpleObjectModification(BinaryReader reader, ObjectDataFormatVersion formatVersion)
 {
     ReadFrom(reader, formatVersion);
 }
Exemplo n.º 26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MapItemObjectData"/> class.
 /// </summary>
 /// <param name="formatVersion"></param>
 public MapItemObjectData(ObjectDataFormatVersion formatVersion)
     : base(formatVersion)
 {
 }
Exemplo n.º 27
0
 internal BuffObjectData(ObjectDataFormatVersion formatVersion)
 {
     FormatVersion = formatVersion;
 }
Exemplo n.º 28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CampaignDestructableObjectData"/> class.
 /// </summary>
 /// <param name="formatVersion"></param>
 public CampaignDestructableObjectData(ObjectDataFormatVersion formatVersion)
     : base(formatVersion)
 {
 }
Exemplo n.º 29
0
 internal UnitObjectData(ObjectDataFormatVersion formatVersion)
 {
     FormatVersion = formatVersion;
 }
Exemplo n.º 30
0
 internal AbilityObjectData(ObjectDataFormatVersion formatVersion)
 {
     FormatVersion = formatVersion;
 }