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 UpdateRedPoint() { bool IsBoxOpen = true; int starNum = LTInstanceUtil.GetChapterCurStarNum(m_ChapterData.Id); foreach (int key in m_ChapterData.RewardDataDic.Keys) { if (starNum >= key) { IsBoxOpen = LTInstanceUtil.IsChapterStarBoxOpen(m_ChapterData.Id, key); } if (!IsBoxOpen) { break; } } RedPoint.CustomSetActive(!IsBoxOpen); }
public void ShowStarBox() { //检查宝箱是否可领取,可领取情况帮忙自动领取 int starNum = LTInstanceUtil.GetChapterCurStarNum(mChapterTpl.Id); foreach (int key in mChapterTpl.RewardDataDic.Keys) { if (starNum >= key) { if (!LTInstanceUtil.IsChapterStarBoxOpen(mChapterTpl.Id, key)) { isShowingBoxReward = true; LTInstanceMapModel.Instance.RequestMainGetStarReward(key, LTInstanceMapModel.Instance.MainChapterId, delegate { List<LTShowItemData> itemList = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChapterStarReward(LTInstanceMapModel.Instance.MainChapterId, key); if (itemList != null && itemList.Count > 0) { InitStarBox(); //上传友盟获得钻石,主线 FusionTelemetry.ItemsUmengCurrency(itemList, "主线副本"); System .Action callback =delegate { isShowingBoxReward = false; } ; var ht = Johny.HashtablePool.Claim(); ht["reward"] = itemList; ht["callback"] = callback; ht["title"] =EB.Localizer .GetString("ID_MAIN_INSTANCE_BOX_REWRAD_TIP"); GlobalMenuManager.Instance.Open("LTShowBoxView", ht); } else { isShowingBoxReward = false; } }); break; } } } }