예제 #1
0
        public static void SetToDefault(GUIStyle style)
        {
            var name = style.name;

            style.Assign(GUIStyle.none);
            style.name = name;
        }
예제 #2
0
        public static void Assign(this GUISkin skin, GUISkin src)
        {
            skin.customStyles = src.customStyles.Select(style =>
            {
                var newStyle = new GUIStyle();
                newStyle.Assign(style);
                return(newStyle);
            }).ToArray();
            skin.font = src.font;

            skin.settings.Assign(src.settings);
            skin.button.Assign(src.button);
            skin.box.Assign(src.box);
            skin.horizontalScrollbarThumb.Assign(src.horizontalScrollbarThumb);
            skin.horizontalScrollbar.Assign(src.horizontalScrollbar);
            skin.horizontalScrollbarLeftButton.Assign(src.horizontalScrollbarLeftButton);
            skin.horizontalScrollbarRightButton.Assign(src.horizontalScrollbarRightButton);
            skin.horizontalSlider.Assign(src.horizontalSlider);
            skin.horizontalSliderThumb.Assign(src.horizontalSliderThumb);
            skin.label.Assign(src.label);
            skin.scrollView.Assign(src.scrollView);
            skin.textArea.Assign(src.textArea);
            skin.textField.Assign(src.textField);
            skin.toggle.Assign(src.toggle);
            skin.verticalScrollbar.Assign(src.verticalScrollbar);
            skin.verticalScrollbarDownButton.Assign(src.verticalScrollbarDownButton);
            skin.verticalScrollbarThumb.Assign(src.verticalScrollbarThumb);
            skin.verticalScrollbarUpButton.Assign(src.verticalScrollbarUpButton);
            skin.verticalSlider.Assign(src.verticalSlider);
            skin.verticalSliderThumb.Assign(src.verticalSliderThumb);
            skin.window.Assign(src.window);
            skin.name = src.name;
        }
예제 #3
0
        internal static GUIStyle FromUSS(string ussStyleRuleName, string ussInPlaceStyleOverride = null, GUISkin srcSkin = null)
        {
            // Check if the style already exists in skin
            var blockName = RuleNameToBlockName(ussStyleRuleName);
            var styleName = ConverterUtils.ToStyleName(ussStyleRuleName);
            var inSkin    = (srcSkin ? srcSkin : GUISkin.current).FindStyle(styleName);
            var style     = new GUIStyle()
            {
                name = styleName
            };

            if (inSkin != null)
            {
                style.Assign(inSkin);
            }

            PopulateFromUSS(EditorResources.styleCatalog, style, blockName, ussInPlaceStyleOverride);
            return(style);
        }