Exemplo n.º 1
0
    public override void SetValue(UIWidget widget)
    {
        base.SetValue(widget);

        UILabel label = (UILabel)widget;

        FontName = label.bitmapFont.name;
        FontStyle = label.fontStyle;
        Alignment = label.alignment;
        IsGridient = label.applyGradient;
        GradientTop = new CustomColor(label.gradientTop);
        GradientBottom = new CustomColor(label.gradientBottom);
        EffectStyle = label.effectStyle;
        EffectColor = new CustomColor(label.effectColor);
        EffectDistance = new CustomVector2(label.effectDistance);
        EffectiveSpacingX = label.effectiveSpacingX;
        EffectiveSpacingY = label.effectiveSpacingY;
        ColorTint = new CustomColor(label.color);
    }
Exemplo n.º 2
0
 public UILabelEffect(UILabel.Effect t, float x, float y)
 {
     type   = t;
     dist.x = x;
     dist.y = y;
 }
Exemplo n.º 3
0
    protected override bool DrawProperties()
    {
        mLabel = mWidget as UILabel;
        ComponentSelector.Draw <UIFont>(mLabel.font, OnSelectFont);

        if (mLabel.font != null)
        {
            GUI.skin.textArea.wordWrap = true;
            string text = string.IsNullOrEmpty(mLabel.text) ? "" : mLabel.text;
            text = EditorGUILayout.TextArea(mLabel.text, GUI.skin.textArea, GUILayout.Height(100f));
            if (!text.Equals(mLabel.text))
            {
                RegisterUndo(); mLabel.text = text;
            }

            GUILayout.BeginHorizontal();
            int len = EditorGUILayout.IntField("Max Width", mLabel.lineWidth, GUILayout.Width(120f));
            GUILayout.Label("pixels");
            GUILayout.EndHorizontal();
            if (len != mLabel.lineWidth)
            {
                RegisterUndo(); mLabel.lineWidth = len;
            }

            int count = EditorGUILayout.IntField("Max Lines", mLabel.maxLineCount, GUILayout.Width(100f));
            if (count != mLabel.maxLineCount)
            {
                RegisterUndo(); mLabel.maxLineCount = count;
            }

            GUILayout.BeginHorizontal();
            bool shrinkToFit = EditorGUILayout.Toggle("Shrink to Fit", mLabel.shrinkToFit, GUILayout.Width(100f));
            GUILayout.Label("- adjust scale to fit");
            GUILayout.EndHorizontal();

            if (shrinkToFit != mLabel.shrinkToFit)
            {
                RegisterUndo();
                mLabel.shrinkToFit = shrinkToFit;
                if (!shrinkToFit)
                {
                    mLabel.MakePixelPerfect();
                }
            }

            GUILayout.BeginHorizontal();
            bool password = EditorGUILayout.Toggle("Password", mLabel.password, GUILayout.Width(100f));
            GUILayout.Label("- hide characters");
            GUILayout.EndHorizontal();
            if (password != mLabel.password)
            {
                RegisterUndo(); mLabel.password = password;
            }

            GUILayout.BeginHorizontal();
            bool encoding = EditorGUILayout.Toggle("Encoding", mLabel.supportEncoding, GUILayout.Width(100f));
            GUILayout.Label("- use emoticons and colors");
            GUILayout.EndHorizontal();
            if (encoding != mLabel.supportEncoding)
            {
                RegisterUndo(); mLabel.supportEncoding = encoding;
            }

            //GUILayout.EndHorizontal();

            if (encoding && mLabel.font.hasSymbols)
            {
                UIFont.SymbolStyle sym = (UIFont.SymbolStyle)EditorGUILayout.EnumPopup("Symbols", mLabel.symbolStyle, GUILayout.Width(170f));
                if (sym != mLabel.symbolStyle)
                {
                    RegisterUndo(); mLabel.symbolStyle = sym;
                }
            }

            GUILayout.BeginHorizontal();
            {
                UILabel.Effect effect = (UILabel.Effect)EditorGUILayout.EnumPopup("Effect", mLabel.effectStyle, GUILayout.Width(170f));
                if (effect != mLabel.effectStyle)
                {
                    RegisterUndo(); mLabel.effectStyle = effect;
                }

                if (effect != UILabel.Effect.None)
                {
                    Color c = EditorGUILayout.ColorField(mLabel.effectColor);
                    if (mLabel.effectColor != c)
                    {
                        RegisterUndo(); mLabel.effectColor = c;
                    }
                }
            }
            GUILayout.EndHorizontal();

            if (mLabel.effectStyle != UILabel.Effect.None)
            {
                GUILayout.Label("Distance", GUILayout.Width(70f));
                GUILayout.Space(-34f);
                GUILayout.BeginHorizontal();
                GUILayout.Space(70f);
                Vector2 offset = EditorGUILayout.Vector2Field("", mLabel.effectDistance);
                GUILayout.Space(20f);

                if (offset != mLabel.effectDistance)
                {
                    RegisterUndo();
                    mLabel.effectDistance = offset;
                }
                GUILayout.EndHorizontal();
            }
            return(true);
        }
        EditorGUILayout.Space();
        return(false);
    }
Exemplo n.º 4
0
    override protected bool OnDrawProperties()
    {
        mLabel = mWidget as UILabel;
        ComponentSelector.Draw <UIFont>(mLabel.font, OnSelectFont);
        if (mLabel.font == null)
        {
            return(false);
        }

        GUI.skin.textArea.wordWrap = true;
        string text = string.IsNullOrEmpty(mLabel.text) ? "" : mLabel.text;

        text = EditorGUILayout.TextArea(mLabel.text, GUI.skin.textArea, GUILayout.Height(100f));
        if (!text.Equals(mLabel.text))
        {
            RegisterUndo(); mLabel.text = text;
        }

        GUILayout.BeginHorizontal();
        {
            int len = EditorGUILayout.IntField("Line Width", mLabel.lineWidth, GUILayout.Width(120f));
            if (len != mLabel.lineWidth)
            {
                RegisterUndo(); mLabel.lineWidth = len;
            }

            int count = EditorGUILayout.IntField("Line Count", mLabel.maxLineCount, GUILayout.Width(100f));
            if (count != mLabel.maxLineCount)
            {
                RegisterUndo(); mLabel.maxLineCount = count;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        bool password = EditorGUILayout.Toggle("Password", mLabel.password, GUILayout.Width(120f));

        if (password != mLabel.password)
        {
            RegisterUndo(); mLabel.password = password;
        }

        bool encoding = EditorGUILayout.Toggle("Encoding", mLabel.supportEncoding, GUILayout.Width(100f));

        if (encoding != mLabel.supportEncoding)
        {
            RegisterUndo(); mLabel.supportEncoding = encoding;
        }

        GUILayout.EndHorizontal();

        if (encoding)
        {
            UIFont.SymbolStyle sym = (UIFont.SymbolStyle)EditorGUILayout.EnumPopup("Symbols", mLabel.symbolStyle, GUILayout.Width(170f));
            if (sym != mLabel.symbolStyle)
            {
                RegisterUndo(); mLabel.symbolStyle = sym;
            }
        }

        GUILayout.BeginHorizontal();
        {
            UILabel.Effect effect = (UILabel.Effect)EditorGUILayout.EnumPopup("Effect", mLabel.effectStyle, GUILayout.Width(170f));
            if (effect != mLabel.effectStyle)
            {
                RegisterUndo(); mLabel.effectStyle = effect;
            }

            if (effect != UILabel.Effect.None)
            {
                Color c = EditorGUILayout.ColorField(mLabel.effectColor);
                if (mLabel.effectColor != c)
                {
                    RegisterUndo(); mLabel.effectColor = c;
                }
            }
        }
        GUILayout.EndHorizontal();

        if (mLabel.effectStyle != UILabel.Effect.None)
        {
            GUILayout.Label("Distance", GUILayout.Width(70f));
            GUILayout.Space(-34f);
            GUILayout.BeginHorizontal();
            GUILayout.Space(70f);
            Vector2 offset = EditorGUILayout.Vector2Field("", mLabel.effectDistance);
            GUILayout.Space(20f);

            if (offset != mLabel.effectDistance)
            {
                RegisterUndo();
                mLabel.effectDistance = offset;
            }
            GUILayout.EndHorizontal();
        }
        return(true);
    }
Exemplo n.º 5
0
 private void ApplyChanges()
 {
     this.mShouldBeProcessed = false;
     this.mLastText = this.text;
     this.mLastInvisibleHack = this.mInvisibleHack;
     this.mLastWidth = this.mMaxLineWidth;
     this.mLastEncoding = this.mEncoding;
     this.mLastCount = this.mMaxLineCount;
     this.mLastPass = this.mPassword;
     this.mLastShow = this.mShowLastChar;
     this.mLastEffect = this.mEffectStyle;
     this.mLastColor = this.mEffectColor;
 }
Exemplo n.º 6
0
 public void ApplyEffect(Transform transform, int vertexStart, UILabel.Effect effect, Color effectColor, float size)
 {
     this.ApplyEffect(transform, vertexStart, this.vSize, effect, effectColor, size);
 }
Exemplo n.º 7
0
    override protected bool DrawProperties()
    {
        mLabel = mWidget as UILabel;

        ComponentSelector.Draw <UIFont>(mLabel.font, OnSelectFont);
        if (mLabel.font == null)
        {
            return(false);
        }

        GUI.skin.textArea.wordWrap = true;
        string text = string.IsNullOrEmpty(mLabel.text) ? "" : mLabel.text;

        text = EditorGUILayout.TextArea(mLabel.text, GUI.skin.textArea, GUILayout.Height(100f));
        if (!text.Equals(mLabel.text))
        {
            RegisterUndo(); mLabel.text = text;
        }
        EditorGUILayout.LabelField("*Language Id代替text序列化");
        EditorGUILayout.LabelField("*固定内容直接把中文表id填到Language Id");

        GUILayout.BeginHorizontal();
        int languageId = EditorGUILayout.IntField("Language Id", mLabel.LanguageId, GUILayout.Width(220f));

        if (languageId != mLabel.LanguageId)
        {
            SystemSwitch.ReleaseMode          = false;
            SystemSwitch.UseHmf               = false;
            UILabel.GetContent                = Mogo.GameData.LanguageData.GetContent;
            RegisterUndo(); mLabel.LanguageId = languageId;
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        {
            int len = EditorGUILayout.IntField("Line Width", mLabel.lineWidth, GUILayout.Width(120f));
            if (len != mLabel.lineWidth)
            {
                RegisterUndo(); mLabel.lineWidth = len;
            }

            int count = EditorGUILayout.IntField("Line Count", mLabel.maxLineCount, GUILayout.Width(120f));
            if (count != mLabel.maxLineCount)
            {
                RegisterUndo(); mLabel.maxLineCount = count;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        {
            int len = EditorGUILayout.IntField("Spacing X", mLabel.spacingX, GUILayout.Width(120f));
            if (len != mLabel.spacingX)
            {
                RegisterUndo(); mLabel.spacingX = len;
            }

            int count = EditorGUILayout.IntField("Spacing Y", mLabel.spacingY, GUILayout.Width(120f));
            if (count != mLabel.spacingY)
            {
                RegisterUndo(); mLabel.spacingY = count;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        bool password = EditorGUILayout.Toggle("Password", mLabel.password, GUILayout.Width(120f));

        if (password != mLabel.password)
        {
            RegisterUndo(); mLabel.password = password;
        }

        bool encoding = EditorGUILayout.Toggle("Encoding", mLabel.supportEncoding, GUILayout.Width(100f));

        if (encoding != mLabel.supportEncoding)
        {
            RegisterUndo(); mLabel.supportEncoding = encoding;
        }

        bool tranlateReturn = EditorGUILayout.Toggle("TranslateReturn", mLabel.TranslateReturn, GUILayout.Width(120f));

        if (tranlateReturn != mLabel.TranslateReturn)
        {
            RegisterUndo(); mLabel.TranslateReturn = tranlateReturn;
        }

        GUILayout.EndHorizontal();

        if (encoding && mLabel.font.hasSymbols)
        {
            UIFont.SymbolStyle sym = (UIFont.SymbolStyle)EditorGUILayout.EnumPopup("Symbols", mLabel.symbolStyle, GUILayout.Width(170f));
            if (sym != mLabel.symbolStyle)
            {
                RegisterUndo(); mLabel.symbolStyle = sym;
            }
        }

        GUILayout.BeginHorizontal();
        {
            UILabel.Effect effect = (UILabel.Effect)EditorGUILayout.EnumPopup("Effect", mLabel.effectStyle, GUILayout.Width(170f));
            if (effect != mLabel.effectStyle)
            {
                RegisterUndo(); mLabel.effectStyle = effect;
            }

            if (effect != UILabel.Effect.None)
            {
                Color c = EditorGUILayout.ColorField(mLabel.effectColor);
                if (mLabel.effectColor != c)
                {
                    RegisterUndo(); mLabel.effectColor = c;
                }
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (mLabel.effectStyle != UILabel.Effect.None)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Distance", GUILayout.Width(70f));
            Vector2 offset = EditorGUILayout.Vector2Field("", mLabel.effectDistance);
            GUILayout.Space(20f);

            if (offset != mLabel.effectDistance)
            {
                RegisterUndo();
                mLabel.effectDistance = offset;
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        {
            int len = EditorGUILayout.IntField("TextChangeWidth", mLabel.ChangeTextWidth, GUILayout.Width(120f));
            if (len != mLabel.ChangeTextWidth)
            {
                RegisterUndo(); mLabel.ChangeTextWidth = len;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("一秒变样式", GUILayout.Width(75f));
        //if (GUILayout.Button("36标题", GUILayout.Width(50f)))
        //    ExportScenesManager.SetUIHeadText(mLabel.gameObject);
        //if (GUILayout.Button("30标题", GUILayout.Width(50f)))
        //    ExportScenesManager.SetUI30TitleText(mLabel.gameObject);
        //if (GUILayout.Button("28标题", GUILayout.Width(50f)))
        //    ExportScenesManager.SetUI28TitleText(mLabel.gameObject);
        //GUILayout.EndHorizontal();

        //GUILayout.BeginHorizontal();
        //GUILayout.Label("", GUILayout.Width(75f));
        //if (GUILayout.Button("26标题", GUILayout.Width(50f)))
        //    ExportScenesManager.SetUI26TitleText(mLabel.gameObject);
        //if (GUILayout.Button("通用", GUILayout.Width(50f)))
        //    ExportScenesManager.SetUICommonText(mLabel.gameObject);
        //if (GUILayout.Button("A标签", GUILayout.Width(50f)))
        //    ExportScenesManager.SetUIAHorizontalUpButtonText(mLabel.gameObject);
        //GUILayout.EndHorizontal();

        //GUILayout.BeginHorizontal();
        //GUILayout.Label("", GUILayout.Width(75f));
        //if (GUILayout.Button("绿色", GUILayout.Width(60f)))
        //    ExportScenesManager.SetUIGreenText(mLabel.gameObject);
        //if (GUILayout.Button("红色", GUILayout.Width(60f)))
        //    ExportScenesManager.SetUIRedText(mLabel.gameObject);
        //if (GUILayout.Button("icon", GUILayout.Width(60f)))
        //    ExportScenesManager.SetUIIconNumText(mLabel.gameObject);
        //GUILayout.EndHorizontal();

        //GUILayout.BeginHorizontal();
        //GUILayout.Label("", GUILayout.Width(75f));
        //if (GUILayout.Button("底纹按钮", GUILayout.Width(60f)))
        //    ExportScenesManager.SetUINormalButtonText(mLabel.gameObject);
        //if (GUILayout.Button("主右上", GUILayout.Width(60f)))
        //    ExportScenesManager.SetUIMainRightUpText(mLabel.gameObject);
        //if (GUILayout.Button("主右", GUILayout.Width(60f)))
        //    ExportScenesManager.SetUIMainRightText(mLabel.gameObject);
        //GUILayout.EndHorizontal();

        //GUILayout.BeginHorizontal();
        //GUILayout.Label("", GUILayout.Width(75f));
        //if (GUILayout.Button("底纹按钮", GUILayout.Width(60f)))
        //    ExportScenesManager.SetUINormalButtonText(mLabel.gameObject);
        //if (GUILayout.Button("双字加空格", GUILayout.Width(75f)))
        //{
        //    RegisterUndo();
        //    mLabel.ChangeTextWidth = 100;
        //    mLabel.text = mLabel.text;
        //}
        GUILayout.EndHorizontal();

        return(true);
    }
Exemplo n.º 8
0
    protected override bool DrawProperties()
    {
        mLabel = mWidget as UILabel;
        ComponentSelector.Draw <UIFont>(mLabel.font, OnSelectFont);

        if (mLabel.font != null)
        {
            GUI.skin.textArea.wordWrap = true;
            string text = string.IsNullOrEmpty(mLabel.text) ? "" : mLabel.text;
            text = EditorGUILayout.TextArea(mLabel.text, GUI.skin.textArea, GUILayout.Height(100f));
            if (!text.Equals(mLabel.text))
            {
                RegisterUndo(); mLabel.text = text;
            }

            UILabel.Overflow ov = (UILabel.Overflow)EditorGUILayout.EnumPopup("Overflow", mLabel.overflowMethod);
            if (ov != mLabel.overflowMethod)
            {
                RegisterUndo(); mLabel.overflowMethod = ov;
            }

            // Only input fields need this setting exposed, and they have their own "is password" setting, so hiding it here.
            //GUILayout.BeginHorizontal();
            //bool password = EditorGUILayout.Toggle("Password", mLabel.password, GUILayout.Width(100f));
            //GUILayout.Label("- hide characters");
            //GUILayout.EndHorizontal();
            //if (password != mLabel.password) { RegisterUndo(); mLabel.password = password; }

            GUILayout.BeginHorizontal();
            bool encoding = EditorGUILayout.Toggle("Encoding", mLabel.supportEncoding, GUILayout.Width(100f));
            GUILayout.Label("use emoticons and colors");
            GUILayout.EndHorizontal();
            if (encoding != mLabel.supportEncoding)
            {
                RegisterUndo(); mLabel.supportEncoding = encoding;
            }

            //GUILayout.EndHorizontal();

            if (encoding && mLabel.font.hasSymbols)
            {
                UIFont.SymbolStyle sym = (UIFont.SymbolStyle)EditorGUILayout.EnumPopup("Symbols", mLabel.symbolStyle, GUILayout.Width(170f));
                if (sym != mLabel.symbolStyle)
                {
                    RegisterUndo(); mLabel.symbolStyle = sym;
                }
            }

            GUILayout.BeginHorizontal();
            bool useTableDic = EditorGUILayout.Toggle("UseTableDic", mLabel.useDicTable, GUILayout.Width(100f));
            if (useTableDic)
            {
                GUILayout.Label("curDicID :" + mLabel.curDicID);
            }
            GUILayout.EndHorizontal();
            mLabel.useDicTable = useTableDic;

            GUILayout.BeginHorizontal();
            {
                UILabel.Effect effect = (UILabel.Effect)EditorGUILayout.EnumPopup("Effect", mLabel.effectStyle, GUILayout.Width(170f));
                if (effect != mLabel.effectStyle)
                {
                    RegisterUndo(); mLabel.effectStyle = effect;
                }

                if (effect != UILabel.Effect.None)
                {
                    Color c = EditorGUILayout.ColorField(mLabel.effectColor);
                    if (mLabel.effectColor != c)
                    {
                        RegisterUndo(); mLabel.effectColor = c;
                    }
                }
            }
            GUILayout.EndHorizontal();

            if (mLabel.effectStyle != UILabel.Effect.None)
            {
#if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2
                GUILayout.Label("Distance", GUILayout.Width(70f));
                GUILayout.Space(-34f);
                GUILayout.BeginHorizontal();
                GUILayout.Space(70f);
                Vector2 offset = EditorGUILayout.Vector2Field("", mLabel.effectDistance);
                GUILayout.Space(20f);
                GUILayout.EndHorizontal();
#else
                Vector2 offset = mLabel.effectDistance;

                GUILayout.BeginHorizontal();
                GUILayout.Label("Distance", GUILayout.Width(76f));
                offset.x = EditorGUILayout.FloatField(offset.x);
                offset.y = EditorGUILayout.FloatField(offset.y);
                GUILayout.Space(18f);
                GUILayout.EndHorizontal();
#endif
                if (offset != mLabel.effectDistance)
                {
                    RegisterUndo();
                    mLabel.effectDistance = offset;
                }
            }

            int count = EditorGUILayout.IntField("Max Lines", mLabel.maxLineCount, GUILayout.Width(100f));
            if (count != mLabel.maxLineCount)
            {
                RegisterUndo(); mLabel.maxLineCount = count;
            }
            return(true);
        }
        EditorGUILayout.Space();
        return(false);
    }
Exemplo n.º 9
0
 protected static void SetLabel(UILabel label, Color color, Color effectColor, UILabel.Effect effect)
 {
     if (label != null)
     {
         label.color       = color;
         label.effectStyle = UILabel.Effect.Shadow;
     }
 }
Exemplo n.º 10
0
    override protected bool OnDrawProperties()
    {
        mLabel = mWidget as UILabel;
        if (GUILayout.Button("Font", GUILayout.Width(76f)))
        {
            ComponentSelectorNew.Show <Font>(OnSelectFont);
        }

        int fontSize = EditorGUILayout.IntField("FontSize:", mLabel.FontSize);

        if (fontSize != mLabel.FontSize)
        {
            RegisterUndo(); mLabel.FontSize = fontSize;
        }

        Font font = EditorGUILayout.ObjectField("", mLabel.TrueTypeFont, typeof(Font), false) as Font;

        if (font != mLabel.TrueTypeFont)
        {
            mLabel.TrueTypeFont = font;
        }

        EditorGUILayout.ObjectField("Material", mLabel.material, typeof(Material), false);

        if (mLabel.font == null)
        {
            return(false);
        }

        string text = EditorGUILayout.TextArea(mLabel.text, GUILayout.Height(100f));

        if (!text.Equals(mLabel.text))
        {
            RegisterUndo(); mLabel.text = text;
        }

        GUILayout.BeginHorizontal();
        {
            int len = EditorGUILayout.IntField("Line Width", mLabel.lineWidth, GUILayout.Width(120f));
            if (len != mLabel.lineWidth)
            {
                RegisterUndo(); mLabel.lineWidth = len;
            }

            bool multi = EditorGUILayout.Toggle("Multi-line", mLabel.multiLine, GUILayout.Width(100f));
            if (multi != mLabel.multiLine)
            {
                RegisterUndo(); mLabel.multiLine = multi;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        {
            int len = EditorGUILayout.IntField("Fixed Chinese", mLabel.FixedWidthForChinese, GUILayout.Width(120f));
            if (len != mLabel.FixedWidthForChinese)
            {
                RegisterUndo(); mLabel.FixedWidthForChinese = len;
            }
        }
        GUILayout.EndHorizontal();

        int spaceingY = EditorGUILayout.IntField("LineSpacingY", mLabel.lineSpacingY);

        if (spaceingY != mLabel.lineSpacingY)
        {
            RegisterUndo(); mLabel.lineSpacingY = spaceingY;
        }

        int spaceingX = EditorGUILayout.IntField("FontSpacingX", mLabel.FontSpacingX);

        if (spaceingX != mLabel.FontSpacingX)
        {
            RegisterUndo(); mLabel.FontSpacingX = spaceingX;
        }

        GUILayout.BeginHorizontal();
        {
            bool password = EditorGUILayout.Toggle("Password", mLabel.password, GUILayout.Width(120f));
            if (password != mLabel.password)
            {
                RegisterUndo(); mLabel.password = password;
            }

            bool encoding = EditorGUILayout.Toggle("Encoding", mLabel.supportEncoding, GUILayout.Width(100f));
            if (encoding != mLabel.supportEncoding)
            {
                RegisterUndo(); mLabel.supportEncoding = encoding;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        {
            UILabel.Effect effect = (UILabel.Effect)EditorGUILayout.EnumPopup("Effect", mLabel.effectStyle, GUILayout.Width(170f));
            if (effect != mLabel.effectStyle)
            {
                RegisterUndo(); mLabel.effectStyle = effect;
            }

            if (effect != UILabel.Effect.None)
            {
                Color c = EditorGUILayout.ColorField(mLabel.effectColor);
                if (mLabel.effectColor != c)
                {
                    RegisterUndo(); mLabel.effectColor = c;
                }
            }
        }
        GUILayout.EndHorizontal();
        FontStyle style = (FontStyle)EditorGUILayout.EnumPopup("FontStyle:", mLabel.FontStyle, GUILayout.Width(200f));

        if (style != mLabel.FontStyle)
        {
            RegisterUndo();
            mLabel.FontStyle = style;
        }

        GUILayout.BeginHorizontal();
        Color color = EditorGUILayout.ColorField("Top Color", mLabel.TopColor);

        uint colorIntValue = (uint)NGUIMath.ColorToInt(color);

        colorIntValue &= 0xFFFFFFFF;
        string colorRGBA  = colorIntValue.ToString("X8");
        string ncolorRGBA = EditorGUILayout.TextField("RGBA:", colorRGBA);

        if (ncolorRGBA != colorRGBA)
        {
            color = ColorOperation.GetColorFromRGBAStr(ncolorRGBA);
        }

        if (mLabel.TopColor != color)
        {
            NGUIEditorTools.RegisterUndo("Color Change", mLabel);
            mLabel.TopColor = color;
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        color = EditorGUILayout.ColorField("Bottom Color", mLabel.BottomColor);

        colorIntValue  = (uint)NGUIMath.ColorToInt(color);
        colorIntValue &= 0xFFFFFFFF;
        colorRGBA      = colorIntValue.ToString("X8");
        ncolorRGBA     = EditorGUILayout.TextField("RGBA:", colorRGBA);
        if (ncolorRGBA != colorRGBA)
        {
            color = ColorOperation.GetColorFromRGBAStr(ncolorRGBA);
        }

        if (mLabel.BottomColor != color)
        {
            NGUIEditorTools.RegisterUndo("Color Change", mLabel);
            mLabel.BottomColor = color;
        }
        GUILayout.EndHorizontal();

        return(true);
    }
Exemplo n.º 11
0
    private void OnGUI()
    {
        //向下空出5个像素
        GUILayout.Space(8);
        //创建是否改变当前字体开关
        isChangFont = EditorGUILayout.Toggle("是否改变当前字体", isChangFont);
        GUILayout.Space(5);
        //如果改变当前字体则创建字体文件选择框
        if (isChangFont)
        {
            if (NGUIEditorTools.DrawPrefixButton("Font", GUILayout.Width(64f)))
            {
                ComponentSelector.Show <Font>(OnNGUIFont);
            }
            curFont = (Font)EditorGUILayout.ObjectField("", curFont, typeof(Font), true);
            GUILayout.Space(5);
        }

        //创建是否改变字体类型开关
        isChangeStyle = EditorGUILayout.Toggle("是否改变字体类型", isChangeStyle);
        GUILayout.Space(5);
        //如果改变,则创建字体类型的枚举下拉框
        if (isChangeStyle)
        {
            curFontStyle = (FontStyle)EditorGUILayout.EnumPopup("字体类型", curFontStyle);
            GUILayout.Space(5);
        }

        //创建是否增加字体大小的开关
        isChangeSize = EditorGUILayout.Toggle("是否设置字体大小", isChangeSize);
        GUILayout.Space(5);
        if (isChangeSize)
        {
            //fontSize = EditorGUILayout.IntField(fontSize, GUI.skin.textArea,
            //                    GUILayout.Height(20f), GUILayout.Width(Screen.width - 100f));
            beforFontSize = EditorGUILayout.IntField("被替换的字体大小", beforFontSize);
            GUILayout.Space(5);
            nowFontSize = EditorGUILayout.IntField("替换后的字体大小", nowFontSize);
            GUILayout.Space(5);
        }

        isChangeEffect = EditorGUILayout.Toggle("是否改变阴影特效", isChangeEffect);
        GUILayout.Space(5);
        if (isChangeEffect)
        {
            fontEffect = (UILabel.Effect)EditorGUILayout.EnumPopup("阴影特效", fontEffect);
            GUILayout.Space(5);
        }

        isSetGradientApply = EditorGUILayout.Toggle("是否设置颜色渐变", isSetGradientApply);
        if (isSetGradientApply)
        {
            isGradientApply = EditorGUILayout.Toggle("使用", isGradientApply);
        }

        isChangeColor = EditorGUILayout.Toggle("是否改变颜色", isChangeColor);
        GUILayout.Space(10);
        if (isChangeColor)
        {
            isSelfWrite = EditorGUILayout.Toggle("是否自己填写颜色", isSelfWrite);
            GUILayout.Space(5);
            if (isSelfWrite)
            {
                selfColor = (Color)EditorGUILayout.ColorField("初始的颜色", selfColor);
            }
            else
            {
                beforColor = (ClientColorConfig.ClientColor)EditorGUILayout.EnumPopup("初始的颜色", beforColor);
                GUILayout.Space(8);
            }

            nowColor = (ClientColorConfig.ClientColor)EditorGUILayout.EnumPopup("修改后的颜色", nowColor);
            GUILayout.Space(5);
        }


        //创建确认按钮
        if (GUILayout.Button("确认修改", GUILayout.Height(30), GUILayout.Width(300)))
        {
            Change();
        }
    }