Пример #1
0
 public void loadingID(ref int id, string urlShop)
 {
     Debug.Log(File.Exists(Application.persistentDataPath + urlShop));
     if (File.Exists(Application.persistentDataPath + urlShop))
     {
         try
         {
             SaveID          saveData = new SaveID();
             BinaryFormatter bf       = new BinaryFormatter();
             FileStream      fs       = new FileStream(Application.persistentDataPath + urlShop, FileMode.Open);
             saveData = (SaveID)bf.Deserialize(fs);
             fs.Close();
             // do somthing
             id = saveData.currentItemID;
         }
         catch (Exception e)
         {
             print(e);
         }
     }
 }
Пример #2
0
    public void savingID(ShopManager shopManager, string urlShop)
    {
        try
        {
            Debug.Log("shopManager: " + shopManager);
            SaveID saveData = new SaveID();
            // Save Data

            // Do something
            saveData.currentItemID = shopManager.currentItemID;
            //
            BinaryFormatter bf = new BinaryFormatter();
            FileStream      fs = new FileStream(Application.persistentDataPath + urlShop, FileMode.OpenOrCreate);
            bf.Serialize(fs, saveData);
            fs.Close();
        }
        catch (Exception e)
        {
            print(e);
        }
        print("saved data to " + Application.persistentDataPath + urlShop);
    }