- Renamed a bunch of ObjectProperty-related stuff (ObjectProperty -> SerializableProperty, IPropertyObject -> ISerializableEntity, the "SerializableProperty" attribute -> Serialize).

- Rectangle serialization.
- Option to restrict numeric properties to a range of values.
- WIP generic ISerializableEntity editor.
This commit is contained in:
Joonas Rikkonen
2017-11-08 21:15:03 +02:00
parent a0d606ef5f
commit 8e556f1c76
60 changed files with 1035 additions and 678 deletions
@@ -29,49 +29,49 @@ namespace Barotrauma.Items.Components
//the angle in which the Character holds the item
protected float holdAngle;
[SerializableProperty(false, true)]
[Serialize(false, true)]
public bool Attached
{
get { return attached && item.ParentInventory == null; }
set { attached = value; }
}
[SerializableProperty(false, false)]
[Serialize(false, false)]
public bool ControlPose
{
get;
set;
}
[SerializableProperty(false, false)]
[Serialize(false, false)]
public bool Attachable
{
get { return attachable; }
set { attachable = value; }
}
[SerializableProperty(false, false)]
[Serialize(false, false)]
public bool AttachedByDefault
{
get { return attachedByDefault; }
set { attachedByDefault = value; }
}
[SerializableProperty("0.0,0.0", false)]
[Serialize("0.0,0.0", false)]
public Vector2 HoldPos
{
get { return ConvertUnits.ToDisplayUnits(holdPos); }
set { holdPos = ConvertUnits.ToSimUnits(value); }
}
[SerializableProperty("0.0,0.0", false)]
[Serialize("0.0,0.0", false)]
public Vector2 AimPos
{
get { return ConvertUnits.ToDisplayUnits(aimPos); }
set { aimPos = ConvertUnits.ToSimUnits(value); }
}
[SerializableProperty(0.0f, false)]
[Serialize(0.0f, false)]
public float HoldAngle
{
get { return MathHelper.ToDegrees(holdAngle); }
@@ -24,14 +24,14 @@ namespace Barotrauma.Items.Components
private float reloadTimer;
[SerializableProperty(0.0f, false)]
[Serialize(0.0f, false)]
public float Range
{
get { return ConvertUnits.ToDisplayUnits(range); }
set { range = ConvertUnits.ToSimUnits(value); }
}
[SerializableProperty(0.5f, false)]
[Serialize(0.5f, false)]
public float Reload
{
get { return reload; }
@@ -22,7 +22,7 @@ namespace Barotrauma.Items.Components
private UsableIn usableIn;
[SerializableProperty(0.0f, false)]
[Serialize(0.0f, false)]
public float Force
{
get { return force; }
@@ -30,7 +30,7 @@ namespace Barotrauma.Items.Components
}
#if CLIENT
[SerializableProperty("", false)]
[Serialize("", false)]
public string Particles
{
get { return particles; }
@@ -13,28 +13,28 @@ namespace Barotrauma.Items.Components
private Vector2 barrelPos;
[SerializableProperty("0.0,0.0", false)]
[Serialize("0.0,0.0", false)]
public string BarrelPos
{
get { return XMLExtensions.Vector2ToString(ConvertUnits.ToDisplayUnits(barrelPos)); }
set { barrelPos = ConvertUnits.ToSimUnits(XMLExtensions.ParseToVector2(value)); }
set { barrelPos = ConvertUnits.ToSimUnits(XMLExtensions.ParseVector2(value)); }
}
[SerializableProperty(1.0f, false)]
[Serialize(1.0f, false)]
public float Reload
{
get { return reload; }
set { reload = Math.Max(value, 0.0f); }
}
[SerializableProperty(0.0f, false)]
[Serialize(0.0f, false)]
public float Spread
{
get;
set;
}
[SerializableProperty(0.0f, false)]
[Serialize(0.0f, false)]
public float UnskilledSpread
{
get;
@@ -21,44 +21,44 @@ namespace Barotrauma.Items.Components
private float activeTimer;
[SerializableProperty(0.0f, false)]
[Serialize(0.0f, false)]
public float Range
{
get { return range; }
set { range = value; }
}
[SerializableProperty(0.0f, false)]
[Serialize(0.0f, false)]
public float StructureFixAmount
{
get; set;
}
[SerializableProperty(0.0f, false)]
[Serialize(0.0f, false)]
public float LimbFixAmount
{
get; set;
}
[SerializableProperty(0.0f, false)]
[Serialize(0.0f, false)]
public float ExtinquishAmount
{
get; set;
}
[SerializableProperty("", false)]
[Serialize("", false)]
public string Particles
{
get { return particles; }
set { particles = value; }
}
[SerializableProperty(0.0f, false)]
[Serialize(0.0f, false)]
public float ParticleSpeed
{
get; set;
}
[SerializableProperty("0.0,0.0", false)]
[Serialize("0.0,0.0", false)]
public Vector2 BarrelPos
{
get { return barrelPos; }
@@ -12,7 +12,7 @@ namespace Barotrauma.Items.Components
bool throwing;
[SerializableProperty(1.0f, false)]
[Serialize(1.0f, false)]
public float ThrowForce
{
get { return throwForce; }