private void ShowViewByChapter(int chapter) { this.chapter = chapter; DCopyMainChapter chapterDB = ReadCfgCopyMainChapter.GetDataById(chapter); int enterIndex = MLRaid.Instance.GetMaxCanEnterCopyIndex(copyDifficulty, chapter); for (int i = 0; i < 3; i++) { boxStarNums[i].text = chapterDB.Stars[i].ToString(); ERewardState rewardState = MLRaid.Instance.GetChapterRewardStateByAwardIndex(chapter, i); switch (rewardState) { case ERewardState.NOT_RECEIVE: case ERewardState.CAN_RECEIVE: boxStates[i].spriteName = "613"; break; case ERewardState.HAS_RECEIVE: boxStates[i].spriteName = "614"; break; } } chapterName.text = chapterDB.Name; for (int i = 0; i < copyItems.Count; i++) { ItemCopy tab = copyItems[i]; if (i < chapterDB.Copys.Length) { tab.item.SetActive(true); Color color = i < enterIndex ? Color.white : Color.cyan; tab.icon.color = color; for (int k = 0; k < tab.stars.Length; k++) { tab.stars[k].color = color; } int copyID = chapterDB.Copys[i]; DCopy db = ReadCfgCopy.GetDataById(copyID); int starNum = MLRaid.Instance.GetCopyStarNumById(copyID); tab.copyName.text = db.Name; tab.copyName.color = i < enterIndex ? Color.yellow : Color.gray; tab.item.transform.localPosition = chapterDB.CopyPosArray[i]; GTItemHelper.ShowStarNum(tab.stars, starNum); } else { copyItems[i].item.SetActive(false); } } btnPrev.SetActive(chapter > DCopyMainChapter.MAINCOPY_ST_CHAPTER_ID); btnNext.SetActive(chapter < DCopyMainChapter.MAINCOPY_ED_CHAPTER_ID); }
private void OnBoxClick(GameObject go) { GTAudioManager.Instance.PlayEffectAudio(GTAudioKey.SOUND_UI_CLICK); int index = go.name.ToInt32() - 1; DCopyMainChapter db = ReadCfgCopyMainChapter.GetDataById(chapter); GTWindowManager.Instance.OpenWindow(EWindowID.UIAwardBox); UIAwardBox window = (UIAwardBox)GTWindowManager.Instance.GetWindow(EWindowID.UIAwardBox); ERewardState state = MLRaid.Instance.GetChapterRewardStateByAwardIndex(chapter, index); UIEventListener.VoidDelegate doReceive = delegate(GameObject w) { GTNetworkSend.Instance.TryMainCopyReceiveReward(chapter, index); }; window.ShowAwardById(db.Awards[index], state, doReceive); }
public void ShowAwardById(int award, ERewardState rewardState, UIEventListener.VoidDelegate doReceive) { List <GTItem> list = GTAwardHelper.GetAwardDataByID(award); DAward db = ReadCfgAward.GetDataById(award); for (int i = 0; i < items.Count; i++) { Item it = items[i]; if (i < list.Count) { GTItem vo = list[i]; it.itemBtn.SetActive(true); it.itemNum.text = vo.Num > 1 ? vo.Num.ToString() : string.Empty; GTItemHelper.ShowItemTexture(it.itemTexture, vo.Id); GTItemHelper.ShowItemQuality(it.itemQuality, vo.Id); GTItemHelper.ShowItemName(it.itemName, vo.Id); DItem itemDB = ReadCfgItem.GetDataById(vo.Id); it.chip.SetActive(itemDB.ItemType == EItemType.CHIP); } else { it.itemBtn.SetActive(false); } } switch (rewardState) { case ERewardState.NOT_RECEIVE: btnReceive.GetComponent <UISprite>().spriteName = "67"; btnReceive.transform.Find("Label").GetComponent <UILabel>().text = "领取"; break; case ERewardState.CAN_RECEIVE: btnReceive.GetComponent <UISprite>().spriteName = "8"; btnReceive.transform.Find("Label").GetComponent <UILabel>().text = "领取"; break; case ERewardState.HAS_RECEIVE: btnReceive.GetComponent <UISprite>().spriteName = "9"; btnReceive.transform.Find("Label").GetComponent <UILabel>().text = "已领取"; break; } title.text = db.Name; DoReceive = doReceive; }
public void TryMainCopyReceiveReward(int chapter, int index) { ERewardState rewardState = MLRaid.Instance.GetChapterRewardStateByAwardIndex(chapter, index); switch (rewardState) { case ERewardState.NOT_RECEIVE: GTItemHelper.ShowTip("未达成条件"); return; case ERewardState.HAS_RECEIVE: GTItemHelper.ShowTip("奖励已领取"); return; } DCopyMainChapter chapterDB = ReadCfgCopyMainChapter.GetDataById(chapter); DAward awardDB = ReadCfgAward.GetDataById(chapterDB.Awards[index]); if (GTItemHelper.CheckBagFull(awardDB.MaxDropNum)) { return; } }