Exemplo n.º 1
0
            public SerializedClip AddClip(string path, string id, SerializedClip copyFrom = null, AudioClip loadedClip = null)
            {
                if (containers == null)
                {
                    containers = new Dictionary <string, IClipContainer>();
                }
                if (clips == null)
                {
                    clips = new List <SerializedClip>();
                }
                SerializedClip serializedClip = null;

                for (int i = 0; i < clips.Count; i++)
                {
                    if (clips[i].id == id)
                    {
                        serializedClip = clips[i];
                        break;
                    }
                }
                if (serializedClip == null)
                {
                    SerializedClip serializedClip2 = new SerializedClip();
                    serializedClip2.id       = id;
                    serializedClip2.filename = path;
                    serializedClip           = serializedClip2;
                    clips.Add(serializedClip);
                }
                serializedClip.filename = path;
                if (loadedClip != null)
                {
                    serializedClip.clip        = loadedClip;
                    serializedClip.isEmbedded  = true;
                    serializedClip.clipDirty   = false;
                    serializedClip.missingFile = false;
                }
                if (copyFrom != null)
                {
                    serializedClip.Merge(copyFrom);
                }
                serializedClip.sample = this;
                serializedClip.CheckClipFileChange();
                IClipContainer clipContainer = EnsureContainerFor(id);

                if (clipContainer != null)
                {
                    ParseId(id, out string _, out string localId);
                    clipContainer.SetChild(localId, serializedClip);
                }
                else
                {
                    root = serializedClip;
                }
                return(serializedClip);
            }
Exemplo n.º 2
0
            public void CheckClipFileChange()
            {
                bool flag = false;

                for (int i = 0; i < clips.Count; i++)
                {
                    SerializedClip serializedClip = clips[i];
                    serializedClip.CheckClipFileChange();
                    if (serializedClip.clipDirty)
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    Coroutines.StartGlobalCoroutine(LoadClips());
                }
            }