123456789101112131415161718192021222324252627282930313233343536373839 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- namespace KairoEngine.UI.Encyclopedia
- {
- public class DefaultEncyclopediaCategory : EncyclopediaCategory
- {
- public List<DefaultEncyclopediaCategoryArticle> articles = new List<DefaultEncyclopediaCategoryArticle>();
- private List<EncyclopediaArticle> data = new List<EncyclopediaArticle>();
- [System.Serializable]
- public class DefaultEncyclopediaCategoryArticle
- {
- [HorizontalGroup("Line", 0.015f), HideLabel] public bool unlocked = true;
- [HorizontalGroup("Line", 0.985f), HideLabel] public DefaultEncyclopediaArticle article;
- }
- public override List<EncyclopediaArticle> GetArticles()
- {
- if(data.Count == 0) UpdateArticles();
- return data;
- }
- public override void UpdateArticles()
- {
- data = new List<EncyclopediaArticle>();
- foreach (DefaultEncyclopediaCategoryArticle item in articles)
- {
- var article = item.article.GetArticle();
- article.id = id + "_" + article.id;
- article.unlocked = item.unlocked;
- data.Add(article);
- }
- }
- }
- }
|