using System.Collections.Generic; using game; public class Market { public bool ConfirmationForPurchase => _conf.needPurchaseConfirmation; public IReadOnlyList Sections => _sections; private readonly List _sections; private readonly ConfBaseMarket _conf; public Market(string confPath) { _conf = G.Instance.Configs.Get(confPath); _sections = new List(); InitShops(); } public Market(uint confId) { _conf = G.Instance.Configs.Get(confId); InitShops(); } private void InitShops() { foreach (ConfBaseMarketSection confSection in _conf.sections) _sections.Add( new MarketSection(confSection)); } public class MarketSection { public readonly string PreviewPath; public readonly BaseShop Shop; public MarketSection(ConfBaseMarketSection conf) { PreviewPath = conf.previewPath; Shop = ShopFactory.CreateShop(conf.shopProto); } } }