public void Init(Hotfix_LT.Data.LostMainChapterTemplate data) { m_ChapterData = data; mDMono.transform.name = m_ChapterData.Id; chapterId = int.Parse(m_ChapterData.Id); newChapterFX.CustomSetActive(false); ContainerObj.CustomSetActive(true); BGSprite.spriteName = m_ChapterData.Icon; if (m_ChapterData.IsBoxRewardType()) { InfoObj.CustomSetActive(false); BoxTipObj.CustomSetActive(true); PerfectObj.CustomSetActive(false); int mForwardChapterId = 0; int.TryParse(m_ChapterData.ForwardChapterId, out mForwardChapterId); BoxLabel.text = string.Format(EB.Localizer.GetString("ID_INSTANCE_MAP_BOX_REWRAD_TIP"), mForwardChapterId % 100); if (LTInstanceUtil.IsChapterComplete(m_ChapterData.ForwardChapterId)) { if (LTInstanceMapModel.Instance.GetMainChapterRewardState(m_ChapterData.Id)) { ContainerObj.CustomSetActive(false); } else { RedPoint.CustomSetActive(true); } } else { RedPoint.CustomSetActive(false); } BGSprite.target.width = 376; BGSprite.target.height = 360; } else { InfoObj.CustomSetActive(true); BoxTipObj.CustomSetActive(false); int allStarNum = LTInstanceUtil.GetChapterCurStarNum(m_ChapterData.Id); int fullStarNum = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChapterMaxStarNumById(m_ChapterData.Id); PerfectObj.CustomSetActive(LTInstanceUtil.GetChapterIsPerfectComplete(m_ChapterData.Id) && allStarNum == fullStarNum); StarLabel.text = string.Format("{0}{1}/{2}", (allStarNum >= fullStarNum) ? "[42fe76]" : "", allStarNum, fullStarNum); NameLabel.text = m_ChapterData.Name; UpdateRedPoint(); BGSprite.target.width = 360; BGSprite.target.height = 420; } mDMono.transform.localPosition = data.ChapterPos; mDMono.gameObject.CustomSetActive(true); }
//创建已开放章节列表 private void InitChapter() { Hashtable chapterData; DataLookupsCache.Instance.SearchDataByID <Hashtable>("userCampaignStatus.normalChapters", out chapterData); openChapterIds.Clear(); if (!openChapterIds.Contains("101")) { openChapterIds.Add("101"); } if (chapterData != null) { foreach (DictionaryEntry data in chapterData) { string chapterId = data.Key.ToString(); if (!openChapterIds.Contains(chapterId)) { openChapterIds.Add(chapterId); } } } List <Data.LostMainChapterTemplate> temps = Data.SceneTemplateManager.Instance.GetLostMainChapterBoxRewards(); for (int i = 0; i < temps.Count; ++i) { if (!openChapterIds.Contains(temps[i].Id)) { openChapterIds.Add(temps[i].Id); } } string maxChapter = Hotfix_LT.Data.SceneTemplateManager.Instance.GetMaxChapter(openChapterIds); Hotfix_LT.Data.LostMainChapterTemplate tpl = Hotfix_LT.Data.SceneTemplateManager.Instance.GetNextChapter(maxChapter); if (tpl != null && LTInstanceUtil.IsChapterComplete(maxChapter)) { openChapterIds.Add(tpl.Id); newChapterId = vaildMaxChapter = tpl.Id; maxLandId = int.Parse(tpl.LandId); } else { newChapterId = string.Empty; vaildMaxChapter = maxChapter; Hotfix_LT.Data.LostMainChapterTemplate cur = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChatpterTplById(maxChapter); maxLandId = int.Parse(cur.LandId); } }
private void UpdateGotoBtnRP() { controller.GObjects["MoveToLeftRP"].CustomSetActive(false); controller.GObjects["MoveToRightRP"].CustomSetActive(false); bool left = false; bool right = false; var list = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChapterBoxRewards(); for (int i = 0; i < list.Count; ++i) { int land = int.Parse(list[i].LandId); if (currentLandId == land) { continue; } if (left && currentLandId > land) { continue; } if (right && currentLandId < land) { continue; } if (LTInstanceUtil.IsChapterComplete(list[i].ForwardChapterId) && !LTInstanceMapModel.Instance.GetMainChapterRewardState(list[i].Id)) { if (currentLandId > land) { controller.GObjects["MoveToLeftRP"].CustomSetActive(true); left = true; } if (currentLandId < land) { controller.GObjects["MoveToRightRP"].CustomSetActive(true); right = true; } } } }
public static bool GetChapterIsOpen(int chapterId) { Hashtable chapterData = Johny.HashtablePool.Claim(); DataLookupsCache.Instance.SearchHashtableByID("userCampaignStatus.normalChapters", out chapterData); int maxChapterId = 101; foreach (DictionaryEntry data in chapterData) { int chapterIntId = int.Parse(data.Key.ToString()); if (chapterIntId > maxChapterId) { maxChapterId = chapterIntId; } } Hotfix_LT.Data.LostMainChapterTemplate tpl = Hotfix_LT.Data.SceneTemplateManager.Instance.GetNextChapter(maxChapterId.ToString()); if (tpl != null && LTInstanceUtil.IsChapterComplete(maxChapterId.ToString()) && BalanceResourceUtil.GetUserLevel() >= tpl.LevelLimit && LTInstanceUtil.GetIsChapterLimitConditionComplete(tpl, out int num)) { maxChapterId = int.Parse(tpl.Id); } return(chapterId <= maxChapterId); }
public void OnChapterClick() { if (m_ChapterData.IsBoxRewardType()) { if (!LTInstanceUtil.IsChapterComplete(m_ChapterData.ForwardChapterId)) { int FC = 0; int.TryParse(m_ChapterData.ForwardChapterId, out FC); MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, string.Format(EB.Localizer.GetString("ID_INSTANCE_MAP_BOX_REWRAD_TIP2"), FC % 100)); return; } if (LTInstanceMapModel.Instance.GetMainChapterRewardState(m_ChapterData.Id)) { return; } LTInstanceMapModel.Instance.RequestMainChapterReward(m_ChapterData.Id, delegate { ContainerObj.CustomSetActive(false); GlobalMenuManager.Instance.Open("LTShowRewardView", m_ChapterData.RewardDataDic[0]); }); return; } FusionAudio.PostEvent("UI/General/ButtonClick", true); if (AllianceUtil.GetIsInTransferDart("ID_CAMPAGIN")) { return; } //此处判断进阶条件是否满足 if (!LTInstanceUtil.GetIsChapterLimitConditionComplete(m_ChapterData, out int currNum)) { //打开跳转界面 GlobalMenuManager.Instance.Open("PlayerUpgradeTipView", new int[3] { m_ChapterData.Limitparam2, m_ChapterData.Limitparam1, currNum }); return; } if (BalanceResourceUtil.GetUserLevel() < m_ChapterData.LevelLimit) { MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, string.Format(EB.Localizer.GetString("ID_codefont_in_LTInstanceMapChapterCtrl_2697"), m_ChapterData.LevelLimit)); //GlobalMenuManager.Instance.Open("LTPlayerLevelUpTipView", "Levelup"); return; } //主线章节入口 if (LTInstanceMapHudController.curChapterID != null && LTInstanceMapHudController.curChapterID != m_ChapterData.Id) { return; } LTInstanceMapHudController.curChapterID = m_ChapterData.Id; if (!string.IsNullOrEmpty(m_ChapterData.BeforeChapter)) { string flagStr = PlayerPrefs.GetString(LoginManager.Instance.LocalUserId.Value + m_ChapterData.BeforeChapter); if (string.IsNullOrEmpty(flagStr)) { LTStoryController.OpenStory(OnChapterClick, m_ChapterData.BeforeChapter); PlayerPrefs.SetString(LoginManager.Instance.LocalUserId.Value + m_ChapterData.BeforeChapter, "True");//本地临时保存,等服务器做好了会保存到服务器 PlayerPrefs.Save(); return; } } Action act = new Action(delegate { LTMainInstanceHudController.EnterInstance(m_ChapterData.Id); LTInstanceMapHudController.curChapterID = null; }); Hotfix_LT.Messenger.Raise(Hotfix_LT.EventName.PlayCloudFxEvent, act); }