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:
parent
d82028a071
commit
89815ad4d3
50 changed files with 242 additions and 361 deletions
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue