Пример #1
0
        private void ShowMenu()
        {
            IGenericMenu menu;

            if (createMenuCallback != null)
            {
                menu = createMenuCallback.Invoke();
            }
            else
            {
                menu = elementPanel?.contextType == ContextType.Player ? new GenericDropdownMenu() : DropdownMenu.CreateDropdown();
            }

            AddMenuItems(menu);
            menu.DropDown(visualInput.worldBound, this, true);
        }
Пример #2
0
        private void ShowMenu()
        {
            if (m_EnumType == null)
            {
                return;
            }

            IGenericMenu menu;

            if (createMenuCallback != null)
            {
                menu = createMenuCallback.Invoke();
            }
            else
            {
                menu = elementPanel?.contextType == ContextType.Player ? new GenericDropdownMenu() : DropdownMenu.CreateDropdown();
            }

            int selectedIndex = Array.IndexOf(m_EnumData.values, value);

            for (int i = 0; i < m_EnumData.values.Length; ++i)
            {
                bool isSelected = selectedIndex == i;
                menu.AddItem(m_EnumData.displayNames[i], isSelected, contentView => ChangeValueFromMenu(contentView), m_EnumData.values[i]);
            }

            menu.DropDown(visualInput.worldBound, this, true);
        }