Class CatalogAsset
This consolidates all catalogs into one asset.
Inherited Members
Namespace: UnityEngine.GameFoundation.DefaultCatalog
Syntax
public class CatalogAsset : ScriptableObject, ICatalogConfigurator, ISerializationCallbackReceiver
Properties
tagCatalog
A reference to a TagCatalogAsset.
Declaration
public TagCatalogAsset tagCatalog { get; }
Property Value
Type | Description |
---|---|
TagCatalogAsset |
Methods
ConfigureCatalog(CatalogBuilder, IExternalValueProvider)
Configures the specified builder
with the specific content of this catalog.
Declaration
protected void ConfigureCatalog(CatalogBuilder builder, IExternalValueProvider valueProvider)
Parameters
Type | Name | Description |
---|---|---|
CatalogBuilder | builder | The target builder. |
IExternalValueProvider | valueProvider | A value provider to override some catalog item's data with an external source. |
ContainsItem(String)
Tells whether an item with the specified key
exists or not.
Declaration
public bool ContainsItem(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | The identifier of the CatalogItemAsset instance to find. |
Returns
Type | Description |
---|---|
Boolean |
|
CreateDefaultData()
Creates a default data structure for a new player.
Declaration
public GameFoundationData CreateDefaultData()
Returns
Type | Description |
---|---|
GameFoundationData | Returns the default Game Foundation data. |
FindItem(String)
Looks for a CatalogItemAsset instance by its key
.
Declaration
public CatalogItemAsset FindItem(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | The identifier of the CatalogItemAsset to find. |
Returns
Type | Description |
---|---|
CatalogItemAsset | The requested CatalogItemAsset. |
Exceptions
Type | Condition |
---|---|
ArgumentException | If the |
FindItems(TagAsset, ICollection<CatalogItemAsset>, Boolean)
Fills in the given target
collection with all
CatalogItemAsset instances of this catalog matching the given tag
and returns their count.
Declaration
public int FindItems(TagAsset tag, ICollection<CatalogItemAsset> target = null, bool clearTarget = true)
Parameters
Type | Name | Description |
---|---|---|
TagAsset | tag | The Tag instance used as a filter. |
ICollection<CatalogItemAsset> | target | The target container of all the matching CatalogItemAsset instances. |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of CatalogItemAsset instances matching the tag filter in this catalog. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If the |
FindItems<TCatalogItemAsset>(TagAsset, ICollection<CatalogItemAsset>, Boolean)
Fills in the given target
collection with all
TCatalogItemAsset
instances of this catalog matching the given
tag
and returns their count.
Declaration
public int FindItems<TCatalogItemAsset>(TagAsset tag, ICollection<CatalogItemAsset> target = null, bool clearTarget = true)
where TCatalogItemAsset : CatalogItemAsset
Parameters
Type | Name | Description |
---|---|---|
TagAsset | tag | The TagAsset instance used as a filter. |
ICollection<CatalogItemAsset> | target | The target container of all the matching |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of |
Type Parameters
Name | Description |
---|---|
TCatalogItemAsset | Type inherited from CatalogItemAsset to look for. |
GetItems(ICollection<CatalogItemAsset>, Boolean)
Fills in the given target
collection with all
CatalogItemAsset instances of this catalog and returns their count.
Declaration
public int GetItems(ICollection<CatalogItemAsset> target = null, bool clearTarget = true)
Parameters
Type | Name | Description |
---|---|---|
ICollection<CatalogItemAsset> | target | The target container of all the CatalogItemAsset instances. |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of CatalogItemAsset instances of this catalog. |
GetItems<TCatalogItemAsset>(ICollection<TCatalogItemAsset>, Boolean)
Fills in the given target
collection with all
TCatalogItemAsset
instances of this catalog and returns their count.
Declaration
public int GetItems<TCatalogItemAsset>(ICollection<TCatalogItemAsset> target = null, bool clearTarget = true)
where TCatalogItemAsset : CatalogItemAsset
Parameters
Type | Name | Description |
---|---|---|
ICollection<TCatalogItemAsset> | target | The target container of all the |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of |
Type Parameters
Name | Description |
---|---|
TCatalogItemAsset | The type of items to find. |
Remarks
There is no constraint on the generic so the given collection can be as basic as needed and reused with different catalogs.
OnAfterDeserialize()
Declaration
public void OnAfterDeserialize()
Implements
OnBeforeSerialize()
Declaration
public void OnBeforeSerialize()
Implements
SetValueProvider(IExternalValueProvider)
Set the given valueProvider
as the external value provider for this database.
Also override catalog item's data that are not configured.
Declaration
public void SetValueProvider(IExternalValueProvider valueProvider)
Parameters
Type | Name | Description |
---|---|---|
IExternalValueProvider | valueProvider | A value provider to override some catalog item's data with an external source. |
Explicit Interface Implementations
ICatalogConfigurator.Configure(CatalogBuilder)
Configures the specified builder
with the content of this provider.
Declaration
void ICatalogConfigurator.Configure(CatalogBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
CatalogBuilder | builder | The target builder. |