Exemplo n.º 1
0
    void OnChapterChanged(int curChapterId)
    {
        ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(curChapterId);

        if (chapterT == null)
        {
            Debug.LogError("章节数据错误id=" + curChapterId);
            return;
        }

        ObjectSelf.GetInstance().SetCurChapterID(mCurChapterId);

        //---------------关卡难度---------
        mDifficutType = EM_STAGE_DIFFICULTTYPE.NORMAL;
        UpdateHardBtnImgs(mDifficutType);
        UpdateDifficults(chapterT);

        //---------------章节------------
        UpdateChapter(chapterT);

        //---------------关卡------------
        //选中当前章节最后一个可以挑战的关卡;
        mCurLevelId = StageModule.GetLastStageIdInTheChapter(chapterT, mDifficutType);

        //----------- 关卡详细描述---------
        UpdateLevelInfo();

        //--------------所有关卡----------
        UpdateLevels(chapterT);
    }
Exemplo n.º 2
0
    void OnDifficultChanged(EM_STAGE_DIFFICULTTYPE difficultType)
    {
        ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(mCurChapterId);

        if (chapterT == null)
        {
            Debug.LogError("章节数据错误id=" + mCurChapterId);
            return;
        }

        ObjectSelf.GetInstance().CurChapterLevel = (int)difficultType;

        UpdateHardBtnImgs(difficultType);

        //---------------关卡------------
        //选中当前章节最后一个可以挑战的关卡;
        mCurLevelId = StageModule.GetLastStageIdInTheChapter(chapterT, difficultType);

        //---------------章节------------
        UpdateChapter(chapterT);

        //-------------关卡详细描述-------
        UpdateLevelInfo();

        //--------------所有关卡---------
        UpdateLevels(chapterT);
    }
Exemplo n.º 3
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);
        }
    }