Example #1
0
    void OnClickStars(GameObject games)
    {
        ChapterReward chapterReward = UIEventListener.Get(games).parameter as ChapterReward;

        starOpen.SetStar(chapterReward, curChapterId);
        starOpen.gameObject.SetActive(true);
    }
Example #2
0
 public void SetStar(ChapterReward _data, int _chapter = 0)
 {
     curChapter = _chapter;
     data       = _data;
     OnCurChapterStarUpdate();
 }
Example #3
0
    void ShowBoxReward()
    {
        ChapterReward chapterReward = null;

        curChapterId = 1;
        ChapterRef ChapterRef = ConfigMng.Instance.GetChapterRefData(curChapterId);

        chapterReward = GetReward(ChapterRef);
        while (isGetReward(ChapterRef) && curChapterId < ConfigMng.Instance.GetChapterRefTable().Count)
        {
            ++curChapterId;
            ChapterRef    = ConfigMng.Instance.GetChapterRefData(curChapterId);
            chapterReward = GetReward(ChapterRef);
        }

        if (stars != null)
        {
            if (chapterReward != null)
            {
                stars.gameObject.SetActive(true);
                stars.SetStar(chapterReward, curChapterId);
                if (stars != null)
                {
                    UIEventListener.Get(stars.gameObject).onClick  -= OnClickStars;
                    UIEventListener.Get(stars.gameObject).onClick  += OnClickStars;
                    UIEventListener.Get(stars.gameObject).parameter = chapterReward;
                }
            }
            else
            {
                stars.gameObject.SetActive(false);
            }
        }

        //ChapterRef dataList = ConfigMng.Instance.GetChapterRefData(EndMng.CurChapterID);
        //if (dataList == null) return;
        //bool isGetAll = true;
        //for (int i = 0, len = dataList.rewardData.Count; i < len; i++)
        //{
        //    if (!GameCenter.endLessTrialsMng.GetStarReward(GameCenter.endLessTrialsMng.CurChapterID, dataList.rewardData[i].starNum))//显示还没领取的
        //    {
        //        if (stars != null)
        //        {
        //            stars.gameObject.SetActive(true);
        //            stars.SetStar(dataList.rewardData[i]);
        //            if (stars != null)
        //            {
        //                UIEventListener.Get(stars.gameObject).onClick -= OnClickStars;
        //                UIEventListener.Get(stars.gameObject).onClick += OnClickStars;
        //                UIEventListener.Get(stars.gameObject).parameter = dataList.rewardData[i];
        //            }
        //        }
        //        isGetAll = false;
        //        break;
        //    }
        //}
        //if (isGetAll)
        //{
        //    if (stars != null) stars.gameObject.SetActive(false);
        //}
    }