示例#1
0
    Offset <Symbol> MakeSymbol(FlatBufferBuilder builder, SymbolData symbol)
    {
        var playableData = MakePlayable(builder, symbol);

        List <Offset <Symbol> >   symbols   = new List <Offset <Symbol> >();
        List <Offset <Timeline> > timelines = new List <Offset <Timeline> >();

        foreach (var playable in symbol.Playables)
        {
            if (playable is SymbolData)
            {
                symbols.Add(MakeSymbol(builder, playable as SymbolData));
            }
            else if (playable is TimeLineData)
            {
                timelines.Add(MakeTimeline(builder, playable as TimeLineData));
            }
        }

        var symbolsVector   = Symbol.CreateSymbolsVector(builder, symbols.ToArray());
        var timelinesVector = Symbol.CreateTimelinesVector(builder, timelines.ToArray());

        Symbol.StartSymbol(builder);
        Symbol.AddBase(builder, playableData);
        Symbol.AddSymbols(builder, symbolsVector);
        Symbol.AddTimelines(builder, timelinesVector);
        return(Symbol.EndSymbol(builder));
    }