Esempio n. 1
0
        public EAlly HUnionAllyInit(int unionID, bool isKF)
        {
            EAlly result = EAlly.EFail;

            try
            {
                lock (_Mutex)
                {
                    IAllyService kuaFuService = GetKuaFuService(true);
                    if (null == kuaFuService)
                    {
                        return(result);
                    }

                    DateTime oldTime;
                    if (_unionDic.TryGetValue(unionID, out oldTime))
                    {
                        _unionDic[unionID] = DateTime.Now;
                        return(EAlly.Succ);
                    }

                    try
                    {
                        result = (EAlly)kuaFuService.UnionAllyInit(_ClientInfo.ServerId, unionID, isKF);
                        if (result == EAlly.Succ)
                        {
                            _unionDic.TryAdd(unionID, DateTime.Now);

                            HAllyDataList(unionID, EAllyDataType.Ally);
                            HAllyDataList(unionID, EAllyDataType.Request);
                            HAllyDataList(unionID, EAllyDataType.Accept);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        ResetKuaFuService();
                    }
                }
            }
            catch (System.Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }

            return(result);
        }