Example #1
0
    public static GUIStyle GetSectionStyle()
    {
        if (_sectionStyle == null)
        {
            _sectionStyle      = new GUIStyle();
            _sectionStyle.name = "heu_ui_section";

            GUIStyleState styleState = new GUIStyleState();
            styleState.textColor = new Color(0.705f, 0.705f, 0.705f, 1.0f);
            _sectionStyle.active = styleState;

            _sectionStyle.alignment     = TextAnchor.UpperCenter;
            _sectionStyle.border        = new RectOffset(9, 9, 4, 14);
            _sectionStyle.clipping      = TextClipping.Clip;
            _sectionStyle.contentOffset = new Vector2(0f, 3f);
            _sectionStyle.imagePosition = ImagePosition.ImageLeft;

            string    textureName   = string.Format("heu_ui_section_box{0}", GuiUtil.IsEditorDarkSkin() ? "_d" : "");
            Texture2D normalTexture = Resources.Load <Texture2D>(textureName);

            GUIStyleState normalState = new GUIStyleState();
            normalState.background = normalTexture;
            _sectionStyle.normal   = normalState;

            _sectionStyle.overflow = new RectOffset(4, 4, 0, 9);
            _sectionStyle.padding  = new RectOffset(4, 4, 4, 4);

            _sectionStyle.richText     = false;
            _sectionStyle.stretchWidth = false;
        }
        return(_sectionStyle);
    }