12345678910111213141516171819202122232425262728293031323334353637383940 |
- 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;
- foreach (AchievementStatus item in achievementsController.achievementsStatus)
- {
- var article = item.achievement.GetArticle();
- article.id = id + "_" + article.id;
- article.unlocked = item.unlocked;
- data.Add(article);
- }
- }
- }
- }
|