using System.Collections.Generic; using UnityEditor; using UnityEngine; [System.Serializable] public class ShopData : IModelMapper { [SerializeField] public List> content = new List>(); [SerializeField] public string Map; [SerializeField] public string NpcName; public ShopData(Shop shop) { Map = shop.Map; NpcName = shop.Npc; foreach (IndexValuePair item in shop.Content) { content.Add( new IndexValuePair(item.Key, new EquippableItemData(item.Value)) ); } } public Shop MapDataToObject() { var shop = new Shop(Map, NpcName); shop.Content.Clear(); foreach (IndexValuePair item in content) { var castedObject = item.Value.MapDataToObject() as EquippableItem; if (castedObject == null) shop.Content.Add( new IndexValuePair(item.Key, new EquippableItem(item.Value.MapDataToObject())) ); else shop.Content.Add( new IndexValuePair(item.Key, castedObject) ); } return shop; } public Shop MapDataToObject(string prefarbAssetName) { throw new System.NotImplementedException(); } }