コード例 #1
0
        /// <summary>
        /// Output all information achievement
        /// </summary>
        /// <param name="achievement"></param>
        private void OutputInfo(Achievement achievement, Text header, Text state, Image icon)
        {
            header.text = achievement.GetHeader();
            if (achievement.GetState())
            {
                icon.sprite = achievement.GetUnlockedIcon();
                ColorUtility.TryParseHtmlString(unlockColor, out colorState);
                state.color = colorState;

                if (achievement is ProgressAchievement)
                {
                    ProgressAchievement progressAchievement = (ProgressAchievement)achievement;
                    state.text = UNLOCK_STATE + " " + progressAchievement.GetProgress().ToString() + "/" + progressAchievement.MAX_PROGRESS_VALUE.ToString();
                }
                else
                {
                    state.text = UNLOCK_STATE;
                }
            }
            else
            {
                icon.sprite = achievement.GetLockedIcon();
                ColorUtility.TryParseHtmlString(lockColor, out colorState);
                state.color = colorState;

                if (achievement is ProgressAchievement)
                {
                    ProgressAchievement progressAchievement = (ProgressAchievement)achievement;
                    state.text = LOCK_STATE + " " + progressAchievement.GetProgress().ToString() + "/" + progressAchievement.MAX_PROGRESS_VALUE.ToString();
                }
                else
                {
                    state.text = LOCK_STATE;
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Output achievement information in UI Text and Image
 /// </summary>
 private void Output(Text header, Image icon, Achievement achievement)
 {
     header.text = achievement.GetHeader();
     icon.sprite = achievement.GetUnlockedIcon();
 }