static void SyncDataManual() { LevelDataIndex levelDataIndex = Resources.LoadAssetAtPath <LevelDataIndex>(StreamTools.GetStreamingAssetsPathInEditor() + ConstantData.MissionLevelDataIndexPath); if (!levelDataIndex) { levelDataIndex = ScriptableObject.CreateInstance <LevelDataIndex>(); AssetDatabase.CreateAsset(levelDataIndex, StreamTools.GetStreamingAssetsPathInEditor() + ConstantData.MissionLevelDataIndexPath); } else { levelDataIndex.Clear(); } System.IO.FileInfo[] fileInfos = StreamTools.GetAllFile(StreamTools.GetStreamingAssetsPathInEditor() + ConstantData.MissionLevelDataPath, "*-*"); foreach (var v in fileInfos) { LevelData data = Resources.LoadAssetAtPath <LevelData>(StreamTools.GetStreamingAssetsPathInEditor() + ConstantData.MissionLevelDataPath + v.Name); data.SpecificPocket = !(data.StartPunishmentPocket == PocketIndexes.None && data.StartRewardPocket == PocketIndexes.None); levelDataIndex.Add(data); } Debug.Log("Synchronize data finished"); }
void SyncData() { System.IO.FileInfo[] fileInfos = StreamTools.GetAllFile(StreamTools.GetStreamingAssetsPathInEditor() + ConstantData.MissionLevelDataPath, "*-*"); if (fileInfos.Length != m_LevelDataIndex.Count) { Debug.Log("Level data indexes need synchronized, now synchronizing"); m_LevelDataIndex.Clear(); foreach (var v in fileInfos) { LevelData data = Resources.LoadAssetAtPath <LevelData>(StreamTools.GetStreamingAssetsPathInEditor() + ConstantData.MissionLevelDataPath + v.Name); m_LevelDataIndex.Add(data); } } }