コード例 #1
0
    //상품리스트 성공적으로 들어올떄 콜백함수
    void productListReceivedEvent(List <StoreKitProduct> productList)
    {
        UserEditor.Getsingleton.EditLog("productListReceivedEvent. total products received: " + productList.Count);

        // print the products to the console
        //foreach (StoreKitProduct product in productList)
        //	UserEditor.Getsingleton.EditLog(product.ToString() + "\n");

        //Loadmanager.instance.LoadingUI(false);



        //상품정보(가격, 화폐단위) 받아오기
        for (int i = 0; i < productList.Count; i++)
        {
            Dic_StorkitProductInfo [productList [i].productIdentifier] = productList[i];

            //Debug.Log (productList [i].productIdentifier + " / " + productList [i].price + " / " + productList [i].currencyCode + " / " + productList [i].formattedPrice +
            //	" / " + productList [i].currencySymbol);
        }



        // 구입 했던 거래 정보
        List <StoreKitTransaction> _storeKitTrns = StoreKitBinding.getAllSavedTransactions();

        UserEditor.Getsingleton.EditLog("getAllSavedTransactions count : " + _storeKitTrns.Count);

//		for(int i = 0 ; i < _storeKitTrns.Count ; i++)
//		{
//			UserEditor.Getsingleton.EditLog ("getAllSavedTransactions _ Transaction state : " + _storeKitTrns[i].ToString());
//
//		}

        // 구매 후 소모 처리 되지 않은 상 품들
        List <StoreKitTransaction> _storekitAllCurrent = StoreKitBinding.getAllCurrentTransactions();

        UserEditor.Getsingleton.EditLog("getAllCurrentTransactions count : " + _storekitAllCurrent.Count);

        for (int i = 0; i < _storekitAllCurrent.Count; i++)
        {
            isForceConsume = true;
            UserEditor.Getsingleton.EditLog("getAllCurrentTransactions _ Transaction state : " + _storekitAllCurrent[i].ToString());

            if (_storekitAllCurrent [i].transactionState == StoreKitTransactionState.Purchased)             //거래 대기열에 있음, 사용자에게 청구 됨. 클라이언트는 트랜잭션을 완료해야함.
            {
                // 다시 소모 처리 시된 상품 저장 => 만약 소모처리중 프로토콜 에러 발 생시 강제 소모 하려고
                storekitTracs.Add(_storekitAllCurrent [i]);

                //거래 상품중에 소모를 하지않은 상품들 소모해준다
                productPurchaseAwaitingConfirmationEvent(_storekitAllCurrent [i]);
                //StoreKitBinding.finishPendingTransaction (_storekitAllCurrent [i].transactionIdentifier);
            }
            else if (_storekitAllCurrent [i].transactionState == StoreKitTransactionState.Failed)             // 거래 실패된 상품 거래 는 그냥 소모 처리 한다
            {
                UserEditor.Getsingleton.EditLog("강제소모 함  : " + _storekitAllCurrent [i].productIdentifier + " / " + _storekitAllCurrent [i].transactionState);
                StoreKitBinding.finishPendingTransaction(_storekitAllCurrent [i].transactionIdentifier);
            }
        }
        if (_storekitAllCurrent.Count > 0)
        {
            isForceConsume = false;
        }


        IsGetQueryInventory = true;
    }