Exemple #1
0
        public int SpreadSign(int zoneID, int roleID)
        {
            int result;

            try
            {
                lock (_Mutex)
                {
                    KFSpreadData data;
                    //如果取到数据,证明已经注册说了
                    if (_RoleId2KFSpreadDataDict.TryGetValue(roleID, out data))
                    {
                        return(0);
                    }

                    ISpreadService kuaFuService = GetKuaFuService();
                    if (null == kuaFuService)
                    {
                        return(StdErrorCode.Error_Server_Not_Registed);
                    }

                    try
                    {
                        result = kuaFuService.SpreadSign(_ClientInfo.ServerId, zoneID, roleID);
                        if (result > 0)
                        {
                            KFSpreadData newData = new KFSpreadData();
                            newData.ServerID = _ClientInfo.ServerId;
                            newData.ZoneID   = zoneID;
                            newData.RoleID   = roleID;

                            _RoleId2KFSpreadDataDict.TryAdd(roleID, newData);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        ResetKuaFuService();
                    }
                }
            }
            catch (System.Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }

            return(StdErrorCode.Error_Success);
        }
 public int SpreadSign(int zoneID, int roleID)
 {
     try
     {
         lock (this._Mutex)
         {
             KFSpreadData data;
             if (this._RoleId2KFSpreadDataDict.TryGetValue(roleID, out data))
             {
                 return(0);
             }
             ISpreadService kuaFuService = this.GetKuaFuService(false);
             if (null == kuaFuService)
             {
                 return(-11001);
             }
             try
             {
                 int result = kuaFuService.SpreadSign(this._ClientInfo.ServerId, zoneID, roleID);
                 if (result > 0)
                 {
                     KFSpreadData newData = new KFSpreadData();
                     newData.ServerID = this._ClientInfo.ServerId;
                     newData.ZoneID   = zoneID;
                     newData.RoleID   = roleID;
                     this._RoleId2KFSpreadDataDict.TryAdd(roleID, newData);
                 }
             }
             catch (Exception ex)
             {
                 this.ResetKuaFuService();
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteExceptionUseCache(ex.ToString());
     }
     return(1);
 }