Exemplo n.º 1
0
        public bool ShowNotice(EraInfo info)
        {
            if (info == null)
            {
                return(false);
            }

            return((info.State == EraState.Finish || info.State == EraState.PlayAnim || info.State == EraState.PlayAnimEnd) &&
                   info.TakeAward == false);
        }
Exemplo n.º 2
0
        //获取元素状态
        private EraState GetState(EraInfo eraInfo)
        {
            if (eraInfo == null || eraInfo.Record == null)
            {
                return(EraState.Finish);
            }

            var tbMayaBase = eraInfo.Record;

            if (tbMayaBase.ActiveType == (int)EraActiveType.Mission)
            {
                //播放动画
                if (tbMayaBase.Id == PlayAnimEraId)
                {
                    return(EraState.PlayAnim);
                }

                //正在进行
                if (tbMayaBase.Id == CurrentEraId)
                {
                    return(EraState.OnGoing);
                }

                //完成
                var finish = PlayerDataManager.Instance.GetFlag(tbMayaBase.FinishFlagId);
                if (finish)
                {
                    return(EraState.Finish);
                }
                return(EraState.NotStart);
            }

            //条件
            if (tbMayaBase.ActiveType == (int)EraActiveType.Condition)
            {
                var finish = PlayerDataManager.Instance.GetFlag(tbMayaBase.FinishFlagId);
                if (finish)
                {
                    return(EraState.Finish);
                }
                return(EraState.NotStart);
            }
            return(EraState.Finish);
        }
Exemplo n.º 3
0
        public void Init()
        {
            currentEraId = -1;
            preEraIdDict.Clear();
            missionIdEraDict.Clear();
            pageInfoDict.Clear();
            catalogPageOffset.Clear();
            flagEraDict.Clear();
            eraInfoDict.Clear();

            var typeCountDict = new Dictionary <int, int>();

            var lastId = -1;

            Table.ForeachMayaBase(record =>
            {
                int oldCount = 0;
                if (!typeCountDict.TryGetValue(record.Type, out oldCount))
                {
                }
                typeCountDict[record.Type] = oldCount + 1;

                var info               = new EraInfo();
                info.Order             = typeCountDict[record.Type] - 1;
                info.Record            = record;
                eraInfoDict[record.Id] = info;

                if (record.ActiveType == (int)EraActiveType.Mission)
                {
                    if (record.ActiveParam[0] >= 0)
                    {
                        missionIdEraDict[record.ActiveParam[0]] = record;
                    }
                }

                if (record.FunBenId >= 0)
                {
                    fubenIdEraDict[record.FunBenId] = info;
                }

                //元素标记位Dic
                if (record.FinishFlagId > 0)
                {
                    flagEraDict[record.FinishFlagId] = info;
                }

                List <EraInfo> infoList;
                if (!typeInfo.TryGetValue(record.Type, out infoList))
                {
                    infoList = new List <EraInfo>();
                    typeInfo[record.Type]   = infoList;
                    typeNotice[record.Type] = false;
                }
                infoList.Add(info);

                preEraIdDict[record.Id] = lastId;
                lastId = record.Id;

                return(true);
            });


            // ---------------- UI显示相关 -------------------------
            var titleUse         = 1;
            var totalContentPage = 0;                            //内容页

            totalCatalogPage = 0;                                //导航页
            var typePageCount     = new Dictionary <int, int>(); // 各个类型目录占用的页数 //0=1  1 = 1
            var contentPageOffset = new Dictionary <int, int>(); //内容页偏移  //0=0  1=10

            for (var i = 0; i < typeCountDict.Count; ++i)
            {
                var count = typeCountDict[i];
                onePageCount     = count;
                typePageCount[i] = count / onePageCount;
                //typePageCount[i] = (int)Math.Ceiling((double)(titleUse + count) / onePageCount);
                if (i > 0)
                {
                    catalogPageOffset[i] = typePageCount[i] + typeCountDict[i - 1];
                    contentPageOffset[i] = contentPageOffset[i - 1] + typeCountDict[i - 1];
                }
                else
                {
                    catalogPageOffset[i] = 0;
                    contentPageOffset[i] = 0;
                }

                totalCatalogPage += typePageCount[i]; //导航页 1+1 = 2
                totalContentPage += count;            //内容页 10+9 = 19
            }

            totalPage = totalCatalogPage + totalContentPage; //21

            // 刷新当前所在的页数及点击前往的页数
            var enumorator1 = eraInfoDict.GetEnumerator();

            while (enumorator1.MoveNext())
            {
                var eraValue   = enumorator1.Current.Value;
                var pageOffset = catalogPageOffset[eraValue.Record.Type];// 0=0  1 = 1

                onePageCount      = typeCountDict[eraValue.Record.Type];
                eraValue.Page     = pageOffset + eraValue.Order / onePageCount;
                eraValue.GotoPage = totalCatalogPage + catalogPageOffset[eraValue.Record.Type] + eraValue.Order - 1; //contentPageOffset[eraValue.Record.Type]
                PageInfo pageInfo;
                if (!pageInfoDict.TryGetValue(eraValue.Page, out pageInfo))
                {
                    pageInfo                    = new PageInfo();
                    pageInfo.Type               = 0;
                    pageInfo.ShowTitle          = ((eraValue.Order + titleUse) < onePageCount);
                    pageInfoDict[eraValue.Page] = pageInfo;
                }
                pageInfoDict[eraValue.Page].eraList.Add(eraValue);

                pageInfo           = new PageInfo();
                pageInfo.ShowTitle = false;
                pageInfo.Type      = 1;
                pageInfo.eraList.Add(eraValue);
                pageInfoDict[eraValue.GotoPage] = pageInfo;
            }
        }