| | |
| | | [SerializeField] Text m_Description;
|
| | | [SerializeField] Text m_Progress;
|
| | | [SerializeField] Image m_Complete;
|
| | | [SerializeField] Button m_Goto;
|
| | |
|
| | | AchievementModel model { get { return ModelCenter.Instance.GetModel<AchievementModel>(); } }
|
| | |
|
| | |
| | | m_Description.text = UIHelper.ReplaceNewLine(config.Describe);
|
| | | }
|
| | | m_Complete.gameObject.SetActive(false);
|
| | | m_Goto.gameObject.SetActive(false);
|
| | | m_Goto.RemoveAllListeners();
|
| | | if (model.TryGetAchievement(_achievementId, out achievement))
|
| | | {
|
| | | var progress = achievement.completed ? config.NeedCnt : Mathf.Clamp(achievement.progress, 0, config.NeedCnt);
|
| | | m_Progress.text = StringUtility.Contact("(", UIHelper.GetTextColorByItemColor(progress >= config.NeedCnt ? TextColType.Green : TextColType.Red, progress.ToString(), true)
|
| | | , "/", config.NeedCnt, ")");
|
| | | m_Complete.gameObject.SetActive(achievement.completed);
|
| | | m_Goto.gameObject.SetActive(!achievement.completed);
|
| | | m_Goto.AddListener(() =>
|
| | | {
|
| | | model.GotoCompleteAchievement(_achievementId);
|
| | | });
|
| | | }
|
| | | }
|
| | | }
|