-
Notifications
You must be signed in to change notification settings - Fork 16
/
ShopDataRepository.cs
55 lines (40 loc) · 1.36 KB
/
ShopDataRepository.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using AutomaticTypeMapper;
using System.Collections.Generic;
namespace EOLib.Domain.Interact.Shop
{
public interface IShopDataRepository : IResettable
{
int ShopID { get; set; }
string ShopName { get; set; }
List<IShopItem> TradeItems { get; set; }
List<IShopCraftItem> CraftItems { get; set; }
}
public interface IShopDataProvider : IResettable
{
int ShopID { get; }
string ShopName { get; }
IReadOnlyList<IShopItem> TradeItems { get; }
IReadOnlyList<IShopCraftItem> CraftItems { get; }
}
[AutoMappedType(IsSingleton = true)]
public class ShopDataRepository : IShopDataProvider, IShopDataRepository
{
public int ShopID { get; set; }
public string ShopName { get; set; }
public List<IShopItem> TradeItems { get; set; }
public List<IShopCraftItem> CraftItems { get; set; }
IReadOnlyList<IShopItem> IShopDataProvider.TradeItems => TradeItems;
IReadOnlyList<IShopCraftItem> IShopDataProvider.CraftItems => CraftItems;
public ShopDataRepository()
{
ResetState();
}
public void ResetState()
{
ShopID = 0;
ShopName = string.Empty;
TradeItems = new List<IShopItem>();
CraftItems = new List<IShopCraftItem>();
}
}
}