Inheritance: PropertyAttribute
    public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
    {
        BitMaskAttribute typeAttr = attribute as BitMaskAttribute;

        label.text    = label.text;
        prop.intValue = EditorExtension.DrawBitMaskField(position, prop.intValue, typeAttr.propType, label);
    }
Esempio n. 2
0
    public override void OnGUI(Rect _position, SerializedProperty _property, GUIContent _lable)
    {
        // attribute 是PropertyAttribute类中的一个属性
        // EnumFlagsAttribute中的所有属性都可以调用
        BitMaskAttribute flags = attribute as BitMaskAttribute;

        // 枚举值的数值最后为一个数字,如果要取得其代表的或包含的数值必须通过按位运算来提取
        // 绘制出一个下拉菜单,枚举类型
        _property.intValue = EditorGUI.MaskField(_position, _property.displayName + "(" + _property.intValue + ")", _property.intValue, _property.enumDisplayNames);
    }