Пример #1
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
    }
Пример #2
0
    void Start()
    {
        int count = WGDataController.Instance.szShopData.Count;

        for (int i = 0; i < count; i++)
        {
            MDShopData sd = WGDataController.Instance.szShopData[i];
            if (sd.type == MDShopData.JEWEL)
            {
                szIAPData.Add(sd);
            }
        }
                #if TEST
                #elif TBSDK
        WGAlertViewController.Self.showConnecting();
        TBSDK.TBSetUseOldLoadingMode(isUseOldMode);
        isUseOldMode = !isUseOldMode;
        TBSDK.TBInit();

        TBSDK.TBShowToolBar(1, true);
                #endif
    }
Пример #3
0
 void OnGUI()
 {
     //Kinds of Buttons
     if (GUI.Button(getRectByNo(0), "Init"))
     {
         TBSDK.TBSetUseOldLoadingMode(isUseOldMode);
         isUseOldMode = !isUseOldMode;
         TBSDK.TBInit();
     }
     //Login
     if (GUI.Button(getRectByNo(1), "Login"))
     {
         TBSDK.TBLogin(0);
     }
     //Logout
     if (GUI.Button(getRectByNo(2), "Logout"))
     {
         TBSDK.TBLogout();
     }
     //SwitchAccount
     if (GUI.Button(getRectByNo(3), "SwitchAccount"))
     {
         TBSDK.TBSwitchAccount();
     }
     //isLogin
     if (GUI.Button(getRectByNo(4), "IsLogin"))
     {
         TBSDK.TBIsLogined();
     }
     //setDebug
     if (GUI.Button(getRectByNo(5), "SetDebug"))
     {
         TBSDK.TBSetDebug();
     }
     //SessionID
     if (GUI.Button(getRectByNo(6), "SessionID"))
     {
         TBSDK.TBSessionID();
     }
     //UserID
     if (GUI.Button(getRectByNo(7), "UserID"))
     {
         TBSDK.TBUserID();
     }
     //UserName
     if (GUI.Button(getRectByNo(8), "NickName"))
     {
         TBSDK.TBNickName();
     }
     //Pay50
     if (GUI.Button(getRectByNo(9), "Pay 50 rmb"))
     {
         TBSDK.TBPayRMB(50, "order here", "payDescription");
     }
     //Exchange
     if (GUI.Button(getRectByNo(10), "Exchange"))
     {
         TBSDK.TBExchange("order here", "payDescription");
     }
     //CheckOrder
     if (GUI.Button(getRectByNo(11), "CheckOrder"))
     {
         TBSDK.TBCheckOrder("orderhere");
     }
     //UserCenter
     if (GUI.Button(getRectByNo(12), "UserCenter"))
     {
         TBSDK.TBEnterUserCenter(0);
     }
     //GameRecommend
     if (GUI.Button(getRectByNo(13), "Recommendation"))
     {
         TBSDK.TBEnterAppCenter(0);
     }
     //BBS
     if (GUI.Button(getRectByNo(14), "BBS"))
     {
         TBSDK.TBEnterAppBBS(0);
     }
     //ShowToolBar
     if (GUI.Button(getRectByNo(15), "ShowToolBar"))
     {
         TBSDK.TBShowToolBar(3, true);
     }
     //HideToolBar
     if (GUI.Button(getRectByNo(16), "HideToolBar"))
     {
         TBSDK.TBHideToolBar();
     }
 }
Пример #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();
        }
    }