namespace UnityEngine.Purchasing.Extension
{
///
/// Base class for Purchasing Modules.
///
/// In addition to providing helper methods, use of an abstract
/// class allows addition of IPurchasingModule methods without
/// breaking compatibility with existing plugins.
///
public abstract class AbstractPurchasingModule : IPurchasingModule
{
///
/// Object that binds this module with store implementations.
///
protected IPurchasingBinder m_Binder;
///
/// Configures the purchasing module.
///
/// The object binding the purchasing with store implementations
public void Configure(IPurchasingBinder binder)
{
m_Binder = binder;
Configure();
}
///
/// Registers a store with the purchasing binder.
///
/// The store name
/// The store's instance
protected void RegisterStore(string name, IStore store)
{
m_Binder.RegisterStore(name, store);
}
///
/// Binds the store extension with the purchasing binder.
///
/// Implementation of IStoreExtension.
/// Instance of the store extension
protected void BindExtension(T instance) where T : IStoreExtension
{
m_Binder.RegisterExtension(instance);
}
///
/// Binds the store configuration with the purchasing binder.
///
/// Implementation of IStoreConfiguration.
/// Instance of the store configuration
protected void BindConfiguration(T instance) where T : IStoreConfiguration
{
m_Binder.RegisterConfiguration(instance);
}
///
/// Configures the purchasing module with default settings.
///
public abstract void Configure();
}
}