Exemplo n.º 1
0
    public static T RecordValue <T>(T value, int nodeId, int graphId, int frameCount)
    {
        VisualScriptingFrameTrace data = SetLastCallFrame(nodeId, graphId, frameCount, "");

        data.AddValue(value, nodeId);
        return(value);
    }
Exemplo n.º 2
0
    public static VisualScriptingFrameTrace SetLastCallFrame(int nodeId, int graphId, int frameCount, string name, int stepOffset = 0)
    {
        if (s_LastFrame != frameCount)
        {
            if (s_Data == null)
            {
                s_Data = new Dictionary <int, TraceRecorder>();
            }

            if (s_LastFrame > 0)
            {
                // record last frame, before setting up new one
                foreach (var keypair in s_CurrentFrameData)
                {
                    if (!s_Data.TryGetValue(keypair.Key, out var recorder))
                    {
                        s_Data.Add(keypair.Key, recorder = new TraceRecorder(k_MaxRecordedFrames));
                    }

                    VisualScriptingFrameTrace data = keypair.Value;
                    recorder.Record(frameCount, data);
                }
            }

            s_CurrentFrameData = null;
            s_LastFrame        = frameCount;
        }

        if (s_CurrentFrameData == null)
        {
            s_CurrentFrameData = new Dictionary <int, VisualScriptingFrameTrace>();
        }

        if (!s_CurrentFrameData.TryGetValue(graphId, out var frameData))
        {
            s_CurrentFrameData.Add(graphId, frameData = new VisualScriptingFrameTrace());
        }

        if (stepOffset == 0)
        {
            frameData.SetNextStep(nodeId);
        }
        else
        {
            frameData.PadAndInsert(stepOffset, nodeId);
        }
        return(frameData);
    }