コード例 #1
0
ファイル: XmlDBManager.cs プロジェクト: Xentrics/Praecapatus
        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();
        }
コード例 #2
0
ファイル: XmlDBManager.cs プロジェクト: Xentrics/Praecapatus
        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;
            }
        }
コード例 #3
0
ファイル: Shop.cs プロジェクト: Xentrics/Praecapatus
 public void Set(Shop sh)
 {
     money = sh.money;
     _items = sh._items;
     _boughtItems = sh._boughtItems;
     _shopID = sh._shopID;
 }
コード例 #4
0
ファイル: ShopManager.cs プロジェクト: Xentrics/Praecapatus
 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);
 }
コード例 #5
0
        void Awake()
        {
            _ec = GetComponent<EntityController>();
            _inv = (_ec) ? _ec.inventory : null;
            _shop = GetComponent<Shop>();

            if (_shop != null)
                _ec.shopID = _shop.shopID;
        }