Пример #1
0
    private bool ShowEffect()
    {
        List <ChapterAwardConfig> starAwardList = new List <ChapterAwardConfig>();

        foreach (var item in ChapterAwardConfigLoader.Data)
        {
            if (item.Value.Degree == (int)PVEManager.Instance.ChapterType && item.Value.ChapterID == _chapterID)
            {
                starAwardList.Add(item.Value);
            }
        }

        for (int i = 0; i < 3; ++i)
        {
            if (i >= starAwardList.Count)
            {
                continue;
            }
            ChapterAwardConfig cfg = starAwardList[i];
            int curStar            = PVEManager.Instance.GetChapterStar(_chapterID, PVEManager.Instance.ChapterType);
            if (!PVEManager.Instance.HasChapterAward(_chapterID, PVEManager.Instance.ChapterType, i) && curStar >= cfg.Star)
            {
                // 有可领取的奖励
                return(true);
            }
        }

        return(false);
    }
Пример #2
0
    private void RefreshItem(int index)
    {
        if (index >= _starAwardList.Count)
        {
            return;
        }

        foreach (var item in ChapterAwardConfigLoader.Data)
        {
            if (item.Value.Degree == (int)PVEManager.Instance.ChapterType && item.Value.ChapterID == _chapterID)
            {
                _starAwardList.Add(item.Value);
            }
        }

        ChapterAwardConfig cfg = _starAwardList[index];

        List <AwardInfo> awardList = AwardManager.Instance.GetAwardList(cfg.Award);

        for (int i = 0; i < 3; ++i)
        {
            int newIndex = index * 3 + i;
            if (i >= awardList.Count)
            {
                // 没有这个物品
                _itemList[newIndex].gameObject.SetActive(false);
            }
            else
            {
                _itemList[newIndex].gameObject.SetActive(true);
                _itemList[newIndex].SetInfo(awardList[i].ItemID, awardList[i].ItemCount);
            }
        }

        _txtAwardStar[index].text = cfg.Star.ToString();

        _imgHasAward[index].gameObject.SetActive(false);
        _txtNotAward[index].gameObject.SetActive(false);
        _btnAward[index].gameObject.SetActive(false);

        int curStar = PVEManager.Instance.GetChapterStar(_chapterID, PVEManager.Instance.ChapterType);

        if (PVEManager.Instance.HasChapterAward(_chapterID, PVEManager.Instance.ChapterType, index))
        {
            // 不可领取
            if (curStar >= cfg.Star)
            {
                // 已经领取
                _imgHasAward[index].gameObject.SetActive(true);
            }
            else
            {
                // 未达成
                _txtNotAward[index].gameObject.SetActive(true);
            }
        }
        else
        {
            // 可以点击领取
            _btnAward[index].gameObject.SetActive(true);
        }
    }