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


C# GUIStyle类代码示例

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


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

示例1: BeginScrollView

 internal static void BeginScrollView(Rect position, Vector2 scrollPosition, Rect viewRect, GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar)
 {
     s_ScrollPos = scrollPosition;
     s_ViewRect = viewRect;
     s_Position = position;
     GUIClip.Push(position, new Vector2(Mathf.Round((-scrollPosition.x - viewRect.x) - ((viewRect.width - position.width) * 0.5f)), Mathf.Round((-scrollPosition.y - viewRect.y) - ((viewRect.height - position.height) * 0.5f))), Vector2.zero, false);
 }
开发者ID:demelev,项目名称:projectHL,代码行数:7,代码来源:PreviewGUI.cs

示例2: OnGUI

    void OnGUI()
    {
        current = EditorGUILayout.BeginScrollView (current);

        GUIStyle buttonStyle = new GUIStyle ();
        buttonStyle.margin.left = 10;
        buttonStyle.margin.top = 5;

        GUIStyle labelStyle = new GUIStyle (buttonStyle);
        labelStyle.fontSize = 24;

        foreach (var layerWithObject in layerWithObjectList) {
            string layerName = LayerMask.LayerToName (layerWithObject.layer);

            layerWithObject.isOpen = GUILayout.Toggle (layerWithObject.isOpen, layerName, labelStyle);

            if (layerWithObject.isOpen) {
                foreach (var obj in layerWithObject.objectList) {
                    if (GUILayout.Button (obj.name, buttonStyle)) {
                        UnityEditor.EditorGUIUtility.PingObject (obj);
                    }
                }
            }

            GUILayout.Space (16);
        }

        EditorGUILayout.EndScrollView ();
    }
开发者ID:Kayrohinc,项目名称:ReferenceExplorer,代码行数:29,代码来源:LayerList.cs

示例3: OnGUI

    void OnGUI()
    {
        GUIStyle buttonStyle = new GUIStyle();
        buttonStyle.normal.background = null;

        GUIStyle designStyle = new GUIStyle();

        //Top and Bottom middle frame
        GUI.DrawTexture(new Rect(0, 0, Screen.width, 128), FrameTopMiddle_KD);
        GUI.DrawTexture(new Rect(0, Screen.height - 128, Screen.width, 128), FrameBottomMiddle_KD);

        //Left and Right middle frame
        GUI.DrawTexture(new Rect(0, 0, 128, Screen.height), FrameLeft_KD);
        GUI.DrawTexture(new Rect(Screen.width - 128, 0, 128, Screen.height), FrameRight_KD);

        //Frame corners
        GUI.Box(new Rect(Screen.width - 128, 0, 128, 128), FrameTopRight_KD, designStyle);
        GUI.Box(new Rect(0, 0, 128, 128), FrameTopLeft_KD, designStyle);
        GUI.Box(new Rect(Screen.width - 128, Screen.height - 128, 128, 128), FrameBottomRight_KD, designStyle);
        GUI.Box(new Rect(0, Screen.height - 128, 128, 128), FrameBottomLeft_KD, designStyle);

        GUI.Box(new Rect(0, 0, 1024, 1024), FrameMoon_KD, designStyle);
        GUI.Box(new Rect(100, 0, 512, 128), ButtonsBG_KD, designStyle);

        GUI.Box(new Rect(Screen.width - 256, 0, 256, 64), Logo_KD, designStyle);

        //Energy Bar
        //GUI.DrawTexture(new Rect(Screen.width - 33, Screen.height - 232, 30, 200 * .5f), EnergyBarBW_KD, ScaleMode.ScaleAndCrop);
        //GUI.Box(new Rect(Screen.width - 33, Screen.height - 232, 30, 200), EnergyBar_KD, designStyle);
        //GUI.DrawTexture(new Rect(Screen.width - 33, Screen.height - 232, 25, 200 - PowerLevel * 200 / 100), EnergyBarBW_KD, ScaleMode.ScaleAndCrop);
        //GUI.Box(new Rect(Screen.width - 33, Screen.height - 232, 30, 200 * .5f), EnergyBarBW_KD, designStyle);
    }
开发者ID:kdikov,项目名称:moonville,代码行数:32,代码来源:FrameMainMenuNZh.cs

示例4: Start

 void Start()
 {
     this.labelStyle = new GUIStyle();
     this.labelStyle.fontSize = Screen.height / 22;
     this.labelStyle.normal.textColor = Color.white;
     //start_gyro = StartCameraController.ini_gyro;
 }
开发者ID:hounenhounen,项目名称:NCMB_BitSummit_hacoscon,代码行数:7,代码来源:MyCameraController.cs

示例5: Start

    void Start()
    {
        _img = (Texture2D)Resources.Load("bg1");
        _img2 = (Texture2D)Resources.Load("bg2");

        style = new GUIStyle();

        style.font = (Font)Resources.Load("Fonts/Arial");

        style.active.background = _img2; // not working
        style.hover.background = _img2; // not working
        style.normal.background = _img; // not working

        style.active.textColor = Color.red; // not working
        style.hover.textColor = Color.blue; // not working
        style.normal.textColor = Color.white;

        int border = 30;

        style.border.left = border; // not working, since backgrounds aren't showing
        style.border.right = border; // ---
        style.border.top = border; // ---
        style.border.bottom = border; // ---

        style.stretchWidth = true; // ---
        style.stretchHeight = true; // not working, since backgrounds aren't showing

        style.alignment = TextAnchor.MiddleCenter;
    }
开发者ID:russboss,项目名称:VisTest2,代码行数:29,代码来源:DynamicGUIStyle.cs

示例6: OnEnable

    void OnEnable()
    {
		displayManager = target as RUISDisplayManager;
		
        displays = serializedObject.FindProperty("displays");
		ruisMenuPrefab = serializedObject.FindProperty("ruisMenuPrefab");
		
		guiX = serializedObject.FindProperty("guiX");
		guiY = serializedObject.FindProperty("guiY");
		guiZ = serializedObject.FindProperty("guiZ");
		guiScaleX = serializedObject.FindProperty("guiScaleX");
		guiScaleY = serializedObject.FindProperty("guiScaleY");
		hideMouseOnPlay = serializedObject.FindProperty("hideMouseOnPlay");
		
		displayManagerLink = new SerializedObject(displayManager);
		guiDisplayChoiceLink = displayManagerLink.FindProperty("guiDisplayChoice");
		
//        allowResolutionDialog = serializedObject.FindProperty("allowResolutionDialog");
        displayPrefab = Resources.Load("RUIS/Prefabs/Main RUIS/RUISDisplay") as GameObject;

        displayBoxStyle = new GUIStyle();
        displayBoxStyle.normal.textColor = Color.white;
        displayBoxStyle.alignment = TextAnchor.MiddleCenter;
        displayBoxStyle.border = new RectOffset(2, 2, 2, 2);
        displayBoxStyle.margin = new RectOffset(1, 0, 0, 0);
        displayBoxStyle.wordWrap = true;

        monoDisplayTexture = Resources.Load("RUIS/Editor/Textures/monodisplay") as Texture2D;
        stereoDisplayTexture = Resources.Load("RUIS/Editor/Textures/stereodisplay") as Texture2D;
		
		menuCursorPrefab = serializedObject.FindProperty("menuCursorPrefab");
		menuLayer = serializedObject.FindProperty("menuLayer");
    }
开发者ID:znjRoLS,项目名称:RUISAircraftGunner,代码行数:33,代码来源:RUISDisplayManagerEditor.cs

示例7: OnSceneGUI

	private         void OnSceneGUI    () {
		Ferr2D_Path  path      = (Ferr2D_Path)target;
		GUIStyle     iconStyle = new GUIStyle();
		iconStyle.alignment    = TextAnchor.MiddleCenter;
		
		// setup undoing things
		Undo.RecordObject(target, "Modified Path");
		
        // draw the path line
		if (Event.current.type == EventType.repaint)
			DoPath(path);
		
		// Check for drag-selecting multiple points
		DragSelect(path);
		
        // do adding verts in when the shift key is down!
		if (Event.current.shift && !Event.current.control) {
			DoShiftAdd(path, iconStyle);
		}
		
        // draw and interact with all the path handles
		DoHandles(path, iconStyle);
		
		// update everything that relies on this path, if the GUI changed
		if (GUI.changed) {
			UpdateDependentsSmart(path, false, false);
			EditorUtility.SetDirty (target);
			prevChanged = true;
		} else if (Event.current.type == EventType.used) {
			if (prevChanged == true) {
				UpdateDependentsSmart(path, false, true);
			}
			prevChanged = false;
		}
	}
开发者ID:lancetipton04,项目名称:VG,代码行数:35,代码来源:Ferr2D_PathEditor.cs

示例8: OnGUI

    void OnGUI()
    {
        float screenWidth = Screen.width;
        float screenHeight = Screen.height;
        float weapTextHeight = screenHeight * .02f; //4% of total screen height
        float weapImageHeight = screenHeight * .07f;
        float scoreTextHeight = screenHeight * .08f;

        GUIStyle centerStyle = new GUIStyle(GUI.skin.label);
        centerStyle.alignment = TextAnchor.MiddleCenter;
        GUIStyle rightStyle = new GUIStyle(GUI.skin.label);
        rightStyle.alignment = TextAnchor.MiddleRight;
        rightStyle.fontSize = 20;

        GUI.Label(new Rect(105, 5, 50, weapTextHeight), "MAIN", centerStyle);
        GUI.Label(new Rect(225, 5, 50, weapTextHeight), "SUB", centerStyle);

        Texture2D weaponTexture = Resources.Load<Texture2D>("bullet_bill");
        GUI.DrawTexture(new Rect(105, 5 + weapTextHeight, 50, weapImageHeight), weaponTexture, ScaleMode.ScaleToFit, true, 1.0f);

        Texture2D subWeaponTexture = Resources.Load<Texture2D>("thunderbolt");
        GUI.DrawTexture(new Rect(225, 5 + weapTextHeight, 50, weapImageHeight), subWeaponTexture, ScaleMode.ScaleToFit, true, 1.0f);

        Texture2D meterTexture = Resources.Load<Texture2D>("meter");
        GUI.DrawTexture(new Rect(400, 5, 600, scoreTextHeight), meterTexture, ScaleMode.StretchToFill, true, 1.0f);

        GUI.Label(new Rect(screenWidth - 450, 5, 280, scoreTextHeight), "Score: 314159265351337", rightStyle);
    }
开发者ID:jcsinck,项目名称:colt,代码行数:28,代码来源:gui_renderer.cs

示例9: OnGUI

 void OnGUI()
 {
     GUIStyle style = new GUIStyle();
     style.normal.textColor = Color.black;
     for (int i = 0; i < helptext.Length; i++)
         GUILayout.Label(helptext[i], style);
 }
开发者ID:alerdenisov,项目名称:ADAPT,代码行数:7,代码来源:HelpText.cs

示例10: OnGUI

    void OnGUI()
    {
        if (photonView.isMine) {

            listenForLevelUp();

            GUIStyle style = new GUIStyle();
            style.normal.textColor = Color.blue;
            style.fontSize = 20;
            GUILayout.Label("Health: " + sCharacterClass.currentHealth.ToString() + " / "
                + sCharacterClass.maxHealth.ToString(), style);
            GUILayout.Label("Level: " + sCharacterClass.level.ToString(), style);
            GUILayout.Label("xp" + sCharacterClass.experience.ToString() + " / " + sCharacterClass.reqExperience.ToString(), style);

            if(collideWeapon != null)
            {
                GUI.Label(new Rect(10, 200, 300, 20), "Press F to pick up " + collideWeapon.GunID, style);
            }

            if(increaseStat > 0)
            {
                levelUpStats();
            }

        }
    }
开发者ID:EricJSoler,项目名称:astron,代码行数:26,代码来源:PlayerHUD.cs

示例11: AgentPanel

 void AgentPanel(Agent agent)
 {
     GUILayout.BeginVertical();
         //GUILayout.Box(agent._name, GUILayout.Height(100f));
         GUILayout.Box(agent._name);
         GUILayout.Label("HP: "+agent.life+"/"+agent.lifeTotal+"  "+"XP: "+agent.skill);
         GUILayout.BeginHorizontal();
          GUILayout.Label("BP:");
          Dictionary<Type, int> typeToCount = new Dictionary<Type, int>();
          Dictionary<Type, Texture> typeToIcon = new Dictionary<Type, Texture>();
          foreach (EObject obj in agent.backpack) {
             if (typeToCount.ContainsKey(obj.GetType()))
                 typeToCount[obj.GetType()] = typeToCount[obj.GetType()] + 1;
             else {
                 typeToCount.Add(obj.GetType(), 1);
                 typeToIcon.Add(obj.GetType(), obj.getIcon());
             }
          }
         foreach (Type type in typeToCount.Keys) {
         GUILayout.BeginHorizontal();
             GUIStyle iconStyle = new GUIStyle();
             iconStyle.margin = new RectOffset(0, 0, 5, 0);
             GUILayout.Label(typeToIcon[type], iconStyle, GUILayout.Width (20), GUILayout.Height (15));
             GUIStyle textStyle = new GUIStyle();
             textStyle.margin = new RectOffset(0, 10, 5, 0);
             textStyle.normal.textColor = Color.white;
             GUILayout.Label(": " + typeToCount[type], textStyle);
         GUILayout.EndHorizontal();
         }
         GUILayout.EndHorizontal();
     GUILayout.EndVertical();
 }
开发者ID:igaray,项目名称:iaj,代码行数:32,代码来源:InfoControlBar.cs

示例12: OnGUI

	// Test Menu
	// Includes SendTag/SendTags and getting the userID and pushToken
	void OnGUI () {
		GUIStyle customTextSize = new GUIStyle("button");
		customTextSize.fontSize = 30;

		GUIStyle guiBoxStyle = new GUIStyle("box");
		guiBoxStyle.fontSize = 30;

		GUI.Box(new Rect(10, 10, 390, 250), "Test Menu", guiBoxStyle);

		if (GUI.Button (new Rect (60, 80, 300, 60), "SendTags", customTextSize)) {
			// You can tags users with key value pairs like this:
            OneSignal.SendTag("UnityTestKey", "TestValue");
			// Or use an IDictionary if you need to set more than one tag.
            OneSignal.SendTags(new Dictionary<string, string>() { { "UnityTestKey2", "value2" }, { "UnityTestKey3", "value3" } });

			// You can delete a single tag with it's key.
            // OneSignal.DeleteTag("UnityTestKey");
			// Or delete many with an IList.
            // OneSignal.DeleteTags(new List<string>() {"UnityTestKey2", "UnityTestKey3" });
		}

		if (GUI.Button (new Rect (60, 170, 300, 60), "GetIds", customTextSize)) {
            OneSignal.GetIdsAvailable((userId, pushToken) => {
				extraMessage = "UserID:\n" + userId + "\n\nPushToken:\n" + pushToken;
			});
		}

		if (extraMessage != null) {
			guiBoxStyle.alignment = TextAnchor.UpperLeft;
			guiBoxStyle.wordWrap = true;
			GUI.Box (new Rect (10, 300, Screen.width - 20, Screen.height - 310), extraMessage, guiBoxStyle);
		}
	}
开发者ID:sonxoans2,项目名称:Tap-Rotate,代码行数:35,代码来源:GameControllerExample.cs

示例13: prepGUIStyles

    protected new void prepGUIStyles()
    {
        availableGUIStyles = new Dictionary<string, GUIStyle>();

        float targetWidth = 1280f;
        float targetHeight = 800f;
        Vector3 scaleForCurrRes = new Vector3((Screen.width * 1.0f)/targetWidth,(Screen.height * 1.0f)/targetHeight,1f);

        GUIStyle fieldTitleStyle = new GUIStyle(GUI.skin.label);
        fieldTitleStyle.alignment = TextAnchor.MiddleCenter;
        fieldTitleStyle.fontSize = (int) (50 * scaleForCurrRes.x);

        GUIStyle fieldContentStyle = new GUIStyle(GUI.skin.label);
        fieldContentStyle.alignment = TextAnchor.MiddleCenter;
        fieldContentStyle.fontSize = (int) (30 * scaleForCurrRes.x);

        GUIStyle goalTextStyle = new GUIStyle(GUI.skin.label);
        goalTextStyle.alignment = TextAnchor.MiddleLeft;
        goalTextStyle.fontSize = (int) (30 * scaleForCurrRes.x);

        GUIStyle btnStyle = new GUIStyle(GUI.skin.button);
        btnStyle.wordWrap = true;
        btnStyle.normal.textColor = Color.black;

        availableGUIStyles.Add("FieldTitle",fieldTitleStyle);
        availableGUIStyles.Add("FieldContent",fieldContentStyle);
        availableGUIStyles.Add("GoalText",goalTextStyle);
        availableGUIStyles.Add("Button",btnStyle);
        hasInitGUIStyles = true;
    }
开发者ID:TAPeri,项目名称:WordsMatter,代码行数:30,代码来源:GoalWindow.cs

示例14: JBCStyle

    public JBCStyle()
    {
        bgTexture = new Texture2D(1, 1);
        bgTexture.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.8f));
        bgTexture.Apply();

        HiddenScrollBar = new GUIStyle(GUI.skin.verticalScrollbar);
        HiddenScrollBar.fixedHeight = HiddenScrollBar.fixedWidth = 0;

        boxStyle = new GUIStyle();
        boxStyle.normal.background = bgTexture;
        boxStyle.normal.textColor = Color.white;

        menuStyle = new GUIStyle(GUI.skin.button);
        menuStyle.normal.textColor = Color.white;
        menuStyle.fontSize = MENU_FONT_SIZE;
        menuStyle.fontStyle = FontStyle.Bold;
        menuStyle.normal.textColor = new Color(0.8f, 0.6f, 0f);

        levelToStyle = new Dictionary<ConsoleLevel, GUIStyle>();

        GUIStyle style = MakeLogStyle();
        style.normal.textColor = new Color(0.62f, 0.82f, 0.62f);
        levelToStyle[ConsoleLevel.Debug] = style;
        style = MakeLogStyle();
        style.normal.textColor = new Color(1f, 0.87f, 0.87f);
        levelToStyle[ConsoleLevel.Info] = style;
        style = MakeLogStyle();
        style.normal.textColor = new Color(1f, 0.47f, 0.47f);
        levelToStyle[ConsoleLevel.Warn] = style;
        style = MakeLogStyle();
        style.normal.textColor = new Color(1f, 0.133f, 0.133f);
        levelToStyle[ConsoleLevel.Error] = style;
        levelToStyle[ConsoleLevel.Fatal] = style;
    }
开发者ID:junkbyte,项目名称:UnityConsole,代码行数:35,代码来源:JBCStyle.cs

示例15: OnGUI

	void OnGUI(){
		GUIStyle style = new GUIStyle ();
		style.fontSize = Mathf.RoundToInt(40*scale);
		style.normal.textColor = Color.white;
		style.alignment = TextAnchor.UpperCenter;
		GUI.Label (new Rect(Screen.width/2 - titleWidth/2, Screen.height * 0.05f*scale, titleWidth, titleHeight), "Word Snack",style);
		
		
		GUIStyle ButtonStyle = new GUIStyle ();
		ButtonStyle.fontSize = Mathf.RoundToInt(32*scale);
		ButtonStyle.normal.textColor = Color.white;
		ButtonStyle.normal.background = buttonBackground;
		ButtonStyle.alignment = TextAnchor.LowerCenter;
		GUI.BeginGroup (new Rect (Screen.width / 2 - buttonWidth/2, Screen.height * 0.5f, buttonWidth, buttonHeight));
		if (GUILayout.Button ("Play", ButtonStyle)) {
			Debug.Log ("Play is pressed");
			Application.LoadLevel(1);
		}
		GUILayout.Button ( "Instructions", ButtonStyle);
		GUILayout.Button ( "About", ButtonStyle);
		GUI.EndGroup ();
		
		Debug.Log (Screen.height);
		Debug.Log (Screen.width);
	}
开发者ID:imann24,项目名称:WordSnack,代码行数:25,代码来源:StartScreenGUI.cs


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