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; } } } }
private void InitStarBox() { int curStarNum = LTInstanceUtil.GetChapterStarNum(LTInstanceMapModel.Instance.MainChapterId); int maxStarNum = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChapterMaxStarNumById(LTInstanceMapModel.Instance.MainChapterId); StarNumLabel.text = string.Format("{0}/{1}", curStarNum, maxStarNum); StarSlider.value = (float)curStarNum / (float)maxStarNum; List<int> starNumList = new List<int>(mChapterTpl.RewardDataDic.Keys); for (int i = 0; i < StarBoxList.Count; i++) { if (i < starNumList.Count) { if (maxStarNum == 0) return; StarBoxList[i].CustomSetActive(true); StarBoxList[i].name = starNumList[i].ToString(); StarBoxList[i].transform.Find("Num").GetComponent<UILabel>().text = string.Format("x{0}", starNumList[i]); StarBoxList[i].transform.localPosition = new Vector2(((float)starNumList[i] / (float)maxStarNum - 0.5f) * BackBarSprite.localSize.x, StarBoxList[i].transform.localPosition.y); SetStarBoxTween(StarBoxList[i], false); bool isOpen = LTInstanceUtil.IsChapterStarBoxOpen(LTInstanceMapModel.Instance.MainChapterId, starNumList[i]); StarBoxList[i].transform.Find("Open").gameObject.CustomSetActive(isOpen); StarBoxList[i].GetComponent<BoxCollider>("Box").enabled = !isOpen; if (!isOpen) { if (curStarNum >= starNumList[i]) { SetStarBoxTween(StarBoxList[i], true); } } } else { StarBoxList[i].CustomSetActive(false); } } }