public void OnStarBoxClick(GameObject box) { int needNum = int.Parse(box.name); int ownNum = LTInstanceUtil.GetChapterStarNum(LTInstanceMapModel.Instance.MainChapterId); List<LTShowItemData> itemList = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChapterStarReward(LTInstanceMapModel.Instance.MainChapterId, needNum); if (itemList == null) { EB.Debug.LogError("GetLostMainChapterStarReward: not found, itemList is null, chapterId = {0}, starNum = {1}", LTInstanceMapModel.Instance.MainChapterId, needNum); return; } if (ownNum >= needNum) { LTInstanceMapModel.Instance.RequestMainGetStarReward(needNum, LTInstanceMapModel.Instance.MainChapterId, delegate { if (itemList.Count > 0) { InitStarBox(); //上传友盟获得钻石,主线 List<LTShowItemData> mlist = itemList; FusionTelemetry.ItemsUmengCurrency(itemList, "主线副本"); GlobalMenuManager.Instance.Open("LTShowRewardView", itemList); } }); } else { string tip = string.Format(EB.Localizer.GetString("ID_codefont_in_LTMainInstanceHudController_10032"), needNum); Hashtable data = Johny.HashtablePool.Claim(); data.Add("data", itemList); data.Add("tip", tip); GlobalMenuManager.Instance.Open("LTRewardShowUI", data); } }
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); } } }