Ejemplo n.º 1
0
    void BuySuccess(TBData data)
    {
        string order = ShopOrderManager.getInstance().getOrderDes(data.order);

        for (int i = 0; i < szIAPData.Count; i++)
        {
            if (order.Equals(szIAPData[i].proid))
            {
                ShopOrderManager.getInstance().setOrderStatu(order, ShopOrderManager.BuyEndStates);
                ShopOrderManager.getInstance().saveShopOrder();

                _dataPlayer.Jewel += szIAPData[i].get_num;
                                #if Add_AD
                if (!szIAPData[i].proid.Equals("Coins_60"))
                {
                    WGGameWorld.Instance.RemoveAd();
                }
                                #endif
#if Umeng
                Umeng.GA.Pay(szIAPData[i].cost_num, Umeng.GA.PaySource.TongBu, szIAPData[i].get_num);
#endif

                DataPlayerController.getInstance().saveDataPlayer();
                WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN);
                WGAlertViewController.Self.showTipView(1001);
            }
        }
    }
Ejemplo n.º 2
0
 public static ShopOrderManager getInstance()
 {
     if (dataCtrl == null)
     {
         dataCtrl = new ShopOrderManager();
     }
     return(dataCtrl);
 }
Ejemplo n.º 3
0
    public void OnBuyWithMDShopData(MDShopData data)
    {
#if UNITY_ANDROID
        sCurBuy = "" + data.proid2;

        YeHuoSDK.YHPay(sCurBuy, (float)data.cost_num, data.get_num, (success) => {
            if (success)
            {
                for (int i = 0; i < szIAPData.Count; i++)
                {
                    if (sCurBuy.Equals(szIAPData[i].proid2))
                    {
                        _dataPlayer.Jewel += szIAPData[i].get_num;

                        DataPlayerController.getInstance().saveDataPlayer();
                        WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN);
                        WGAlertViewController.Self.showTipView(1001);
                    }
                }
            }
        });
#else
        WGAlertViewController.Self.showConnecting();
                #if TEST
        mnIvokeBlock.InvokeBlock(0.3f, () => {
            didCompleteWithRecepit("", data.proid);
        });
                #elif TBSDK
        if (TBSDK.TBIsLogined())
        {
            string order = data.proid + "_" + Core.nData.sysTime + "_" + TBSDK.TBUserID();

            Debug.Log(order);

            ShopOrderManager.getInstance().SetOrderDes(order, data.proid);
            ShopOrderManager.getInstance().setOrderStatu(order, ShopOrderManager.BuyingStates);
            ShopOrderManager.getInstance().saveShopOrder();
            TBSDK.TBPayRMB(data.cost_num, order, data.proid);
        }
        else
        {
            TBSDK.TBLogin(0);
        }
                #else
        IAP.payForProIdentifier(data.proid);
                #endif
#endif
    }
Ejemplo n.º 4
0
    void TBMessage(string msg)
    {
        Debug.Log(msg);
        TBData data = SDK.Deserialize <TBData>(msg);

        Debug.Log(SDK.Serialize(data));


        if (data.act == TBACT.TBInitDidFinish)
        {
        }
        else if (data.act == TBACT.TBLoginResult)
        {
            WGAlertViewController.Self.hiddenConnecting();
        }
        else if (data.act == TBACT.TBBuyGoodsDidSuccessWithOrder)
        {
            WGAlertViewController.Self.hiddenConnecting();
            BuySuccess(data);
        }
        else if (data.act == TBACT.TBBuyGoodsDidFailedWithOrder)
        {
            WGAlertViewController.Self.showAlertView(1800 + data.status).alertViewBehavriour = (ab, view) => {
                switch (ab)
                {
                case MDAlertBehaviour.CLICK_OK:
                    view.hiddenView();
                    break;

                case MDAlertBehaviour.DID_HIDDEN:
                    WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                    break;
                }
            };
            WGAlertViewController.Self.hiddenConnecting();
            ShopOrderManager.getInstance().setOrderStatu(data.order, ShopOrderManager.BuyFail);
            ShopOrderManager.getInstance().saveShopOrder();
        }
        else if (data.act == TBACT.TBBuyGoodsDidStartRechargeWithOrder)
        {
//			TBSDK.TBCheckOrder(data.order);
//			WGAlertViewController.Self.showConnecting();
        }
        else if (data.act == TBACT.TBBuyGoodsDidCancelByUser)
        {
            WGAlertViewController.Self.showAlertView(1810).alertViewBehavriour = (ab, view) => {
                switch (ab)
                {
                case MDAlertBehaviour.CLICK_OK:
                    view.hiddenView();
                    break;

                case MDAlertBehaviour.DID_HIDDEN:
                    WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                    break;
                }
            };
            ShopOrderManager.getInstance().setOrderStatu(data.order, ShopOrderManager.BuyCancel);
            ShopOrderManager.getInstance().saveShopOrder();
            WGAlertViewController.Self.hiddenConnecting();
        }
        else if (data.act == TBACT.TBDidLogout)
        {
        }
        else if (data.act == TBACT.TBLeavedPlatform)
        {
            if (!string.IsNullOrEmpty(data.order))
            {
#if TBSDK
                TBSDK.TBCheckOrder(data.order);
#endif
            }
            else
            {
                WGAlertViewController.Self.hiddenConnecting();
            }
        }
        else if (data.act == TBACT.TBCheckOrderFinishedWithOrder)
        {
            WGAlertViewController.Self.hiddenConnecting();
            if (data.status == 1 || data.status == 3)
            {
                BuySuccess(data);
            }
            else if (data.status == 0 || data.status == 2 || data.status == -1)
            {
                ShopOrderManager.getInstance().setOrderStatu(data.order, ShopOrderManager.BuyFail);
                WGAlertViewController.Self.showAlertView(1820 + data.status).alertViewBehavriour = (ab, view) => {
                    switch (ab)
                    {
                    case MDAlertBehaviour.CLICK_OK:
                        view.hiddenView();
                        break;

                    case MDAlertBehaviour.DID_HIDDEN:
                        WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                        break;
                    }
                };
            }
        }
        else if (data.act == TBACT.TBCheckOrderDidFailed)
        {
            WGAlertViewController.Self.showAlertView(1811).alertViewBehavriour = (ab, view) => {
                switch (ab)
                {
                case MDAlertBehaviour.CLICK_OK:
                    view.hiddenView();
                    break;

                case MDAlertBehaviour.DID_HIDDEN:
                    WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                    break;
                }
            };
            WGAlertViewController.Self.hiddenConnecting();
        }
    }