Class Catalog
Contains all the runtime CatalogItem instances and provide query methods to get them.
Namespace: UnityEngine.GameFoundation
Syntax
public class Catalog
Constructors
Catalog()
Create an empty Catalog.
Declaration
public Catalog()
Methods
Find<TCatalogItem>(String)
Looks for a CatalogItem instance by its key
.
Declaration
public TCatalogItem Find<TCatalogItem>(string key)
where TCatalogItem : CatalogItem
Parameters
Type | Name | Description |
---|---|---|
String | key | The identifier of the CatalogItem to find. |
Returns
Type | Description |
---|---|
TCatalogItem | The requested CatalogItem. |
Type Parameters
Name | Description |
---|---|
TCatalogItem | The sub-type of catalog item to get. |
Exceptions
Type | Condition |
---|---|
ArgumentException | If the |
FindIAPTransactionByProductId(String)
Get a BaseTransaction from its product id.
Declaration
public IAPTransaction FindIAPTransactionByProductId(string productId)
Parameters
Type | Name | Description |
---|---|---|
String | productId | The product id of the IAP transaction definition to find. |
Returns
Type | Description |
---|---|
IAPTransaction | If found, returns the IAPTransaction object, otherwise null |
FindItems(Predicate<CatalogItem>, ICollection<CatalogItem>, Boolean)
Gets filtered items.
Declaration
public int FindItems(Predicate<CatalogItem> filter, ICollection<CatalogItem> target = null, bool clearTarget = true)
Parameters
Type | Name | Description |
---|---|---|
Predicate<CatalogItem> | filter | The predicate filtering the CatalogItem instances. |
ICollection<CatalogItem> | target | The target collection the filtered CatalogItem instances are copied to. |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of filtered items. |
FindItems<TState>(Func<TState, CatalogItem, Boolean>, TState, ICollection<CatalogItem>, Boolean)
Gets filtered items.
Declaration
public int FindItems<TState>(Func<TState, CatalogItem, bool> filter, TState state, ICollection<CatalogItem> target = null, bool clearTarget = true)
Parameters
Type | Name | Description |
---|---|---|
Func<TState, CatalogItem, Boolean> | filter | The predicate filtering the CatalogItem instances. |
TState | state | An object representing data to be used by the filter. |
ICollection<CatalogItem> | target | The target collection the filtered CatalogItem instances are copied to. |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of filtered items. |
Type Parameters
Name | Description |
---|---|
TState | The type of the data provided to the |
FindItems<TCatalogItem>(Tag, ICollection<TCatalogItem>, Boolean)
Fills in the given target
collection with all CatalogItem instances
of this catalog matching the given tag
and returns their count.
Declaration
public int FindItems<TCatalogItem>(Tag tag, ICollection<TCatalogItem> target = null, bool clearTarget = true)
where TCatalogItem : CatalogItem
Parameters
Type | Name | Description |
---|---|---|
Tag | tag | The Tag instance used as a filter. |
ICollection<TCatalogItem> | target | The target container of all the matching CatalogItem instances. |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of CatalogItem instances matching the tag filter in this catalog. |
Type Parameters
Name | Description |
---|---|
TCatalogItem | Limit the search to items of the specified type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If the |
FindItems<TCatalogItem>(Tag, ICollection<CatalogItem>, Boolean)
Fills in the given target
collection with all CatalogItem instances
of this catalog matching the given tag
and returns their count.
Declaration
public int FindItems<TCatalogItem>(Tag tag, ICollection<CatalogItem> target = null, bool clearTarget = true)
where TCatalogItem : CatalogItem
Parameters
Type | Name | Description |
---|---|---|
Tag | tag | The Tag instance used as a filter. |
ICollection<CatalogItem> | target | The target container of all the matching CatalogItem instances. |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of CatalogItem instances matching the tag filter in this catalog. |
Type Parameters
Name | Description |
---|---|
TCatalogItem | Limit the search to items of the specified type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If the |
GetItems<TCatalogItem>(ICollection<TCatalogItem>, Boolean)
Fills in the given target
collection with all CatalogItem instances
of this catalog and returns their count.
Declaration
public int GetItems<TCatalogItem>(ICollection<TCatalogItem> target = null, bool clearTarget = true)
where TCatalogItem : CatalogItem
Parameters
Type | Name | Description |
---|---|---|
ICollection<TCatalogItem> | target | The target container of all the CatalogItem instances. |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of CatalogItem instances of this catalog. |
Type Parameters
Name | Description |
---|---|
TCatalogItem | The sub-type of catalog item to get. |