1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using KairoEngine.UI.Encyclopedia;
- using Sirenix.OdinInspector;
- namespace KairoEngine.Achievements
- {
- public class AchievementsEncyclopediaCategory : EncyclopediaCategory
- {
- public AchievementsController achievementsController;
- private List<EncyclopediaArticle> data = new List<EncyclopediaArticle>();
- private void Start()
- {
- if(achievementsController == null) achievementsController = FindObjectOfType<AchievementsController>();
- if(achievementsController == null) Debug.LogError("Missing Achievements Controller", this.gameObject);
- }
- public override List<EncyclopediaArticle> GetArticles()
- {
- UpdateArticles();
- return data;
- }
- public override void UpdateArticles()
- {
- data = new List<EncyclopediaArticle>();
- if(achievementsController == null) return;
- if(achievementsController.achievementsStatus == null) return;
- foreach (AchievementStatus item in achievementsController.achievementsStatus)
- {
- var article = item.achievement.GetArticle();
- article.id = id + "_" + article.id;
- article.unlocked = item.unlocked;
- data.Add(article);
- }
- }
- }
- }
|