Exemplo n.º 1
0
 private void FetchChaptersData()
 {
     try {
         if (!File.Exists(path + file_name))
         {
             Debug.LogError("Chapters File not found, creating a default file");
             CreateDefaultData();
         }
         else
         {
             var data = _offlineDataManager.FetchData(path + file_name);
             localChapterData = data as LocalChapterData;
             CompareAndUpdateChapterData();
         }
     } catch (Exception e) {
         Debug.LogError("Fetching Chapter failed \n" + e.Message);
     }
 }
Exemplo n.º 2
0
    private void CreateDefaultData()
    {
        if (_defaultData != null && _defaultData.chapters != null)
        {
            LocalChapterData local_data = new LocalChapterData()
            {
                chapters = new List <ChapterData>()
            };

            foreach (var data in _defaultData.chapters)
            {
                local_data.chapters.Add(data.chapter_data);
            }

            localChapterData = local_data;

            _offlineDataManager.SaveData(path + file_name, local_data);
        }
    }