Class SimpleCatalogProvider
A simple implementation of IBaseCatalogProvider that uses a delegate to fetch product definitions. This provider wraps a function delegate to provide product catalog functionality in a straightforward manner.
Implements
Inherited Members
Namespace: UnityEngine.Purchasing
Assembly: Unity.Purchasing.dll
Syntax
public class SimpleCatalogProvider : IBaseCatalogProvider
Constructors
SimpleCatalogProvider(Action<Action<List<ProductDefinition>>>)
Initializes a new instance of the SimpleCatalogProvider with a function delegate for fetching products.
Declaration
public SimpleCatalogProvider(Action<Action<List<ProductDefinition>>> func)
Parameters
Type | Name | Description |
---|---|---|
Action<Action<List<ProductDefinition>>> | func | A function delegate that takes a callback as parameter and is responsible for fetching product definitions. The delegate should invoke the provided callback with the retrieved list of product definitions. Can be null, in which case FetchProducts will not perform any operation. |
Methods
FetchProducts(Action<List<ProductDefinition>>)
Fetches product definitions by invoking the configured function delegate.
Declaration
public void FetchProducts(Action<List<ProductDefinition>> callback)
Parameters
Type | Name | Description |
---|---|---|
Action<List<ProductDefinition>> | callback | A callback function that will be invoked with the list of product definitions. The callback receives a List<T> containing the fetched products. If the internal function delegate is null, the callback will not be invoked. |