GUI
- backgroundColor
- BeginGroup
- BeginScrollView
- Box
- BringWindowToBack
- BringWindowToFront
- Button
- changed
- color
- contentColor
- depth
- DragWindow
- DrawTexture
- enabled
- EndGroup
- EndScrollView
- FocusControl
- FocusWindow
- GetNameOfFocusedControl
- GUI
- HorizontalScrollbar
- HorizontalSlider
- Label
- matrix
- PasswordField
- RepeatButton
- ScrollTo
- SelectionGrid
- SetNextControlName
- skin
- TextArea
- TextField
- Toggle
- Toolbar
- tooltip
- UnfocusWindow
- VerticalScrollbar
- VerticalSlider
- Window
GUI.RepeatButton 重复按钮
static function RepeatButton (position : Rect, text : String) : bool
static function RepeatButton (position : Rect, image : Texture) : bool
static function RepeatButton (position : Rect, content : GUIContent) : bool
static function RepeatButton (position : Rect, text : String, style : GUIStyle) : bool
static function RepeatButton (position : Rect, image : Texture, style : GUIStyle) : bool
static function RepeatButton (position : Rect, content : GUIContent, style : GUIStyle) : bool
Parameters参数
- positionRectangle on the screen to use for the button.
用于按钮在屏幕上矩形的位置 - textText to display on the button.
在按钮上显示的文本 - imageTexture to display on the button.
在按钮上显示的纹理图片 - contentText, image and tooltip for this button.
用于按钮的文本,图片和提示信息。 - styleThe style to use. If left out, the button style from the current GUISkin is used.
使用样式,如果不,按钮样式应用当前的GUISkin皮肤。
bool - true when the users clicks the button
当用户点击按钮的时候返回true。
Description描述
Make a button that is active as long as the user holds it down.
创建一个按钮,只要用户按着不放,将一直被激活。
从按下按钮到释放按钮的时间内重复引发其 Click 事件的控件,也就是说它将连续不停的发送点击事件。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Texture btnTexture;
void OnGUI() {
if (!typeof(btnTexture)) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
if (GUI.RepeatButton(new Rect(10, 10, 50, 50), btnTexture))
Debug.Log("Clicked the button with an image");
if (GUI.RepeatButton(new Rect(10, 70, 50, 30), "Click"))
Debug.Log("Clicked the button with text");
}
}
var btnTexture : Texture;
function OnGUI() {
if (!btnTexture) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
if (GUI.RepeatButton(Rect(10,10,50,50),btnTexture))
Debug.Log("Clicked the button with an image");
if (GUI.RepeatButton(Rect(10,70,50,30),"Click"))
Debug.Log("Clicked the button with text");
}
最后修改:2011年1月14日 Friday 21:33