Пример #1
0
        public void OnGUI()
        {
            GUIContent content = EditorGUIUtility.TextContent(this.GetConnectedProfiler() + "|Specifies the target player for receiving profiler and log data.");
            Vector2    vector  = EditorStyles.toolbarDropDown.CalcSize(content);
            Rect       rect    = GUILayoutUtility.GetRect(vector.x, vector.y);

            if (EditorGUI.DropdownButton(rect, content, FocusType.Passive, EditorStyles.toolbarDropDown))
            {
                List <ProfilerChoise> list = new List <ProfilerChoise>();
                list.Clear();
                AttachProfilerUI.AddPlayerProfilers(list);
                AttachProfilerUI.AddDeviceProfilers(list);
                AttachProfilerUI.AddLastIPProfiler(list);
                if (!ProfilerDriver.IsConnectionEditor())
                {
                    if (!list.Any((ProfilerChoise p) => p.IsSelected()))
                    {
                        List <ProfilerChoise> arg_10B_0 = list;
                        ProfilerChoise        item      = default(ProfilerChoise);
                        item.Name       = "(Autoconnected Player)";
                        item.Enabled    = false;
                        item.IsSelected = (() => true);
                        item.ConnectTo  = delegate
                        {
                        };
                        arg_10B_0.Add(item);
                    }
                }
                this.AddEnterIPProfiler(list, GUIUtility.GUIToScreenRect(rect));
                this.OnGUIMenu(rect, list);
            }
        }
Пример #2
0
        void OnGUI()
        {
            Event evt      = Event.current;
            bool  hitEnter = evt.type == EventType.KeyDown && (evt.keyCode == KeyCode.Return || evt.keyCode == KeyCode.KeypadEnter);

            GUI.SetNextControlName(kTextFieldId);

            /*Rect contentRect = */ EditorGUILayout.BeginVertical();
            {
                GUILayout.Space(5);
                m_IPString = EditorGUILayout.TextField(m_IPString);


                if (!didFocus)
                {
                    didFocus = true;
                    EditorGUI.FocusTextInControl(kTextFieldId);
                }

                GUI.enabled = m_IPString.Length != 0;
                if (GUILayout.Button("Connect") || hitEnter)
                {
                    Close();
                    // Save ip
                    EditorPrefs.SetString(kLastIP, m_IPString);
                    AttachProfilerUI.DirectIPConnect(m_IPString);
                    GUIUtility.ExitGUI();
                }
            }
            EditorGUILayout.EndVertical();

            //position.height = contentRect.height;
        }
        public void OnGUI(Rect connectRect, GUIContent profilerLabel)
        {
            if (!EditorGUI.ButtonMouseDown(connectRect, profilerLabel, FocusType.Native, EditorStyles.toolbarDropDown))
            {
                return;
            }
            List <ProfilerChoise> list = new List <ProfilerChoise>();

            list.Clear();
            AttachProfilerUI.AddPlayerProfilers(list);
            AttachProfilerUI.AddDeviceProfilers(list);
            AttachProfilerUI.AddLastIPProfiler(list);
            this.AddEnterIPProfiler(list, GUIUtility.GUIToScreenRect(connectRect));
            string[] options = (from p in list
                                select p.Name).ToArray <string>();
            bool[] enabled = (from p in list
                              select p.Enabled).ToArray <bool>();
            int num = list.FindIndex((ProfilerChoise p) => p.IsSelected());

            int[] selected;
            if (num == -1)
            {
                selected = new int[0];
            }
            else
            {
                selected = new int[]
                {
                    num
                };
            }
            EditorUtility.DisplayCustomMenu(connectRect, options, enabled, selected, new EditorUtility.SelectMenuItemFunction(this.SelectProfilerClick), list);
        }
Пример #4
0
        public void OnGUI(Rect connectRect, GUIContent profilerLabel)
        {
            if (!EditorGUI.ButtonMouseDown(connectRect, profilerLabel, FocusType.Native, EditorStyles.toolbarDropDown))
            {
                return;
            }
            List <ProfilerChoise> profilerChoiseList = new List <ProfilerChoise>();

            profilerChoiseList.Clear();
            AttachProfilerUI.AddPlayerProfilers(profilerChoiseList);
            AttachProfilerUI.AddDeviceProfilers(profilerChoiseList);
            AttachProfilerUI.AddLastIPProfiler(profilerChoiseList);
            this.AddEnterIPProfiler(profilerChoiseList, GUIUtility.GUIToScreenRect(connectRect));
            string[] array1 = profilerChoiseList.Select <ProfilerChoise, string>((Func <ProfilerChoise, string>)(p => p.Name)).ToArray <string>();
            bool[]   array2 = profilerChoiseList.Select <ProfilerChoise, bool>((Func <ProfilerChoise, bool>)(p => p.Enabled)).ToArray <bool>();
            int      index  = profilerChoiseList.FindIndex((Predicate <ProfilerChoise>)(p => p.IsSelected()));

            int[] selected;
            if (index == -1)
            {
                selected = new int[0];
            }
            else
            {
                selected = new int[1] {
                    index
                }
            };
            EditorUtility.DisplayCustomMenu(connectRect, array1, array2, selected, new EditorUtility.SelectMenuItemFunction(this.SelectProfilerClick), (object)profilerChoiseList);
        }
    }
Пример #5
0
        private static void AddLastIPProfiler(List <ProfilerChoise> profilers)
        {
            string lastIP = ProfilerIPWindow.GetLastIPString();

            if (!string.IsNullOrEmpty(lastIP))
            {
                ProfilerChoise item = default(ProfilerChoise);
                item.Name       = lastIP;
                item.Enabled    = true;
                item.IsSelected = (() => ProfilerDriver.connectedProfiler == 65261);
                item.ConnectTo  = delegate
                {
                    AttachProfilerUI.DirectIPConnect(lastIP);
                };
                profilers.Add(item);
            }
        }
Пример #6
0
 public void OnGUI(Rect connectRect, GUIContent profilerLabel)
 {
     if (EditorGUI.ButtonMouseDown(connectRect, profilerLabel, FocusType.Passive, EditorStyles.toolbarDropDown))
     {
         List <ProfilerChoise> list = new List <ProfilerChoise>();
         list.Clear();
         AttachProfilerUI.AddPlayerProfilers(list);
         AttachProfilerUI.AddDeviceProfilers(list);
         AttachProfilerUI.AddLastIPProfiler(list);
         if (!ProfilerDriver.IsConnectionEditor())
         {
             if (!list.Any((ProfilerChoise p) => p.IsSelected()))
             {
                 List <ProfilerChoise> arg_D2_0 = list;
                 ProfilerChoise        item     = default(ProfilerChoise);
                 item.Name       = "(Autoconnected Player)";
                 item.Enabled    = false;
                 item.IsSelected = (() => true);
                 item.ConnectTo  = delegate
                 {
                 };
                 arg_D2_0.Add(item);
             }
         }
         this.AddEnterIPProfiler(list, GUIUtility.GUIToScreenRect(connectRect));
         string[] options = (from p in list
                             select p.Name).ToArray <string>();
         bool[] enabled = (from p in list
                           select p.Enabled).ToArray <bool>();
         int   num = list.FindIndex((ProfilerChoise p) => p.IsSelected());
         int[] selected;
         if (num == -1)
         {
             selected = new int[0];
         }
         else
         {
             selected = new int[]
             {
                 num
             };
         }
         EditorUtility.DisplayCustomMenu(connectRect, options, enabled, selected, new EditorUtility.SelectMenuItemFunction(this.SelectProfilerClick), list);
     }
 }
 private static void AddDeviceProfilers(List <ProfilerChoise> profilers)
 {
     DevDevice[] devices = DevDeviceList.GetDevices();
     for (int i = 0; i < devices.Length; i++)
     {
         DevDevice devDevice = devices[i];
         bool      flag      = (devDevice.features & DevDeviceFeatures.PlayerConnection) != DevDeviceFeatures.None;
         if (devDevice.isConnected && flag)
         {
             string url = "device://" + devDevice.id;
             profilers.Add(new ProfilerChoise
             {
                 Name       = devDevice.name,
                 Enabled    = true,
                 IsSelected = () => ProfilerDriver.connectedProfiler == 65262 && ProfilerDriver.directConnectionUrl == url,
                 ConnectTo  = delegate
                 {
                     AttachProfilerUI.DirectURLConnect(url);
                 }
             });
         }
     }
 }
Пример #8
0
 public ProfilerWindow()
 {
     float[] relativeSizes = new float[] { 50f, 50f };
     int[] minSizes = new int[] { 50, 50 };
     this.m_VertSplit = new SplitterState(relativeSizes, minSizes, null);
     float[] singleArray2 = new float[] { 70f, 30f };
     int[] numArray2 = new int[] { 450, 50 };
     this.m_ViewSplit = new SplitterState(singleArray2, numArray2, null);
     float[] singleArray3 = new float[] { 20f, 80f };
     int[] numArray3 = new int[] { 100, 100 };
     this.m_NetworkSplit = new SplitterState(singleArray3, numArray3, null);
     this.m_Recording = true;
     this.m_AttachProfilerUI = new AttachProfilerUI();
     this.m_GraphPos = Vector2.zero;
     this.m_PaneScroll = new Vector2[9];
     this.m_CurrentFrame = -1;
     this.m_LastFrameFromTick = -1;
     this.m_PrevLastFrame = -1;
     this.m_LastAudioProfilerFrame = -1;
     this.m_ChartOldMax = new float[] { -1f, -1f };
     this.m_ChartMaxClamp = 70000f;
     this.msgNames = new string[] { "UserMessage", "ObjectDestroy", "ClientRpc", "ObjectSpawn", "Owner", "Command", "LocalPlayerTransform", "SyncEvent", "SyncVars", "SyncList", "ObjectSpawnScene", "NetworkInfo", "SpawnFinished", "ObjectHide", "CRC", "ClientAuthority" };
     this.msgFoldouts = new bool[] { true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false };
 }
Пример #9
0
        private void OnGUI()
        {
            Event current = Event.current;
            bool  flag    = (current.type == EventType.KeyDown) && ((current.keyCode == KeyCode.Return) || (current.keyCode == KeyCode.KeypadEnter));

            GUI.SetNextControlName("IPWindow");
            EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Space(5f);
            this.m_IPString = EditorGUILayout.TextField(this.m_IPString, new GUILayoutOption[0]);
            if (!this.didFocus)
            {
                this.didFocus = true;
                EditorGUI.FocusTextInControl("IPWindow");
            }
            GUI.enabled = this.m_IPString.Length != 0;
            if (GUILayout.Button("Connect", new GUILayoutOption[0]) || flag)
            {
                base.Close();
                EditorPrefs.SetString("ProfilerLastIP", this.m_IPString);
                AttachProfilerUI.DirectIPConnect(this.m_IPString);
                GUIUtility.ExitGUI();
            }
            EditorGUILayout.EndVertical();
        }
Пример #10
0
 public ProfilerWindow()
 {
     float[] relativeSizes = new float[] { 50f, 50f };
     int[] minSizes = new int[] { 50, 50 };
     this.m_VertSplit = new SplitterState(relativeSizes, minSizes, null);
     float[] singleArray2 = new float[] { 70f, 30f };
     int[] numArray2 = new int[] { 450, 50 };
     this.m_ViewSplit = new SplitterState(singleArray2, numArray2, null);
     float[] singleArray3 = new float[] { 20f, 80f };
     int[] numArray3 = new int[] { 100, 100 };
     this.m_NetworkSplit = new SplitterState(singleArray3, numArray3, null);
     this.m_AttachProfilerUI = new AttachProfilerUI();
     this.m_GraphPos = Vector2.zero;
     this.m_PaneScroll = new Vector2[9];
     this.m_PaneScroll_AudioChannels = Vector2.zero;
     this.m_PaneScroll_AudioDSP = Vector2.zero;
     this.m_PaneScroll_AudioClips = Vector2.zero;
     this.m_ViewType = ProfilerViewType.Hierarchy;
     this.m_CurrentArea = ProfilerArea.CPU;
     this.m_ShowDetailedMemoryPane = ProfilerMemoryView.Simple;
     this.m_ShowDetailedAudioPane = ProfilerAudioView.Stats;
     this.m_ShowInactiveDSPChains = false;
     this.m_HighlightAudibleDSPChains = true;
     this.m_DSPGraphZoomFactor = 1f;
     this.m_CurrentFrame = -1;
     this.m_LastFrameFromTick = -1;
     this.m_PrevLastFrame = -1;
     this.m_LastAudioProfilerFrame = -1;
     this.m_ChartOldMax = new float[] { -1f, -1f };
     this.m_ChartMaxClamp = 70000f;
     this.m_TimelineViewDetail = false;
     this.m_GatherObjectReferences = true;
     this.m_AudioProfilerGroupView = null;
     this.m_AudioProfilerClipView = null;
     this.m_SelectedMemRecordMode = ProfilerMemoryRecordMode.None;
     this.s_CheckMark = '✔';
     this.msgNames = new string[] { "UserMessage", "ObjectDestroy", "ClientRpc", "ObjectSpawn", "Owner", "Command", "LocalPlayerTransform", "SyncEvent", "SyncVars", "SyncList", "ObjectSpawnScene", "NetworkInfo", "SpawnFinished", "ObjectHide", "CRC", "ClientAuthority" };
     this.msgFoldouts = new bool[] { true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false };
 }