Esempio n. 1
0
    public override void OnInspectorGUI()
    {
        SectionSprite(DisplayFlag.WithoutSize | DisplayFlag.WithoutMaterial | DisplayFlag.WithoutFill);

        serializedObject.Update();
        MadGUI.PropertyField(panel, "Panel", MadGUI.ObjectIsSet);
        EditorGUILayout.Space();

        EditorGUI.BeginChangeCheck();
        MadGUI.PropertyField(font, "Font", MadGUI.ObjectIsSet);
        if (EditorGUI.EndChangeCheck())
        {
            UpdateTextureGUID();
        }

        MadGUI.PropertyField(atlas, "Atlas");

        if (madText.atlas != null && madText.font != null)
        {
            var texture     = madText.font.texture;
            var texturePath = AssetDatabase.GetAssetPath(texture);
            var textureGuid = AssetDatabase.AssetPathToGUID(texturePath);
            if (madText.atlas.GetItem(textureGuid) == null)
            {
                if (MadGUI.WarningFix("This font texture is not available in selected atlas.", "Add to atlas"))
                {
                    MadAtlasBuilder.AddToAtlas(madText.atlas, madText.font.texture);
                }
            }
        }

        EditorGUILayout.LabelField("Text");
        if (text.hasMultipleDifferentValues)
        {
            EditorGUILayout.TextArea("-");
        }
        else
        {
            text.stringValue = EditorGUILayout.TextArea(text.stringValue);
        }
        MadGUI.PropertyField(scale, "Scale");
        MadGUI.PropertyField(align, "Align");
        MadGUI.PropertyField(letterSpacing, "Letter Spacing");
        MadGUI.PropertyField(wordWrap, "Word Wrap");
        MadGUI.Indent(() => {
            MadGUI.PropertyField(wordWrapLength, "Line Length");
        });

        serializedObject.ApplyModifiedProperties();
    }
Esempio n. 2
0
 static void CreateAtlas()
 {
     MadAtlasBuilder.CreateAtlas();
 }