Ejemplo n.º 1
0
    //public Action ActPurchaseSuccess, ActPurchaseCancelled;
    public AmIAP()
    {
        arrProduct = new List <StoreKitProduct> ();

        StoreKitManager.productListReceivedEvent += allProducts => { // 상품 목록 받는 부분.
            Ag.LogString("received total products: " + allProducts.Count);
            ProdNumFromAppl = allProducts.Count;
            arrProduct      = allProducts;
            for (int k = 0; k < arrProduct.Count; k++)
            {
                (" Product : " + arrProduct [k].productIdentifier + "      Prc : " + arrProduct [k].price).HtLog();
            }
            Ag.LogDouble(" StoreKitManager.productListReceivedEvent ::   Done !!! ");
        };

        StoreKitManager.purchaseSuccessfulEvent += tObject => { // StoreKitTransaction Object..
            Ag.LogString("Receipt >>> " + tObject.base64EncodedTransactionReceipt.Substring(0, 10), pWichtig: true);

            AgStt.IntendedPause = false; // 초 기 화
            ReceiptOfIAP        = tObject.base64EncodedTransactionReceipt;
            TransactionID       = tObject.transactionIdentifier;
            if (ReceiptOfIAP.Length > 100)   // 구매 성공.
            {
                WasInAppPrchs aObj = new WasInAppPrchs()
                {
                    User = TheUser //, ActPurchaseSuccess = this.ActPurchaseSuccess, ActPurchaseCancelled = this.ActPurchaseCancelled
                };
                aObj.messageAction = (int pInt) => {
                    switch (pInt)   //
                    {
                    case 0:
                        WasUserInfo uObj = new WasUserInfo()
                        {
                            User = TheUser, flag = 0
                        };
                        uObj.messageAction = (int uInt) => {
                            Ag.LogString(" OK ");
                        };
                        break;
                    }
                };
                Ag.LogString(" purchaseSuccessfulEvent  WasInAppPrcs call.. ", pWichtig: true);
            }
        };

        // public static event Action<string> purchaseCancelledEvent;
        StoreKitManager.purchaseCancelledEvent += tStr => {
            AgStt.IntendedPause = false; // 초 기 화

            EventPurchaseCancelled();
            Debug.Log("purchase Canceled >>_ " + tStr);
        };
    }
Ejemplo n.º 2
0
    void GetCash(string pBuycode)
    {
        AgStt.mIAB.ProductID = GameObject.Find("Axis/Camera/Match").GetComponent <MenuManager> ().mProductCode;
        AgStt.mIAB.BuyCode   = pBuycode;
        AgStt.mIAB.StoreType = 3;
        WasInAppPrchs aObj = new WasInAppPrchs()
        {
            User = Ag.mySelf,
        };

        aObj.messageAction = (int pInt) => {
            switch (pInt)
            {
            case 0:
                GameObject.Find("Axis/Camera/Match").GetComponent <MenuManager> ().MainUserInfo();
                return;
            }
        };
    }
    void GetCash()
    {
        WasInAppPrchs aObj = new WasInAppPrchs()
        {
            User = Ag.mySelf,
        };

        aObj.messageAction = (int pInt) => {
            switch (pInt)
            {
            case 0:
                MainUserInfo();

                Ag.LogString(" result : Success ");

                #if UNITY_ANDROID
                GoogleIAB.consumeProduct(Productid);
                #endif

                return;
            }
        };
    }