Exemple #1
0
    //刷新所有的levelitem;
    void UpdateLevels(ChapterinfoTemplate chapterT)
    {
        //获取当前章节所有的关卡列表;
        stageDatas = new List <StageTemplate>();
        //章节的所有普通关卡--chapterInfo表中所有的关卡表;
        //主线;
        switch (DifficultType)
        {
        case EM_STAGE_DIFFICULTTYPE.NONE:
            break;

        case EM_STAGE_DIFFICULTTYPE.NORMAL:
            List <StageTemplate> datas1 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.MAIN_QUEST1);
            stageDatas = StageModule.AddList(stageDatas, datas1);
            //支线;
            List <StageTemplate> datas4 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.SIDE_QUEST);
            stageDatas = StageModule.AddList(stageDatas, datas4);
            break;

        case EM_STAGE_DIFFICULTTYPE.HARD:
            List <StageTemplate> datas2 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.MAIN_QUEST2);
            stageDatas = StageModule.AddList(stageDatas, datas2);
            break;

        case EM_STAGE_DIFFICULTTYPE.HARDEST:
            List <StageTemplate> datas3 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.MAIN_QUEST3);
            stageDatas = StageModule.AddList(stageDatas, datas3);
            break;

        default:
            break;
        }
        //章节的特殊关卡;
        SpecialStage ss = ObjectSelf.GetInstance().BattleStageData.GetSpecialStageData();

        if (ss.m_StageID > 0 && (ss.m_BattlePieceNum == mCurChapterId))
        {
            //特殊关卡;
            if (StageModule.IsStageTemplate(ss.m_StageID))
            {
                StageTemplate st = StageModule.GetStageTemplateById(ss.m_StageID);
                stageDatas.Add(st);
            }
            //神秘商店;
            else
            {
                //构造一个神秘商店;
                StageTemplate st = new StageTemplate();
                st.m_stageid        = ss.m_BattlePieceNum; //章节id;
                st.m_mysteriousShop = ss.m_StageID;        //神秘商店表格id;
                st.m_CustomData     = true;
                stageDatas.Add(st);
            }
        }

        int adder = stageDatas.Count - mLevelItems.Count;

        if (adder > 0)
        {
            CreateLevels(adder);
        }

        for (int i = 0; i < mLevelItems.Count; i++)
        {
            if (i >= stageDatas.Count)
            {
                mLevelItems[i].SetTemplateData(null);
            }
            else
            {
                if (stageDatas[i].m_CustomData != null)
                {
                    mLevelItems[i].SetTemplateData(stageDatas[i], EM_STAGE_STAGETYPE.MYSTERIOUS);
                }
                else
                {
                    mLevelItems[i].SetTemplateData(stageDatas[i]);
                }

                mLevelItems[i].SetActive(true);
            }

            //设置选中状态;
            mLevelItems[i].SetSelectState(mCurLevelId);
        }
    }
    //刷新所有的levelitem;
    void UpdateLevels(ChapterinfoTemplate chapterT)
    {
        //获取当前章节所有的关卡列表;
        stageDatas = new List <StageTemplate>();
        //章节的所有普通关卡--chapterInfo表中所有的关卡表;
        //主线;
        switch (DifficultType)
        {
        case EM_STAGE_DIFFICULTTYPE.NONE:
            break;

        case EM_STAGE_DIFFICULTTYPE.NORMAL:
            List <StageTemplate> datas1 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.MAIN_QUEST1);
            stageDatas = StageModule.AddList(stageDatas, datas1);
            //支线;
            List <StageTemplate> datas4 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.SIDE_QUEST);
            stageDatas = StageModule.AddList(stageDatas, datas4);
            break;

        case EM_STAGE_DIFFICULTTYPE.HARD:
            List <StageTemplate> datas2 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.MAIN_QUEST2);
            stageDatas = StageModule.AddList(stageDatas, datas2);
            break;

        case EM_STAGE_DIFFICULTTYPE.HARDEST:
            List <StageTemplate> datas3 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.MAIN_QUEST3);
            stageDatas = StageModule.AddList(stageDatas, datas3);
            break;

        default:
            break;
        }

        int adder = stageDatas.Count - mLevelItems.Count;

        if (adder > 0)
        {
            CreateLevels(adder);
        }

        for (int i = 0; i < mLevelItems.Count; i++)
        {
            if (i >= stageDatas.Count)
            {
                mLevelItems[i].SetTemplateData(null);
            }
            else
            {
                if (stageDatas[i].m_CustomData != null)
                {
                    mLevelItems[i].SetTemplateData(stageDatas[i], EM_STAGE_STAGETYPE.MYSTERIOUS);
                }
                else
                {
                    mLevelItems[i].SetTemplateData(stageDatas[i]);
                }

                mLevelItems[i].SetActive(true);
            }

            //设置选中状态;
            mLevelItems[i].SetSelectState(mCurLevelId);
        }
    }