|
@@ -5,11 +5,12 @@ using UnityEngine;
|
|
|
using Sirenix.OdinInspector;
|
|
|
using KairoEngine.Statistics;
|
|
|
using StatisticsSystem = KairoEngine.Statistics.Statistics;
|
|
|
+using KairoEngine.UI.Encyclopedia;
|
|
|
|
|
|
namespace KairoEngine.Achievements
|
|
|
{
|
|
|
[CreateAssetMenu(fileName = "Achievement", menuName = "KairoEngine/Achievements/Achievement", order = 10), HideMonoScript]
|
|
|
- public class AchievementBase : ScriptableObject
|
|
|
+ public class AchievementBase : ScriptableObject, IEncyclopediaArticle
|
|
|
{
|
|
|
|
|
|
[BoxGroup("Achievement")] public string title;
|
|
@@ -78,6 +79,34 @@ namespace KairoEngine.Achievements
|
|
|
else return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public EncyclopediaArticle GetArticle()
|
|
|
+ {
|
|
|
+ bool unlocked = HasAchieved();
|
|
|
+ var stat = StatisticsSystem.GetData(statisticTitle);
|
|
|
+ var article = new EncyclopediaArticle
|
|
|
+ {
|
|
|
+ title = title,
|
|
|
+ id = identifier,
|
|
|
+ description = description,
|
|
|
+ unlocked = unlocked,
|
|
|
+ icon = unlocked ? unlockedIcon : lockedIcon
|
|
|
+ };
|
|
|
+ article.content.Add("title", title);
|
|
|
+ article.content.Add("identifier", identifier);
|
|
|
+ article.content.Add("description", description);
|
|
|
+ article.content.Add("statistic", statisticTitle);
|
|
|
+ article.booleans.Add("unlocked", unlocked);
|
|
|
+ article.booleans.Add("use-statistic", useStatistic);
|
|
|
+ article.images.Add("unlocked-icon", unlockedIcon);
|
|
|
+ article.images.Add("locked-icon", lockedIcon);
|
|
|
+ if(statisticType == StatisticType.integer && stat != null)
|
|
|
+ {
|
|
|
+ article.integers.Add("current-value", stat.GetInteger());
|
|
|
+ article.integers.Add("max-value", intValue);
|
|
|
+ }
|
|
|
+ return article;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public enum ComparisionOperator
|