Exemple #1
0
        public List <AllyData> HAllyDataList(int unionID, EAllyDataType type)
        {
            List <AllyData> list = new List <AllyData>();

            lock (_Mutex)
            {
                ConcurrentDictionary <int, List <AllyData> > dic = null;
                switch (type)
                {
                case EAllyDataType.Ally:
                    dic = _allyDic;
                    break;

                case EAllyDataType.Request:
                    dic = _requestDic;
                    break;

                case EAllyDataType.Accept:
                    dic = _acceptDic;
                    break;
                }

                if (dic.TryGetValue(unionID, out list))
                {
                    return(list);
                }

                IAllyService kuaFuService = GetKuaFuService();
                if (null == kuaFuService)
                {
                    return(list);
                }

                try
                {
                    list = kuaFuService.AllyDataList(_ClientInfo.ServerId, unionID, (int)type);
                    if (list != null)
                    {
                        dic.TryAdd(unionID, list);
                    }
                }
                catch (System.Exception ex)
                {
                    ResetKuaFuService();
                }
            }

            return(list);
        }