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);
        }
        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);
        }
    }
Esempio n. 3
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);
            }
        }
Esempio n. 4
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);
     }
 }