Ejemplo n.º 1
0
        void DoChartToggle()
        {
            LoadChartTexture();
            EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.Width(130));
            Texture2D t = null;

            #region chart

            EditorGUILayout.BeginHorizontal();
            t = isShowPssChart ? pssChart : disableChart;
            isShowPssChart = GUILayout.Toggle(isShowPssChart, t, EditorStyles.label, GUILayout.Width(15), GUILayout.Height(15));
            GUILayout.Label("Pss", GUILayout.Width(40));
            GUILayout.Label(m_TreeView.GetPssMemory());
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal();
            t = isShowPowerChart ? powrChart : disableChart;
            isShowPowerChart = GUILayout.Toggle(isShowPowerChart, t, EditorStyles.label, GUILayout.Width(15), GUILayout.Height(15));
            GUILayout.Label("Power", GUILayout.Width(40));
            GUILayout.Label(m_TreeView.GetPower());
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal();
            t = isShowMonoChart ? monoChart : disableChart;
            isShowMonoChart = GUILayout.Toggle(isShowMonoChart, t, EditorStyles.label, GUILayout.Width(15), GUILayout.Height(15));
            GUILayout.Label("Mono  ", GUILayout.Width(40));
            GUILayout.Label(m_TreeView.GetMonoMemory());
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal();
            t = isShowLuaChart ? luaChart : disableChart;
            isShowLuaChart = GUILayout.Toggle(isShowLuaChart, t, EditorStyles.label, GUILayout.Width(15), GUILayout.Height(15));
            GUILayout.Label("Lua", GUILayout.Width(40));
            GUILayout.Label(m_TreeView.GetLuaMemory());
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal();
            t = isShowFpsChart ? fpsChart : disableChart;
            isShowFpsChart = GUILayout.Toggle(isShowFpsChart, t, EditorStyles.label, GUILayout.Width(15), GUILayout.Height(15));
            GUILayout.Label("Fps", GUILayout.Width(40));
            GUILayout.Label(m_TreeView.GetFPS());
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(15);
            GUILayout.Label("catch", GUILayout.Width(40));
            GUILayout.Label(m_TreeView.GetCatchedLuaMemory());
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(1);
            GUILayout.FlexibleSpace();
            #endregion

            EditorGUILayout.EndVertical();
        }
Ejemplo n.º 2
0
        void DoToolbar()
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

            #region clear
            bool isClear = GUILayout.Button("Clear", EditorStyles.toolbarButton, GUILayout.Height(30));
            if (isClear)
            {
                m_TreeView.Clear(true);
            }
            GUILayout.Space(5);
            #endregion

            #region deep
            bool flag = GUILayout.Toggle(LuaDeepProfilerSetting.Instance.isDeepProfiler,
                                         "Deep Profiler Lua", EditorStyles.toolbarButton, GUILayout.Height(30));
            if (flag != LuaDeepProfilerSetting.Instance.isDeepProfiler)
            {
                LuaDeepProfilerSetting.Instance.isDeepProfiler = flag;
                EditorApplication.isPlaying = false;
                InjectMethods.Recompile();
            }
            GUILayout.Space(5);

            flag = GUILayout.Toggle(LuaDeepProfilerSetting.Instance.profilerMono,
                                    "Include Mono", EditorStyles.toolbarButton, GUILayout.Height(30));
            if (flag != LuaDeepProfilerSetting.Instance.profilerMono)
            {
                LuaDeepProfilerSetting.Instance.profilerMono = flag;
                EditorApplication.isPlaying = false;
                InjectMethods.Recompile();
            }
            GUILayout.Space(5);

            flag = GUILayout.Toggle(LuaDeepProfilerSetting.Instance.includeCSLua,
                                    "Contain C# Lua", EditorStyles.toolbarButton, GUILayout.Height(30));
            if (flag != LuaDeepProfilerSetting.Instance.includeCSLua)
            {
                LuaDeepProfilerSetting.Instance.includeCSLua = flag;
                EditorApplication.isPlaying = false;
                InjectMethods.Recompile();
            }
            GUILayout.Space(5);
            #endregion

            #region stop
            bool isStop = GUILayout.Toggle(m_isStop, "Stop GC", EditorStyles.toolbarButton, GUILayout.Height(30));

            if (m_isStop != isStop)
            {
                if (isStop)
                {
                    LuaLib.StopGC();
                    m_isStop = true;
                }
                else
                {
                    LuaLib.ResumeGC();
                    m_isStop = false;
                }
            }
            GUILayout.Space(5);
            #endregion

            #region run gc
            bool isRunGC = GUILayout.Button("Run GC", EditorStyles.toolbarButton, GUILayout.Height(30));
            if (isRunGC)
            {
                LuaLib.RunGC();
            }
            GUILayout.Space(5);
            #endregion

            #region history
            flag = GUILayout.Toggle(LuaDeepProfilerSetting.Instance.isRecord,
                                    "Record", EditorStyles.toolbarButton, GUILayout.Height(30));
            if (flag != LuaDeepProfilerSetting.Instance.isRecord)
            {
                LuaDeepProfilerSetting.Instance.isRecord = flag;
                if (flag)
                {
                    GameViewUtility.ChangeGameViewSize(480, 270);
                }
                EditorApplication.isPlaying = false;
            }
            GUILayout.Space(25);
            #endregion

            #region path
            if (GUILayout.Button("Lua Path", EditorStyles.toolbarButton, GUILayout.Height(30)))
            {
                LocalToLuaIDE.SetExternalProjectRootPath();
            }
            if (GUILayout.Button("IDE Path", EditorStyles.toolbarButton, GUILayout.Height(30)))
            {
                LocalToLuaIDE.SetExternalEditorPath();
            }
            if (GUILayout.Button("Clear Path", EditorStyles.toolbarButton, GUILayout.Height(30)))
            {
                LocalToLuaIDE.ClearPath();
            }
            GUILayout.Space(100);
            if (GUILayout.Button("Save Result", EditorStyles.toolbarButton, GUILayout.Height(30)))
            {
                m_TreeView.SaveResult();
            }
            if (GUILayout.Button("Load Result", EditorStyles.toolbarButton, GUILayout.Height(30)))
            {
                m_TreeView.LoadHistory();
            }
            #endregion

            #region gc value
            GUILayout.Space(5);
            GUILayout.FlexibleSpace();
            GUILayout.Label(string.Format("Lua Total:{0}", m_TreeView.GetLuaMemory()), EditorStyles.toolbarButton, GUILayout.Height(30));
            #endregion

            GUILayout.Space(100);
            GUILayout.FlexibleSpace();

            m_TreeView.searchString = m_SearchField.OnToolbarGUI(m_TreeView.searchString);

            EditorGUILayout.EndHorizontal();
        }
Ejemplo n.º 3
0
        void DoToolbar()
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

            #region clear
            bool isClear = GUILayout.Button("Clear", EditorStyles.toolbarButton, GUILayout.Height(30));
            if (isClear)
            {
                currentFrameIndex = 0;
                m_TreeView.Clear(true);
            }
            GUILayout.Space(5);
            #endregion

            #region history
            bool flag = GUILayout.Toggle(LuaDeepProfilerSetting.Instance.isRecord, "Record", EditorStyles.toolbarButton, GUILayout.Height(30));
            if (flag != LuaDeepProfilerSetting.Instance.isRecord)
            {
                LuaDeepProfilerSetting.Instance.isRecord = flag;
            }
            GUILayout.Space(25);
            #endregion

            #region socket

            if (GUILayout.Button("OpenService", EditorStyles.toolbarButton, GUILayout.Height(30)))
            {
                NetWorkServer.Close();
                currentFrameIndex = 0;
                m_TreeView.Clear(true);
                NetWorkServer.RegisterOnReceive(m_TreeView.LoadRootSample);
                NetWorkServer.BeginListen("0.0.0.0", port);
            }
            GUILayout.Label("port:", GUILayout.Height(30), GUILayout.Width(35));
            port = EditorGUILayout.IntField(port, GUILayout.Height(16), GUILayout.Width(50));

            if (GUILayout.Button("CloseService", EditorStyles.toolbarButton, GUILayout.Height(30)))
            {
                NetWorkServer.Close();
            }
            #endregion

            #region chart
            isShowLuaChart = GUILayout.Toggle(isShowLuaChart, "LuaChart", EditorStyles.toolbarButton, GUILayout.Height(30));
            GUILayout.Space(5);
            isShowMonoChart = GUILayout.Toggle(isShowMonoChart, "MonoChart", EditorStyles.toolbarButton, GUILayout.Height(30));
            GUILayout.Space(25);
            #endregion

            #region path

            /*
             * if (GUILayout.Button("Lua Path", EditorStyles.toolbarButton, GUILayout.Height(30)))
             * {
             *  LocalToLuaIDE.SetExternalProjectRootPath();
             * }
             * if (GUILayout.Button("IDE Path", EditorStyles.toolbarButton, GUILayout.Height(30)))
             * {
             *  LocalToLuaIDE.SetExternalEditorPath();
             * }
             * if (GUILayout.Button("Clear Path", EditorStyles.toolbarButton, GUILayout.Height(30)))
             * {
             *  LocalToLuaIDE.ClearPath();
             * }
             * GUILayout.Space(100);
             * if (GUILayout.Button("Save Result", EditorStyles.toolbarButton, GUILayout.Height(30)))
             * {
             *  m_TreeView.SaveResult();
             * }
             * if (GUILayout.Button("Load Result", EditorStyles.toolbarButton, GUILayout.Height(30)))
             * {
             *  m_TreeView.LoadHistory();
             * }*/
            #endregion

            #region gc value
            GUILayout.Space(100);
            GUILayout.FlexibleSpace();
            GUILayout.Label(string.Format("Lua Total:{0}", m_TreeView.GetLuaMemory()), EditorStyles.toolbarButton, GUILayout.Height(30));

            GUILayout.Space(15);
            GUILayout.Label(string.Format("Mono Total:{0}", m_TreeView.GetMonoMemory()), EditorStyles.toolbarButton, GUILayout.Height(30));
            GUILayout.Space(25);
            #endregion

            m_TreeView.searchString = m_SearchField.OnToolbarGUI(m_TreeView.searchString);

            EditorGUILayout.EndHorizontal();
        }