46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using game;
|
|
|
|
|
|
public class Market
|
|
{
|
|
public bool ConfirmationForPurchase => _conf.needPurchaseConfirmation;
|
|
public IReadOnlyList<MarketSection> Sections => _sections;
|
|
|
|
private readonly List<MarketSection> _sections;
|
|
private readonly ConfBaseMarket _conf;
|
|
|
|
public Market(string confPath)
|
|
{
|
|
_conf = G.Instance.Configs.Get<ConfBaseMarket>(confPath);
|
|
_sections = new List<MarketSection>();
|
|
|
|
InitShops();
|
|
}
|
|
|
|
public Market(uint confId)
|
|
{
|
|
_conf = G.Instance.Configs.Get<ConfBaseMarket>(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);
|
|
}
|
|
}
|
|
|
|
}
|