Exemple #1
0
        public void SetAndRefresh(int majorId, SubLevelUnlockInfo subLevelUnlockInfo, SubLevelData subLevelData)
        {
            _majorId            = majorId;
            _subLevelUnlockInfo = subLevelUnlockInfo;
            _subLevelData       = subLevelData;
            LblNum.text         = _subLevelData.SubLevelId.ToString();
            var unlocked  = _subLevelUnlockInfo != null && _subLevelUnlockInfo.Unlocked;
            var starCount = _subLevelUnlockInfo != null ? _subLevelUnlockInfo.CurrentStar : 0;

            SprPoint.color = unlocked ? Color.white : Color.gray;
            for (int i = 0; i < 3; i++)
            {
                Stars[i].SetActive(i < starCount);
            }
            if (unlocked && starCount == 0)
            {
                if (!_standOnArrow)
                {
                    _standOnArrow = PrefabHelper.InstantiateAndReset(StandOnArrowPrefab, transform);
                }
            }
            else
            {
                Destroy(_standOnArrow);
            }
        }
Exemple #2
0
        public void SetAndRefresh(int majorLevelID, SubLevelUnlockInfo subLevelUnlockInfo)
        {
            if (subLevelUnlockInfo == null)
            {
                Debug.LogError("刷新不能没有subLevelUnlockInfo");
                return;
            }

            _majorLevelID       = majorLevelID;
            _subLevelUnlockInfo = subLevelUnlockInfo;

            #region 显示星星

            if (_subLevelUnlockInfo.Unlocked)
            {
                SprLock.SetActive(false);
                if (_subLevelUnlockInfo.CurrentStar <= 0)
                {
                    GrpStars.SetActive(false);
                    SprNewStart.SetActive(true);
                }
                else
                {
                    GrpStars.SetActive(true);
                    for (int i = 0; i < Stars.Length; i++)
                    {
                        Stars[i].SetActive(i < _subLevelUnlockInfo.CurrentStar);
                    }
                    SprNewStart.SetActive(false);
                }
            }
            else
            {
                GrpStars.SetActive(false);
                SprNewStart.SetActive(false);
                SprLock.SetActive(true);
            }

            #endregion

            LblNumber.text = string.Format("{0}-{1}", _majorLevelID, _subLevelUnlockInfo.SubLevelId);

            var challengeLevelConfig = ConfigManager.GetConfig(ConfigManager.ConfigType.ChallengeLevelConfig) as ChallengeLevelConfig;
            if (challengeLevelConfig != null)
            {
                var mlc =
                    challengeLevelConfig.MajorLevelList.Find(
                        x => x.MajorLevelId == _majorLevelID);
                if (mlc == null)
                {
                    Debug.LogError("没有找到Major关卡文本配置:" + _majorLevelID);
                }
                else
                {
                    var slc = mlc.SubLevelList.Find(x => x.SubLevelId == _subLevelUnlockInfo.SubLevelId);
                    if (slc == null)
                    {
                        Debug.LogError("没有找到Sub关卡文本配置:" + _majorLevelID + "," + _subLevelUnlockInfo.SubLevelId);
                    }
                    else
                    {
                        LblName.text = slc.Title;
                    }
                }
            }
            else
            {
                Debug.LogError("没有关卡配置,请检查");
            }
        }