Exemple #1
0
    public void InsertItem(UnityEngine.Object obj, int i)
    {
        if (obj as AudioClip != null)
        {
            SpecialEffectAnimClipAudioItem audioItem = new SpecialEffectAnimClipAudioItem();
            audioItem.SpeAnimClip = this;
            audioItem.obj         = obj;
            audioItem.Init_Editor();
            itemList.Insert(i, audioItem);

            UpdateSerializeItemList();
            return;
        }

        var go = obj as GameObject;

        if (go != null)
        {
            var spe = go.GetComponent <SpecialEffect>();
            if (spe != null)
            {
                SpecialEffectAnimClipEffectItem effItem = new SpecialEffectAnimClipEffectItem();
                effItem.SpeAnimClip = this;
                effItem.obj         = go;
                effItem.Init_Editor();
                itemList.Insert(i, effItem);
            }

            UpdateSerializeItemList();
        }
    }
Exemple #2
0
    //为Clip增加子项
    //type: 0为spe , 1为audio
    public int AddItem(UnityEngine.Object obj)
    {
        if (obj as AudioClip != null)
        {
            SpecialEffectAnimClipAudioItem audioItem = new SpecialEffectAnimClipAudioItem();
            audioItem.SpeAnimClip = this;
            audioItem.obj         = obj;
            audioItem.Init_Editor();
            itemList.Add(audioItem);
            UpdateSerializeItemList();
            return(itemList.Count - 1);
        }

        var go = obj as GameObject;

        if (go != null)
        {
            var spe = go.GetComponent <SpecialEffect>();
            if (spe != null)
            {
                SpecialEffectAnimClipEffectItem effItem = new SpecialEffectAnimClipEffectItem();
                effItem.SpeAnimClip = this;
                effItem.obj         = go;
                effItem.Init_Editor();
                itemList.Add(effItem);
                UpdateSerializeItemList();
                return(itemList.Count - 1);
            }
        }
        return(-1);
    }