Class ManagedGameObjectBase
A base class used to represent a game object with a managed type.
Inherited Members
Namespace: Microsoft.XboxStudios.GameStateTracker
Assembly: GameStateTracker.Generic.Managed.dll
Syntax
public abstract class ManagedGameObjectBase : IGameObject, INotifyPropertyChanged
Remarks
Public fields and properties are automatically registered as game properties. However, these names are reserved for use by the IGameObject interface: GameState, Info, Item, and Properties.
Constructors
View SourceManagedGameObjectBase(IGameObject)
Initializes a new instance of the ManagedGameObjectBase class.
Declaration
protected ManagedGameObjectBase(IGameObject gameObject)
Parameters
Type | Name | Description |
---|---|---|
IGameObject | gameObject | The game object to clone. |
ManagedGameObjectBase(in ObjectInfo)
Initializes a new instance of the ManagedGameObjectBase class.
Declaration
protected ManagedGameObjectBase(in ObjectInfo info)
Parameters
Type | Name | Description |
---|---|---|
ObjectInfo | info | The game object info. |
Properties
View SourceAdditionalData
Gets the additional data which couldn't be stored in managed properties.
Declaration
protected Dictionary<string, object?> AdditionalData { get; }
Property Value
Type | Description |
---|---|
Dictionary<string, object> |
GameState
Gets or sets the game state associated with the game object.
Declaration
public IGameState? GameState { get; set; }
Property Value
Type | Description |
---|---|
IGameState |
Info
Gets all of the necessary information to identify the object.
Declaration
public ObjectInfo Info { get; }
Property Value
Type | Description |
---|---|
ObjectInfo |
this[string]
Gets or sets the value of a property with the given name.
Declaration
public object? this[string key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
string | key | The property name. |
Property Value
Type | Description |
---|---|
object | The property value, or null if no property was found. |
Properties
Gets a collection of property names for the game object.
Declaration
public virtual IReadOnlyCollection<string> Properties { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<string> |
Methods
View SourceConvertInstancePropertyValue(PropertyInfo, object?)
Converts a value to the correct type for the given property.
Declaration
protected virtual object? ConvertInstancePropertyValue(PropertyInfo prop, object? value)
Parameters
Type | Name | Description |
---|---|---|
PropertyInfo | prop | The property info. |
object | value | The property value. |
Returns
Type | Description |
---|---|
object | The converted value. |
GetInstanceProperty(string)
Gets the property info the given game class property.
Declaration
protected virtual PropertyInfo? GetInstanceProperty(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The property name. |
Returns
Type | Description |
---|---|
PropertyInfo | The property info. |
SetInstanceProperty(string, object?)
Sets the value of the given game class property.
Declaration
protected void SetInstanceProperty(string key, object? value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The property name. |
object | value | The property value. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
Overrides
Events
View SourcePropertyChanged
Occurs when a property value changes.
Declaration
public event PropertyChangedEventHandler? PropertyChanged
Event Type
Type | Description |
---|---|
PropertyChangedEventHandler |