Example #1
0
        public EAlly HAllyRequest(int unionID, int zoneID, string unionName)
        {
            AllyData result = null;

            try
            {
                lock (_Mutex)
                {
                    if (!VersionIsEqual())
                    {
                        _unionDic.Clear();
                        _allyDic.Clear();
                        _requestDic.Clear();
                        _acceptDic.Clear();

                        _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyStartGameEvent(), (int)_sceneType);
                        return(EAlly.EFail);
                    }

                    IAllyService kuaFuService = GetKuaFuService();
                    if (null == kuaFuService)
                    {
                        return(EAlly.EServer);
                    }

                    try
                    {
                        AllyData d = kuaFuService.AllyRequest(_ClientInfo.ServerId, unionID, zoneID, unionName);
                        if (d.LogState == (int)EAlly.AllyRequestSucc)
                        {
                            List <AllyData> list = null;
                            if (!_requestDic.TryGetValue(unionID, out list))
                            {
                                list = new List <AllyData>()
                                {
                                };
                                _requestDic.TryAdd(unionID, list);
                            }

                            list.Add(d);
                            return((EAlly)d.LogState);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        ResetKuaFuService();
                    }
                }
            }
            catch (System.Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }

            return(EAlly.EAllyRequest);
        }
Example #2
0
 public EAlly HAllyRequest(int unionID, int zoneID, string unionName)
 {
     try
     {
         lock (this._Mutex)
         {
             if (!this.VersionIsEqual())
             {
                 this._unionDic.Clear();
                 this._allyDic.Clear();
                 this._requestDic.Clear();
                 this._acceptDic.Clear();
                 this._CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyStartGameEvent(), 10004);
                 return(EAlly.EFail);
             }
             IAllyService kuaFuService = this.GetKuaFuService(false);
             if (null == kuaFuService)
             {
                 return(EAlly.EServer);
             }
             try
             {
                 AllyData d = kuaFuService.AllyRequest(this._ClientInfo.ServerId, unionID, zoneID, unionName);
                 if (d.LogState == 1)
                 {
                     List <AllyData> list = null;
                     if (!this._requestDic.TryGetValue(unionID, out list))
                     {
                         list = new List <AllyData>();
                         this._requestDic.TryAdd(unionID, list);
                     }
                     list.Add(d);
                     return((EAlly)d.LogState);
                 }
             }
             catch (Exception ex)
             {
                 this.ResetKuaFuService();
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteExceptionUseCache(ex.ToString());
     }
     return(EAlly.EAllyRequest);
 }