//初始化表格数据
    public void InitByTable()
    {
        //先加入总览按钮
        {
            var newCatalog = new AchievementSummaryBtnDataModel();
            newCatalog.Title  = GameUtils.GetDictionaryText(300834);
            newCatalog.TypeId = -1;
            DataModel.Catalog.Add(newCatalog);
        }

        //遍历表格分类
        Table.ForeachAchievement(table =>
        {
            //-1类型的是大类,不是成就数据
            if (-1 == table.Type)
            {
                //左侧分类按钮列表
                var newCatalog    = new AchievementSummaryBtnDataModel();
                newCatalog.Title  = table.Name;
                newCatalog.TypeId = table.Id;
                DataModel.Catalog.Add(newCatalog);

                //成就大类列表
                var newSummary    = new AchievementSummaryItemDataModel();
                newSummary.Title  = table.Name;
                newSummary.TypeId = table.Id;
                DataModel.Summary.Add(newSummary);

                return(true);
            }

            //该成就的分类
            var summary = DataModel.Summary[table.Type];
            summary.TotalNum++;


            {
//分析表格,根据类型缓存表格数据
                List <AchievementRecord> list = null;
                if (!mAnalyzeTable.TryGetValue(table.Type, out list))
                {
                    list = new List <AchievementRecord>();
                    mAnalyzeTable.Add(table.Type, list);
                }
                list.Add(table);
            }


            {
//缓存扩展数据所影响的成就
                if (-1 != table.Exdata)
                {
                    var list = new List <AchievementRecord>();
                    if (!mExtDataDic.TryGetValue(table.Exdata, out list))
                    {
                        list = new List <AchievementRecord>();
                        mExtDataDic.Add(table.Exdata, list);
                    }

                    list.Add(table);
                }
            }

            {
//缓存标记位影响哪些成就
                List <AchievementRecord> list = null;
                var flagId = table.RewardFlagId;
                if (-1 != flagId)
                {
                    if (!mFlagDataDic.TryGetValue(flagId, out list))
                    {
                        list = new List <AchievementRecord>();
                        mFlagDataDic.Add(flagId, list);
                    }
                    list.Add(table);
                }

                flagId = table.FinishFlagId;
                if (-1 != flagId)
                {
                    if (!mFlagDataDic.TryGetValue(flagId, out list))
                    {
                        list = new List <AchievementRecord>();
                        mFlagDataDic.Add(flagId, list);
                    }
                    list.Add(table);
                }

                flagId = table.ClientDisplay;
                if (-1 != flagId)
                {
                    if (!mFlagDataDic.TryGetValue(flagId, out list))
                    {
                        list = new List <AchievementRecord>();
                        mFlagDataDic.Add(flagId, list);
                    }
                    list.Add(table);
                }
            }

            {
//缓存等级影响哪些成就
                List <AchievementRecord> list = null;
                var level = table.ViewLevel;
                if (-1 != level)
                {
                    if (!mLevelDic.TryGetValue(level, out list))
                    {
                        list = new List <AchievementRecord>();
                        mLevelDic.Add(level, list);
                    }
                    list.Add(table);
                }
            }

            mTotalAchievement++;

            return(true);
        });
    }
示例#2
0
        //初始化表格数据
        private void InitialTableData()
        {
            //先加入总览按钮
            {
                var _newCatalog = new AchievementSummaryBtnDataModel();
                _newCatalog.Title  = GameUtils.GetDictionaryText(300834);
                _newCatalog.TypeId = -1;
                m_DataModel.Catalog.Add(_newCatalog);
            }

            //遍历表格分类
            var showDict = new Dictionary <int, AchievementSummaryItemDataModel>();

            Table.ForeachAchievement(table =>
            {
                if (table.ViewLevel >= 999)
                {
                    return(true);
                }
                //-1类型的是大类,不是成就数据
                if (-1 == table.Type)
                {
                    if (table.Id == eraAchievementType)
                    {
                        return(true);
                    }

                    //左侧分类按钮列表
                    var _newCatalog    = new AchievementSummaryBtnDataModel();
                    _newCatalog.Title  = table.Name;
                    _newCatalog.TypeId = table.Id;
                    m_DataModel.Catalog.Add(_newCatalog);

                    //成就大类列表
                    var _newSummary    = new AchievementSummaryItemDataModel();
                    _newSummary.Title  = table.Name;
                    _newSummary.TypeId = table.Id;
                    _newSummary.IconId = table.Icon;
                    m_DataModel.Summary.Add(_newSummary);

                    showDict[_newSummary.TypeId] = _newSummary;

                    return(true);
                }

                //该成就的分类
                AchievementSummaryItemDataModel _summary;
                if (!showDict.TryGetValue(table.Type, out _summary))
                {
                    return(true);
                }
                //var _summary = m_DataModel.Summary[table.Type];
                _summary.TotalNum++;


                {
                    //分析表格,根据类型缓存表格数据
                    List <AchievementRecord> _list = null;
                    if (!m_dicAnalyzeTable.TryGetValue(table.Type, out _list))
                    {
                        _list = new List <AchievementRecord>();
                        m_dicAnalyzeTable.Add(table.Type, _list);
                    }
                    _list.Add(table);
                }


                {
                    //缓存扩展数据所影响的成就
                    if (-1 != table.Exdata)
                    {
                        var _list = new List <AchievementRecord>();
                        if (!m_dicExtDataDic.TryGetValue(table.Exdata, out _list))
                        {
                            _list = new List <AchievementRecord>();
                            m_dicExtDataDic.Add(table.Exdata, _list);
                        }

                        _list.Add(table);
                    }
                }

                {
                    //缓存标记位影响哪些成就
                    List <AchievementRecord> _list = null;
                    var _flagId = table.RewardFlagId;
                    if (-1 != _flagId)
                    {
                        if (!m_dicFlagDataDic.TryGetValue(_flagId, out _list))
                        {
                            _list = new List <AchievementRecord>();
                            m_dicFlagDataDic.Add(_flagId, _list);
                        }
                        _list.Add(table);
                    }

                    _flagId = table.FinishFlagId;
                    if (-1 != _flagId)
                    {
                        if (!m_dicFlagDataDic.TryGetValue(_flagId, out _list))
                        {
                            _list = new List <AchievementRecord>();
                            m_dicFlagDataDic.Add(_flagId, _list);
                        }
                        _list.Add(table);
                    }

                    _flagId = table.ClientDisplay;
                    if (-1 != _flagId)
                    {
                        if (!m_dicFlagDataDic.TryGetValue(_flagId, out _list))
                        {
                            _list = new List <AchievementRecord>();
                            m_dicFlagDataDic.Add(_flagId, _list);
                        }
                        _list.Add(table);
                    }
                }

                {
                    //缓存等级影响哪些成就
                    List <AchievementRecord> _list = null;
                    var _level = table.ViewLevel;
                    if (-1 != _level)
                    {
                        if (!m_dicLevelDic.TryGetValue(_level, out _list))
                        {
                            _list = new List <AchievementRecord>();
                            m_dicLevelDic.Add(_level, _list);
                        }
                        _list.Add(table);
                    }
                }

                mTotalAchievement++;

                return(true);
            });
        }