您的位置:首页 > 产品设计 > UI/UE

NGUI笔记1之 UICamera

2015-02-06 16:27 113 查看
UICamera作用

监听刚体组件(colliders)事件

/// * OnHover (isOver) is sent when the mouse hovers over a collider or moves away.

/// * OnPress (isDown) is sent when a mouse button gets pressed on the collider.

/// * OnSelect (selected) is sent when a mouse button is first pressed on an object. Repeated presses won't result in an OnSelect(true).

/// * OnClick () is sent when a mouse is pressed and released on the same object.

///   UICamera.currentTouchID tells you which button was clicked.

/// * OnDoubleClick () is sent when the click happens twice within a fourth of a second.

///   UICamera.currentTouchID tells you which button was clicked.

///

/// * OnDragStart () is sent to a game object under the touch just before the OnDrag() notifications begin.

/// * OnDrag (delta) is sent to an object that's being dragged.

/// * OnDragOver (draggedObject) is sent to a game object when another object is dragged over its area.

/// * OnDragOut (draggedObject) is sent to a game object when another object is dragged out of its area.

/// * OnDragEnd () is sent to a dragged object when the drag event finishes.

///

/// * OnTooltip (show) is sent when the mouse hovers over a collider for some time without moving.

/// * OnScroll (float delta) is sent out when the mouse scroll wheel is moved.

/// * OnKey (KeyCode key) is sent when keyboard or controller input is used.

例子:

void OnPress (bool isPressed)
{
if (isPressed) Debug.Log("I was pressed on!");
else Debug.Log("I was unpressed");
}



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: