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

@ -27,8 +27,6 @@ namespace Server.Items
new[] { 0x1924, 0x1924, 0x1928 }
};
private int _flour;
[Constructible]
public FlourMillEastAddon()
{
@ -40,10 +38,10 @@ namespace Server.Items
public override BaseAddonDeed Deed => new FlourMillEastDeed();
[CommandProperty(AccessLevel.GameMaster)]
public bool HasFlour => _flour > 0;
public bool HasFlour => _curFlour > 0;
[CommandProperty(AccessLevel.GameMaster)]
public bool IsFull => _flour >= MaxFlour;
public bool IsFull => _curFlour >= MaxFlour;
[CommandProperty(AccessLevel.GameMaster)]
public bool IsWorking { get; private set; }
@ -51,14 +49,14 @@ namespace Server.Items
[CommandProperty(AccessLevel.GameMaster)]
public int MaxFlour => 2;
[SerializableField(0)]
[SerializableProperty(0)]
[CommandProperty(AccessLevel.GameMaster)]
public int CurFlour
{
get => _flour;
get => _curFlour;
set
{
_flour = Math.Clamp(value, 0, MaxFlour);
_curFlour = Math.Clamp(value, 0, MaxFlour);
UpdateStage();
this.MarkDirty();
}
@ -86,7 +84,7 @@ namespace Server.Items
if (from.PlaceInBackpack(flour))
{
_flour = 0;
_curFlour = 0;
}
else
{