/// <summary> /// Load all the prepared files into cache. /// </summary> public void LoadPreparedFiles() { if (m_PreparedFiles == null) { return; } if (m_Data == null) { m_Data = new Dictionary <string, Dictionary <string, string[]> >(); } foreach (KeyValuePair <string, PreparedFileContainer> file in m_PreparedFiles) { if (file.Value.Columns.Length == 0) { Debug.Log("ExternalDataManager : Trying to load file " + file.Key + " but it has no specified column."); } else if (file.Value.Columns.Length == 1) { if (file.Value.Columns[0] == -1) { Dictionary <string, List <string> > loadedData = file.Value.UseAsset ? CSVUtil.LoadAllColumns(file.Value.File) : CSVUtil.LoadAllColumns(file.Value.Path, file.Value.FileName); m_Data.Add(file.Key, loadedData.ConvertValues((obj) => obj.ToArray())); } else { Dictionary <string, List <string> > loadedData = file.Value.UseAsset ? CSVUtil.LoadSingleColumn(file.Value.File, file.Value.Columns[0]) : CSVUtil.LoadSingleColumn(file.Value.Path, file.Value.FileName, file.Value.Columns[0]); m_Data.Add(file.Key, loadedData.ConvertValues((obj) => obj.ToArray())); } } else { Dictionary <string, List <string> > loadedData = file.Value.UseAsset ? CSVUtil.LoadMultipleColumns(file.Value.File, file.Value.Columns) : CSVUtil.LoadMultipleColumns(file.Value.Path, file.Value.FileName, file.Value.Columns); m_Data.Add(file.Key, loadedData.ConvertValues((obj) => obj.ToArray())); } } m_PreparedFiles.Clear(); }