예제 #1
0
 public IAPData(PK.GetPurchaseItems.REDataPacks data)
 {
     this.id                     = data.id;
     this.tag                    = data.tag;
     this.sale_percentage        = data.sale_percentage;
     this.regular_coins          = data.regular_coins;
     this.free_percentage        = data.free_percentage;
     this.coins                  = data.coins;
     this.price                  = data.price;
     this.product_url            = data.product_url;
     this.level_up_bonus         = data.level_up_bonus;
     this.level_bonus_percentage = data.level_bonus_percentage;
     this.regular_price          = data.regular_price;
     this.code                   = data.code;
 }
예제 #2
0
    public override void callback_ItemClick(GameObject obj, params object[] args)
    {
        PK.GetPurchaseItems.REDataPacks _ItemInfo = (PK.GetPurchaseItems.REDataPacks)args[0];
        product_url = _ItemInfo.product_url;

        PLATFORM.I.BuyPurchase(_ItemInfo, (result, google, apple) => {
            if (result != "failed")
            {
                //Debug.Log("Purchase : ProductID:" + productID + ", receipt:" + receipt);
                NET.I.SendReqPurchase((id, msg) =>
                {
                    Main.I.AppsFlyerEvent_Purchase(PLATFORM.I.GetIAPData());

                    PK.Purchase.RECEIVE info = JsonConvert.DeserializeObject <PK.Purchase.RECEIVE>(msg);

                    USER.I.GetUserInfo().Balance = info.data.balance;
                    USER.I.onUpdateUserInfo();

                    UI.I.AddMessage(UI.IDs.TouchLock);
                    UI.I.AddMessage(UI.IDs.RQCheckDeal);
                    UI.I.AddMessage(UI.IDs.UpdateBuyButton);
                    UI.I.AddMessage(UI.IDs.TouchUnLock);
                    UI.I.AddMessage(UI.IDs.PopPurchaseSuccessful, "coins", info.data.coins);
                    UI.SetWaitLoading(false);
                }, NET.I.OnSendReqTimerout, product_url, google, apple);
            }
            else
            {
                UI.SetWaitLoading(false);
#if UNITY_EDITOR
                NET.I.TestSendReqPurchase((id, msg) =>
                {
                    PK.Purchase.RECEIVE info = JsonConvert.DeserializeObject <PK.Purchase.RECEIVE>(msg);

                    USER.I.GetUserInfo().Balance = info.data.balance;
                    USER.I.onUpdateUserInfo();

                    UI.I.AddMessage(UI.IDs.TouchLock);
                    UI.I.AddMessage(UI.IDs.RQCheckDeal);
                    UI.I.AddMessage(UI.IDs.UpdateBuyButton);
                    UI.I.AddMessage(UI.IDs.TouchUnLock);
                    UI.I.AddMessage(UI.IDs.PopPurchaseSuccessful, "coins", info.data.coins);
                    UI.SetWaitLoading(false);
                }, NET.I.OnSendReqTimerout, product_url);
#endif
            }
        });
    }
예제 #3
0
    // 일반적인 아이템 리스트 정보 세팅
    public void SetInfo(int index, PK.GetPurchaseItems.REDataPacks info)
    {
        _info          = info;
        _original_Info = null;
        _index         = index;

        if (index == 2 || index == 5)
        {
            _imgBackground[0].gameObject.SetActive(false);
            _imgBackground[1].gameObject.SetActive(true);
        }
        else
        {
            _imgBackground[0].gameObject.SetActive(true);
            _imgBackground[1].gameObject.SetActive(false);
        }

        if (index == 2 || index == 5)
        {
            _labelType = eType.red;
        }
        else
        {
            _labelType = eType.green;
        }

        if (index == 2)
        {
            _iconType = eType.most;
        }
        else if (index == 5)
        {
            _iconType = eType.best;
        }
        else
        {
            _iconType = eType.coin1 + index;
        }

        UpdateItem();
    }
예제 #4
0
//    public void BuyPurchase(string productId, System.Action<string, GooglePlayReceipt, AppleInAppPurchaseReceipt> Complete)
//    {
//        _IAP.BuyProductID(productId, Complete);
//    }
    public void BuyPurchase(PK.GetPurchaseItems.REDataPacks ItemInfo, System.Action <string, GooglePlayReceipt, AppleInAppPurchaseReceipt> Complete)
    {
        Main.I.AppsFlyerEvent(AFInAppEvents.SHOP, AFInAppEvents.TRY_PURCHASE, ItemInfo.id.ToString());

        _IAP.BuyProductID(new DEF.IAPData(ItemInfo), Complete);
    }