• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UnityEngine.GUIStyle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



GUIStyle类属于UnityEngine命名空间,在下文中一共展示了GUIStyle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AspectSelectionGrid

 public static int AspectSelectionGrid(int selected, Texture[] textures, int approxSize, GUIStyle style, string emptyString, out bool doubleClick)
 {
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(10f) };
     GUILayout.BeginVertical("box", options);
     int num = 0;
     doubleClick = false;
     if (textures.Length != 0)
     {
         float num2 = (EditorGUIUtility.currentViewWidth - 20f) / ((float) approxSize);
         int num3 = (int) Mathf.Ceil(((float) textures.Length) / num2);
         Rect aspectRect = GUILayoutUtility.GetAspectRect(num2 / ((float) num3));
         Event current = Event.current;
         if (((current.type == EventType.MouseDown) && (current.clickCount == 2)) && aspectRect.Contains(current.mousePosition))
         {
             doubleClick = true;
             current.Use();
         }
         num = GUI.SelectionGrid(aspectRect, selected, textures, Mathf.RoundToInt(EditorGUIUtility.currentViewWidth - 20f) / approxSize, style);
     }
     else
     {
         GUILayout.Label(emptyString, new GUILayoutOption[0]);
     }
     GUILayout.EndVertical();
     return num;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:26,代码来源:TerrainInspector.cs


示例2: BeginLayoutGroup

        internal static GUILayoutGroup BeginLayoutGroup(GUIStyle style, GUILayoutOption[] options, System.Type layoutType)
        {
            GUILayoutGroup next;
            switch (Event.current.type)
            {
                case EventType.Used:
                case EventType.Layout:
                    next = CreateGUILayoutGroupInstanceOfType(layoutType);
                    next.style = style;
                    if (options != null)
                    {
                        next.ApplyOptions(options);
                    }
                    current.topLevel.Add(next);
                    break;

                default:
                    next = current.topLevel.GetNext() as GUILayoutGroup;
                    if (next == null)
                    {
                        throw new ArgumentException("GUILayout: Mismatched LayoutGroup." + Event.current.type);
                    }
                    next.ResetCursor();
                    GUIDebugger.LogLayoutGroupEntry(next.rect, next.margin, next.style, next.isVertical);
                    break;
            }
            current.layoutGroups.Push(next);
            current.topLevel = next;
            return next;
        }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:30,代码来源:GUILayoutUtility.cs


示例3: SetStyles

        public static void SetStyles()
        {
            WindowStyle = new GUIStyle(GUI.skin.window);
            IconStyle = new GUIStyle();

            ButtonToggledStyle = new GUIStyle(GUI.skin.button);
            ButtonToggledStyle.normal.textColor = Color.green;
            ButtonToggledStyle.normal.background = ButtonToggledStyle.onActive.background;

            ButtonToggledRedStyle = new GUIStyle(ButtonToggledStyle);
            ButtonToggledRedStyle.normal.textColor = Color.red;

            ButtonStyle = new GUIStyle(GUI.skin.button);
            ButtonStyle.normal.textColor = Color.white;

            ErrorLabelRedStyle = new GUIStyle(GUI.skin.label);
            ErrorLabelRedStyle.normal.textColor = Color.red;
            ErrorLabelRedStyle.fontSize = 10;

            LabelStyle = new GUIStyle(GUI.skin.label);

            LabelStyleRed = new GUIStyle(LabelStyle);
            LabelStyleRed.normal.textColor = Color.red;

            LabelStyleYellow = new GUIStyle(LabelStyle);
            LabelStyleYellow.normal.textColor = Color.yellow;
        }
开发者ID:vosechu,项目名称:CrewManifest,代码行数:27,代码来源:Utilities.cs


示例4: OnGUI

		public void OnGUI()
		{
			m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition );

			GUILayout.BeginVertical();

			GUILayout.Space( 10 );

			GUILayout.BeginHorizontal();
			GUILayout.FlexibleSpace();
			GUILayout.Box( m_aboutImage, GUIStyle.none );

			if ( Event.current.type == EventType.MouseUp && GUILayoutUtility.GetLastRect().Contains( Event.current.mousePosition ) )
				Application.OpenURL( "http://www.amplify.pt" );

			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();

			GUIStyle labelStyle = new GUIStyle( EditorStyles.label );
			labelStyle.alignment = TextAnchor.MiddleCenter;
			labelStyle.wordWrap = true;

			GUILayout.Label( "\nAmplify Color " + VersionInfo.StaticToString(), labelStyle, GUILayout.ExpandWidth( true ) );

			GUILayout.Label( "\nCopyright (c) Amplify Creations, Lda. All rights reserved.\n", labelStyle, GUILayout.ExpandWidth( true ) );

			GUILayout.EndVertical();

			GUILayout.EndScrollView();
		}
开发者ID:davidlawson,项目名称:ggj2016,代码行数:30,代码来源:About.cs


示例5: buttonStyle

        public const double G = 6.674E-11; //this seems to be the value the game uses

        #endregion Fields

        #region Methods

        public static GUIStyle buttonStyle(Color color)
        {
            GUIStyle style = new GUIStyle(GUI.skin.button);
            style.onNormal.textColor = style.onFocused.textColor = style.onHover.textColor = style.onActive.textColor = color;
            style.normal.textColor = color;
            return style;
        }
开发者ID:Majiir,项目名称:MuMechLib,代码行数:13,代码来源:ARUtils.cs


示例6: OnInspectorGUI

 public override void OnInspectorGUI()
 {
   if (this.m_TextStyle == null)
     this.m_TextStyle = (GUIStyle) "ScriptText";
   bool enabled = GUI.enabled;
   GUI.enabled = true;
   TextAsset target = this.target as TextAsset;
   if ((UnityEngine.Object) target != (UnityEngine.Object) null)
   {
     string str;
     if (this.targets.Length > 1)
     {
       str = this.targetTitle;
     }
     else
     {
       str = target.ToString();
       if (str.Length > 7000)
         str = str.Substring(0, 7000) + "...\n\n<...etc...>";
     }
     Rect rect = GUILayoutUtility.GetRect(EditorGUIUtility.TempContent(str), this.m_TextStyle);
     rect.x = 0.0f;
     rect.y -= 3f;
     rect.width = GUIClip.visibleRect.width + 1f;
     GUI.Box(rect, str, this.m_TextStyle);
   }
   GUI.enabled = enabled;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:28,代码来源:TextAssetInspector.cs


示例7: DrawBox

 public static void DrawBox(GUIStyle style)
 {
     if (Boxing) {
         Vector2 Size = BoxEnd - BoxStart;
         GUI.Box (new Rect (BoxStart.x, Screen.height - BoxStart.y, Size.x, -Size.y), "", style);
     }
 }
开发者ID:simutronics,项目名称:Lockstep-Framework,代码行数:7,代码来源:SelectionManager.cs


示例8: Styles

			public Styles() {

				#if UNITY_EDITOR
				this.skin = Resources.Load<GUISkin>("UI.Windows/Core/Styles/Boxes/" + (UnityEditor.EditorGUIUtility.isProSkin == true ? "SkinDark" : "SkinLight"));
				this.boxes = new GUIStyle[WindowLayoutStyles.MAX_DEPTH] {
					
					this.skin.FindStyle("flow node 0"),
					this.skin.FindStyle("flow node 1"),
					this.skin.FindStyle("flow node 2"),
					this.skin.FindStyle("flow node 3"),
					this.skin.FindStyle("flow node 4"),
					this.skin.FindStyle("flow node 5")
					
				};
				this.boxesSelected = new GUIStyle[WindowLayoutStyles.MAX_DEPTH] {
					
					this.skin.FindStyle("flow node 0"), // on
					this.skin.FindStyle("flow node 1"),
					this.skin.FindStyle("flow node 2"),
					this.skin.FindStyle("flow node 3"),
					this.skin.FindStyle("flow node 4"),
					this.skin.FindStyle("flow node 5")
					
				};
				
				this.boxSelected = this.skin.FindStyle("flow node 5");
				#endif

			}
开发者ID:zhaoluxyz,项目名称:Unity3d.UI.Windows,代码行数:29,代码来源:WindowLayoutStyles.cs


示例9: Foldout

        public static bool Foldout(bool open, GUIContent header, Action content)
        {
            if (foldoutStyle == null)
            {
                foldoutStyle = new GUIStyle(GUI.skin.FindStyle("ShurikenModuleBg"));
                foldoutStyle.padding = new RectOffset(10, 10, 10, 10);

                headerStyle = new GUIStyle(GUI.skin.FindStyle("ShurikenModuleTitle"));
                headerStyle.contentOffset = new Vector2(3, -2);
            }

            GUILayout.BeginVertical("ShurikenEffectBg", GUILayout.MinHeight(1f));

            open = GUI.Toggle(GUILayoutUtility.GetRect(0, 16), open, header, headerStyle);
            if (open)
            {
                GUILayout.BeginVertical(foldoutStyle);

                content();

                GUILayout.EndVertical();
            }
            GUILayout.EndVertical();

            return open;
        }
开发者ID:jitendrac,项目名称:TouchScript,代码行数:26,代码来源:GUIElements.cs


示例10: OnPreviewGUI

		public override void OnPreviewGUI(Rect r, GUIStyle background) {
			
			//var color = new Color(0.8f, 0.8f, 1f, 1f);
			//color.a = 0.7f;
			this.OnPreviewGUI(Color.white, r, GUI.skin.box, true, false);

		}
开发者ID:Trithilon,项目名称:Unity3d.UI.Windows,代码行数:7,代码来源:WindowLayoutEditor.cs


示例11: InitOnMainThread

        public static void InitOnMainThread()
        {
            lock (s_mutex)
            {
                if (s_mainThread != null)
                {
                    return;
                }

                if (Runtime.IsEditor)
                {
                    try
                    {
                        GUIStyle style = new GUIStyle();
                        style.CalcHeight(GUIContent.none, 0);
                    }
                    catch (ArgumentException)
                    {
                        #if LUNAR_DEBUG
                        UnityEngine.Debug.Log("ThreadUtils.Init() is not called on the main thread");
                        #endif

                        return;
                    }
                }

                s_mainThread = Thread.CurrentThread;
            }
        }
开发者ID:mswf,项目名称:game-a-week,代码行数:29,代码来源:ThreadUtils.cs


示例12: DrawExtraFeatures

		private void DrawExtraFeatures() {
			if (icon == null) {
				string iconFilename = EditorGUIUtility.isProSkin ? DarkSkinIconFilename : LightSkinIconFilename;
				icon = AssetDatabase.LoadAssetAtPath(iconFilename, typeof(Texture2D)) as Texture2D;
			}
			if (dialogueSystemController == null || icon == null) return;
			if (iconButtonStyle == null) {
				iconButtonStyle = new GUIStyle(EditorStyles.label);
				iconButtonStyle.normal.background = icon;
				iconButtonStyle.active.background = icon;
			}
			if (iconButtonContent == null) {
				iconButtonContent = new GUIContent(string.Empty, "Click to open Dialogue Editor.");
			}
			GUILayout.BeginHorizontal();
			if (GUILayout.Button(iconButtonContent, iconButtonStyle, GUILayout.Width(icon.width), GUILayout.Height(icon.height))) {
				Selection.activeObject = dialogueSystemController.initialDatabase;
				PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow.OpenDialogueEditorWindow();
			}
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Wizard...", GUILayout.Width(64))) {
				DialogueManagerWizard.Init();
			}
			GUILayout.EndHorizontal();
			EditorWindowTools.DrawHorizontalLine();
		}
开发者ID:SHEePYTaGGeRNeP,项目名称:DialogGame,代码行数:26,代码来源:DialogueSystemControllerEditor.cs


示例13: WindowGUI

        private void WindowGUI(int windowID)
        {
            GUIStyle mySty = new GUIStyle(GUI.skin.button);
            mySty.normal.textColor = mySty.focused.textColor = Color.white;
            mySty.padding = new RectOffset(8, 8, 8, 8);

            GUILayout.BeginHorizontal();
            int meterAlt = (int)Math.Truncate(altitude);
            String text;
            if (altitude > altitudeMax)
                text = "Radar Altitude: MAX";
            else
                text = "Radar Altitude: " + meterAlt;

            if (!this.isEnabled)
                text = "   Disabled   ";

            if (GUILayout.Button (text, mySty, GUILayout.ExpandWidth (true))) {
                this.isEnabled = !this.isEnabled;

                var generator = base.GetComponent<ModuleGenerator> ();

                if (!isEnabled)
                    generator.Shutdown ();
                else
                    generator.Activate ();
            }
            GUILayout.EndHorizontal();

            //DragWindow makes the window draggable. The Rect specifies which part of the window it can by dragged by, and is
            //clipped to the actual boundary of the window. You can also pass no argument at all and then the window can by
            //dragged by any part of it. Make sure the DragWindow command is AFTER all your other GUI input stuff, or else
            //it may "cover up" your controls and make them stop responding to the mouse.
            GUI.DragWindow(new Rect(0, 0, 10000, 20));
        }
开发者ID:metiscus,项目名称:KSP_RadarAltimeter,代码行数:35,代码来源:RadarAltitude.cs


示例14: AspectSelectionGridImageAndText

 public static int AspectSelectionGridImageAndText(int selected, GUIContent[] textures, int approxSize, GUIStyle style, string emptyString, out bool doubleClick)
 {
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(10f) };
     EditorGUILayout.BeginVertical(GUIContent.none, EditorStyles.helpBox, options);
     int num = 0;
     doubleClick = false;
     if (textures.Length != 0)
     {
         int xCount = 0;
         Rect position = GetBrushAspectRect(textures.Length, approxSize, 12, out xCount);
         Event current = Event.current;
         if (((current.type == EventType.MouseDown) && (current.clickCount == 2)) && position.Contains(current.mousePosition))
         {
             doubleClick = true;
             current.Use();
         }
         num = GUI.SelectionGrid(position, selected, textures, xCount, style);
     }
     else
     {
         GUILayout.Label(emptyString, new GUILayoutOption[0]);
     }
     GUILayout.EndVertical();
     return num;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:25,代码来源:TerrainInspector.cs


示例15: Toggle

 internal Toggle()
 {
     Default = new GUIStyle()
       {
     normal = {
       background = Elements.LoadImage("toggle-normal.png"),
     },
     onNormal = {
       background = Elements.LoadImage("toggle-on-normal.png"),
     },
     hover = {
       background = Elements.LoadImage("toggle-hover.png"),
     },
     onHover = {
       background = Elements.LoadImage("toggle-on-hover.png"),
     },
     active = {
       background = Elements.LoadImage("toggle-active.png"),
     },
     onActive = {
       background = Elements.LoadImage("toggle-on-active.png"),
     },
     margin = { right = 10 }
       };
 }
开发者ID:buckle2000,项目名称:besiege-modloader,代码行数:25,代码来源:Toggle.cs


示例16: Display

        public void Display()
        {
            GUIStyle minorTitle = new GUIStyle(GUI.skin.label);
            minorTitle.alignment = TextAnchor.UpperCenter;
            minorTitle.padding = new RectOffset(0, 0, 0, 0);

            if (stallStyle == null)
                stallStyle = new GUIStyle(FlightGUI.boxStyle);

            GUILayout.Label("Flight Status", minorTitle, GUILayout.ExpandWidth(true));
            GUILayout.BeginHorizontal();
            if (statusBlinker)
            {
                stallStyle.normal.textColor = stallStyle.focused.textColor = stallStyle.hover.textColor = stallStyle.active.textColor = stallStyle.onActive.textColor = stallStyle.onNormal.textColor = stallStyle.onFocused.textColor = stallStyle.onHover.textColor = stallStyle.onActive.textColor = statusColor;
                if (statusBlinkerTimer < 0.5)
                    GUILayout.Box(statusString, stallStyle, GUILayout.ExpandWidth(true));
                else
                    GUILayout.Box("", stallStyle, GUILayout.ExpandWidth(true));

                if (statusBlinkerTimer < 1)
                    statusBlinkerTimer += TimeWarp.deltaTime;
                else
                    statusBlinkerTimer = 0;
            }
            else
            {
                stallStyle.normal.textColor = stallStyle.focused.textColor = stallStyle.hover.textColor = stallStyle.active.textColor = stallStyle.onActive.textColor = stallStyle.onNormal.textColor = stallStyle.onFocused.textColor = stallStyle.onHover.textColor = stallStyle.onActive.textColor = statusColor;
                GUILayout.Box(statusString, stallStyle, GUILayout.ExpandWidth(true));
            }
            GUILayout.EndHorizontal();
        }
开发者ID:pcwilcox,项目名称:Ferram-Aerospace-Research,代码行数:31,代码来源:FlightStatusGUI.cs


示例17: InitialiseStyles

        /// <summary>
        ///     Initialises all the styles required for this object.
        /// </summary>
        private void InitialiseStyles()
        {
            this.windowStyle = new GUIStyle(HighLogic.Skin.window)
            {
                margin = new RectOffset(),
                padding = new RectOffset(5, 5, 0, 5),
            };

            this.hudWindowStyle = new GUIStyle(this.windowStyle)
            {
                normal =
                {
                    background = null
                },
                onNormal =
                {
                    background = null
                },
                padding = new RectOffset(5, 5, 0, 8),
            };

            this.hudWindowBgStyle = new GUIStyle(this.hudWindowStyle)
            {
                normal =
                {
                    background = TextureHelper.CreateTextureFromColour(new Color(0.0f, 0.0f, 0.0f, 0.5f))
                },
                onNormal =
                {
                    background = TextureHelper.CreateTextureFromColour(new Color(0.0f, 0.0f, 0.0f, 0.5f))
                }
            };
        }
开发者ID:Kerbas-ad-astra,项目名称:KerbalEngineer,代码行数:36,代码来源:SectionWindow.cs


示例18: UnityEditorUtility

		static UnityEditorUtility ()
		{
			// Create splitter style
			splitterStyle					= new GUIStyle();
			splitterStyle.normal.background	= Texture2D.whiteTexture;
			splitterStyle.stretchWidth		= true;
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:7,代码来源:UnityEditorUtility.cs


示例19: Display

		public override void Display (GUIStyle _style, int _slot, float zoom, bool isActive)
		{
			if (timerTexture)
			{
				if (Application.isPlaying)
				{
					if (GameObject.FindWithTag (Tags.gameEngine) && GameObject.FindWithTag (Tags.gameEngine).GetComponent <PlayerInput>())
					{
						PlayerInput playerInput = GameObject.FindWithTag (Tags.gameEngine).GetComponent <PlayerInput>();
					
						if (playerInput.activeConversation && playerInput.activeConversation.isTimed)
						{
							Rect timerRect = relativeRect;
							timerRect.width = slotSize.x / 100f * AdvGame.GetMainGameViewSize().x * playerInput.activeConversation.GetTimeRemaining ();
							GUI.DrawTexture (ZoomRect (timerRect, zoom), timerTexture, ScaleMode.StretchToFill, true, 0f);
						}
					}
				}
				else
				{
					GUI.DrawTexture (ZoomRect (relativeRect, zoom), timerTexture, ScaleMode.StretchToFill, true, 0f);
				}
			}
			
			base.Display (_style, _slot, zoom, isActive);
		}
开发者ID:amutnick,项目名称:CrackTheCode_Repo,代码行数:26,代码来源:MenuTimer.cs


示例20: DrawLabel

		public static void DrawLabel (string _text, GUIStyle _style, Alignment _alignment = Alignment.None)
		{
			GUILayout.BeginHorizontal();
			{
				switch (_alignment)
				{
				case Alignment.None:
					GUILayout.Label(_text, _style);
					break;
					
				case Alignment.Left:
					GUILayout.Label(_text, _style);
					GUILayout.FlexibleSpace();
					break;
					
				case Alignment.Center:
					GUILayout.FlexibleSpace();
					GUILayout.Label(_text, _style);
					GUILayout.FlexibleSpace();
					break;
					
				case Alignment.Right:
					GUILayout.FlexibleSpace();
					GUILayout.Label(_text, _style);
					break;
				}
			}
			GUILayout.EndHorizontal();
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:29,代码来源:UnityEditorUtility.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnityEngine.GameObject类代码示例发布时间:2022-05-26
下一篇:
C# UnityEngine.GUISkin类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap