コード例 #1
0
    void OnEnable()
    {
        if (null == iapManager)
        {
            iapManager = IAPBuilder.CurrentIapManager;
        }

        iapManager.OnPurchaseSupported     += OnPurchaseSupportedHandler;
        iapManager.OnPurchaseNotSupported  += OnPurchcaseNotSupportedHandler;
        iapManager.OnQuerySkuInfoSucceeded += OnQuerySkuInfoSucceededHandler;
        iapManager.OnQuerySkuInfoFailed    += OnQuerySkuInfoFailedHandler;
        iapManager.OnPurchaseSucceeded     += OnPurchaseSucceededHandler;
        iapManager.OnPurchaseFailed        += OnPurchaseFailedHandler;
        iapManager.OnConsumeSucceeded      += OnConsumeSucceededHandler;
        iapManager.OnConsumeFailed         += OnConsumeFailedHandler;
        iapManager.OnQueryNotConsumedPurchasesSucceeded += OnQueryNotConsumedPurchasesSucceededHandler;
        iapManager.OnQueryNotConsumedPurchasesFailed    += OnQueryNotConsumedPurchasesFailedHandler;
    }
コード例 #2
0
        /// <summary>
        /// Build IIAPManager object and attach it to GameObject (After calling this method the IAPBuilder class is reset)
        /// </summary>
        /// <param name="mono">Mono reference from GameObject to which you want to attach IIAPManager</param>
        /// <returns></returns>
        public IIAPManager BuildAndAttach(MonoBehaviour mono)
        {
            IIAPManager ret = null;

            #if _dev_ || _cafebazaar_
            ret = mono.gameObject.AddComponent <BazaarIAPManager>();
            ((BazaarIAPManager)ret).SetData(_publicKeys[Store.Bazaar], _products);
            #endif

            #if _dev_ || _myket_
            ret = mono.gameObject.AddComponent <MyketIAPManager>();
            ((MyketIAPManager)ret).SetData(_publicKeys[Store.Myket], _products);
            #endif

            #if _dev_ || _googleplay_
            ret = mono.gameObject.AddComponent <GooglePlayIAPManager>();
            ((GooglePlayIAPManager)ret).SetData(_products);
            #endif

            CurrentIapManager = ret;

            return(ret);
        }