Ei kuvausta
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AbstractPurchasingModule.cs 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. namespace UnityEngine.Purchasing.Extension
  2. {
  3. /// <summary>
  4. /// Base class for Purchasing Modules.
  5. ///
  6. /// In addition to providing helper methods, use of an abstract
  7. /// class allows addition of IPurchasingModule methods without
  8. /// breaking compatibility with existing plugins.
  9. /// </summary>
  10. public abstract class AbstractPurchasingModule : IPurchasingModule
  11. {
  12. /// <summary>
  13. /// Object that binds this module with store implementations.
  14. /// </summary>
  15. protected IPurchasingBinder m_Binder;
  16. /// <summary>
  17. /// Configures the purchasing module.
  18. /// </summary>
  19. /// <param name="binder"> The object binding the purchasing with store implementations </param>
  20. public void Configure(IPurchasingBinder binder)
  21. {
  22. m_Binder = binder;
  23. Configure();
  24. }
  25. /// <summary>
  26. /// Registers a store with the purchasing binder.
  27. /// </summary>
  28. /// <param name="name"> The store name </param>
  29. /// <param name="store"> The store's instance </param>
  30. protected void RegisterStore(string name, IStore store)
  31. {
  32. m_Binder.RegisterStore(name, store);
  33. }
  34. /// <summary>
  35. /// Binds the store extension with the purchasing binder.
  36. /// </summary>
  37. /// <typeparam name="T"> Implementation of <c>IStoreExtension</c>. </typeparam>
  38. /// <param name="instance"> Instance of the store extension </param>
  39. protected void BindExtension<T>(T instance) where T : IStoreExtension
  40. {
  41. m_Binder.RegisterExtension(instance);
  42. }
  43. /// <summary>
  44. /// Binds the store configuration with the purchasing binder.
  45. /// </summary>
  46. /// <typeparam name="T"> Implementation of <c>IStoreConfiguration</c>. </typeparam>
  47. /// <param name="instance"> Instance of the store configuration </param>
  48. protected void BindConfiguration<T>(T instance) where T : IStoreConfiguration
  49. {
  50. m_Binder.RegisterConfiguration(instance);
  51. }
  52. /// <summary>
  53. /// Configures the purchasing module with default settings.
  54. /// </summary>
  55. public abstract void Configure();
  56. }
  57. }