예제 #1
0
    public override void InitUIView()
    {
        base.InitUIView();

        ObjectSelf.GetInstance().SetIsPrompt(false);

        //ChapterinfoTemplate ct = DataTemplate.GetInstance().GetChapterTemplateByStageID(1310381000);
        /////
        /////当前所打关卡没有解锁新关卡时,从战斗结算界面回到关卡选择界面时,选中的关卡仍为之前所打的那关,
        /////当前关卡打完后有新关卡解锁,返回关卡选择界面就跳到下一关(困难难度一样如此),若同时解锁了两个
        /////关卡(主线和支线),返回关卡选择界面选中主线关
        /////
        if (NeedSpecialStage)
        {
            InitLevelId = ObjectSelf.GetInstance().BattleStageData.GetSpecialStageData().m_StageID;
        }
        else
        {
            List <int> newStages = ObjectSelf.GetInstance().BattleStageData.GetNewStageList();

            if (newStages != null && newStages.Count > 0)
            {
                DisplayNormal();
            }
            else
            {
                if (ObjectSelf.GetInstance().CurStageID > 0 && StageModule.IsStageLevelById(ObjectSelf.GetInstance().CurStageID))
                {
                    InitLevelId = ObjectSelf.GetInstance().CurStageID;
                }
                else
                {
                    DisplayNormal();
                }
            }
        }

        if (InitLevelId <= 0)
        {
            if (InitChapterId <= 0)
            {
                DisplayNormal();
            }
            else
            {
                ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(InitChapterId);
                if (chapterT == null)
                {
                    DisplayNormal();
                }
                else
                {
                    mDifficutType = EM_STAGE_DIFFICULTTYPE.NORMAL;
                    mCurChapterId = InitChapterId;
                    mCurLevelId   = StageModule.GetLastStageIdInTheChapter(chapterT, mDifficutType);
                }
            }
        }
        else
        {
            StageTemplate stageT = StageModule.GetStageTemplateById(InitLevelId);
            if (stageT == null)
            {
                DisplayNormal();
            }
            else
            {
                mDifficutType = StageModule.GetStageDifficultType(stageT);
                mCurLevelId   = InitLevelId;
                int chapterId = DataTemplate.GetInstance().GetChapterIdByStageT(stageT);
                if (chapterId == -1)
                {
                    Debug.LogError("关卡stageid找不到对应的章节id,stageid=" + InitLevelId);
                }
                else
                {
                    mCurChapterId = chapterId;
                }
            }
        }
        OnNewMapOpenShow();
        Sprite inst = UIResourceMgr.LoadSprite(common.defaultPath + "Ui_guanqiabeijing");

        Dictionary <int, BattleStage> .KeyCollection keycoll = TotalCharpter.Keys;
        foreach (int chapterid in keycoll)
        {
            if (chapterid != 1001)
            {
                ChapterinfoTemplate info = StageModule.GetChapterinfoTemplateById(chapterid);
                if (info != null)
                {
                    //var info = (ChapterinfoTemplate)DataTemplate.GetInstance().m_ChapterTable.getTableData(chapterid);
                    //var info = (ChapterinfoTemplate)table[chapterid];
                    Sprite     pic  = UIResourceMgr.LoadSprite(common.defaultPath + info.getBackgroundPicture());
                    GameObject item = new GameObject("background");
                    if (pic != null)
                    {
                        item.AddComponent <Image>().sprite = Instantiate(pic, Vector3.zero, Quaternion.identity) as Sprite;
                    }
                    else
                    {
                        item.AddComponent <Image>().sprite = Instantiate(inst, Vector3.zero, Quaternion.identity) as Sprite;
                    }
                    item.transform.SetParent(mBgTrans, false);
                }
            }
        }

        Init();

        // 新手引导 100302
        if (GuideManager.GetInstance().isGuideUser&& GuideManager.GetInstance().IsContentGuideID(100302) == false)
        {
            GuideManager.GetInstance().ShowGuideWithIndex(100302);
        }
    }