예제 #1
0
 public void LoadAdsData()
 {
     adsSettings = new AdsSetting[1] {
         new AdsSetting()
     };                                         //We should load ads setting from a json file
     adsFullCondition = new AdsFullCondition(); //We should load ads setting from a json file
     if (File.Exists(dataPath))
     {
         BinaryFormatter binaryFormatter = new BinaryFormatter();
         string          data;
         using (FileStream fileStream = File.Open(dataPath, FileMode.Open))
         {
             try
             {
                 data = (string)binaryFormatter.Deserialize(fileStream);
                 adsDataCollection = JsonUtility.FromJson <AdsDataCollection>(data);
             }
             catch (System.Exception e)
             {
                 Debug.LogError(e.Message);
                 ResetData();
             }
         }
     }
     else
     {
         ResetData();
     }
     adsDataCollection.UpdateAdsCollection(adsSettings);
 }
예제 #2
0
 private void ResetData()
 {
     adsDataCollection = new AdsDataCollection(adsSettings);
     SaveAdsData();
 }