DefaultEncyclopediaArticle.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Sirenix.OdinInspector;
  5. namespace KairoEngine.UI.Encyclopedia
  6. {
  7. [CreateAssetMenu(fileName = "Encyclopedia Article", menuName = "KairoEngine/Encyclopedia Article"), HideMonoScript]
  8. public class DefaultEncyclopediaArticle : ScriptableObject, IEncyclopediaArticle
  9. {
  10. public string title = "Example Article Title";
  11. public Sprite icon;
  12. public Sprite image;
  13. public string author;
  14. public string date;
  15. public string description;
  16. [HideLabel, TextArea()] public string text;
  17. public EncyclopediaArticle GetArticle()
  18. {
  19. var article = new EncyclopediaArticle();
  20. article.id = title;
  21. article.title = title;
  22. article.description = description;
  23. article.icon = icon;
  24. article.content.Add("title", title);
  25. article.content.Add("description", description);
  26. article.content.Add("author", author);
  27. article.content.Add("date", date);
  28. article.content.Add("text", text);
  29. article.images.Add("icon", icon);
  30. article.images.Add("image", image);
  31. //Debug.Log($"Created article with {article.content.Keys.Count} content keys");
  32. return article;
  33. }
  34. }
  35. }