Version: 2017.1

IPurchasingModule

interface in UnityEngine.Purchasing.Extension

切换到手册

描述

一个或多个商店的 Unity IAP 配置。

商店实现必须提供一个此接口的实现。将 IPurchasingModule 实现与 ConfigurationBuilder 配合使用,以扩展 Unity IAP 的商店功能。

using UnityEngine;

class MyPurchasingModule : IPurchasingModule { public void Configure(IPurchasingBinder binder) { binder.RegisterStore("MyManufacturerAppStore", InstantiateMyManufacturerAppStore()); // Our Purchasing service implementation provides the real implementation. binder.RegisterExtension<IManufacturerExtensions>(new FakeManufacturerExtensions()); }

IStore InstantiateMyManufacturerAppStore() { // Check for Manufacturer. "Android" used here for the sake of example. // In your implementation, return platform-appropriate store instead of "null". if (Application.platform == RuntimePlatform.Android) { return null; } else { return null; } }

IStoreExtension IManufacturerExtensions() { return null; } }

公共函数

Configure在 Unity IAP 加载您的模块时调用。使用 IPurchasingBinder 注册商店和关联的扩展。