feat: Updates to Serialization Generator v2.2 (#1157)

* Adds `SerializationProperty` - This will generate the private variable for serialization. Also provides an option `useField` to specify your own. Example:
  ```cs
  [SerializationProperty(0, useField: nameof(_resource)]
  ```
This commit is contained in:
Kamron Batman 2022-09-04 08:45:27 -07:00 • committed by GitHub
parent d82028a071
commit 89815ad4d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 242 additions and 361 deletions

View file

@ -20,7 +20,7 @@ public partial class BaseArmor
Timer.StartTimer(() => _crafter = crafter?.RawName);
_quality = content.Quality ?? ArmorQuality.Regular;
_durability = content.Durability ?? ArmorDurabilityLevel.Regular;
_rawResource = content.RawResource ?? DefaultResource;
_resource = content.RawResource ?? DefaultResource;
_armorBase = content.BaseArmorRating ?? -1;
_strBonus = content.StrBonus ?? -1;
_dexBonus = content.DexBonus ?? -1;
@ -107,12 +107,12 @@ public partial class BaseArmor
if (GetSaveFlag(flags, OldSaveFlag.Protection))
{
_protection = (ArmorProtectionLevel)reader.ReadEncodedInt();
_protectionLevel = (ArmorProtectionLevel)reader.ReadEncodedInt();
}
if (GetSaveFlag(flags, OldSaveFlag.Resource))
{
_rawResource = (CraftResource)reader.ReadEncodedInt();
_resource = (CraftResource)reader.ReadEncodedInt();
}
if (GetSaveFlag(flags, OldSaveFlag.BaseArmor))