public int HuanYingSiYuanSignUp(string userId, int roleId, int zoneId, int gameType, int groupIndex, int zhanDouLi) { int result2; if (string.IsNullOrEmpty(userId) || roleId <= 0) { result2 = -20; } else { userId = userId.ToUpper(); int count = Interlocked.Increment(ref this.CurrentRequestCount); try { if (count < this.MaxRequestCount) { lock (this.Mutex) { KuaFuRoleData kuaFuRoleData; if (this.RoleId2RoleDataDict.TryGetValue(roleId, out kuaFuRoleData)) { if (kuaFuRoleData.ServerId != this.ClientInfo.ServerId) { return(-11); } } } IKuaFuService kuaFuService = this.GetKuaFuService(false); if (null == kuaFuService) { return(-11001); } try { IGameData huanYingSiYuanGameData = new IGameData { ZhanDouLi = zhanDouLi }; int result = kuaFuService.RoleSignUp(this.ClientInfo.ServerId, userId, zoneId, roleId, gameType, groupIndex, huanYingSiYuanGameData); } catch (Exception ex) { this.ResetKuaFuService(); } } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } finally { Interlocked.Decrement(ref this.CurrentRequestCount); } result2 = 1; } return(result2); }
/// <summary> /// 匹配报名 /// </summary> /// <param name="userId"></param> /// <param name="roleId"></param> /// <param name="zoneId"></param> /// <param name="gameType"></param> /// <param name="groupIndex"></param> /// <returns></returns> public int HuanYingSiYuanSignUp(string userId, int roleId, int zoneId, int gameType, int groupIndex, int zhanDouLi) { int result; if (string.IsNullOrEmpty(userId) || roleId <= 0) { return(StdErrorCode.Error_Not_Exist); } userId = userId.ToUpper(); int count = Interlocked.Increment(ref CurrentRequestCount); try { if (count < MaxRequestCount) { lock (Mutex) { KuaFuRoleData kuaFuRoleData; if (RoleId2RoleDataDict.TryGetValue(roleId, out kuaFuRoleData)) { //如果服务器ID不同,表明是跨服登录角色,不应该在此报名 if (kuaFuRoleData.ServerId != ClientInfo.ServerId) { return(StdErrorCode.Error_Operation_Faild); } } } IKuaFuService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { HuanYingSiYuanGameData huanYingSiYuanGameData = new HuanYingSiYuanGameData() { ZhanDouLi = zhanDouLi }; result = kuaFuService.RoleSignUp(ClientInfo.ServerId, userId, zoneId, roleId, gameType, groupIndex, huanYingSiYuanGameData); } catch (System.Exception ex) { ResetKuaFuService(); } } else { return(StdErrorCode.Error_Server_Not_Registed); } } } catch (System.Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } finally { Interlocked.Decrement(ref CurrentRequestCount); } return(StdErrorCode.Error_Success); }