41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
namespace Continentis.MainGame
|
|
{
|
|
[CreateAssetMenu(menuName = "Continentis/KeywordsCollection", fileName = "KeywordsCollection")]
|
|
public class KeywordCollection : SerializedScriptableObject
|
|
{
|
|
public Dictionary<string, string> keywords = new Dictionary<string, string>();
|
|
public Dictionary<string, InterpretedKeyword> interpretedKeywords = new Dictionary<string, InterpretedKeyword>();
|
|
|
|
public string GetKeywordDescription(string keyword)
|
|
{
|
|
if (keywords.TryGetValue(keyword, out var description))
|
|
{
|
|
return description;
|
|
}
|
|
|
|
if (interpretedKeywords.TryGetValue(keyword, out var interpretedKeyword))
|
|
{
|
|
return interpretedKeyword.description;
|
|
}
|
|
|
|
Debug.LogWarning($"Keyword '{keyword}' not found in the collection.");
|
|
return string.Empty;
|
|
}
|
|
}
|
|
|
|
public struct InterpretedKeyword
|
|
{
|
|
public string name;
|
|
public string description;
|
|
|
|
public InterpretedKeyword(string name, string description)
|
|
{
|
|
this.name = name;
|
|
this.description = description;
|
|
}
|
|
}
|
|
} |