public void UpdateMemory(List <InfoItemRef> list_update, BatimentVente_Controller shop) { var mic = MemoryComponement.GetMemoryItemComponent(); foreach (var iir in list_update) { mic.Add(iir.ItemRef, shop, iir); } }
public void RemoveShop(BatimentVente_Controller shop) { var lmi = MemoryItems.Where(x => x.ShopExist(shop)); foreach (var mi in lmi) { mi.Remove(shop); } }
internal void Remove(BatimentVente_Controller _shop) { var si = List_ShopInfo.Find(x => x.Shop == _shop); if (si != null) { List_ShopInfo.Remove(si); } }
public void Remove(ItemRef itemRef, BatimentVente_Controller shop) { var mi = MemoryItems.Find(x => x.ItemRef == itemRef); if (mi != null) { mi.Remove(shop); } }
public void Add(ItemRef itemRef, BatimentVente_Controller shop, int?priceS, int?priceB, bool hadStock, float?distance) { var mi = MemoryItems.Find(x => x.ItemRef == itemRef); if (mi != null) { mi.AddInfo(shop, priceS, priceB, hadStock, distance); } else { var miT = new MemoryItem(); miT.ItemRef = itemRef; miT.AddInfo(shop, priceS, priceB, hadStock, distance); MemoryItems.Add(miT); } if (!List_AllShop.Any(x => x == shop)) { List_AllShop.Add(shop); } }
public BatimentVente_Controller GetShopLowerPriceForItem(ItemRef itemRef) { var mc = Controller.GetMemoryComponement(); var mi = mc.GetMemoryItemComponent().GetInfo(itemRef); if (mi != null) { float price = Mathf.Infinity; BatimentVente_Controller shopRet = null; foreach (var shopInfo in mi.List_ShopInfo.Where(x => x.HadStock)) { if (shopInfo.PriceBuy.HasValue && shopInfo.PriceBuy.Value < price) { shopRet = shopInfo.Shop; price = shopInfo.PriceBuy.Value; } } return(shopRet); } return(null); }
public BatimentVente_Controller GetShopHigherPriceForItem(ItemRef itemRef) { var mc = Controller.GetMemoryComponement(); var mi = mc.GetMemoryItemComponent().GetInfo(itemRef); if (mi != null) { float price = -1; BatimentVente_Controller shopRet = null; foreach (var shopInfo in mi.List_ShopInfo) { if (shopInfo.PriceSell.HasValue && shopInfo.PriceSell.Value > price) { shopRet = shopInfo.Shop; price = shopInfo.PriceSell.Value; } } return(shopRet); } return(null); }
public void AddInfo(BatimentVente_Controller _shop, int?_priceS, int?_priceB, bool hadStock, float?_distance) { var si = List_ShopInfo.Find(x => x.Shop == _shop); if (si != null) { si.HadStock = hadStock; si.PriceBuy = _priceB; si.PriceSell = _priceS; si.Distance = _distance; } else { List_ShopInfo.Add(new ShopInfo() { Shop = _shop, Distance = _distance, PriceBuy = _priceB, HadStock = hadStock, PriceSell = _priceS, }); } }
//public void Add(UpdateShopInfo updateShopInfo) //{ // Add(updateShopInfo.ItemRef, updateShopInfo.ShopInfo.Shop, updateShopInfo.ShopInfo.Price, updateShopInfo.ShopInfo.Distance); //} internal void Add(ItemRef farine_ref, BatimentVente_Controller shop_1, InfoItemRef infoItemRef) { Add(farine_ref, shop_1, infoItemRef.PriceSell, infoItemRef.PriceBuy, infoItemRef.HadStock, 0); }
public bool ShopExist(BatimentVente_Controller _shop) { return(List_ShopInfo.Exists(x => x.Shop == _shop)); }