- 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
@@ -13,7 +13,7 @@ namespace Barotrauma.Items.Components
//the output is sent if both inputs have received a signal within the timeframe
protected float timeFrame;
[InGameEditable, SerializableProperty(0.0f, true)]
[InGameEditable, Serialize(0.0f, true)]
public float TimeFrame
{
get { return timeFrame; }
@@ -23,14 +23,14 @@ namespace Barotrauma.Items.Components
}
}
[InGameEditable, SerializableProperty("1", true)]
[InGameEditable, Serialize("1", true)]
public string Output
{
get { return output; }
set { output = value; }
}
[InGameEditable, SerializableProperty("", true)]
[InGameEditable, Serialize("", true)]
public string FalseOutput
{
get { return falseOutput; }
@@ -15,7 +15,7 @@ namespace Barotrauma.Items.Components
private Queue<Tuple<string, DateTime>> signalQueue;
[InGameEditable, SerializableProperty(1.0f, true)]
[InGameEditable, Serialize(1.0f, true)]
public float Delay
{
get { return (float)delay.TotalSeconds; }
@@ -21,7 +21,7 @@ namespace Barotrauma.Items.Components
private bool castShadows;
[Editable, SerializableProperty(100.0f, true)]
[Editable, Serialize(100.0f, true)]
public float Range
{
get { return range; }
@@ -31,7 +31,7 @@ namespace Barotrauma.Items.Components
}
}
[Editable, SerializableProperty(true, true)]
[Editable, Serialize(true, true)]
public bool CastShadows
{
get { return castShadows; }
@@ -44,7 +44,7 @@ namespace Barotrauma.Items.Components
}
}
[Editable, SerializableProperty(false, true)]
[Editable, Serialize(false, true)]
public bool IsOn
{
get { return IsActive; }
@@ -57,7 +57,7 @@ namespace Barotrauma.Items.Components
}
}
[SerializableProperty(0.0f, false)]
[Serialize(0.0f, false)]
public float Flicker
{
get { return flicker; }
@@ -67,7 +67,7 @@ namespace Barotrauma.Items.Components
}
}
[InGameEditable, SerializableProperty("1.0,1.0,1.0,1.0", true)]
[InGameEditable, Serialize("1.0,1.0,1.0,1.0", true)]
public Color LightColor
{
get { return lightColor; }
@@ -207,7 +207,7 @@ namespace Barotrauma.Items.Components
IsActive = (signal != "0");
break;
case "set_color":
LightColor = XMLExtensions.ParseToColor(signal, false);
LightColor = XMLExtensions.ParseColor(signal, false);
break;
}
}
@@ -17,7 +17,7 @@ namespace Barotrauma.Items.Components
private float updateTimer;
[InGameEditable, SerializableProperty(0.0f, true)]
[InGameEditable, Serialize(0.0f, true)]
public float Range
{
get { return range; }
@@ -27,14 +27,14 @@ namespace Barotrauma.Items.Components
}
}
[InGameEditable, SerializableProperty("1", true)]
[InGameEditable, Serialize("1", true)]
public string Output
{
get { return output; }
set { output = value; }
}
[InGameEditable, SerializableProperty("", true)]
[InGameEditable, Serialize("", true)]
public string FalseOutput
{
get { return falseOutput; }
@@ -20,14 +20,14 @@ namespace Barotrauma.Items.Components
private float phase;
[InGameEditable, SerializableProperty(WaveType.Pulse, true)]
[InGameEditable, Serialize(WaveType.Pulse, true)]
public WaveType OutputType
{
get;
set;
}
[InGameEditable, SerializableProperty(1.0f, true)]
[InGameEditable, Serialize(1.0f, true)]
public float Frequency
{
get { return frequency; }
@@ -16,14 +16,14 @@ namespace Barotrauma.Items.Components
private Regex regex;
[InGameEditable, SerializableProperty("1", true)]
[InGameEditable, Serialize("1", true)]
public string Output
{
get { return output; }
set { output = value; }
}
[InGameEditable, SerializableProperty("", true)]
[InGameEditable, Serialize("", true)]
public string Expression
{
get { return expression; }
@@ -11,7 +11,7 @@ namespace Barotrauma.Items.Components
private bool isOn;
[Editable, SerializableProperty(1000.0f, true)]
[Editable, Serialize(1000.0f, true)]
public float MaxPower
{
get { return maxPower; }
@@ -21,7 +21,7 @@ namespace Barotrauma.Items.Components
}
}
[Editable, SerializableProperty(false, true)]
[Editable, Serialize(false, true)]
public bool IsOn
{
get
@@ -8,20 +8,20 @@ namespace Barotrauma.Items.Components
private string targetSignal;
[InGameEditable, SerializableProperty("1", true)]
[InGameEditable, Serialize("1", true)]
public string Output
{
get { return output; }
set { output = value; }
}
[InGameEditable, SerializableProperty("0", true)]
[InGameEditable, Serialize("0", true)]
public string FalseOutput
{
get { return falseOutput; }
set { falseOutput = value; }
}
[InGameEditable, SerializableProperty("", true)]
[InGameEditable, Serialize("", true)]
public string TargetSignal
{
get { return targetSignal; }
@@ -14,14 +14,14 @@ namespace Barotrauma.Items.Components
private int channel;
[SerializableProperty(20000.0f, false)]
[Serialize(20000.0f, false)]
public float Range
{
get { return range; }
set { range = Math.Max(value, 0.0f); }
}
[InGameEditable, SerializableProperty(1, true)]
[InGameEditable, Serialize(1, true)]
public int Channel
{
get { return channel; }
@@ -31,7 +31,7 @@ namespace Barotrauma.Items.Components
}
}
[Editable, SerializableProperty(false, false)]
[Editable, Serialize(false, false)]
public bool LinkToChat
{
get;