Ejemplo n.º 1
0
    private IEnumerator RefreshRdItems()
    {
        for (int i = 0; i < _rect.childCount; i++)
        {
            if (_cachedElementsTransforms.Contains(_rect.GetChild(i)))
            {
                continue;
            }

            _rdElement = _rect.GetChild(i).gameObject.GetComponent <CustomReorderableElement>() ??
                         _rect.GetChild(i).gameObject.AddComponent <CustomReorderableElement>();
            _rdElement.InitializeReorderableItem(_rdList);

            _cachedElementsTransforms.Add(_rect.GetChild(i));
            _cachedRdElements.Add(_rdElement);
        }

        yield return(0);

        for (int i = _cachedElementsTransforms.Count - 1; i >= 0; i--)
        {
            if (_cachedElementsTransforms[i] == null)
            {
                _cachedElementsTransforms.RemoveAt(i);
                _cachedElementsTransforms.RemoveAt(i);
            }
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Initialize every trackInfo obj
    /// </summary>
    /// <param name="track"></param>
    public void InstanceInTrackList(AudioClip track)
    {
        tracksCount++;
        GameObject o = Instantiate(TrackItem) as GameObject;

        o.name = track.name;
        o.transform.SetParent(PlayListContent, false);
        TrackInfo info = o.GetComponent <TrackInfo>();
        CustomReorderableElement rdElem = o.GetComponent <CustomReorderableElement>();

        rdElem.InitializeReorderableItem(reorderableList);
        info.GetInfo(track, tracksCount, trackMenu, playerController, playListController);
        allTrackInfosList.Add(info);
    }