void Init() { ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(mCurChapterId); if (chapterT == null) { Debug.LogError("章节数据错误id=" + mCurChapterId); return; } UpdateHardBtnImgs(mDifficutType); //---------------------关卡难度----------------------- //m_normal.isOn = true; UpdateDifficults(chapterT); //---------------------章节-------------------------- UpdateChapter(chapterT); //--------------------- 关卡详细描述------------------- UpdateLevelInfo(); //---------------------所有关卡----------------------- UpdateLevels(chapterT); m_MapScroll.setIdx(mCurChapterId - 1); //特殊关卡计时; //if (ObjectSelf.GetInstance().BattleStageData.m_IsOpenSpecialStage) //{ // m_SpecialStageTime = ObjectSelf.GetInstance().BattleStageData.m_SpecialStage.m_Time; // m_CountDownObject.SetActive(true); // //m_CountDownText.text = string.Format("剩余时间:{0}:{1}", m_SpecialStageTime / 60, m_SpecialStageTime % 60); //} //else //{ // m_CountDownObject.SetActive(false); //} //// 新手引导相关--- 开启支线关卡 if (ObjectSelf.GetInstance().m_isOpenZhiXian) { for (int i = 0; i < stageDatas.Count; i++) { if (StageModule.GetStageType(stageDatas[i]) == EM_STAGE_TYPE.SIDE_QUEST) { OnLevelItemClick(stageDatas[i].m_stageid); } } } //新手引导 关卡选择 强制点击返回第一章 if (ObjectSelf.GetInstance().m_isOpenPerfectReward) { OnClickbackpoint(); } }
void Init() { ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(mCurChapterId); if (chapterT == null) { Debug.LogError("章节数据错误id=" + mCurChapterId); return; } UpdateHardBtnImgs(mDifficutType); //---------------------关卡难度----------------------- //m_normal.isOn = true; UpdateDifficults(chapterT); //---------------------章节-------------------------- UpdateChapter(chapterT); //---------------------所有关卡----------------------- UpdateLevels(chapterT); //// 新手引导相关--- 开启支线关卡 if (ObjectSelf.GetInstance().m_isOpenZhiXian) { for (int i = 0; i < stageDatas.Count; i++) { if (StageModule.GetStageType(stageDatas[i]) == EM_STAGE_TYPE.SIDE_QUEST) { OnLevelItemClick(stageDatas[i].m_stageid); } } } //新手引导 关卡选择 强制点击返回第一章 if (ObjectSelf.GetInstance().m_isOpenPerfectReward) { OnClickbackpoint(); } }
public void SetTemplateData(StageTemplate data, EM_STAGE_STAGETYPE flag = EM_STAGE_STAGETYPE.NONE) { mStageT = data; if (data == null) { mGo.SetActive(false); return; } //如果是神秘商店特殊处理; if (flag == EM_STAGE_STAGETYPE.MYSTERIOUS) { m_TitleTxt.text = ""; mStarsImg[0].gameObject.SetActive(false); mStarsImg[1].gameObject.SetActive(false); mStarsImg[2].gameObject.SetActive(false); mIsNewImg.gameObject.SetActive(false); //这里data.m_stageid存的是场景id; ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(data.m_stageid); float[] val = chapterT.getShopposition(); Vector2 pos1 = new Vector2(val[0], val[1]); mGo.transform.localPosition = pos1; return; } //不是神秘商店另外处理; int chapterId = DataTemplate.GetInstance().GetChapterIdByStageT(data); EM_STAGE_TYPE type = StageModule.GetStageType(data); switch (type) { case EM_STAGE_TYPE.MAIN_QUEST1: case EM_STAGE_TYPE.MAIN_QUEST2: case EM_STAGE_TYPE.MAIN_QUEST3: //m_TitleTxt.text = string.Format("{0}-{1}", chapterId, StageModule.GetStageNumInChapter(data)); m_TitleTxt.text = StageModule.GetStageNumInChapter(data).ToString(); break; case EM_STAGE_TYPE.SIDE_QUEST: m_TitleTxt.text = GameUtils.getString("stage_type_branch"); break; //case EM_STAGE_TYPE.SPEC_QUEST: // break; //case EM_STAGE_TYPE.ACTIVE_QUEST_DIJING: // break; //case EM_STAGE_TYPE.ACTIVE_QUEST_YANLONG: // break; //case EM_STAGE_TYPE.LIMIT_TEST: // break; //case EM_STAGE_TYPE.BOSS_SHOUWANGZHE: // break; //case EM_STAGE_TYPE.BOSS_CHUANSHUO: // break; default: m_TitleTxt.text = ""; break; } //位置; Vector2 pos = new Vector2(data.getStageiconposition()[0], data.getStageiconposition()[1]); mGo.transform.localPosition = pos; m_Icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + data.m_stageicon); m_Icon.SetNativeSize(); float delta = (float)(data.getStageIconScale()) / 100f; m_Icon.transform.localScale = Vector3.one * delta; //是否已开启; if (ObjectSelf.GetInstance().BattleStageData.IsStageOpen(data.m_stageid)) { GameUtils.SetBtnSpriteGrayState(m_IconBtn, false); //星星; int starNum = 0; if (ObjectSelf.GetInstance().BattleStageData.IsCopyScenePass(data.m_stageid, out starNum)) { for (int i = 0; i < MaxStars; i++) { mStarsImg[i].gameObject.SetActive(false); } //switch (starNum) //{ // case 0: // mStarsImg[0].gameObject.SetActive(false); // mStarsImg[1].gameObject.SetActive(false); // mStarsImg[2].gameObject.SetActive(false); // break; // case 1: // mStarsImg[0].gameObject.SetActive(true); // mStarsImg[1].gameObject.SetActive(false); // mStarsImg[2].gameObject.SetActive(false); // break; // case 2: // mStarsImg[0].gameObject.SetActive(false); // mStarsImg[1].gameObject.SetActive(true); // mStarsImg[2].gameObject.SetActive(true); // break; // case 3: // mStarsImg[0].gameObject.SetActive(true); // mStarsImg[1].gameObject.SetActive(true); // mStarsImg[2].gameObject.SetActive(true); // break; // default: // mStarsImg[0].gameObject.SetActive(false); // mStarsImg[1].gameObject.SetActive(false); // mStarsImg[2].gameObject.SetActive(false); // break; //} if (starNum > 0 && starNum <= 3) { mStarsImg[starNum - 1].gameObject.SetActive(true); } } else { mStarsImg[0].gameObject.SetActive(false); mStarsImg[1].gameObject.SetActive(false); mStarsImg[2].gameObject.SetActive(false); } } else { GameUtils.SetBtnSpriteGrayState(m_IconBtn, true); mStarsImg[0].gameObject.SetActive(false); mStarsImg[1].gameObject.SetActive(false); mStarsImg[2].gameObject.SetActive(false); } //是否限制次数关卡; if (data.m_limittime > 0) { StageData sd = ObjectSelf.GetInstance().BattleStageData.GetStageDataByStageId(data.m_stageid); int useTimes = sd == null ? 0 : sd.m_FightSum; mRemindTimes.text = (data.m_limittime - useTimes).ToString(); mRemindTitle.gameObject.SetActive(true); } else { mRemindTitle.gameObject.SetActive(false); } //是否是新开启的关卡; UpdateIsNew(); }