Ejemplo n.º 1
0
    // Copy clips
    private void CopyFrames(List <Uni2DAnimationFrame> a_rFramesSource, List <Uni2DAnimationFrame> a_rFramesDestination)
    {
        // Update asset table
        Uni2DEditorAssetTable rAssetTable = Uni2DEditorAssetTable.Instance;
        string rClipGUID = Uni2DEditorUtils.GetUnityAssetGUID(this);

        foreach (Uni2DAnimationFrame rOldFrame in a_rFramesDestination)
        {
            string oTextureGUID = rOldFrame.textureContainer != null ? rOldFrame.textureContainer.GUID : null;
            if (!string.IsNullOrEmpty(oTextureGUID))
            {
                rAssetTable.RemoveClipUsingTexture(rClipGUID, oTextureGUID);
            }
        }

        a_rFramesDestination.Clear( );
        foreach (Uni2DAnimationFrame rFrameSource in a_rFramesSource)
        {
            a_rFramesDestination.Add(new Uni2DAnimationFrame(rFrameSource));

            string oTextureGUID = rFrameSource.textureContainer != null ? rFrameSource.textureContainer.GUID : null;
            if (!string.IsNullOrEmpty(oTextureGUID))
            {
                rAssetTable.AddClipUsingTexture(rClipGUID, oTextureGUID);
            }
        }

        rAssetTable.Save( );
    }