예제 #1
0
    /// <summary>
    /// Refresh all labels that use this font.
    /// </summary>

    public void MarkAsChanged()
    {
#if UNITY_EDITOR
        NGUITools.SetDirty(this);
#endif
        var rep = replacement;
        if (rep != null)
        {
            rep.MarkAsChanged();
        }

        mSprite = null;
        var labels = NGUITools.FindActive <UILabel>();

        for (int i = 0, imax = labels.Length; i < imax; ++i)
        {
            var lbl = labels[i];

            if (lbl.enabled && NGUITools.GetActive(lbl.gameObject) && NGUITools.CheckIfRelated(this, lbl.font as INGUIFont))
            {
                var fnt = lbl.font;
                lbl.font = null;
                lbl.font = fnt;
            }
        }

        // Clear all symbols
        var sym = symbols;
        for (int i = 0, imax = sym.Count; i < imax; ++i)
        {
            sym[i].MarkAsChanged();
        }
        mEmbeddedSymbols = null;
    }
예제 #2
0
    // Token: 0x060006C2 RID: 1730 RVA: 0x00037834 File Offset: 0x00035A34
    public void MarkAsChanged()
    {
        INGUIFont replacement = this.replacement;

        if (replacement != null)
        {
            replacement.MarkAsChanged();
        }
        this.mSprite = null;
        UILabel[] array = NGUITools.FindActive <UILabel>();
        int       i     = 0;
        int       num   = array.Length;

        while (i < num)
        {
            UILabel uilabel = array[i];
            if (uilabel.enabled && NGUITools.GetActive(uilabel.gameObject) && NGUITools.CheckIfRelated(this, uilabel.bitmapFont))
            {
                INGUIFont bitmapFont = uilabel.bitmapFont;
                uilabel.bitmapFont = null;
                uilabel.bitmapFont = bitmapFont;
            }
            i++;
        }
        int j     = 0;
        int count = this.symbols.Count;

        while (j < count)
        {
            this.symbols[j].MarkAsChanged();
            j++;
        }
    }
예제 #3
0
    void MarkAsChanged()
    {
        List <UILabel> labels = NGUIEditorTools.FindAll <UILabel>();

        foreach (UILabel lbl in labels)
        {
            if (NGUITools.CheckIfRelated(lbl.bitmapFont as INGUIFont, mFont))
            {
                lbl.bitmapFont = null;
                lbl.bitmapFont = mFont;
            }
        }
    }
예제 #4
0
    /// <summary>
    /// Convenience function -- mark all widgets using the sprite as changed.
    /// </summary>

    void MarkSpriteAsDirty()
    {
        var sprite = (mAtlas != null) ? mAtlas.GetSprite(NGUISettings.selectedSprite) : null;

        if (sprite == null)
        {
            return;
        }

        var sprites = NGUITools.FindActive <UISprite>();

        foreach (UISprite sp in sprites)
        {
            if (NGUITools.CheckIfRelated(sp.atlas, mAtlas) && sp.spriteName == sprite.name)
            {
                var atl = sp.atlas;
                sp.atlas = null;
                sp.atlas = atl;
                NGUITools.SetDirty(sp);
            }
        }

        var labels = NGUITools.FindActive <UILabel>();

        foreach (UILabel lbl in labels)
        {
            if (lbl.bitmapFont == null)
            {
                continue;
            }

            var font = lbl.bitmapFont;

            if (NGUITools.CheckIfRelated(font.atlas, mAtlas) && font.UsesSprite(sprite.name))
            {
                lbl.bitmapFont = null;
                lbl.bitmapFont = font;
                NGUITools.SetDirty(lbl);
            }
        }
    }
예제 #5
0
파일: UIAtlas.cs 프로젝트: nam2350/PangPang
    /// <summary>
    /// Mark all widgets associated with this atlas as having changed.
    /// </summary>

    public void MarkAsChanged()
    {
#if UNITY_EDITOR
        NGUITools.SetDirty(this);
#endif
        var rep = replacement;
        if (rep != null)
        {
            rep.MarkAsChanged();
        }

        var list = NGUITools.FindActive <UISprite>();

        for (int i = 0, imax = list.Length; i < imax; ++i)
        {
            var sp = list[i];

            if (NGUITools.CheckIfRelated(this, sp.atlas))
            {
                var atl = sp.atlas;
                sp.atlas = null;
                sp.atlas = atl;
#if UNITY_EDITOR
                NGUITools.SetDirty(sp);
#endif
            }
        }

        var f0 = Resources.FindObjectsOfTypeAll <NGUIFont>();

        for (int i = 0, imax = f0.Length; i < imax; ++i)
        {
            var font = f0[i];
            if (font.atlas == null)
            {
                continue;
            }

            if (NGUITools.CheckIfRelated(this, font.atlas))
            {
                var atl = font.atlas;
                font.atlas = null;
                font.atlas = atl;
#if UNITY_EDITOR
                NGUITools.SetDirty(font);
#endif
            }
        }

        var f1 = Resources.FindObjectsOfTypeAll <UIFont>();

        for (int i = 0, imax = f1.Length; i < imax; ++i)
        {
            var font = f1[i];

            if (NGUITools.CheckIfRelated(this, font.atlas))
            {
                var atl = font.atlas;
                font.atlas = null;
                font.atlas = atl;
#if UNITY_EDITOR
                NGUITools.SetDirty(font);
#endif
            }
        }

        var labels = NGUITools.FindActive <UILabel>();

        for (int i = 0, imax = labels.Length; i < imax; ++i)
        {
            var lbl = labels[i];
            if (lbl.atlas == null)
            {
                continue;
            }

            if (NGUITools.CheckIfRelated(this, lbl.atlas))
            {
                var atl  = lbl.atlas;
                var font = lbl.bitmapFont;
                lbl.bitmapFont = null;
                lbl.bitmapFont = font;
#if UNITY_EDITOR
                NGUITools.SetDirty(lbl);
#endif
            }
        }
    }
예제 #6
0
    // Token: 0x060006FD RID: 1789 RVA: 0x000394C8 File Offset: 0x000376C8
    public void MarkAsChanged()
    {
        INGUIAtlas replacement = this.replacement;

        if (replacement != null)
        {
            replacement.MarkAsChanged();
        }
        UISprite[] array = NGUITools.FindActive <UISprite>();
        int        i     = 0;
        int        num   = array.Length;

        while (i < num)
        {
            UISprite uisprite = array[i];
            if (NGUITools.CheckIfRelated(this, uisprite.atlas))
            {
                INGUIAtlas atlas = uisprite.atlas;
                uisprite.atlas = null;
                uisprite.atlas = atlas;
            }
            i++;
        }
        NGUIFont[] array2 = Resources.FindObjectsOfTypeAll <NGUIFont>();
        int        j      = 0;
        int        num2   = array2.Length;

        while (j < num2)
        {
            NGUIFont nguifont = array2[j];
            if (nguifont.atlas != null && NGUITools.CheckIfRelated(this, nguifont.atlas))
            {
                INGUIAtlas atlas2 = nguifont.atlas;
                nguifont.atlas = null;
                nguifont.atlas = atlas2;
            }
            j++;
        }
        UIFont[] array3 = Resources.FindObjectsOfTypeAll <UIFont>();
        int      k      = 0;
        int      num3   = array3.Length;

        while (k < num3)
        {
            UIFont uifont = array3[k];
            if (NGUITools.CheckIfRelated(this, uifont.atlas))
            {
                INGUIAtlas atlas3 = uifont.atlas;
                uifont.atlas = null;
                uifont.atlas = atlas3;
            }
            k++;
        }
        UILabel[] array4 = NGUITools.FindActive <UILabel>();
        int       l      = 0;
        int       num4   = array4.Length;

        while (l < num4)
        {
            UILabel uilabel = array4[l];
            if (uilabel.atlas != null && NGUITools.CheckIfRelated(this, uilabel.atlas))
            {
                INGUIAtlas atlas4     = uilabel.atlas;
                INGUIFont  bitmapFont = uilabel.bitmapFont;
                uilabel.bitmapFont = null;
                uilabel.bitmapFont = bitmapFont;
            }
            l++;
        }
    }
예제 #7
0
    public override void OnInspectorGUI()
    {
        NGUIEditorTools.SetLabelWidth(80f);

        GUILayout.Space(6f);

        var type = mFont.type;

        if (type == NGUIFontType.Reference)
        {
            mReplacement = mFont.replacement;
        }

        GUI.changed = false;
        GUILayout.BeginHorizontal();
        type = (NGUIFontType)EditorGUILayout.EnumPopup("Font Type", type);
        GUILayout.EndHorizontal();

        if (GUI.changed)
        {
            NGUIEditorTools.RegisterUndo("Font Change", mFont as Object);
            mFont.type = type;
            NGUITools.SetDirty(mFont as Object);
        }

        if (type == NGUIFontType.Reference)
        {
            ComponentSelector.Draw(mFont.replacement, OnSelectFont, true);

            GUILayout.Space(6f);
            EditorGUILayout.HelpBox("Reference fonts will have their font data come from another one. " +
                                    "This allows you to have your labels reference a font that has all the emoticons, that also points to a secondary font containing the actual glyph data " +
                                    "that can be easily swapped at run-time with a font containing glyphs of another language.", MessageType.Info);

            if (mReplacement != mFont && mFont.replacement != mReplacement)
            {
                NGUIEditorTools.RegisterUndo("Font Change", mFont as Object);
                mFont.replacement = mReplacement;
                NGUITools.SetDirty(mFont as Object);
            }
        }

        if (type == NGUIFontType.Dynamic)
        {
#if UNITY_3_5
            EditorGUILayout.HelpBox("Dynamic fonts require Unity 4.0 or higher.", MessageType.Error);
#else
            Font fnt = EditorGUILayout.ObjectField("TTF Font", mFont.dynamicFont, typeof(Font), false) as Font;

            if (fnt != mFont.dynamicFont)
            {
                NGUIEditorTools.RegisterUndo("Font change", mFont as Object);
                mFont.dynamicFont = fnt;
            }

            var mat = EditorGUILayout.ObjectField("Material", mFont.material, typeof(Material), false) as Material;

            if (mFont.material != mat)
            {
                NGUIEditorTools.RegisterUndo("Font Material", mFont as Object);
                mFont.material = mat;
            }
#endif
        }

        if (type == NGUIFontType.Bitmap)
        {
            ComponentSelector.Draw(mFont.atlas, OnSelectAtlas, true);

            if (mFont.atlas != null)
            {
                if (mFont.bmFont.isValid)
                {
                    NGUIEditorTools.DrawAdvancedSpriteField(mFont.atlas, mFont.spriteName, SelectSprite, false);
                }
            }
            else
            {
                // No atlas specified -- set the material and texture rectangle directly
                var mat = EditorGUILayout.ObjectField("Material", mFont.material, typeof(Material), false) as Material;

                if (mFont.material != mat)
                {
                    NGUIEditorTools.RegisterUndo("Font Material", mFont as Object);
                    mFont.material = mat;
                }
            }
        }

        if (type != NGUIFontType.Reference)
        {
            GUI.changed = false;
            //EditorGUI.BeginDisabledGroup(mFont.isDynamic);
            var size = EditorGUILayout.IntField("Default Size", mFont.defaultSize, GUILayout.Width(120f));
            //EditorGUI.EndDisabledGroup();

            GUILayout.BeginHorizontal();
            int space = EditorGUILayout.IntField("Space Width", mFont.spaceWidth, GUILayout.Width(120f));
            if (space == 0)
            {
                GUILayout.Label("(default)");
            }
            GUILayout.EndHorizontal();

            if (GUI.changed)
            {
                NGUIEditorTools.RegisterUndo("Font change", mFont as Object);
                mFont.spaceWidth  = space;
                mFont.defaultSize = size;

                var labels = NGUITools.FindActive <UILabel>();

                foreach (UILabel lbl in labels)
                {
                    if (lbl.font == null)
                    {
                        continue;
                    }

                    var font = lbl.font;

                    if (NGUITools.CheckIfRelated(font, mFont))
                    {
                        lbl.font = null;
                        lbl.font = font;
                        NGUITools.SetDirty(lbl);
                    }
                }
            }

            EditorGUILayout.Space();
        }

        if (type == NGUIFontType.Dynamic || type == NGUIFontType.Reference)
        {
            var font = mFont as NGUIFont;

            if (font != null)
            {
                if (NGUIEditorTools.DrawHeader("Symbol Atlas"))
                {
                    NGUIEditorTools.BeginContents();
                    ComponentSelector.Draw(font.symbolAtlas, OnSelectSymbolAtlas, true);
                    NGUIEditorTools.EndContents();
                }

                EditorGUILayout.Space();
            }
        }

        // For updating the font's data when importing from an external source, such as the texture packer
        bool resetWidthHeight = false;

        if (type == NGUIFontType.Bitmap && (mFont.atlas != null || mFont.material != null))
        {
            if (NGUIEditorTools.DrawHeader("Import"))
            {
                NGUIEditorTools.BeginContents();
                var data = EditorGUILayout.ObjectField("Import Data", null, typeof(TextAsset), false) as TextAsset;

                if (data != null)
                {
                    NGUIEditorTools.RegisterUndo("Import Font Data", mFont as Object);
                    BMFontReader.Load(mFont.bmFont, (mFont as Object).name, data.bytes);
                    mFont.MarkAsChanged();
                    resetWidthHeight = true;
                    Debug.Log("Imported " + mFont.bmFont.glyphCount + " characters");
                }
                NGUIEditorTools.EndContents();
            }

            EditorGUILayout.Space();
        }

        if (mFont is UIFont && mFont.bmFont.isValid)
        {
            EditorGUILayout.HelpBox("Legacy font type should be upgraded in order to maintain compatibility with Unity 2018 and newer.", MessageType.Warning, true);

            if (GUILayout.Button("Upgrade"))
            {
                var path = EditorUtility.SaveFilePanelInProject("Save As", (mFont as Object).name + ".asset", "asset", "Save font as...", NGUISettings.currentPath);

                if (!string.IsNullOrEmpty(path))
                {
                    NGUISettings.currentPath = System.IO.Path.GetDirectoryName(path);
                    var asset = ScriptableObject.CreateInstance <NGUIFont>();
                    asset.bmFont      = mFont.bmFont;
                    asset.symbols     = mFont.symbols;
                    asset.atlas       = mFont.atlas;
                    asset.spriteName  = mFont.spriteName;
                    asset.uvRect      = mFont.uvRect;
                    asset.defaultSize = mFont.defaultSize;

                    var fontName = path.Replace(".asset", "");
                    fontName   = fontName.Substring(path.LastIndexOfAny(new char[] { '/', '\\' }) + 1);
                    asset.name = fontName;

                    var existing = AssetDatabase.LoadMainAssetAtPath(path);
                    if (existing != null)
                    {
                        EditorUtility.CopySerialized(asset, existing);
                    }
                    else
                    {
                        AssetDatabase.CreateAsset(asset, path);
                    }

                    AssetDatabase.SaveAssets();
                    AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);

                    asset = AssetDatabase.LoadAssetAtPath <NGUIFont>(path);
                    NGUISettings.ambigiousFont = asset;
                    Selection.activeObject     = asset;

                    if (asset != null)
                    {
                        mFont.replacement = asset;
                        mFont.MarkAsChanged();
                    }
                }
            }
        }

        if (type == NGUIFontType.Bitmap && mFont.bmFont.isValid)
        {
            Texture2D tex = mFont.texture;

            if (tex != null && mFont.atlas == null)
            {
                // Pixels are easier to work with than UVs
                Rect pixels = NGUIMath.ConvertToPixels(mFont.uvRect, tex.width, tex.height, false);

                // Automatically set the width and height of the rectangle to be the original font texture's dimensions
                if (resetWidthHeight)
                {
                    pixels.width  = mFont.texWidth;
                    pixels.height = mFont.texHeight;
                }

                // Font sprite rectangle
                pixels = EditorGUILayout.RectField("Pixel Rect", pixels);

                // Convert the pixel coordinates back to UV coordinates
                Rect uvRect = NGUIMath.ConvertToTexCoords(pixels, tex.width, tex.height);

                if (mFont.uvRect != uvRect)
                {
                    NGUIEditorTools.RegisterUndo("Font Pixel Rect", mFont as Object);
                    mFont.uvRect = uvRect;
                }
                //NGUIEditorTools.DrawSeparator();
                EditorGUILayout.Space();
            }
        }

        var nguiFont    = mFont as NGUIFont;
        var symbolAtlas = (nguiFont != null) ? nguiFont.symbolAtlas : null;
        if (symbolAtlas == null && type != NGUIFontType.Reference)
        {
            symbolAtlas = mFont.atlas;
        }

        if (symbolAtlas != null && NGUIEditorTools.DrawHeader("Symbols and Emoticons"))
        {
            NGUIEditorTools.BeginContents();

            var symbols = mFont.symbols;

            for (int i = 0; i < symbols.Count;)
            {
                var sym = symbols[i];

                GUILayout.BeginHorizontal();
                GUILayout.Label(sym.sequence, GUILayout.Width(40f));

                if (NGUIEditorTools.DrawSpriteField(symbolAtlas, sym.spriteName, ChangeSymbolSprite, GUILayout.MinWidth(100f)))
                {
                    mSelectedSymbol = sym;
                }

                var col = GUILayout.Toggle(sym.colored, new GUIContent(""), GUILayout.Width(16f));

                if (col != sym.colored)
                {
                    sym.colored = col;
                    mFont.MarkAsChanged();
                }

                if (GUILayout.Button("Edit", GUILayout.Width(40f)) && symbolAtlas != null)
                {
                    NGUISettings.atlas          = symbolAtlas;
                    NGUISettings.selectedSprite = sym.spriteName;
                    NGUIEditorTools.Select(symbolAtlas as Object);
                }

                GUI.backgroundColor = Color.red;

                if (GUILayout.Button("X", GUILayout.Width(22f)))
                {
                    NGUIEditorTools.RegisterUndo("Remove symbol", mFont as Object);
                    mSymbolSequence = sym.sequence;
                    mSymbolSprite   = sym.spriteName;
                    symbols.Remove(sym);
                    mFont.MarkAsChanged();
                }
                GUI.backgroundColor = Color.white;
                GUILayout.EndHorizontal();
                //GUILayout.Space(4f);
                ++i;
            }

            if (symbols.Count > 0)
            {
                if (Event.current.type == EventType.Repaint)
                {
                    Texture2D tex  = NGUIEditorTools.blankTexture;
                    Rect      rect = GUILayoutUtility.GetLastRect();
                    GUI.color = new Color(0f, 0f, 0f, 0.25f);
                    GUI.DrawTexture(new Rect(20f, rect.yMin + 28f, Screen.width - 30f, 1f), tex);
                    GUI.color = Color.white;
                }

                GUILayout.Space(10f);
            }

            GUILayout.BeginHorizontal();
            mSymbolSequence = EditorGUILayout.TextField(mSymbolSequence, GUILayout.Width(40f));
            NGUIEditorTools.DrawSpriteField(symbolAtlas, mSymbolSprite, SelectSymbolSprite);

            bool isValid = !string.IsNullOrEmpty(mSymbolSequence) && !string.IsNullOrEmpty(mSymbolSprite);
            GUI.backgroundColor = isValid ? Color.green : Color.grey;

            if (GUILayout.Button("Add", GUILayout.Width(40f)) && isValid)
            {
                NGUIEditorTools.RegisterUndo("Add symbol", mFont as Object);
                var sym = mFont.AddSymbol(mSymbolSequence, mSymbolSprite);
                sym.colored = mSymbolColored;
                mFont.MarkAsChanged();
                mSymbolSequence = "";
                mSymbolSprite   = "";
            }
            GUI.backgroundColor = Color.white;
            GUILayout.EndHorizontal();

            NGUIEditorTools.SetLabelWidth(42f);
            GUILayout.BeginHorizontal();
            mSymbolColored = EditorGUILayout.Toggle("Tinted", mSymbolColored, GUILayout.Width(60f));
            GUILayout.Label("- affected by label's color by default");
            GUILayout.EndHorizontal();
            NGUIEditorTools.SetLabelWidth(80f);

            if (symbols.Count == 0)
            {
                EditorGUILayout.HelpBox("Want to add an emoticon to your font? In the field above type ':)', choose a sprite, then hit the Add button.", MessageType.Info);
            }
            else
            {
                GUILayout.Space(4f);
            }

            if (nguiFont != null)
            {
                if (Event.current.type == EventType.Repaint)
                {
                    Texture2D tex  = NGUIEditorTools.blankTexture;
                    Rect      rect = GUILayoutUtility.GetLastRect();
                    GUI.color = new Color(0f, 0f, 0f, 0.25f);
                    GUI.DrawTexture(new Rect(20f, rect.yMin + 6f, Screen.width - 30f, 1f), tex);
                    GUI.color = Color.white;
                }

                GUILayout.Space(6f);

                GUI.changed = false;
                GUILayout.BeginHorizontal();
                GUILayout.Label("Scale", GUILayout.Width(40f));
                var scale = EditorGUILayout.FloatField(nguiFont.symbolScale, GUILayout.Width(50f));
                GUILayout.Label("- scaling multiplier");
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Offset", GUILayout.Width(40f));
                var offset = EditorGUILayout.IntField(nguiFont.symbolOffset, GUILayout.Width(50f));
                GUILayout.Label("- vertical offset");
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Height", GUILayout.Width(40f));
                var height = EditorGUILayout.IntField(nguiFont.symbolMaxHeight, GUILayout.Width(50f));
                GUILayout.Label("- maximum sprite height");
                GUILayout.EndHorizontal();

                if (GUI.changed)
                {
                    NGUIEditorTools.RegisterUndo("Change symbol values", mFont as Object);
                    nguiFont.symbolScale     = scale;
                    nguiFont.symbolOffset    = offset;
                    nguiFont.symbolMaxHeight = height;
                    nguiFont.MarkAsChanged();
                }
            }

            NGUIEditorTools.EndContents();
        }

        if (type == NGUIFontType.Bitmap && mFont.bmFont != null && mFont.bmFont.isValid)
        {
            if (NGUIEditorTools.DrawHeader("Modify"))
            {
                NGUIEditorTools.BeginContents();

                UISpriteData sd = mFont.sprite;

                bool disable = (sd != null && (sd.paddingLeft != 0 || sd.paddingBottom != 0));
                EditorGUI.BeginDisabledGroup(disable || mFont.packedFontShader);

                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(20f);
                EditorGUILayout.BeginVertical();

                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical();
                NGUISettings.foregroundColor = EditorGUILayout.ColorField("Foreground", NGUISettings.foregroundColor);
                NGUISettings.backgroundColor = EditorGUILayout.ColorField("Background", NGUISettings.backgroundColor);
                GUILayout.EndVertical();
                mCurve = EditorGUILayout.CurveField("", mCurve, GUILayout.Width(40f), GUILayout.Height(40f));
                GUILayout.EndHorizontal();

                if (GUILayout.Button("Add a Shadow"))
                {
                    ApplyEffect(Effect.Shadow, NGUISettings.foregroundColor, NGUISettings.backgroundColor);
                }
                if (GUILayout.Button("Add a Soft Outline"))
                {
                    ApplyEffect(Effect.Outline, NGUISettings.foregroundColor, NGUISettings.backgroundColor);
                }
                if (GUILayout.Button("Rebalance Colors"))
                {
                    ApplyEffect(Effect.Rebalance, NGUISettings.foregroundColor, NGUISettings.backgroundColor);
                }
                if (GUILayout.Button("Apply Curve to Alpha"))
                {
                    ApplyEffect(Effect.AlphaCurve, NGUISettings.foregroundColor, NGUISettings.backgroundColor);
                }
                if (GUILayout.Button("Apply Curve to Foreground"))
                {
                    ApplyEffect(Effect.ForegroundCurve, NGUISettings.foregroundColor, NGUISettings.backgroundColor);
                }
                if (GUILayout.Button("Apply Curve to Background"))
                {
                    ApplyEffect(Effect.BackgroundCurve, NGUISettings.foregroundColor, NGUISettings.backgroundColor);
                }

                GUILayout.Space(10f);
                if (GUILayout.Button("Add Transparent Border (+1)"))
                {
                    ApplyEffect(Effect.Border, NGUISettings.foregroundColor, NGUISettings.backgroundColor);
                }
                if (GUILayout.Button("Remove Border (-1)"))
                {
                    ApplyEffect(Effect.Crop, NGUISettings.foregroundColor, NGUISettings.backgroundColor);
                }

                EditorGUILayout.EndVertical();
                GUILayout.Space(20f);
                EditorGUILayout.EndHorizontal();

                EditorGUI.EndDisabledGroup();

                if (disable)
                {
                    GUILayout.Space(3f);
                    EditorGUILayout.HelpBox("The sprite used by this font has been trimmed and is not suitable for modification. " +
                                            "Try re-adding this sprite with 'Trim Alpha' disabled.", MessageType.Warning);
                }

                NGUIEditorTools.EndContents();
            }
        }

        if (mFont.atlas == null)
        {
            mView      = View.Font;
            mUseShader = false;
        }

        // Preview option
        if (mFont.atlas != null)
        {
            GUILayout.BeginHorizontal();
            {
                mView = (View)EditorGUILayout.EnumPopup("Preview", mView);
                GUILayout.Label("Shader", GUILayout.Width(45f));
                mUseShader = EditorGUILayout.Toggle(mUseShader, GUILayout.Width(20f));
            }
            GUILayout.EndHorizontal();
        }
    }