Working on improving the serialization system and ObjectProperty/IPropertyObject (TODO: come up with better names). The plan is to:
- Add support for some of the most common types (vectors, colors, rects) so there's no need to parse the values in the setters of the serializable properties (see Holdable.HoldPos for example). - Make a generic version of the item editing HUD that can be used on any IPropertyObject. Should make it easier to implement things like the character editor, editing structure properties, particle editor, etc. - Improve the interface of the editing HUD. Instead of having to type in a string value into a textbox, there should be number input fields for numeric properties, sliders for properties that only accept a range of values, a color picker, etc. And tooltips.
This commit is contained in:
@@ -102,7 +102,7 @@ namespace Barotrauma
|
||||
set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(1000, false)]
|
||||
[SerializableProperty(1000, false)]
|
||||
public int BackgroundSpriteAmount
|
||||
{
|
||||
get;
|
||||
@@ -115,14 +115,14 @@ namespace Barotrauma
|
||||
set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(100000.0f, false)]
|
||||
[SerializableProperty(100000.0f, false)]
|
||||
public float Width
|
||||
{
|
||||
get { return width; }
|
||||
set { width = Math.Max(value, 2000.0f); }
|
||||
}
|
||||
|
||||
[HasDefaultValue(50000.0f, false)]
|
||||
[SerializableProperty(50000.0f, false)]
|
||||
public float Height
|
||||
{
|
||||
get { return height; }
|
||||
@@ -160,7 +160,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(5, false)]
|
||||
[SerializableProperty(5, false)]
|
||||
public int SmallTunnelCount
|
||||
{
|
||||
get { return smallTunnelCount; }
|
||||
@@ -177,21 +177,21 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(-300000.0f, false)]
|
||||
[SerializableProperty(-300000.0f, false)]
|
||||
public float SeaFloorDepth
|
||||
{
|
||||
get { return seaFloorBaseDepth; }
|
||||
set { seaFloorBaseDepth = MathHelper.Clamp(value, Level.MaxEntityDepth, 0.0f); }
|
||||
}
|
||||
|
||||
[HasDefaultValue(1000.0f, false)]
|
||||
[SerializableProperty(1000.0f, false)]
|
||||
public float SeaFloorVariance
|
||||
{
|
||||
get { return seaFloorVariance; }
|
||||
set { seaFloorVariance = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(0, false)]
|
||||
[SerializableProperty(0, false)]
|
||||
public int MountainCountMin
|
||||
{
|
||||
get { return mountainCountMin; }
|
||||
@@ -201,7 +201,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(0, false)]
|
||||
[SerializableProperty(0, false)]
|
||||
public int MountainCountMax
|
||||
{
|
||||
get { return mountainCountMax; }
|
||||
@@ -211,7 +211,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(1000.0f, false)]
|
||||
[SerializableProperty(1000.0f, false)]
|
||||
public float MountainHeightMin
|
||||
{
|
||||
get { return mountainHeightMin; }
|
||||
@@ -221,7 +221,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(5000.0f, false)]
|
||||
[SerializableProperty(5000.0f, false)]
|
||||
public float MountainHeightMax
|
||||
{
|
||||
get { return mountainHeightMax; }
|
||||
@@ -231,14 +231,14 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(1, false)]
|
||||
[SerializableProperty(1, false)]
|
||||
public int RuinCount
|
||||
{
|
||||
get { return ruinCount; }
|
||||
set { ruinCount = MathHelper.Clamp(value, 0, 10); }
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.4f, false)]
|
||||
[SerializableProperty(0.4f, false)]
|
||||
public float BottomHoleProbability
|
||||
{
|
||||
get { return bottomHoleProbability; }
|
||||
@@ -278,7 +278,7 @@ namespace Barotrauma
|
||||
private LevelGenerationParams(XElement element)
|
||||
{
|
||||
Name = element == null ? "default" : element.Name.ToString();
|
||||
ObjectProperties = ObjectProperty.InitProperties(this, element);
|
||||
ObjectProperties = ObjectProperty.DeserializeProperties(this, element);
|
||||
|
||||
Vector3 colorVector = element.GetAttributeVector3("BackgroundColor", new Vector3(50, 46, 20));
|
||||
BackgroundColor = new Color((int)colorVector.X, (int)colorVector.Y, (int)colorVector.Z);
|
||||
|
||||
Reference in New Issue
Block a user