예제 #1
0
        public MultiselectDataSource(int mask, string[] displayedOptions, int[] flagValues)
        {
            m_DisplayNames = displayedOptions;
            m_FlagValues   = flagValues;
            string buttonText;

            MaskFieldGUI.GetMenuOptions(mask, displayedOptions, flagValues, out buttonText, out m_OptionNames, out m_OptionMaskValues, out m_SelectedOptions);
        }
예제 #2
0
 public void UpdateSelectedId(AdvancedDropdownItem item)
 {
     m_Mask = m_OptionMaskValues[item.elementIndex];
     MaskFieldGUI.GetMenuOptions(m_Mask, m_DisplayNames, m_FlagValues, out var buttonText, out var buttonTextMixed, out m_OptionNames, out m_OptionMaskValues, out m_SelectedOptions);
     if (enumFlags != null)
     {
         m_EnumFlag = EnumDataUtility.IntToEnumFlags(enumFlags.GetType(), m_Mask);
     }
     RebuildSelection(root);
 }
예제 #3
0
        public override void UpdateSelectedId(AdvancedDropdownItem item)
        {
            m_Mask = m_OptionMaskValues[item.m_Index];
            string buttonText;

            MaskFieldGUI.GetMenuOptions(m_Mask, m_DisplayNames, m_FlagValues, out buttonText, out m_OptionNames, out m_OptionMaskValues, out m_SelectedOptions);
            if (enumFlags != null)
            {
                m_EnumFlag = EditorGUI.IntToEnumFlags(enumFlags.GetType(), m_Mask);
            }
            RebuildSelection();
        }
예제 #4
0
        public MultiselectDataSource(Enum enumValue)
        {
            m_EnumFlag = enumValue;
            var enumType = enumFlags.GetType();

            var enumData = EnumDataUtility.GetCachedEnumData(enumType);

            if (!enumData.serializable)
            {
                // this is the same message used in SerializedPropertyEnumHelper.cpp
                throw new NotSupportedException(string.Format("Unsupported enum base type for {0}", enumType.Name));
            }

            m_Mask         = EnumDataUtility.EnumFlagsToInt(enumData, enumFlags);
            m_DisplayNames = enumData.displayNames;
            m_FlagValues   = enumData.flagValues;

            MaskFieldGUI.GetMenuOptions(m_Mask, m_DisplayNames, m_FlagValues, out var buttonText, out var buttonTextMixed, out m_OptionNames, out m_OptionMaskValues, out m_SelectedOptions);
        }