当前位置: 首页>>代码示例>>C#>>正文


C# GUISkin.FindStyle方法代码示例

本文整理汇总了C#中UnityEngine.GUISkin.FindStyle方法的典型用法代码示例。如果您正苦于以下问题:C# GUISkin.FindStyle方法的具体用法?C# GUISkin.FindStyle怎么用?C# GUISkin.FindStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.GUISkin的用法示例。


在下文中一共展示了GUISkin.FindStyle方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: setProperties

    public void setProperties(Rect windowContentRect, GUIContent windowGuiContent, GUISkin skin,
				Action doMyWindowMethod, Action onExitByEscOrClose, Action onClickOutsideOfWindow)
    {
        if (windowStyle==null)
            windowStyle = skin.FindStyle(windowStyleName);
        closeButtonStyle = skin.FindStyle(closeButtonStyleName);
        this.doMyWindowMethod = doMyWindowMethod;
        this.onExitByEscOrClose = onExitByEscOrClose;
        this.onClickOutsideOfWindow = onClickOutsideOfWindow;
        this.skin = skin;
        this.windowGuiContent = windowGuiContent;

        windowRect = new Rect ( windowContentRect.x - windowStyle.padding.left,
                        windowContentRect.y - windowStyle.padding.top,
                        windowContentRect.width + windowStyle.padding.horizontal,
                        windowContentRect.height + windowStyle.padding.vertical);
        windowContentRect.x = windowStyle.padding.left;
        windowContentRect.y = windowStyle.padding.top;
        this.windowContentRect = windowContentRect;
        this.windowDragHeight = windowStyle.padding.top;

        updateDragRect();
        closeButtonHeight = closeButtonStyle.normal.background.height - closeButtonStyle.overflow.vertical;
        closeButtonWidth = closeButtonStyle.normal.background.width - closeButtonStyle.overflow.horizontal;

        int top = 8;
        int left = (int)( windowRect.width - closeButtonWidth) - 12;

        closeButtonRect = new Rect(left,
            top,
            closeButtonWidth,
            closeButtonHeight);
    }
开发者ID:happyjiahan,项目名称:colorus,代码行数:33,代码来源:GuiModalWindow.cs

示例2: UpdateStyles

        private static void UpdateStyles(GUISkin skin)
        {
            if (SearchFieldStyle == null)
            {

                SearchFieldStyle = skin.FindStyle("ToolbarSeachTextField");
                SearchCancelStyle = skin.FindStyle("ToolbarSeachCancelButton");
                ToolbarStyle = skin.FindStyle("Toolbar");
            }
        }
开发者ID:mhfirdausi,项目名称:VGDSix,代码行数:10,代码来源:CreaterGUIHelper.cs

示例3: setProperties

    public void setProperties(int left, int top, int contentWidth, int contentHeight, int margin, GUISkin skin)
    {
        propSingleton = PropertiesSingleton.instance;
        canvas = propSingleton.canvasWorkspaceController.canvas;
        this.left = left;
        this.top = top;
        this.margin = margin;
        this.contentWidth = contentWidth;
        this.contentHeight = contentHeight;

        horizontalScrollHeight =(int) skin.FindStyle("horizontalscrollbar").fixedHeight;

        verticalScrollWidth    =(int) skin.FindStyle("verticalscrollbar").fixedWidth;
        recalculatePositions();
    }
开发者ID:happyjiahan,项目名称:colorus,代码行数:15,代码来源:ScrollBars.cs

示例4: setTopLeftPosition

 public void setTopLeftPosition(int left, int top, GUISkin skin)
 {
     config.activeColorStyle = skin.FindStyle(config.activeColorStyleName);
     config.left = left;
     config.top = top;
     recalculatePositions();
 }
开发者ID:happyjiahan,项目名称:colorus,代码行数:7,代码来源:ActiveColor.cs

示例5: setStyle

 //TODO - remove this part, there is skin.findStyle extension
 public static void setStyle(GUISkin skin, string styleName, out GUIStyle style)
 {
     style = skin.FindStyle(styleName);
     if (style == null){
         Debug.LogWarning("cant find "+styleName+" style, will use button one");
         style = new GUIStyle();
     }
 }
开发者ID:happyjiahan,项目名称:colorus,代码行数:9,代码来源:GUIPart.cs

示例6: MessageWindow

 public MessageWindow(Vector2 size, GUISkin skin)
 {
     this.size = size;
     this.skin = skin;
     if(skin.FindStyle("messageitem") == null) {
         //Debug.Log("Skin does not contain 'messageitem' style, reverting to default.");
         useCustomStyle = false;
     }
     scrollBarWidth = skin.verticalScrollbar.fixedWidth;
     messageWidth = size.x - scrollBarWidth - 1;
     lastTotalMessageHeight = size.y;
 }
开发者ID:niguerrac,项目名称:UnityUI,代码行数:12,代码来源:MessageWindow.cs

示例7: setTopLeftPosition

    public void setTopLeftPosition(int left, int top, GUISkin skin)
    {
        config.activeToolStyle = skin.FindStyle(config.activeToolStyleName);
        config.activePassiveTooLStyle =  new GUIStyle(config.activeToolStyle);
        config.activePassiveTooLStyle.hover.background = null;
        config.activePassiveTooLStyle.active.background = null;
        config.top = top;
        config.left = left;
        activeToolRect = new Rect(left, top,config.width,config.activeToolHeight);

        stampRect = activeToolRect;
        stampRect.x+= config.iconPadding;
        stampRect.y+= config.iconPadding;
        stampRect.width = getActiveStampIcon().width;
        stampRect.height = getActiveStampIcon().height;
        PropertiesSingleton.instance.guiStampList.stampList[PropertiesSingleton.instance.activeStampId].releaseTextures();

        cloudRect = stampRect;
        cloudRect.width = config.regionOnIcon.width;
        cloudRect.height = config.regionOnIcon.height;
        setDictionaryCache();
    }
开发者ID:happyjiahan,项目名称:colorus,代码行数:22,代码来源:ActiveTool.cs

示例8: LoadStyle

    public static bool LoadStyle()
    {
        if (IsSkinLoaded)
            return true;

        //first check if we've stored the right path
        string storedpath = EditorPrefs.GetString("xffect editor assets:");
        if (!string.IsNullOrEmpty(storedpath))
        {
            EditorAssets = storedpath;
        }

        string projectPath = Application.dataPath;
        if (projectPath.EndsWith("/Assets"))
        {
            projectPath = projectPath.Remove(projectPath.Length - ("Assets".Length));
        }

        //if can't load at the default path or the last stored path, then re-check it.
        if (!System.IO.File.Exists(projectPath + EditorAssets + "/Xskin.guiskin"))
        {
            //Initiate search
            System.IO.DirectoryInfo sdir = new System.IO.DirectoryInfo(Application.dataPath);

            Queue<System.IO.DirectoryInfo> dirQueue = new Queue<System.IO.DirectoryInfo>();
            dirQueue.Enqueue(sdir);

            bool found = false;
            while (dirQueue.Count > 0)
            {
                System.IO.DirectoryInfo dir = dirQueue.Dequeue();
                if (System.IO.File.Exists(dir.FullName + "/Xskin.guiskin"))
                {
                    string path = dir.FullName.Replace('\\', '/');
                    found = true;
                    //Remove data path from string to make it relative
                    path = path.Replace(projectPath, "");

                    if (path.StartsWith("/"))
                    {
                        path = path.Remove(0, 1);
                    }

                    EditorAssets = path;
                    Debug.Log("Located editor assets folder to '" + EditorAssets + "'");

                    EditorPrefs.SetString("xffect editor assets:", EditorAssets);

                    break;
                }
                System.IO.DirectoryInfo[] dirs = dir.GetDirectories();
                for (int i = 0; i < dirs.Length; i++)
                {
                    dirQueue.Enqueue(dirs[i]);
                }
            }

            if (!found)
            {
                Debug.LogWarning("Could not locate editor assets folder\nXffect");
                return false;
            }
        }

        XSkin = AssetDatabase.LoadAssetAtPath(EditorAssets + "/Xskin.guiskin", typeof(GUISkin)) as GUISkin;
        InspectorSkin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector);
        Xtoggle = XSkin.FindStyle("xtoggle");
        Xbutton = XSkin.FindStyle("xbutton");
        XbuttonClicked = XSkin.FindStyle("xbutton_clicked");
        XLabelField = XSkin.FindStyle("xlabelfield");
        XArea = XSkin.FindStyle("xarea");
        XTexture = XSkin.FindStyle("xtexture");
        XToggle2 = XSkin.FindStyle("xtoggle2");

        //XInfoArea = XSkin.FindStyle("xinfoarea");

        XInfoArea = InspectorSkin.FindStyle("HelpBox") ?? InspectorSkin.FindStyle("Box");

        IsSkinLoaded = true;


        //load color bkg mat

        ColorBkgMat = AssetDatabase.LoadAssetAtPath(XEditorTool.GetXffectPath() + ColorBkgMatPath, typeof(Material)) as Material;

        return true;
    }
开发者ID:markofevil3,项目名称:SlotMachine,代码行数:87,代码来源:EffectLayerCustom.cs

示例9: InitializeSkins

		private static void InitializeSkins() {
			Print("Initializing Skins");
			GUIStyle tempStyle;
			List<GUIStyle> customStyles;

			gameSkin = GUI.skin;
			expSkin = AssetBase.GetGUISkin("ExperimentsDialogSkin");
			managerSkin = (GUISkin)MonoBehaviour.Instantiate(expSkin);

			customStyles = new List<GUIStyle>(managerSkin.customStyles);
			Print("Initial customStyles copied");

			tempStyle = managerSkin.window;
			tempStyle.padding = new RectOffset(8, 8, 20, 8);
			//tempStyle.fixedWidth = 375f;
			tempStyle.contentOffset = new Vector2(0, -18);
			tempStyle.overflow = new RectOffset(10, 0, 0, 0);
			Print("window modified");

			customStyles.Add(tempStyle = new GUIStyle(managerSkin.FindStyle("resultfield")));
			tempStyle.name = "selectBox";
			tempStyle.overflow = new RectOffset(0, 1, 1, 2);
			Print("selectBox added.");

			customStyles.Add(tempStyle = new GUIStyle(gameSkin.button));
			tempStyle.name = "expandButton";
			tempStyle.margin = new RectOffset(4, 0, 0, 0);
			tempStyle.padding = new RectOffset(0, 0, 0, 0);
			tempStyle.fixedHeight = 18f;
			tempStyle.fixedWidth = 20f;
			tempStyle.alignment = TextAnchor.MiddleCenter;
			tempStyle.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			Print("expandButton added.");

			customStyles.Add(tempStyle = new GUIStyle(expSkin.button));
			tempStyle.name = "deselectButton";
			tempStyle.margin = new RectOffset(4, 4, 2, 2);
			tempStyle.padding = new RectOffset(0, 0, 0, 0);
			tempStyle.fixedHeight = 25f;
			tempStyle.fixedWidth = 25f;
			tempStyle.alignment = TextAnchor.MiddleCenter;
			tempStyle.font = Resources.GetBuiltinResource<Font>("Arial.ttf");

			customStyles.Add(tempStyle = new GUIStyle(gameSkin.button));
			tempStyle.name = "selectButtonUp";
			tempStyle.margin = new RectOffset(0, 4, 0, 0);
			tempStyle.padding = new RectOffset(0, 0, 0, 0);
			tempStyle.fixedHeight = 18f;
			tempStyle.alignment = TextAnchor.MiddleLeft;
			tempStyle.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			Print("selectButtonUp added.");

			customStyles.Add(tempStyle = new GUIStyle(tempStyle));
			tempStyle.name = "selectButtonDown";
			tempStyle.normal = tempStyle.active;
			tempStyle.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			Print("selectButtonDown added.");

			customStyles.Add(tempStyle = new GUIStyle(gameSkin.label));
			tempStyle.name = "expandLabel";
			tempStyle.margin = new RectOffset(4, 0, 0, 0);
			tempStyle.padding = new RectOffset(0, 0, 0, 0);
			tempStyle.fixedHeight = 18f;
			tempStyle.fixedWidth = 20f;
			tempStyle.alignment = TextAnchor.MiddleCenter;
			tempStyle.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			Print("expandLabel added.");

			customStyles.Add(tempStyle = new GUIStyle(expSkin.FindStyle("discard button")));
			tempStyle.name = "transferButton";
			tempStyle.normal.background = managerTransferNormal;
			tempStyle.hover.background = managerTransferOver;
			tempStyle.active.background = managerTransferActive;
			Print("transferButton added.");

			customStyles.Add(tempStyle = new GUIStyle(expSkin.button));
			tempStyle.name = "expandWinButton";
			tempStyle.margin = new RectOffset(8, 4, 0, 0);
			tempStyle.fixedHeight = 16f;
			tempStyle.fontSize = 11;
			tempStyle.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			tempStyle.alignment = TextAnchor.MiddleCenter;
			Print("expandWinButton added.");

			managerSkin.customStyles = customStyles.ToArray();
			Print("customStyles copied to managerSkin");
		}
开发者ID:SirDargon,项目名称:ScienceHardDrives,代码行数:87,代码来源:DargonUtils.cs

示例10: OnGUI

    void OnGUI()
    {
        wantsMouseMove = true;

        // set up the skin if not done yet.
        if (editorSkin==null)
        {
            editorSkin = MyUtils.Utils.GetGuiSkin("VolcanicGuiSkin",out editorSkinPath);
            bg = (Texture2D)(Resources.LoadAssetAtPath(editorSkinPath+"images/bg.png",typeof(Texture2D))); // Get the texture manually as we have some trickes for bg tiling

            GUIStyleArrowInBuildSettings = editorSkin.FindStyle("Help Arrow 90 degree");

        }

        // draw the bg properly. Haven't found a way to do it with guiskin only
        if(bg!=null)
        {
            if (bg.wrapMode!= TextureWrapMode.Repeat)
            {
                bg.wrapMode = TextureWrapMode.Repeat;
            }
            GUI.DrawTextureWithTexCoords(new Rect(0,0,position.width,position.height),bg,new Rect(0, 0, position.width / bg.width, position.height / bg.height));
        }

        if (scenes==null)
        {
            //Debug.Log("Scenes = null");
            OnProjectChange();
            GUIUtility.ExitGUI();
            return;
        }

        if (!DiscreteTooBar || ShowToolBar || ShowHelp)
        {
            DrawToolStrip();
        }

        _scroll = GUILayout.BeginScrollView(_scroll);

        GUI.skin = editorSkin; // should design the scroll widgets so that it can be matching the skin.

        if (ShowHelp)
        {
            BuildHelpUI();
        }

        if (Event.current.type == EventType.Repaint)
            rowsArea = new Rect[scenes.Length];

        for(int i=0;i<scenes.Length;i++)
        {
            BuildSceneEntryUI(i);
        }

        GUILayout.FlexibleSpace();

        if (ShowHelp)
        {
            GUILayout.BeginHorizontal();
                GUILayout.BeginVertical();
                    GUILayout.FlexibleSpace();
                    GUILayout.Label("","Label Jean Fabre Sign");
                GUILayout.EndVertical();
                GUILayout.BeginVertical();
                    GUILayout.FlexibleSpace();
                    GUILayout.Label("","Label Jean Fabre Url");
                GUILayout.EndVertical();
                GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

        }

        GUILayout.EndScrollView();

        if (Event.current.type == EventType.MouseMove)
        {
                Repaint ();
        }

        // detect mouse over top area of the browser window to toggle the toolbar visibility if required
          	if (Event.current.type == EventType.Repaint)
        {
            if (lastMousePosition!= Event.current.mousePosition)
            {
                int topDelta = ShowToolBar || ShowHelp || !DiscreteTooBar ? 20:0;

                // check if we are few pixels above the first row
                if(new Rect(0,-15,position.width,30).Contains(Event.current.mousePosition))
                {
                    ShowToolBar = true;
                }else{
                    ShowToolBar = false;
                }

                int j=0;
                mouseOverRowIndex = -1;
                foreach(Rect _row in rowsArea)
                {
                    Rect _temp = _row;
                    _temp.x = _temp.x  -_scroll.x;
//.........这里部分代码省略.........
开发者ID:derkork,项目名称:PlayMaker--Ecosystem--Browser,代码行数:101,代码来源:ScenesBrowser.cs

示例11: Init

    public static void Init()
    {
        #if (UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4)
        if (isProSkin != tk2dPreferences.inst.isProSkin)
        {
            skin = null;
            isProSkin = tk2dPreferences.inst.isProSkin;
        }
        #else
        if (isProSkin != EditorGUIUtility.isProSkin)
        {
            skin = null;
            isProSkin = EditorGUIUtility.isProSkin;
        }
        #endif

        if (skin == null)
        {
            skin = AssetDatabase.LoadAssetAtPath(GetSkinPath(), typeof(GUISkin)) as GUISkin;
            if (skin != null)
            {
                sc_inspectorBG = skin.FindStyle("SC_InspectorBG");
                sc_inspectorHeaderBG = skin.FindStyle("SC_InspectorHeaderBG");
                sc_listBoxBG = skin.FindStyle("SC_ListBoxBG");
                sc_listBoxItem = skin.FindStyle("SC_ListBoxItem");
                sc_listBoxSectionHeader = skin.FindStyle("SC_ListBoxSectionHeader");
                sc_bodyBackground = skin.FindStyle("SC_BodyBackground");
                sc_dropBox = skin.FindStyle("SC_DropBox");

                toolbarSearch = skin.FindStyle("ToolbarSearch");
                toolbarSearchClear = skin.FindStyle("ToolbarSearchClear");
                toolbarSearchRightCap = skin.FindStyle("ToolbarSearchRightCap");

                anim_BG = skin.FindStyle("Anim_BG");
                anim_trigger = skin.FindStyle("Anim_Trigger");
                anim_triggerSelected = skin.FindStyle("Anim_TriggerSelected");

                whiteBox = skin.FindStyle("WhiteBox");
                selection = skin.FindStyle("Selection");
            }
        }
    }
开发者ID:aprildd,项目名称:CG_BombGame,代码行数:42,代码来源:tk2dEditorSkin.cs

示例12: UseSkin


//.........这里部分代码省略.........

		LeftTabStyle = new GUIStyle(EditorStyles.miniButtonLeft)
		{
			name = "PLYLeftTab",
			richText = false,
			alignment = TextAnchor.MiddleLeft,
			fontSize = 10,
			fixedHeight = 24,
			stretchWidth = true,
			padding = new RectOffset(3, 3, 5, 5),
			margin = new RectOffset(3, 0, 0, 3),
		}; ArrayUtility.Add<GUIStyle>(ref customStyles, LeftTabStyle);

		TinyButton = new GUIStyle(EditorStyles.miniButton)
		{
			name = "PLYTinyButton",
			richText = false,
			fontSize = 10,
			padding = new RectOffset(2, 2, 0, 0),
			margin = new RectOffset(0, 0, 0, 0),
		}; ArrayUtility.Add<GUIStyle>(ref customStyles, TinyButton);

		ToolbarStyle = new GUIStyle(Skin.button)
		{
			name = "PLYToolbar",
			fontStyle = FontStyle.Bold,
			fontSize = 11,
			padding = new RectOffset(5, 5, 5, 5),
			overflow = new RectOffset(0, 0, 0, 1),
			onNormal = { background = Texture_ToolButtonSelected, textColor = Color.white },
			onActive = { background = Texture_ToolButtonSelected, textColor = Color.white },
		}; ArrayUtility.Add<GUIStyle>(ref customStyles, ToolbarStyle);

		ToolbarButtonLeftStyle = new GUIStyle(Skin.FindStyle("ButtonLeft"))
		{
			name = "PLYToolbarLeft",
			fontStyle = FontStyle.Bold,
			fontSize = 11,
			padding = new RectOffset(5, 5, 5, 5),
			border = new RectOffset(4, 2, 2, 2),
			onNormal = { background = Texture_ToolButtonSelectedLeft },
			onActive = { background = Texture_ToolButtonSelectedLeft },
		}; ArrayUtility.Add<GUIStyle>(ref customStyles, ToolbarButtonLeftStyle);

		ToolbarButtonMidStyle = new GUIStyle(Skin.FindStyle("ButtonMid"))
		{
			name = "PLYToolbarMid",
			fontStyle = FontStyle.Bold,
			fontSize = 11,
			padding = new RectOffset(5, 5, 5, 5),
			border = new RectOffset(2, 2, 2, 2),
			onNormal = { background = Texture_ToolButtonSelectedMid },
			onActive = { background = Texture_ToolButtonSelectedMid },
		}; ArrayUtility.Add<GUIStyle>(ref customStyles, ToolbarButtonMidStyle);

		ToolbarButtonRightStyle = new GUIStyle(Skin.FindStyle("ButtonRight"))
		{
			name = "PLYToolbarRight",
			fontStyle = FontStyle.Bold,
			fontSize = 11,
			padding = new RectOffset(5, 5, 5, 5),
			border = new RectOffset(2, 4, 2, 2),
			onNormal = { background = Texture_ToolButtonSelectedRight },
			onActive = { background = Texture_ToolButtonSelectedRight },
		}; ArrayUtility.Add<GUIStyle>(ref customStyles, ToolbarButtonRightStyle);
开发者ID:fvivaudo,项目名称:Rush01,代码行数:66,代码来源:UniRPGEdGui.cs

示例13: StyleSettingsGUI

    private GUIStyle StyleSettingsGUI(GUIStyle style)
    {
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Name");
        style.name = EditorGUILayout.TextField(style.name);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginVertical("Box");
        showCopyStyle = EditorGUILayout.Foldout(showCopyStyle, "Copy Style from Skin");
        if (showCopyStyle)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Copy From");
            copyStyleSkin = (GUISkin)EditorGUILayout.ObjectField(copyStyleSkin, typeof(GUISkin), false);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Style Name");
            copyStyleName = EditorGUILayout.TextField(copyStyleName);
            EditorGUILayout.EndHorizontal();
            GUI.enabled = copyStyleSkin && !string.IsNullOrEmpty(copyStyleName);
            if (GUILayout.Button("COPY"))
            {
                GUIStyle copyStyle = copyStyleSkin.FindStyle(copyStyleName);
                if (copyStyle != null)
                    style = new GUIStyle(copyStyle);
                else
                    Debug.LogWarning("ERROR : No style named " + copyStyleName + " in GUISkin " + copyStyleSkin.name + " could be found!");
                copyStyleSkin = null;
                copyStyleName = "";
            }
            GUI.enabled = true;
        }
        EditorGUILayout.EndVertical();

        #region EnumPopups

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Alignment");
        style.alignment = (TextAnchor)EditorGUILayout.EnumPopup(style.alignment);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Clipping");
        style.clipping = (TextClipping)EditorGUILayout.EnumPopup(style.clipping);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Image Position");
        style.imagePosition = (ImagePosition)EditorGUILayout.EnumPopup(style.imagePosition);
        EditorGUILayout.EndHorizontal();

        #endregion
        #region Simple

        style.contentOffset = EditorGUILayout.Vector2Field("Content Offset", style.contentOffset);

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Fixed Width");
        style.fixedWidth = EditorGUILayout.FloatField(style.fixedWidth);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Fixed Height");
        style.fixedHeight = EditorGUILayout.FloatField(style.fixedHeight);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Stretch Width?");
        style.stretchWidth = EditorGUILayout.Toggle(style.stretchWidth);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Stretch Height?");
        style.stretchHeight = EditorGUILayout.Toggle(style.stretchHeight);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Word Wrap?");
        style.wordWrap = EditorGUILayout.Toggle(style.wordWrap);
        EditorGUILayout.EndHorizontal();

        #endregion
        #region Groups/Complex
        #region Font

        foldFont = EditorGUILayout.Foldout(foldFont, "Font");
        if (foldFont)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Font");
            style.font = (Font)EditorGUILayout.ObjectField(style.font, typeof(Font), false);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Font Size");
            style.fontSize = EditorGUILayout.IntField(style.fontSize);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Font Style");
//.........这里部分代码省略.........
开发者ID:AmineBENCHEIKHBRAHIM,项目名称:3D-Race-Game-Unity3D,代码行数:101,代码来源:GUISkinEditor.cs

示例14: setProps

    public void setProps(Rect itemRect, int padding, GUISkin skin)
    {
        if (styleName == "")
            _style = GUIStyle.none;
        else
            _style = skin.FindStyle(styleName);
        if (_style == null)
            _style = GUIStyle.none;

        if (textStyleName=="")
            _textStyle = GUIStyle.none;
        else
            _textStyle = skin.FindStyle(textStyleName);
        if (_textStyle == null)
            _textStyle = GUIStyle.none;

        _itemRect  = itemRect;

        int middleY =(int)( _itemRect.y + _itemRect.height / 2);
        if (contentSize.y < itemRect.height ){
            int padd =(int)( (itemRect.height - contentSize.y) / 2);
            _contentRect = new Rect (0, _itemRect.y + padding, contentSize.x, contentSize.y);
            _textRect = new Rect(_contentRect.width + padding, _itemRect.y, 0, _itemRect.height);
            _textRect.width = _itemRect.width - _textRect.x ;
        } else {
            int width =(int)((float)itemRect.height  / (float)contentSize.y * (float) contentSize.x);
            _contentRect = new Rect(0, _itemRect.y , width, itemRect.height);
            _textRect = new Rect(_contentRect.width + padding, _itemRect.y, itemRect.width - _contentRect.width - padding, itemRect.height);
        }
        _textRect.width  -= textOffset.horizontal;
        _textRect.height -= textOffset.vertical;
        _textRect.x += textOffset.left;
        _textRect.y += textOffset.top;
    }
开发者ID:happyjiahan,项目名称:colorus,代码行数:34,代码来源:HelpView.cs


注:本文中的UnityEngine.GUISkin.FindStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。