Exemplo n.º 1
0
        public void StepGraphInternal(VarTracerGraphItData graph)
        {
#if UNITY_EDITOR
            foreach (KeyValuePair <string, VarTracerDataInternal> entry in graph.mData)
            {
                VarTracerDataInternal g = entry.Value;
                if (g.mDataInfos.Count <= 0)
                {
                    continue;
                }

                float sum = g.mDataInfos[0].Value;
                float min = g.mDataInfos[0].Value;
                float max = g.mDataInfos[0].Value;
                for (int i = 1; i < g.mDataInfos.Count; ++i)
                {
                    sum += g.mDataInfos[i].Value;
                    min  = Mathf.Min(min, g.mDataInfos[i].Value);
                    max  = Mathf.Max(max, g.mDataInfos[i].Value);
                }
                if (graph.mInclude0)
                {
                    min = Mathf.Min(min, 0.0f);
                    max = Mathf.Max(max, 0.0f);
                }

                g.mMin = min;
                g.mMax = max;
            }
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// Allows you to switch between sharing the y-axis on a graph for all subgraphs, or for them to be independent.
        /// </summary>
        /// <param name="graph"></param>
        /// <param name="shared_y_axis"></param>
        public static void ShareYAxis(string graph, bool shared_y_axis)
        {
#if UNITY_EDITOR
            if (!Instance.Graphs.ContainsKey(graph))
            {
                Instance.Graphs[graph] = new VarTracerGraphItData(graph);
            }

            VarTracerGraphItData g = Instance.Graphs[graph];
            g.mSharedYAxis = shared_y_axis;
#endif
        }
Exemplo n.º 3
0
        /// <summary>
        /// Optional setup function that allows you to specify the initial height of a graph.
        /// </summary>
        /// <param name="graph"></param>
        /// <param name="subgraph"></param>
        /// <param name="height"></param>
        public static void GraphSetupHeight(string graph, float height)
        {
#if UNITY_EDITOR
            if (!Instance.Graphs.ContainsKey(graph))
            {
                Instance.Graphs[graph] = new VarTracerGraphItData(graph);
            }

            VarTracerGraphItData g = Instance.Graphs[graph];
            //g.mCurrentIndex = m_wholeFrameIndex;
            g.SetHeight(height);
#endif
        }
Exemplo n.º 4
0
        public void InsertValue(VarDataInfo dataInfo)
        {
            m_dataList.Add(dataInfo);

            foreach (var channel in m_channelDict.Keys)
            {
#if UNITY_EDITOR
                if (VarTracer.Instance.Graphs.ContainsKey(channel))
                {
                    VarTracerGraphItData g = VarTracer.Instance.Graphs[channel];
                    if (!g.mData.ContainsKey(m_varName))
                    {
                        g.mData[m_varName] = new VarTracerDataInternal(g.mData.Count);
                    }
                    g.mData[m_varName].mCurrentValue = dataInfo.Value;
                    g.mData[m_varName].mDataInfos.Add(dataInfo);
                }
#endif
            }
        }
        void Update()
        {
#if UNITY_EDITOR
            foreach (KeyValuePair <string, VarTracerGraphItData> kv in VarTracer.Instance.Graphs)
            {
                VarTracerGraphItData g = kv.Value;
                if (g.mReadyForUpdate && !g.mFixedUpdate)
                {
                    VarTracer.Instance.StepGraphInternal(g);
                }
            }
#endif
            if (_connectPressed)
            {
                VarTracerNetUtils.Connect(_IPField);
                _connectPressed = false;
            }
            VarTracerNet.Instance.Upate();
            Repaint();
        }
Exemplo n.º 6
0
        public void DetachChannel(string channel)
        {
            if (string.IsNullOrEmpty(channel))
            {
                return;
            }
            if (m_channelDict.ContainsKey(channel))
            {
                m_channelDict.Remove(channel);
#if UNITY_EDITOR
                if (VarTracer.Instance.Graphs.ContainsKey(channel))
                {
                    VarTracerGraphItData g = VarTracer.Instance.Graphs[channel];
                    if (g.mData.ContainsKey(m_varName))
                    {
                        g.mData.Remove(m_varName);
                    }
                }
#endif
            }
        }
Exemplo n.º 7
0
        public void AttchChannel(string channel)
        {
            if (string.IsNullOrEmpty(channel))
            {
                return;
            }
            if (!m_channelDict.ContainsKey(channel))
            {
                m_channelDict[channel] = channel;
#if UNITY_EDITOR
                if (VarTracer.Instance.Graphs.ContainsKey(channel))
                {
                    VarTracerGraphItData g = VarTracer.Instance.Graphs[channel];
                    if (!g.mData.ContainsKey(m_varName))
                    {
                        g.mData[m_varName] = new VarTracerDataInternal(g.mData.Count);
                    }

                    g.mData[m_varName].mDataInfos.Clear();
                    g.mData[m_varName].mDataInfos.AddRange(m_dataList);
                }
#endif
            }
        }