private void MakeCic(ChapterInfoCustom cic) { for (int i = 0; i < cic.needStar.get_Count(); i++) { int key = BoxRewardManager.Instance.MakeBoxRewardID(cic.chapterID, cic.type, cic.needStar.get_Item(i)); if (BoxRewardManager.Instance.m_mapChapterAwards.ContainsKey(key)) { ChapterAwardInfo chapterAwardInfo = BoxRewardManager.Instance.m_mapChapterAwards[key]; if (chapterAwardInfo.canReceive && !chapterAwardInfo.isReceived) { cic.canGetReward = true; break; } cic.canGetReward = false; } } for (int j = 0; j < cic.needStar.get_Count(); j++) { int key2 = BoxRewardManager.Instance.MakeBoxRewardID(cic.chapterID, cic.type, cic.needStar.get_Item(j)); if (BoxRewardManager.Instance.m_mapChapterAwards.ContainsKey(key2)) { ChapterAwardInfo chapterAwardInfo2 = BoxRewardManager.Instance.m_mapChapterAwards[key2]; if (chapterAwardInfo2.canReceive && !chapterAwardInfo2.isReceived) { cic.starCondition = cic.needStar.get_Item(j); break; } if (!chapterAwardInfo2.canReceive) { cic.starCondition = cic.needStar.get_Item(j); break; } if (chapterAwardInfo2.canReceive && chapterAwardInfo2.isReceived) { if (j == cic.needStar.get_Count() - 1) { cic.starCondition = cic.needStar.get_Item(j); } } } } }
private void ResetChapterData() { using (Dictionary <int, ChapterInfoCustom> .Enumerator enumerator = this.dicChaptersNormal.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <int, ChapterInfoCustom> current = enumerator.get_Current(); ChapterInfoCustom value = current.get_Value(); this.MakeCic(value); } } using (Dictionary <int, ChapterInfoCustom> .Enumerator enumerator2 = this.dicChaptersElite.GetEnumerator()) { while (enumerator2.MoveNext()) { KeyValuePair <int, ChapterInfoCustom> current2 = enumerator2.get_Current(); ChapterInfoCustom value2 = current2.get_Value(); this.MakeCic(value2); } } }
private void InitChapterDatas() { for (int i = 0; i < DataReader <ZhuXianZhangJiePeiZhi> .DataList.get_Count(); i++) { ZhuXianZhangJiePeiZhi zhuXianZhangJiePeiZhi = DataReader <ZhuXianZhangJiePeiZhi> .DataList.get_Item(i); ChapterInfoCustom chapterInfoCustom = new ChapterInfoCustom(); chapterInfoCustom.chapter = zhuXianZhangJiePeiZhi.chapterOrder; chapterInfoCustom.type = zhuXianZhangJiePeiZhi.chapterType; chapterInfoCustom.needStar.AddRange(zhuXianZhangJiePeiZhi.needStar); chapterInfoCustom.chapterID = zhuXianZhangJiePeiZhi.id; if (zhuXianZhangJiePeiZhi.chapterType == 101) { this.dicChaptersNormal.Add(zhuXianZhangJiePeiZhi.chapterOrder, chapterInfoCustom); if (zhuXianZhangJiePeiZhi.chapterOrder < this.minChapterNormal) { this.minChapterNormal = zhuXianZhangJiePeiZhi.chapterOrder; } else if (zhuXianZhangJiePeiZhi.chapterOrder > this.maxChapterNormal) { this.maxChapterNormal = zhuXianZhangJiePeiZhi.chapterOrder; } } else if (zhuXianZhangJiePeiZhi.chapterType == 102) { this.dicChaptersElite.Add(zhuXianZhangJiePeiZhi.chapterOrder, chapterInfoCustom); if (zhuXianZhangJiePeiZhi.chapterOrder < this.minChapterElite) { this.minChapterElite = zhuXianZhangJiePeiZhi.chapterOrder; } else if (zhuXianZhangJiePeiZhi.chapterOrder > this.maxChapterElite) { this.maxChapterElite = zhuXianZhangJiePeiZhi.chapterOrder; } } } }
private void RefreshBoxReward(int chapter, DungeonType.ENUM dungeonType) { if (dungeonType == DungeonType.ENUM.Normal || dungeonType == DungeonType.ENUM.Elite) { this.Reward.get_gameObject().SetActive(true); ZhuXianZhangJiePeiZhi zhuXianZhangJiePeiZhi = DataReader <ZhuXianZhangJiePeiZhi> .DataList.Find((ZhuXianZhangJiePeiZhi a) => a.chapterOrder == chapter && a.chapterType == (int)dungeonType); if (zhuXianZhangJiePeiZhi != null) { for (int i = 0; i < zhuXianZhangJiePeiZhi.needStar.get_Count(); i++) { int needstar = zhuXianZhangJiePeiZhi.needStar.get_Item(i); int key = BoxRewardManager.Instance.MakeBoxRewardID(zhuXianZhangJiePeiZhi.id, (int)dungeonType, needstar); if (BoxRewardManager.Instance.m_mapChapterAwards.ContainsKey(key)) { ChapterAwardInfo chapterAwardInfo = BoxRewardManager.Instance.m_mapChapterAwards[key]; if (chapterAwardInfo.canReceive && !chapterAwardInfo.isReceived) { this.currentChapterAwardInfo = chapterAwardInfo; break; } if (!chapterAwardInfo.canReceive) { this.currentChapterAwardInfo = chapterAwardInfo; break; } } else { Debug.LogError("cai == null"); } } ChapterInfoCustom chapterInfoCustom = null; if (dungeonType == DungeonType.ENUM.Normal) { chapterInfoCustom = this.dicChaptersNormal.get_Item(chapter); } else if (dungeonType == DungeonType.ENUM.Elite) { chapterInfoCustom = this.dicChaptersElite.get_Item(chapter); } ChapterInfo chapterInfo = this.listData.get_Item(chapter - 1); if (chapterInfoCustom.canGetReward) { this.BtnBoxReward.get_transform().FindChild("Image1").get_gameObject().SetActive(true); this.BtnBoxReward.get_transform().FindChild("Image2").get_gameObject().SetActive(false); if (this.fxBoxReward != 0) { FXSpineManager.Instance.DeleteSpine(this.fxBoxReward, true); } this.fxBoxReward = FXSpineManager.Instance.PlaySpine(1601, this.BtnBoxReward.get_transform().FindChild("FX"), "InstanceSelectUI", 2001, null, "UI", 0f, 0f, 1f, 1f, false, FXMaskLayer.MaskState.None); } else if (!chapterInfoCustom.canGetReward && chapterInfo.totalStar == chapterInfoCustom.needStar.get_Item(chapterInfoCustom.needStar.get_Count() - 1)) { this.BtnBoxReward.get_transform().FindChild("Image1").get_gameObject().SetActive(false); this.BtnBoxReward.get_transform().FindChild("Image2").get_gameObject().SetActive(true); if (this.fxBoxReward != 0) { FXSpineManager.Instance.DeleteSpine(this.fxBoxReward, true); } } else { this.BtnBoxReward.get_transform().FindChild("Image1").get_gameObject().SetActive(true); this.BtnBoxReward.get_transform().FindChild("Image2").get_gameObject().SetActive(false); if (this.fxBoxReward != 0) { FXSpineManager.Instance.DeleteSpine(this.fxBoxReward, true); } } this.currentRewardNeedStar = chapterInfoCustom.starCondition; this.TextRewardNow.set_text(string.Concat(new object[] { string.Empty, chapterInfo.totalStar, "/", chapterInfoCustom.starCondition })); } } else { this.Reward.get_gameObject().SetActive(false); } }
private void ResetChapterRewardBadge(int chapter, DungeonType.ENUM dungeonType) { ChapterInfoCustom chapterInfoCustom = this.dicChaptersNormal.get_Item(chapter); if (chapterInfoCustom.canGetReward) { this.BtnNormal.get_transform().FindChild("ImageBadge").get_gameObject().SetActive(true); } else { this.BtnNormal.get_transform().FindChild("ImageBadge").get_gameObject().SetActive(false); } chapterInfoCustom = this.dicChaptersElite.get_Item(chapter); if (chapterInfoCustom.canGetReward) { this.BtnElite.get_transform().FindChild("ImageBadge").get_gameObject().SetActive(true); } else { this.BtnElite.get_transform().FindChild("ImageBadge").get_gameObject().SetActive(false); } this.BtnNormal.get_transform().FindChild("ImageBadge").get_gameObject().SetActive(BoxRewardManager.Instance.CheckNormalDungeonBadge()); this.BtnElite.get_transform().FindChild("ImageBadge").get_gameObject().SetActive(BoxRewardManager.Instance.CheckEliteDungeonBadge()); this.BtnLastChapter.get_transform().FindChild("ImageBadge").get_gameObject().SetActive(false); this.BtnNextChapter.get_transform().FindChild("ImageBadge").get_gameObject().SetActive(false); if (dungeonType == DungeonType.ENUM.Normal) { for (int i = chapter - 1; i >= this.minChapterNormal; i--) { chapterInfoCustom = this.dicChaptersNormal.get_Item(i); if (chapterInfoCustom.canGetReward) { this.BtnLastChapter.get_transform().FindChild("ImageBadge").get_gameObject().SetActive(true); break; } } for (int j = chapter + 1; j <= this.maxChapterNormal; j++) { chapterInfoCustom = this.dicChaptersNormal.get_Item(j); if (chapterInfoCustom.canGetReward) { this.BtnNextChapter.get_transform().FindChild("ImageBadge").get_gameObject().SetActive(true); break; } } } else if (dungeonType == DungeonType.ENUM.Elite) { for (int k = chapter - 1; k >= this.minChapterNormal; k--) { chapterInfoCustom = this.dicChaptersElite.get_Item(k); if (chapterInfoCustom.canGetReward) { this.BtnLastChapter.get_transform().FindChild("ImageBadge").get_gameObject().SetActive(true); break; } } for (int l = chapter + 1; l <= this.maxChapterNormal; l++) { chapterInfoCustom = this.dicChaptersElite.get_Item(l); if (chapterInfoCustom.canGetReward) { this.BtnNextChapter.get_transform().FindChild("ImageBadge").get_gameObject().SetActive(true); break; } } } }
private void OnClickBtnBoxReward(GameObject sender) { if (this.lockBtnBoxReward) { return; } if (BackpackManager.Instance.ShowBackpackFull()) { return; } bool flag = true; ChapterInfoCustom chapterInfoCustom = null; if (InstanceSelectUI.currentDungeonType == DungeonType.ENUM.Normal) { chapterInfoCustom = this.dicChaptersNormal.get_Item(InstanceSelectUI.currentShowChapter); } else if (InstanceSelectUI.currentDungeonType == DungeonType.ENUM.Elite) { chapterInfoCustom = this.dicChaptersElite.get_Item(InstanceSelectUI.currentShowChapter); } ChapterInfo chapterInfo = this.listData.get_Item(InstanceSelectUI.currentShowChapter - 1); if (!chapterInfoCustom.canGetReward && chapterInfo.totalStar == chapterInfoCustom.needStar.get_Item(chapterInfoCustom.needStar.get_Count() - 1)) { UIManagerControl.Instance.ShowToastText(GameDataUtils.GetChineseContent(505077, false)); return; } if (!this.currentChapterAwardInfo.canReceive) { flag = false; } XDict <string, int> xDict = BoxRewardManager.Instance.ParseAwardId(this.currentChapterAwardInfo.chapterAwardId); ZhuXianZhangJiePeiZhi zhuXianZhangJiePeiZhi = DataReader <ZhuXianZhangJiePeiZhi> .Get(xDict["chapter"]); List <int> itemIDList = new List <int>(); List <long> itemCountList = new List <long>(); if (zhuXianZhangJiePeiZhi != null) { string text = string.Empty; string text2 = string.Empty; for (int i = 0; i < zhuXianZhangJiePeiZhi.needStar.get_Count(); i++) { if (zhuXianZhangJiePeiZhi.needStar.get_Item(i) == xDict["needstar"]) { text = zhuXianZhangJiePeiZhi.rewardItem.get_Item(i).value; text2 = zhuXianZhangJiePeiZhi.rewardNum.get_Item(i).value; break; } } string[] array = text.Split(new char[] { ',' }); string[] array2 = text2.Split(new char[] { ',' }); for (int j = 0; j < array.Length; j++) { itemIDList.Add(int.Parse(array[j])); itemCountList.Add((long)int.Parse(array2[j])); } } if (flag) { this.lockBtnBoxReward = true; if (this.FxMaskTrans == null) { this.FxMaskTrans = UINodesManager.MiddleUIRoot; } else { this.FxMaskTrans.get_gameObject().SetActive(true); } RewardUI rewardui; this.FxID = FXSpineManager.Instance.ReplaySpine(this.FxID, 801, this.FxMaskTrans, string.Empty, 14000, delegate { FXSpineManager.Instance.PlaySpine(802, this.FxMaskTrans, string.Empty, 14000, null, "UI", 0f, 0f, 1f, 1f, false, FXMaskLayer.MaskState.None); rewardui = LinkNavigationManager.OpenRewardUI(UINodesManager.MiddleUIRoot); rewardui.SetRewardItem("获得奖励", itemIDList, itemCountList, true, true, delegate { BoxRewardManager.Instance.SendReceiveAwardReq(this.currentChapterAwardInfo.chapterAwardId); FXSpineManager.Instance.DeleteSpine(this.FxID, true); if (this.FxMaskTrans != UINodesManager.MiddleUIRoot) { this.FxMaskTrans.get_gameObject().SetActive(false); for (int k = 0; k < this.FxMaskTrans.get_childCount(); k++) { Transform child = this.FxMaskTrans.GetChild(k); Object.Destroy(child.get_gameObject()); } } }, null); this.lockBtnBoxReward = false; }, "UI", 0f, 0f, 1f, 1f, false, FXMaskLayer.MaskState.None); FXSpineManager.Instance.PlaySpine(803, this.FxMaskTrans, string.Empty, 14000, null, "UI", 0f, 0f, 1f, 1f, false, FXMaskLayer.MaskState.None); } else { RewardUI rewardui = LinkNavigationManager.OpenRewardUI(UINodesManager.TopUIRoot); rewardui.SetRewardItem("奖励预览", itemIDList, itemCountList, false, false, delegate { string text3 = GameDataUtils.GetChineseContent(510111, false); text3 = text3.Replace("{s1}", this.currentRewardNeedStar.ToString()); UIManagerControl.Instance.ShowToastText(text3); }, null); } }