Barotrauma Client
Loading...
Searching...
No Matches
Barotrauma.SerializableProperty Class Referencesealed

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.
 

Public Attributes

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

Constructor & Destructor Documentation

◆ SerializableProperty()

Barotrauma.SerializableProperty.SerializableProperty ( PropertyDescriptor property)

Member Function Documentation

◆ DeserializeProperties()

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

◆ GetAttribute< T >()

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

◆ GetBoolValue()

bool Barotrauma.SerializableProperty.GetBoolValue ( object parentObject)

◆ GetFloatValue()

float Barotrauma.SerializableProperty.GetFloatValue ( object parentObject)

◆ GetProperties()

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

◆ GetProperties< T >()

◆ GetSupportedTypeName()

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

◆ GetValue()

object Barotrauma.SerializableProperty.GetValue ( object parentObject)

◆ SerializeProperties()

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

◆ SetValue()

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

◆ TrySetValue() [1/5]

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

◆ TrySetValue() [2/5]

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

◆ TrySetValue() [3/5]

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

◆ TrySetValue() [4/5]

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

◆ TrySetValue() [5/5]

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

◆ 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

Member Data Documentation

◆ Attributes

readonly AttributeCollection Barotrauma.SerializableProperty.Attributes

◆ Name

readonly string Barotrauma.SerializableProperty.Name

◆ OverridePrefabValues

readonly bool Barotrauma.SerializableProperty.OverridePrefabValues

◆ PropertyInfo

readonly PropertyInfo Barotrauma.SerializableProperty.PropertyInfo

◆ PropertyType

readonly Type Barotrauma.SerializableProperty.PropertyType

The documentation for this class was generated from the following file: