//发送修改个人信息消息
    void SendChangeUserInfoMsg(ChangeUserInfoParam param)
    {
        HttpTask task = new HttpTask(ThreadType.MainThread, TaskResponse.Default_Response);

        task.AppendCommonParam(RequestType.CHANGE_USERINFO, param);

        task.ErrorOccured   += testHttpResp_Error;
        task.afterCompleted += testHttpResp_UI;

        //then you should dispatch to a real handler
        task.DispatchToRealHandler();
        ComLoading.Open();
    }
Esempio n. 2
0
    public void ChangeUserInfo(BaseHttpRequest req, BaseResponse response)
    {
        if (response != null && response.status != BaseResponse.ERROR)
        {
            HttpRequest         request = req as HttpRequest;
            ChangeUserInfoParam param   = request.ParamMem as ChangeUserInfoParam;

            ChangeUserInfoResponse resp = response as ChangeUserInfoResponse;
            if (param.type == 2)
            {
                Core.Data.playerManager.RTData.nickName  = param.param;
                Core.Data.playerManager.RTData.curStone += resp.data.stone;
            }
            else if (param.type == 1)
            {
                Core.Data.playerManager.RTData.headID = int.Parse(param.param);
            }
        }
    }
    void testHttpResp_Error(BaseHttpRequest request, string error)
    {
        ConsoleEx.DebugLog("---- Http Resp - Error has ocurred." + error);
        HttpRequest rq = request as HttpRequest;

        switch (rq.Type)
        {
        case RequestType.CHANGE_USERINFO:
        {
            HttpRequest         req   = request as HttpRequest;
            ChangeUserInfoParam param = req.ParamMem as ChangeUserInfoParam;

            if (param.type == 1)
            {
                Destroy(this.gameObject);
            }
            break;
        }
        }
    }
    void testHttpResp_UI(BaseHttpRequest request, BaseResponse response)
    {
        ComLoading.Close();
        if (response.status != BaseResponse.ERROR)
        {
            HttpRequest rq = request as HttpRequest;
            switch (rq.Type)
            {
            case RequestType.CHANGE_USERINFO:
            {
                HttpRequest         req   = request as HttpRequest;
                ChangeUserInfoParam param = req.ParamMem as ChangeUserInfoParam;
                //add by  wxl talkingdata
                if (param.type == 2)
                {
                    Core.Data.ActivityManager.OnPurchaseVirtualCurrency(ActivityManager.ChangeInfoType, 1, COST_STONE);
                }


                DBUIController.mDBUIInstance.RefreshUserInfo();
                if (param.type == 2)
                {
                    lal_Name.text = param.param;
                }
                else if (param.type == 1)
                {
                    Core.Data.playerManager.RTData.headID = int.Parse(param.param);
                    Destroy(this.gameObject);
                }
                break;
            }
            }
        }
        else
        {
            SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getNetworkErrorString(response.errorCode));
        }
    }