using System.Collections.Generic; using UnityEngine; using UVC.Core; public class ShapeIconCatalog : SingletonScene { Dictionary iconMap = new Dictionary(); private readonly Dictionary iconPaths = new Dictionary() { {"box","Images/GridCellIcon/si_icon_box"}, {"flexible","Images/GridCellIcon/si_icon_flexible"}, {"sheet","Images/GridCellIcon/si_icon_flexible"}, {"barrel","Images/GridCellIcon/si_icon_barrel"}, {"bottle","Images/GridCellIcon/si_icon_bottle"}, {"coil","Images/GridCellIcon/si_icon_coil"}, {"powder","Images/GridCellIcon/is_icon_powder"}, {"hazard","Images/GridCellIcon/si_icon_hazard"} }; protected override void Init() { foreach (var path in iconPaths) { iconMap.Add(path.Key,Resources.Load(path.Value)); } } public Sprite GetIcon(string key) { if (iconMap.ContainsKey(key)) { return iconMap[key]; } return null; } }