DisplayCustomMenuWithSeparators() 정적인 개인적인 메소드

static private DisplayCustomMenuWithSeparators ( Rect position, string options, bool enabled, bool separator, int selected, SelectMenuItemFunction callback, object userData ) : void
position UnityEngine.Rect
options string
enabled bool
separator bool
selected int
callback SelectMenuItemFunction
userData object
리턴 void
예제 #1
0
            protected override void OnGUIMenu(Rect connectRect, List <ProfilerChoise> profilers)
            {
                if (additionalMenuItems == null)
                {
                    additionalMenuItems = new List <string> {
                        "Player Logging"
                    };
                    if (Unsupported.IsDeveloperMode())
                    {
                        additionalMenuItems.Add("Full Log (Developer Mode Only)");
                    }
                    additionalMenuItems.Add("");
                }

                var names = additionalMenuItems.Concat(profilers.Select(p => p.Name)).ToArray();

                // "Player Logging" field is always enabled.
                var enabled = new List <bool> {
                    true
                };
                var selected = new List <int>();

                var connected = PlayerConnectionLogReceiver.instance.State != PlayerConnectionLogReceiver.ConnectionState.Disconnected;

                if (connected)
                {
                    selected.Add((int)MenuItemIndex.PlayerLogging);
                    if (Unsupported.IsDeveloperMode())
                    {
                        if (PlayerConnectionLogReceiver.instance.State == PlayerConnectionLogReceiver.ConnectionState.FullLog)
                        {
                            selected.Add((int)MenuItemIndex.FullLog);
                        }

                        // Enable "Show Full Log"
                        enabled.Add(true);
                    }
                    enabled.Add(true);
                    enabled.AddRange(profilers.Select(p => p.Enabled));
                }
                else
                {
                    // everything but first menu item is disabled.
                    enabled.AddRange(new bool[names.Length - 1]);
                }

                int index = profilers.FindIndex(p => p.IsSelected());

                if (index != -1)
                {
                    selected.Add(index + additionalMenuItems.Count);
                }

                var seperators = new bool[enabled.Count];

                seperators[additionalMenuItems.Count - 1] = true;
                EditorUtility.DisplayCustomMenuWithSeparators(connectRect, names, enabled.ToArray(), seperators, selected.ToArray(), SelectClick, profilers);
            }
예제 #2
0
            protected override void OnGUIMenu(Rect connectRect, List <ProfilerChoise> profilers)
            {
                if (this.additionalMenuItems == null)
                {
                    this.additionalMenuItems = new List <string>();
                    this.additionalMenuItems.Add("Player Logging");
                    if (Unsupported.IsDeveloperMode())
                    {
                        this.additionalMenuItems.Add("Full Log (Developer Mode Only)");
                    }
                    this.additionalMenuItems.Add("");
                }
                IEnumerable <string> source = this.additionalMenuItems.Concat(from p in profilers
                                                                              select p.Name);
                List <bool> list = new List <bool>();

                list.Add(true);
                List <int> list2 = new List <int>();
                bool       flag  = ScriptableSingleton <PlayerConnectionLogReceiver> .instance.State != PlayerConnectionLogReceiver.ConnectionState.Disconnected;

                if (flag)
                {
                    list2.Add(0);
                    if (Unsupported.IsDeveloperMode())
                    {
                        if (ScriptableSingleton <PlayerConnectionLogReceiver> .instance.State == PlayerConnectionLogReceiver.ConnectionState.FullLog)
                        {
                            list2.Add(1);
                        }
                        list.Add(true);
                    }
                    list.Add(true);
                    list.AddRange(from p in profilers
                                  select p.Enabled);
                }
                else
                {
                    list.AddRange(new bool[source.Count <string>() - 1]);
                }
                int num = profilers.FindIndex((ProfilerChoise p) => p.IsSelected());

                if (num != -1)
                {
                    list2.Add(num + this.additionalMenuItems.Count);
                }
                bool[] array = new bool[list.Count];
                array[this.additionalMenuItems.Count - 1] = true;
                EditorUtility.DisplayCustomMenuWithSeparators(connectRect, source.ToArray <string>(), list.ToArray(), array, list2.ToArray(), new EditorUtility.SelectMenuItemFunction(this.SelectClick), profilers);
            }
예제 #3
0
        /// <summary>
        /// <para>Show the menu at the given screen rect.</para>
        /// </summary>
        /// <param name="position">The position at which to show the menu.</param>
        public void DropDown(Rect position)
        {
            string[]  options = new string[this.menuItems.Count];
            bool[]    enabled = new bool[this.menuItems.Count];
            ArrayList list    = new ArrayList();

            bool[] separator = new bool[this.menuItems.Count];
            for (int i = 0; i < this.menuItems.Count; i++)
            {
                MenuItem item = (MenuItem)this.menuItems[i];
                options[i]   = item.content.text;
                enabled[i]   = (item.func != null) || (item.func2 != null);
                separator[i] = item.separator;
                if (item.on)
                {
                    list.Add(i);
                }
            }
            EditorUtility.DisplayCustomMenuWithSeparators(position, options, enabled, separator, (int[])list.ToArray(typeof(int)), new EditorUtility.SelectMenuItemFunction(this.CatchMenu), null, true);
        }
예제 #4
0
        public void DropDown(Rect position)
        {
            string[]  array     = new string[this.menuItems.Count];
            bool[]    array2    = new bool[this.menuItems.Count];
            ArrayList arrayList = new ArrayList();

            bool[] array3 = new bool[this.menuItems.Count];
            for (int i = 0; i < this.menuItems.Count; i++)
            {
                GenericMenu.MenuItem menuItem = (GenericMenu.MenuItem) this.menuItems[i];
                array[i]  = menuItem.content.text;
                array2[i] = (menuItem.func != null || menuItem.func2 != null);
                array3[i] = menuItem.separator;
                if (menuItem.on)
                {
                    arrayList.Add(i);
                }
            }
            EditorUtility.DisplayCustomMenuWithSeparators(position, array, array2, array3, (int[])arrayList.ToArray(typeof(int)), new EditorUtility.SelectMenuItemFunction(this.CatchMenu), null, true);
        }
예제 #5
0
        /// <summary>
        ///   <para>Show the menu at the given screen rect.</para>
        /// </summary>
        /// <param name="position">The position at which to show the menu.</param>
        public void DropDown(Rect position)
        {
            string[]  options   = new string[this.menuItems.Count];
            bool[]    enabled   = new bool[this.menuItems.Count];
            ArrayList arrayList = new ArrayList();

            bool[] separator = new bool[this.menuItems.Count];
            for (int index = 0; index < this.menuItems.Count; ++index)
            {
                GenericMenu.MenuItem menuItem = (GenericMenu.MenuItem) this.menuItems[index];
                options[index]   = menuItem.content.text;
                enabled[index]   = menuItem.func != null || menuItem.func2 != null;
                separator[index] = menuItem.separator;
                if (menuItem.on)
                {
                    arrayList.Add((object)index);
                }
            }
            EditorUtility.DisplayCustomMenuWithSeparators(position, options, enabled, separator, (int[])arrayList.ToArray(typeof(int)), new EditorUtility.SelectMenuItemFunction(this.CatchMenu), (object)null);
        }
예제 #6
0
        // Show the menu at the given screen rect
        public void DropDown(Rect position)
        {
            string[]  titles   = new string[menuItems.Count];
            bool[]    enabled  = new bool[menuItems.Count];
            ArrayList selected = new ArrayList();

            bool[] separator = new bool[menuItems.Count];

            for (int idx = 0; idx < menuItems.Count; idx++)
            {
                MenuItem item = (MenuItem)menuItems[idx];
                titles[idx]    = item.content.text;
                enabled[idx]   = ((item.func != null) || (item.func2 != null));
                separator[idx] = item.separator;
                if (item.on)
                {
                    selected.Add(idx);
                }
            }

            EditorUtility.DisplayCustomMenuWithSeparators(position, titles, enabled, separator, (int[])selected.ToArray(typeof(int)), CatchMenu, null, true, allowDuplicateNames);
        }
예제 #7
0
 internal static void DisplayCustomMenuWithSeparators(Rect position, string[] options, bool[] enabled, bool[] separator, int[] selected, EditorUtility.SelectMenuItemFunction callback, object userData)
 {
     EditorUtility.DisplayCustomMenuWithSeparators(position, options, enabled, separator, selected, callback, userData, false);
 }
예제 #8
0
 internal static void DisplayCustomMenu(Rect position, string[] options, bool[] enabled, int[] selected, EditorUtility.SelectMenuItemFunction callback, object userData, bool showHotkey)
 {
     bool[] separator = new bool[options.Length];
     EditorUtility.DisplayCustomMenuWithSeparators(position, options, enabled, separator, selected, callback, userData, showHotkey);
 }