Пример #1
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        EditorGUILayout.PropertyField(m_Text);
        EditorGUILayout.PropertyField(m_Color);
        EditorGUILayout.PropertyField(m_Material);
        EditorGUILayout.PropertyField(m_RaycastTarget);


        BMFontText bmFont = target as BMFontText;

        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(m_FontAsset);


        GUI.changed = false;
        if (m_FontAsset.objectReferenceValue != null)
        {
            if (bmFont.m_FontGroups.Contains(bmFont.m_CurrentGroup))
            {
                selectGroup = bmFont.m_FontGroups.IndexOf(bmFont.m_CurrentGroup);
            }

            selectGroup = EditorGUILayout.Popup("Font Group", selectGroup, bmFont.m_FontGroups.ToArray());
            if (GUI.changed && bmFont.m_FontGroups.Count > selectGroup)
            {
                bmFont.m_CurrentGroup = bmFont.m_FontGroups[selectGroup];
                bmFont.SetAllDirty();
            }
        }

        EditorGUILayout.PropertyField(m_Gap);

        serializedObject.ApplyModifiedProperties();
    }
Пример #2
0
    void OnEnable()
    {
        //_target = (BMFontText)target;
        _target            = (BMFontText)serializedObject.targetObject;
        _fontConfigProp    = serializedObject.FindProperty("fontConfig");
        _pivotPositionProp = serializedObject.FindProperty("pivotPosition");
        _textScaleProp     = serializedObject.FindProperty("textScale");
        _topColorProp      = serializedObject.FindProperty("topColor");
        _bottomColorProp   = serializedObject.FindProperty("bottomColor");
        _isUnicodeProp     = serializedObject.FindProperty("isUnicode");
        _textProp          = serializedObject.FindProperty("text");

        _oldConfig        = (TextAsset)_fontConfigProp.objectReferenceValue;
        _oldMaterialCount = 0;
        _oldPivotPosition = (BMFontText.PivotPosition)_pivotPositionProp.enumValueIndex;
        _oldTextScale     = _textScaleProp.floatValue;
        _oldTopColor      = _topColorProp.colorValue;
        _oldBottomColor   = _bottomColorProp.colorValue;
        _oldText          = _textProp.stringValue;
    }
    void OnEnable()
    {
        //_target = (BMFontText)target;
        _target = (BMFontText)serializedObject.targetObject;
        _fontConfigProp = serializedObject.FindProperty("fontConfig");
        _pivotPositionProp = serializedObject.FindProperty("pivotPosition");
        _textScaleProp = serializedObject.FindProperty("textScale");
        _topColorProp = serializedObject.FindProperty("topColor");
        _bottomColorProp = serializedObject.FindProperty("bottomColor");
        _isUnicodeProp = serializedObject.FindProperty("isUnicode");
        _textProp = serializedObject.FindProperty("text");

        _oldConfig = (TextAsset)_fontConfigProp.objectReferenceValue;
        _oldMaterialCount = 0;
        _oldPivotPosition = (BMFontText.PivotPosition)_pivotPositionProp.enumValueIndex;
        _oldTextScale = _textScaleProp.floatValue;
        _oldTopColor = _topColorProp.colorValue;
        _oldBottomColor = _bottomColorProp.colorValue;
        _oldText = _textProp.stringValue;
    }