PlacedObjectEncyclopediaCategory.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Sirenix.OdinInspector;
  5. using KairoEngine.UI.Encyclopedia;
  6. namespace KairoEngine.Grids
  7. {
  8. public class PlacedObjectEncyclopediaCategory : EncyclopediaCategory
  9. {
  10. public List<PlacedObjecEncyclopediaCategoryArticle> articles = new List<PlacedObjecEncyclopediaCategoryArticle>();
  11. private List<EncyclopediaArticle> data = new List<EncyclopediaArticle>();
  12. [System.Serializable]
  13. public class PlacedObjecEncyclopediaCategoryArticle
  14. {
  15. [HorizontalGroup("Line", 0.015f), HideLabel] public bool unlocked = true;
  16. [HorizontalGroup("Line", 0.985f), HideLabel] public PlacedObjectType article;
  17. }
  18. public override List<EncyclopediaArticle> GetArticles()
  19. {
  20. if(data.Count == 0) UpdateArticles();
  21. return data;
  22. }
  23. public override void UpdateArticles()
  24. {
  25. data = new List<EncyclopediaArticle>();
  26. foreach (PlacedObjecEncyclopediaCategoryArticle item in articles)
  27. {
  28. var article = item.article.GetArticle();
  29. article.id = id + "_" + article.id;
  30. article.unlocked = item.unlocked;
  31. data.Add(article);
  32. }
  33. }
  34. }
  35. }