Barotrauma Client Doc
Barotrauma.SerializableProperty Class Reference

Public Member Functions

 SerializableProperty (PropertyDescriptor property)
 
GetAttribute< T > ()
 
void SetValue (object parentObject, object val)
 
bool TrySetValue (object parentObject, string value)
 
bool TrySetValue (object parentObject, object value)
 
bool TrySetValue (object parentObject, float value)
 
bool TrySetValue (object parentObject, bool value)
 
bool TrySetValue (object parentObject, int value)
 
object GetValue (object parentObject)
 
float GetFloatValue (object parentObject)
 
bool GetBoolValue (object parentObject)
 

Static Public Member Functions

static string GetSupportedTypeName (Type type)
 
static List< SerializablePropertyGetProperties< T > (ISerializableEntity obj)
 
static Dictionary< Identifier, SerializablePropertyGetProperties (object obj)
 
static Dictionary< Identifier, SerializablePropertyDeserializeProperties (object obj, XElement element=null)
 
static void SerializeProperties (ISerializableEntity obj, XElement element, bool saveIfDefault=false, bool ignoreEditable=false)
 
static void UpgradeGameVersion (ISerializableEntity entity, ContentXElement configElement, Version savedVersion)
 Upgrade the properties of an entity saved with an older version of the game. Properties that should be upgraded are defined using "Upgrade" elements in the config file. for example, <Upgrade gameversion="0.9.2.0" scale="0.5"> would force the scale of the entity to 0.5 if it was saved with a version prior to 0.9.2.0. More...
 

Public Attributes

readonly string Name
 
readonly AttributeCollection Attributes
 
readonly Type PropertyType
 
readonly bool OverridePrefabValues
 
readonly PropertyInfo PropertyInfo
 

Detailed Description

Definition at line 56 of file SerializableProperty.cs.

Constructor & Destructor Documentation

◆ SerializableProperty()

Barotrauma.SerializableProperty.SerializableProperty ( PropertyDescriptor  property)

Definition at line 87 of file SerializableProperty.cs.

Member Function Documentation

◆ DeserializeProperties()

static Dictionary<Identifier, SerializableProperty> Barotrauma.SerializableProperty.DeserializeProperties ( object  obj,
XElement  element = null 
)
static

Definition at line 823 of file SerializableProperty.cs.

◆ GetAttribute< T >()

T Barotrauma.SerializableProperty.GetAttribute< T > ( )
Type Constraints
T :Attribute 

Definition at line 96 of file SerializableProperty.cs.

◆ GetBoolValue()

bool Barotrauma.SerializableProperty.GetBoolValue ( object  parentObject)

Definition at line 447 of file SerializableProperty.cs.

◆ GetFloatValue()

float Barotrauma.SerializableProperty.GetFloatValue ( object  parentObject)

Definition at line 415 of file SerializableProperty.cs.

◆ GetProperties()

static Dictionary<Identifier, SerializableProperty> Barotrauma.SerializableProperty.GetProperties ( object  obj)
static

Definition at line 802 of file SerializableProperty.cs.

◆ GetProperties< T >()

◆ GetSupportedTypeName()

static string Barotrauma.SerializableProperty.GetSupportedTypeName ( Type  type)
static

Definition at line 472 of file SerializableProperty.cs.

◆ GetValue()

object Barotrauma.SerializableProperty.GetValue ( object  parentObject)

Definition at line 392 of file SerializableProperty.cs.

◆ SerializeProperties()

static void Barotrauma.SerializableProperty.SerializeProperties ( ISerializableEntity  obj,
XElement  element,
bool  saveIfDefault = false,
bool  ignoreEditable = false 
)
static

Definition at line 852 of file SerializableProperty.cs.

◆ SetValue()

void Barotrauma.SerializableProperty.SetValue ( object  parentObject,
object  val 
)

Definition at line 106 of file SerializableProperty.cs.

◆ TrySetValue() [1/5]

bool Barotrauma.SerializableProperty.TrySetValue ( object  parentObject,
bool  value 
)

Definition at line 352 of file SerializableProperty.cs.

◆ TrySetValue() [2/5]

bool Barotrauma.SerializableProperty.TrySetValue ( object  parentObject,
float  value 
)

Definition at line 331 of file SerializableProperty.cs.

◆ TrySetValue() [3/5]

bool Barotrauma.SerializableProperty.TrySetValue ( object  parentObject,
int  value 
)

Definition at line 372 of file SerializableProperty.cs.

◆ TrySetValue() [4/5]

bool Barotrauma.SerializableProperty.TrySetValue ( object  parentObject,
object  value 
)

Definition at line 226 of file SerializableProperty.cs.

◆ TrySetValue() [5/5]

bool Barotrauma.SerializableProperty.TrySetValue ( object  parentObject,
string  value 
)

Definition at line 111 of file SerializableProperty.cs.

◆ UpgradeGameVersion()

static void Barotrauma.SerializableProperty.UpgradeGameVersion ( ISerializableEntity  entity,
ContentXElement  configElement,
Version  savedVersion 
)
static

Upgrade the properties of an entity saved with an older version of the game. Properties that should be upgraded are defined using "Upgrade" elements in the config file. for example, <Upgrade gameversion="0.9.2.0" scale="0.5"> would force the scale of the entity to 0.5 if it was saved with a version prior to 0.9.2.0.

Parameters
entityThe entity to upgrade
configElementThe XML element to get the upgrade instructions from (e.g. the config of an item prefab)
savedVersionThe game version the entity was saved with

Definition at line 943 of file SerializableProperty.cs.

Member Data Documentation

◆ Attributes

readonly AttributeCollection Barotrauma.SerializableProperty.Attributes

Definition at line 80 of file SerializableProperty.cs.

◆ Name

readonly string Barotrauma.SerializableProperty.Name

Definition at line 79 of file SerializableProperty.cs.

◆ OverridePrefabValues

readonly bool Barotrauma.SerializableProperty.OverridePrefabValues

Definition at line 83 of file SerializableProperty.cs.

◆ PropertyInfo

readonly PropertyInfo Barotrauma.SerializableProperty.PropertyInfo

Definition at line 85 of file SerializableProperty.cs.

◆ PropertyType

readonly Type Barotrauma.SerializableProperty.PropertyType

Definition at line 81 of file SerializableProperty.cs.