public void SaveShop(Shop shop,int shopid) { ShopSaveData saveData = new ShopSaveData(); saveData.shopID = shop.shopID; saveData.money = shop.money; saveData.items = shop.items; saveData.boughtItems = shop.bougthItems; XmlSerializer serializer = new XmlSerializer(typeof(ShopSaveData)); FileStream stream = new FileStream(Application.dataPath + shopXMLPrefix + shopid + ".xml", FileMode.Create); serializer.Serialize(stream, saveData); // stream.Close(); }
public bool LoadShop(Shop shop, int shopid) { try { XmlSerializer serializer = new XmlSerializer(typeof(ShopSaveData)); FileStream stream = new FileStream(Application.dataPath + shopXMLPrefix + shopid + ".xml", FileMode.Open); ShopSaveData sh = serializer.Deserialize(stream) as ShopSaveData; stream.Close(); shop.Set(sh); return true; } catch (FileNotFoundException e) { Debug.LogError(e.Message); return false; } }
public void Set(Shop sh) { money = sh.money; _items = sh._items; _boughtItems = sh._boughtItems; _shopID = sh._shopID; }
public void SetInventories(Inventory buyer, Shop seller) { if (buyer == null || seller == null) throw new System.NullReferenceException("buyer or seller inventory set to NULL!"); _buyer = buyer; _seller = seller; userMode = EShopMode.unset; ChangeModeTo(EShopMode.buy); UIbuyerMoney.Set(_buyer.G, _buyer.K, _buyer.T); SetUpPage(0); }
void Awake() { _ec = GetComponent<EntityController>(); _inv = (_ec) ? _ec.inventory : null; _shop = GetComponent<Shop>(); if (_shop != null) _ec.shopID = _shop.shopID; }