Beispiel #1
0
        public void Load()
        {
            SerializedSampleLibrary serializedSampleLibrary = ReadJson(jsonPath);

            if (serializedSampleLibrary != null)
            {
                LoadJson(serializedSampleLibrary);
            }
            LoadFilesystem();
        }
Beispiel #2
0
 public void LoadJson(SerializedSampleLibrary savedLibrary)
 {
     for (int i = 0; i < savedLibrary.samples.Count; i++)
     {
         SerializedSample serializedSample  = savedLibrary.samples[i];
         SerializedSample serializedSample2 = library.GetSample(serializedSample.name);
         if (serializedSample2 == null)
         {
             SerializedSample serializedSample3 = new SerializedSample();
             serializedSample3.category = serializedSample.category;
             serializedSample3.name     = serializedSample.name;
             serializedSample2          = serializedSample3;
             library.AddSample(serializedSample2);
         }
         serializedSample2.Merge(serializedSample);
     }
 }
Beispiel #3
0
 public static SerializedSampleLibrary ReadJson(string path)
 {
     try
     {
         string json = File.ReadAllText(path);
         SerializedSampleLibrary serializedSampleLibrary = JsonUtility.FromJson <SerializedSampleLibrary>(json);
         for (int i = 0; i < serializedSampleLibrary.samples.Count; i++)
         {
             serializedSampleLibrary.map[serializedSampleLibrary.samples[i].name] = serializedSampleLibrary.samples[i];
         }
         return(serializedSampleLibrary);
     }
     catch
     {
         return(null);
     }
 }