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

@ -14,8 +14,6 @@ namespace Server.Items
new[] { 0x1930, 0x1930, 0x1934 }
};
private int _flour;
[Constructible]
public FlourMillSouthAddon()
{
@ -27,10 +25,10 @@ namespace Server.Items
public override BaseAddonDeed Deed => new FlourMillSouthDeed();
[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; }
@ -38,14 +36,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.Max(0, Math.Min(value, MaxFlour));
_curFlour = Math.Max(0, Math.Min(value, MaxFlour));
UpdateStage();
}
}
@ -74,7 +72,7 @@ namespace Server.Items
if (from.PlaceInBackpack(flour))
{
_flour = 0;
_curFlour = 0;
}
else
{