示例#1
0
        public void UpdateInventory()
        {
            InventoryItems = new List <InventoryItem>();
            string inventoryItemsJson = AmeisenCore.GetLocalizedText(GetInventoryItems.Lua(), GetInventoryItems.OutVar());
            List <RawInventoryItem> rawInventoryItems = new List <RawInventoryItem>();

            try
            {
                rawInventoryItems = JsonConvert.DeserializeObject <List <RawInventoryItem> >(inventoryItemsJson);
            }
            catch
            {
                InventoryItems = new List <InventoryItem>();
                AmeisenLogger.Instance.Log(LogLevel.ERROR, $"Failes to parse InventoryItems", this);
            }

            foreach (RawInventoryItem rawInventoryItem in rawInventoryItems)
            {
                InventoryItems.Add(new InventoryItem(rawInventoryItem));
            }
        }
示例#2
0
        public IEnumerable <InventoryItemDetails> Handle(GetInventoryItems query)
        {
            var items = InMemoryDatabase.Details.Values.ToList();

            return(items);
        }
示例#3
0
 InventoryItemDetails[] Answer(GetInventoryItems _) => items.Values.ToArray();
示例#4
0
 InventoryItemDetails[] Answer(GetInventoryItems _) => items.Values.ToArray();
示例#5
0
 public Task <List <InventoryItemListDto> > Handle(GetInventoryItems message, CancellationToken token = default)
 {
     return(Task.FromResult(InMemoryDatabase.List));
 }