using System; using System.Collections.Generic; using ShiroginSDK.Runtime.Modules.UI.Theme.Enums; using UnityEngine; namespace ShiroginSDK.Runtime.Modules.UI.Theme.Scripts.SO { /// /// Defines a set of themed sprites for one visual profile (e.g. Default, Dark, Halloween). /// [CreateAssetMenu(fileName = "ThemeProfile", menuName = "ShiroginSDK/Theme/Theme Profile")] public class ThemeProfile : ScriptableObject { [Header("Theme Info")] public string ThemeName = "Default"; [SerializeField] private List entries = new(); private Dictionary _cache; /// /// Returns a sprite associated with the given asset type. /// public Sprite GetSprite(ThemeAssetType type) { if (_cache == null) { _cache = new Dictionary(); foreach (var entry in entries) if (!_cache.ContainsKey(entry.Type)) _cache.Add(entry.Type, entry.Sprite); } return _cache.TryGetValue(type, out var sprite) ? sprite : null; } [Serializable] public class ThemeEntry { public ThemeAssetType Type; public Sprite Sprite; } } }