Exemplo n.º 1
0
    void OnGUI()
    {
        if (Event.current.type == EventType.Layout)
        {
            if (m_HeatMapInstance == null)
            {
                AttemptReconnectWithHeatmapInstance();
            }
            if (m_RenderView != null)
            {
                m_RenderView.SetGameObject(m_HeatMapInstance);
            }
        }

        using (var scroll = new EditorGUILayout.ScrollViewScope(m_ScrollPosition))
        {
            m_ScrollPosition = scroll.scrollPosition;
            using (new EditorGUILayout.VerticalScope("box"))
            {
                using (new EditorGUILayout.HorizontalScope())
                {
                    if (GUILayout.Button("Reset"))
                    {
                        SystemReset();
                    }
                    if (GUILayout.Button("Documentation"))
                    {
                        Application.OpenURL("https://bitbucket.org/Unity-Technologies/heatmaps/wiki/Home");
                    }
                }
            }

            using (new EditorGUILayout.VerticalScope("box"))
            {
                m_ShowAggregate = EditorGUI.Foldout(EditorGUILayout.GetControlRect(), m_ShowAggregate, "Data", true);
                if (m_ShowAggregate)
                {
                    m_AggregationView.OnGUI();
                    using (new EditorGUILayout.HorizontalScope())
                    {
                        if (GUILayout.Button("Process"))
                        {
                            SystemProcess();
                        }
                    }
                }
            }

            using (new EditorGUILayout.VerticalScope("box"))
            {
                m_ShowRender = EditorGUI.Foldout(EditorGUILayout.GetControlRect(), m_ShowRender, "Render", true);
                if (m_ShowRender && m_ParserView != null)
                {
                    m_ParserView.OnGUI();
                    m_RenderView.OnGUI();
                }
            }
        }
    }
    void OnGUI()
    {
        GUILayout.BeginVertical("box");
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Reset"))
        {
            SystemReset();
        }
        if (GUILayout.Button("Documentation"))
        {
            Application.OpenURL("https://bitbucket.org/strangeioc/heatmaps/wiki/Home");
        }
        if (GUILayout.Button("Purge"))
        {
            PurgeData();
        }
        GUILayout.EndHorizontal();
        GUILayout.EndVertical();

        GUILayout.BeginVertical("box");
        if (m_AggregationView == null)
        {
            m_AggregationView = AggregationInspector.Init(m_EventClient, m_Aggregator);
        }
        m_ShowAggregate = EditorGUI.Foldout(EditorGUILayout.GetControlRect(), m_ShowAggregate, "Aggregate Events", true);
        if (m_ShowAggregate)
        {
            m_AggregationView.OnGUI();
            GUILayout.BeginHorizontal();

            m_LocalOnly = GUILayout.Toggle(m_LocalOnly, new GUIContent("Local only", "If checked, don't attempt to download raw data from the server."));
            string fetchButtonText = m_LocalOnly ? "Process" : "Fetch and Process";
            if (GUILayout.Button(fetchButtonText))
            {
                SystemProcess();
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();

        GUILayout.BeginVertical("box");
        if (m_ParserView == null)
        {
            m_ParserView = HeatmapDataParserInspector.Init(OnPointData);
        }
        if (m_RenderView == null)
        {
            m_RenderView = HeatmapRendererInspector.Init(this);
        }

        m_ShowRender = EditorGUI.Foldout(EditorGUILayout.GetControlRect(), m_ShowRender, "Render", true);
        if (m_ShowRender && m_ParserView != null)
        {
            m_ParserView.OnGUI();
            m_RenderView.OnGUI();
        }

        if (m_HeatMapInstance)
        {
            m_RenderView.SetGameObject(m_HeatMapInstance);
        }
        GUILayout.EndVertical();
    }