Class GameObjectCache
An implementation of IGameObjectCache.
Inheritance
GameObjectCache
Implements
Inherited Members
Namespace: Microsoft.XboxStudios.GameStateTracker.Cache
Assembly: GameStateTracker.Core.dll
Syntax
public class GameObjectCache : ClassObjectCacheBase<ObjectInfo, IGameObject>, IGameObjectCache, IClassObjectCache<ObjectInfo, IGameObject>, IObjectCache<ObjectInfo, IGameObject>, ICollection<IGameObject>, IEnumerable<IGameObject>, IDictionary<ObjectInfo, IGameObject>, ICollection<KeyValuePair<ObjectInfo, IGameObject>>, IEnumerable<KeyValuePair<ObjectInfo, IGameObject>>, IEnumerable, IQueryResultConsumer<IGameObject>
Remarks
Initializes a new instance of the GameObjectCache class.
Constructors
View SourceGameObjectCache(IReadOnlyCollection<IGameObject>?)
An implementation of IGameObjectCache.
Declaration
public GameObjectCache(IReadOnlyCollection<IGameObject>? existing = null)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<IGameObject> | existing | The objects to initialize the cache with. |
Remarks
Initializes a new instance of the GameObjectCache class.
Methods
View SourceGetDefaultObject(in ObjectInfo)
Gets a default game object for the given object info.
Declaration
protected virtual IGameObject GetDefaultObject(in ObjectInfo info)
Parameters
Type | Name | Description |
---|---|---|
ObjectInfo | info | The object info. |
Returns
Type | Description |
---|---|
IGameObject | A game object. |
GetKey(IGameObject)
Gets the info describing an object.
Declaration
protected override ObjectInfo GetKey(IGameObject input)
Parameters
Type | Name | Description |
---|---|---|
IGameObject | input | The object. |
Returns
Type | Description |
---|---|
ObjectInfo | The object info. |
Overrides
View SourceMergeResult(in QueryResult)
Transforms the query result into an object, and then adds the object to the cache.
Declaration
public IGameObject MergeResult(in QueryResult item)
Parameters
Type | Name | Description |
---|---|---|
QueryResult | item | The query result. |
Returns
Type | Description |
---|---|
IGameObject | The object. |
ToClassKey(in ObjectInfo)
Converts an object's info to its class info.
Declaration
protected override ObjectInfo ToClassKey(in ObjectInfo info)
Parameters
Type | Name | Description |
---|---|---|
ObjectInfo | info | The object info. |
Returns
Type | Description |
---|---|
ObjectInfo | The class info. |
Overrides
Events
View SourceOnObjectCreated
An event which fires when new query results cause an object to be created.
Declaration
public event EventHandler<IGameObject>? OnObjectCreated
Event Type
Type | Description |
---|---|
EventHandler<IGameObject> |