Esempio n. 1
0
    public void RestorePurchases(funcBuy OnCallback)
    {
        // 상품 복원.

        if (0 == m_hashHasProducts.Count)
        {
            return;
        }

        foreach (KeyValuePair <string, BillingTransaction> it in m_hashHasProducts)
        {
            if (eBillingTransactionState.RESTORED == it.Value.TransactionState)
            {
                m_OnCallbackBuy(E_BILLING_RESULT.Success, it.Value);
            }
        }
        m_hashHasProducts.Clear();
    }
Esempio n. 2
0
    public bool Buy(string strIdentifier, funcBuy OnCallback)
    {
        // 구입.
                #if DEBUG_MODE
        Debug.Log("RcBilling:Buy=" + strIdentifier);
                #endif

        m_OnCallbackBuy = OnCallback;

        if (true == this.available)
        {
            BillingProduct product = GetProduct(strIdentifier);
            if (null != product)
            {
                // 비소모 아이템 이면서
                if (false == product.IsConsumable)
                {
                    // 이미 구입했다면
                    if (true == _IsProductPurchased(product))
                    {
                        // 이미 구입 콜백
                        if (null != m_OnCallbackBuy)
                        {
                            m_OnCallbackBuy(E_BILLING_RESULT.Already, null);
                        }
                        return(false);
                    }
                }

                _BuyProduct(product);
                return(true);
            }
        }

        if (null != m_OnCallbackBuy)
        {
            m_OnCallbackBuy(E_BILLING_RESULT.Failed, null);
        }

        return(false);
    }