protected void SendHttpRequest(RequestType reqType, BaseRequestParam param) { HttpTaskEx task = new HttpTaskEx(UniqueId, ThreadType.MainThread, TaskResponse.Default_Response); task.AppendCommonParam(reqType, param); task.DispatchToRealHandler(); }
/** ****************** Append Get/Post Method's parameter **************** */ public void appendPara(BaseRequestParam reqParam) { _paramMem = reqParam; appendParaBegin(); appendPara(_paramMem.generatePara()); appendParaEnd(); }
public JsonResult SaveCompany(BaseRequestParam param) { IOrganizationService organzeService = IocMvcFactoryHelper.GetInterface <IOrganizationService>(); Common.Data.JsonData json = organzeService.Add(new Organze() { Name = param.Name, Code = param.Code }); return(Json(json)); }
/// <summary> /// 分析副本中的碎片 add by wxl /// </summary> /* public void Analysis(){ * foreach (FloorData fdata in FloorConfigList.Values) { * if (fdata != null) { * if (fdata.isBoss == 1) { * if (!floorAndRewardDic.ContainsKey (fdata.specialRewardID)) { * List<int> floorIdList = new List<int> (); * floorIdList.Add (fdata.ID); * int tId = fdata.specialRewardID; * if (DataCore.getDataType (fdata.specialRewardID) == ConfigDataType.Frag) { * SoulData soulConfig = Core.Data.soulManager.GetSoulConfigByNum (fdata.specialRewardID); * * if (soulConfig != null) { * if (soulConfig.type == (int)ItemType.Monster_Frage) { * tId = soulConfig.updateId; * } * } else { * RED.LogWarning (" soul config is null = " + tId); * continue; * } * * } else if (DataCore.getDataType (fdata.specialRewardID) == ConfigDataType.Monster) { * * tId = fdata.specialRewardID; * } else if (DataCore.getDataType (fdata.specialRewardID) == ConfigDataType.Equip) { * tId = fdata.specialRewardID; * * } else { * RED.Log (" other type id = " + tId); * } * * if (!floorAndRewardDic.ContainsKey (tId)) { * floorAndRewardDic.Add (tId, floorIdList); * } else { * List<int> tList = new List<int> (); * floorAndRewardDic.TryGetValue (tId, out tList); * floorAndRewardDic.Remove (tId); * tList.Add (fdata.ID); * floorAndRewardDic.Add (tId, tList); * * } * } else { * List<int> tList = new List<int> (); * floorAndRewardDic.TryGetValue (fdata.specialRewardID, out tList); * floorAndRewardDic.Remove (fdata.specialRewardID); * tList.Add (fdata.ID); * floorAndRewardDic.Add (fdata.specialRewardID, tList); * } * } * } * } * } */ /// <summary> /// 通过宠物或者装备id获得关卡id maybe equip ,frag and monster /// </summary> /// <returns>The floor id by giftid</returns> /// <param name="giftId">Gift identifier.</param> // public List<int> GetFloorIdByGiftId(int giftId){ // List<int> targetId =new List<int>(); // if(giftId != 0){ // // if(floorAndRewardDic.TryGetValue(giftId,out targetId)){ // return targetId; // } // } // return targetId; // } #region 更新地下城状态 public void OnFinishFloor(BaseHttpRequest request, BaseResponse response) { Utils.Assert(request == null, "Request is null."); if (response.status == BaseResponse.ERROR) { return; } if (request.baseType == BaseHttpRequestType.Common_Http_Request) { HttpRequest req = request as HttpRequest; if (req != null) { BaseRequestParam param = req.ParamMem; BattleResponse res = response as BattleResponse; if (param != null) { bool isWin = false; BattleParam bp = param as BattleParam; if (res != null) { if (res.status != BaseResponse.ERROR) { isWin = System.Convert.ToBoolean(res.data.battleData.retCode); isBossOfLastFloor = true; } } else { /*没有返回结果说明是小关(小关100%成功)*/ isWin = true; isBossOfLastFloor = false; } #region 测试代码 //isWin=false; #endregion this.isWinOfLastFloor = isWin; if (bp != null) { OnFinishFloor(bp.doorId, isWin); } } } } }
public void AppendCommonParam(RequestType requestType, BaseRequestParam param, string url) { if (task != null) { // Debug.Log(">>>>>>>>>>>>>>>>>>>>>"); this.request = HttpRequestFactory.createHttpRequestInstance(requestType, param); request.Url = url; // Debug.Log(param.generatePara()); string data = param.generatePara(); //{"gameid":1,"version":"1.0","md5":"FC9387A064E004309239851A9E5864E3"} url = url + "?" + GetFormatData(data); task.AppendThirdParam(ThirdPartyRequestType.CMS, url); task.ErrorOccured += testHttpResp_Error; task.afterCompleted += testHttpResp_Sucess; } }
public void OnFailToWar(BaseHttpRequest request) { Utils.Assert(request == null, "Request is null"); if (request.baseType == BaseHttpRequestType.Common_Http_Request) { HttpRequest req = request as HttpRequest; if (req != null) { BaseRequestParam param = req.ParamMem; if (param != null) { BattleParam bp = param as BattleParam; if (bp != null) { FailToWar(bp.doorId); } } } } }
public static SocketRequest createHttpRequestInstance(RequestType type, BaseRequestParam reqParam) { SocketRequest req = new SocketRequest(type, swInfo, Convert.ToString(platformId)); if (reqParam != null && Enum.IsDefined(typeof(RequestType), type)) { RelationShipReqAndResp preDef = PreDefined[type]; if (preDef != null) { req.setParameter(SocketRequest.ACTION, preDef.requestAction); req.appendPara(reqParam); } else { throw new DragonException("Dictionary PreDefined is not defined."); } } else { throw new DragonException(DragonException.Exception_Message[DragonException.INVALIDATE_ARGUMENT]); } return(req); }
/*点击BOSS关卡<执行>按钮后服务器返回的数据 * */ void BattleResponseFUC(BaseHttpRequest request, BaseResponse response) { ComLoading.Close(); if (response != null) { TemporyData temp = Core.Data.temper; if (response.status != BaseResponse.ERROR) { BattleResponse r = response as BattleResponse; ClientBattleResponse resp = response as ClientBattleResponse; if (r != null) { if (r != null && r.data != null && r.data.reward != null && r.data.sync != null) { Core.Data.playerManager.RTData.curVipLevel = r.data.sync.vip; } r.data.battleData.rsty = null; r.data.battleData.rsmg = null; temp.warBattle = r.data; temp.currentBattleType = TemporyData.BattleType.BossBattle; HttpRequest req = request as HttpRequest; BaseRequestParam param = req.ParamMem; //BattleResponse res = response as BattleResponse; BattleParam bp = param as BattleParam; FloorData floorD = Core.Data.dungeonsManager.getFloorData(bp.doorId); if (r.data.battleData.iswin == 1) { if (floorD != null) { Core.Data.ActivityManager.OnMissionComplete(floorD.name); } } else { if (floorD != null) { Core.Data.ActivityManager.OnMissionFail(floorD.name); } } if (bp.flag == 1) { //add by wxl Core.Data.ActivityManager.OnPurchaseVirtualCurrency(ActivityManager.ChapterType, 1, 10); } } if (resp != null) { temp.currentBattleType = TemporyData.BattleType.BossBattle; temp.clientDataResp = resp; #if LOCAL_AUTO temp.Open_StepMode = false; #else temp.Open_StepMode = true; #endif temp.Open_LocalWarMode = true; HttpRequest req = request as HttpRequest; if (req != null) { ClientBattleParam param = req.ParamMem as ClientBattleParam; if (param != null) { temp.clientReqParam = param; } } } Core.Data.deblockingBuildMgr.mFloorRecord = Core.Data.newDungeonsManager.lastFloorId; //跳转至Ban 的场景 JumpToBattleView(); } else { if (response.errorCode == 4002) { JCRestoreEnergyMsg.OpenUI(110015, 110016); } else { ErrorDeal(response.errorCode); } } } }
/* * This is for creating Common Http Task */ public virtual void AppendCommonParam(RequestType requestType, BaseRequestParam param) { this.request = HttpRequestFactory.createHttpRequestInstance(requestType, param); this.relation = HttpRequestFactory.getRelationShip(requestType); this.OutFilter.request = requestType; }
/* * This is for creating Common Socket Task */ public void AppendCommonParam(RequestType requestType, BaseRequestParam param) { this.request = SocketRequestFactory.createHttpRequestInstance(requestType, param); this.relation = SocketRequestFactory.getRelationShip(requestType); }