예제 #1
0
    void testHttpResp_UI(BaseHttpRequest request, BaseResponse response)
    {
        if (response != null && response.status != BaseResponse.ERROR)
        {
            res = response as PayCountResponse;
            Core.Data.rechargeDataMgr.payData = res.data;
//			CheckFirstRecharge();
            if (UIFirstRechargePanel.GetInstance() != null)
            {
                UIFirstRechargePanel.GetInstance().ShowBtnlabel();
            }
            if (IsFirstRequest)
            {
                IsFirstRequest = false;
                return;
            }
            else
            {
                OpenRechargeUI();
            }
//			if(GetGiftPanelController.Instance != null)
//			{
//				GetGiftPanelController.Instance.BtnBack();
//			}
        }
        else if (response != null && response.status == BaseResponse.ERROR)
        {
            SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getNetworkErrorString(response.errorCode));
//			_RechageStatus = 0;
        }
        ComLoading.Close();
    }
예제 #2
0
//	void CheckFirstRecharge()
//	{
//		if(res != null && res.data != null && res.data.buyCounts != null)
//		{
//			if(res.data.buyCounts.Count == 0)
//			{
//				_RechageStatus = 1;
//				return;
//			}
//		}
//		_RechageStatus = 2;
//	}

    public void CloseAll()
    {
        UIFirstRecharge.GetInstance().Close();
        UIFirstRechargePanel.GetInstance().Close();
        if (_RechargeCallback != null)
        {
            _RechargeCallback();
            _RechargeCallback = null;
            DBUIController.mDBUIInstance.HiddenFor3D_UI();
        }
        else
        {
            DBUIController.mDBUIInstance.ShowFor2D_UI();
        }

        _IsOpenFirstScene = false;
    }
    /*
     * void OnGUI() {
     *      if(GUI.Button(new Rect(0, 0, 100, 100), "test")) {
     *              HttpRequest req = new HttpRequest(RequestType.QUERY_PAY_STATUS, 2001, "ios");
     *              string json = @"{""act"":1002,""data"":{""p"":[{""ppid"":0,""pid"":110052,""num"":120}],""billStatus"":1,""vipStatus"":{""userVip"":1,""totalCach"":600,""toNextLevle"":600,""curStone"":130}}}";
     *              PayStatusResponse resp = fastJSON.JSON.Instance.ToObject<PayStatusResponse>(json);
     *              HttpResp_UI(req, resp);
     *      }
     * } */

    #region 网络返回
    void HttpResp_UI(BaseHttpRequest request, BaseResponse response)
    {
        ComLoading.Close();
        if (response != null && response.status != BaseResponse.ERROR)
        {
            HttpRequest myRequest = (HttpRequest)request;
            switch (myRequest.Type)
            {
            case RequestType.PAY:
                PayResponse payResp = response as PayResponse;
                if (!string.IsNullOrEmpty(payResp.data.orderId))
                {
                    m_strOrderId = payResp.data.orderId;
                    AccountData ad = Native.mInstace.m_thridParty.GetAccountData();
                    ad.payCallback = payResp.data.payCallback;
                    UIDragonMallMgr.GetInstance().mUIDragonRechargeMain.SetCurPayCell(this);
                    OpenThirdPayUI(payResp.data);
                }
                else
                {
                    RED.LogWarning("订单号为null");
                }
                break;

            case RequestType.QUERY_PAY_STATUS:
                PayStatusResponse resp = response as PayStatusResponse;

                RED.Log("收到订单状态:" + resp.data.billStatus);
                if (resp.data.billStatus == 1)                                          //重置成功,展示物品
                {
                    UIDragonMallMgr.GetInstance().mUIDragonRechargeMain.Refresh();
                    CancelInvoke();
                    if (resp.data.p != null)
                    {
                        int length = resp.data.p.Length;
                        for (int i = 0; i < length; i++)
                        {
                            Core.Data.itemManager.AddRewardToBag(resp.data.p[i]);
                            //talking data add by wxl
                            ItemData itemData = Core.Data.itemManager.getItemData(resp.data.p[i].pid);
                            if (itemData != null)
                            {
                                if (m_data != null)
                                {
                                    RechargeData tdata = Core.Data.rechargeDataMgr.GetRechargeData(m_data.ID);
                                    if (tdata != null && tdata.Present2 != null)
                                    {
                                        if (tdata.Present2.Count == 2)
                                        {
                                            Core.Data.ActivityManager.OnChargeSuccess(tdata.Title, tdata.ID.ToString(), tdata.Present2 [0] [1]);
                                        }
                                    }
                                }
                            }
                        }
                    }


                    UIDragonMallMgr mallMgr = UIDragonMallMgr.GetInstance();
                    if (resp.data.vipStatus != null)
                    {
                        Core.Data.playerManager.RTData.curStone = resp.data.vipStatus.curStone;

                        Core.Data.vipManager.vipStatus = resp.data.vipStatus;
                        RED.Log("left rmb:" + resp.data.vipStatus.toNextLevle);
                        int next  = resp.data.vipStatus.toNextLevle / 100;
                        int total = resp.data.vipStatus.totalCach / 100;
                        mallMgr.SeViptPercent(next, total);
                    }

                    mallMgr.mUIDragonRechargeMain.SetCurPayCell(null);
                    if (UIFirstRechargePanel.GetInstance() == null)
                    {
                        DBUIController.mDBUIInstance.RefreshUserInfo();
                    }
                    else
                    {
                        DBUIController.mDBUIInstance.RefreshUserInfoWithoutShow();
                        UIMiniPlayerController.Instance.freshPlayerInfoView();
                    }


                    GetRewardSucUI.OpenUI(resp.data.p, Core.Data.stringManager.getString(5210), true, () => {
                        //点击OK后,出现Vip信息
                        if (resp.data.vipStatus != null)
                        {
                            PlayerManager player = Core.Data.playerManager;
                            int temp             = player.RTData.curVipLevel;
                            int now = resp.data.vipStatus.userVip;
                            player.RTData.curVipLevel = now;
                            UIDragonMallMgr.GetInstance().VipRequest();
                            if (now > temp)
                            {
                                LevelUpUIOther.OpenUI();
                                LevelUpUIOther.mInstance.showVipUpdate(now);
                                SQYMainController.mInstance.RefreshVipLv();
                            }
                        }
                    });
                    //检测是否是 月卡
                    if (m_data.ID == 1)
                    {
                        ActivityNetController.GetInstance().GetMonthStateRequest();
                    }
                    //首充   2是已充已领   1是已充未领
                    if (LuaTest.Instance.OpenFirstCharge)
                    {
                        if (Core.Data.rechargeDataMgr._canGainFirstAward == 0 || Core.Data.rechargeDataMgr._canGainFirstAward == 1 || Core.Data.rechargeDataMgr._canGainFirstAward == -1)
                        {
                            ActivityNetController.GetInstance().GetFirstChargeStateRequest();
                        }
                    }
                }
                else if (resp.data.billStatus == 2)                             //充值成功,订单过期
                {
                    CancelInvoke();
                }
                break;
            }
        }
    }