Пример #1
0
        private void ClickEnableFrameDebugger()
        {
            bool flag  = FrameDebuggerUtility.IsLocalEnabled() || FrameDebuggerUtility.IsRemoteEnabled();
            bool flag2 = !flag && this.m_AttachProfilerUI.IsEditor();

            if (!flag2 || FrameDebuggerUtility.locallySupported)
            {
                if (flag2)
                {
                    if (EditorApplication.isPlaying && !EditorApplication.isPaused)
                    {
                        EditorApplication.isPaused = true;
                    }
                }
                if (!flag)
                {
                    FrameDebuggerUtility.SetEnabled(true, ProfilerDriver.connectedProfiler);
                }
                else
                {
                    FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID());
                }
                if (FrameDebuggerUtility.IsLocalEnabled())
                {
                    GameView gameView = (GameView)WindowLayout.FindEditorWindowOfType(typeof(GameView));
                    if (gameView)
                    {
                        gameView.ShowTab();
                    }
                }
                this.m_PrevEventsLimit = FrameDebuggerUtility.limit;
                this.m_PrevEventsCount = FrameDebuggerUtility.count;
            }
        }
Пример #2
0
 private static void DisableFrameDebugger()
 {
     if (FrameDebuggerUtility.IsLocalEnabled())
     {
         EditorApplication.SetSceneRepaintDirty();
     }
     FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID());
 }
Пример #3
0
        private bool DrawToolbar(FrameDebuggerEvent[] descs)
        {
            bool flag1 = false;
            bool flag2 = !this.m_AttachProfilerUI.IsEditor() || FrameDebuggerUtility.locallySupported;

            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            EditorGUI.BeginDisabledGroup(!flag2);
            GUILayout.Toggle((FrameDebuggerUtility.IsLocalEnabled() ? 1 : (FrameDebuggerUtility.IsRemoteEnabled() ? 1 : 0)) != 0, FrameDebuggerWindow.styles.recordButton, EditorStyles.toolbarButton, new GUILayoutOption[1]
            {
                GUILayout.MinWidth(80f)
            });
            EditorGUI.EndDisabledGroup();
            if (EditorGUI.EndChangeCheck())
            {
                this.ClickEnableFrameDebugger();
                flag1 = true;
            }
            this.m_AttachProfilerUI.OnGUILayout((EditorWindow)this);
            bool flag3 = FrameDebuggerUtility.IsLocalEnabled() || FrameDebuggerUtility.IsRemoteEnabled();

            if (flag3 && ProfilerDriver.connectedProfiler != FrameDebuggerUtility.GetRemotePlayerGUID())
            {
                FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID());
                FrameDebuggerUtility.SetEnabled(true, ProfilerDriver.connectedProfiler);
            }
            GUI.enabled = flag3;
            EditorGUI.BeginChangeCheck();
            EditorGUI.BeginDisabledGroup(FrameDebuggerUtility.count <= 1);
            int newLimit = EditorGUILayout.IntSlider(FrameDebuggerUtility.limit, 1, FrameDebuggerUtility.count);

            EditorGUI.EndDisabledGroup();
            if (EditorGUI.EndChangeCheck())
            {
                this.ChangeFrameEventLimit(newLimit);
            }
            GUILayout.Label(" of " + (object)FrameDebuggerUtility.count, EditorStyles.miniLabel, new GUILayoutOption[0]);
            EditorGUI.BeginDisabledGroup(newLimit <= 1);
            if (GUILayout.Button(FrameDebuggerWindow.styles.prevFrame, EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                this.ChangeFrameEventLimit(newLimit - 1);
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.BeginDisabledGroup(newLimit >= FrameDebuggerUtility.count);
            if (GUILayout.Button(FrameDebuggerWindow.styles.nextFrame, EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                this.ChangeFrameEventLimit(newLimit + 1);
            }
            if (this.m_PrevEventsLimit == this.m_PrevEventsCount && FrameDebuggerUtility.count != this.m_PrevEventsCount && FrameDebuggerUtility.limit == this.m_PrevEventsLimit)
            {
                this.ChangeFrameEventLimit(FrameDebuggerUtility.count);
            }
            this.m_PrevEventsLimit = FrameDebuggerUtility.limit;
            this.m_PrevEventsCount = FrameDebuggerUtility.count;
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();
            return(flag1);
        }
Пример #4
0
        private static void DisableFrameDebugger()
        {
            // if it was true before, we disabled and ask the game scene to repaint
            if (FrameDebugger.IsLocalEnabled())
            {
                EditorApplication.SetSceneRepaintDirty();
            }

            FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID());
        }
 private void DrawConnectionDropdown(FrameDebuggerWindow frameDebugger, IConnectionState m_AttachToPlayerState, out bool isEnabled)
 {
     PlayerConnectionGUILayout.ConnectionTargetSelectionDropdown(m_AttachToPlayerState, EditorStyles.toolbarDropDown);
     isEnabled = FrameDebugger.enabled;
     if (isEnabled && ProfilerDriver.connectedProfiler != FrameDebuggerUtility.GetRemotePlayerGUID())
     {
         // Switch from local to remote debugger or vice versa
         FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID());
         FrameDebuggerUtility.SetEnabled(true, ProfilerDriver.connectedProfiler);
     }
 }
Пример #6
0
        internal void ClickEnableFrameDebugger()
        {
            bool isEnabled       = FrameDebugger.enabled;
            bool enablingLocally = !isEnabled && m_AttachToPlayerState.connectedToTarget == ConnectionTarget.Editor;

            if (enablingLocally && !FrameDebuggerUtility.locallySupported)
            {
                return;
            }

            // pause play mode if needed
            if (enablingLocally)
            {
                if (EditorApplication.isPlaying && !EditorApplication.isPaused)
                {
                    EditorApplication.isPaused = true;
                }
            }

            if (!isEnabled)
            {
                FrameDebuggerUtility.SetEnabled(true, ProfilerDriver.connectedProfiler);
            }
            else
            {
                FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID());
            }

            // Make sure game view is visible when enabling frame debugger locally
            if (FrameDebugger.IsLocalEnabled())
            {
                PlayModeView playModeView = PlayModeView.GetMainPlayModeView();
                if (playModeView)
                {
                    playModeView.ShowTab();
                }
            }
        }
Пример #7
0
        private bool DrawToolbar(FrameDebuggerEvent[] descs)
        {
            bool result = false;
            bool flag   = !this.m_AttachProfilerUI.IsEditor() || FrameDebuggerUtility.locallySupported;

            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            using (new EditorGUI.DisabledScope(!flag))
            {
                GUILayout.Toggle(FrameDebuggerUtility.IsLocalEnabled() || FrameDebuggerUtility.IsRemoteEnabled(), FrameDebuggerWindow.styles.recordButton, EditorStyles.toolbarButton, new GUILayoutOption[]
                {
                    GUILayout.MinWidth(80f)
                });
            }
            if (EditorGUI.EndChangeCheck())
            {
                this.ClickEnableFrameDebugger();
                result = true;
            }
            this.m_AttachProfilerUI.OnGUILayout(this);
            bool flag2 = FrameDebuggerUtility.IsLocalEnabled() || FrameDebuggerUtility.IsRemoteEnabled();

            if (flag2 && ProfilerDriver.connectedProfiler != FrameDebuggerUtility.GetRemotePlayerGUID())
            {
                FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID());
                FrameDebuggerUtility.SetEnabled(true, ProfilerDriver.connectedProfiler);
            }
            GUI.enabled = flag2;
            EditorGUI.BeginChangeCheck();
            int num;

            using (new EditorGUI.DisabledScope(FrameDebuggerUtility.count <= 1))
            {
                num = EditorGUILayout.IntSlider(FrameDebuggerUtility.limit, 1, FrameDebuggerUtility.count, new GUILayoutOption[0]);
            }
            if (EditorGUI.EndChangeCheck())
            {
                this.ChangeFrameEventLimit(num);
            }
            GUILayout.Label(" of " + FrameDebuggerUtility.count, EditorStyles.miniLabel, new GUILayoutOption[0]);
            using (new EditorGUI.DisabledScope(num <= 1))
            {
                if (GUILayout.Button(FrameDebuggerWindow.styles.prevFrame, EditorStyles.toolbarButton, new GUILayoutOption[0]))
                {
                    this.ChangeFrameEventLimit(num - 1);
                }
            }
            using (new EditorGUI.DisabledScope(num >= FrameDebuggerUtility.count))
            {
                if (GUILayout.Button(FrameDebuggerWindow.styles.nextFrame, EditorStyles.toolbarButton, new GUILayoutOption[0]))
                {
                    this.ChangeFrameEventLimit(num + 1);
                }
                if (this.m_PrevEventsLimit == this.m_PrevEventsCount)
                {
                    if (FrameDebuggerUtility.count != this.m_PrevEventsCount && FrameDebuggerUtility.limit == this.m_PrevEventsLimit)
                    {
                        this.ChangeFrameEventLimit(FrameDebuggerUtility.count);
                    }
                }
                this.m_PrevEventsLimit = FrameDebuggerUtility.limit;
                this.m_PrevEventsCount = FrameDebuggerUtility.count;
            }
            GUILayout.EndHorizontal();
            return(result);
        }