예제 #1
0
        internal override int ValueToMask(Enum value)
        {
            if (m_EnumType == null)
            {
                return(0);
            }

            return(EnumDataUtility.EnumFlagsToInt(m_EnumData, value));
        }
예제 #2
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);
        }