블로그 이미지
Every unexpected event is a path to learning for you. blueasa

카테고리

분류 전체보기 (2797)
Unity3D (853)
Programming (479)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (185)
협업 (61)
3DS Max (3)
Game (12)
Utility (68)
Etc (98)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (55)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday

NGUI의 이벤트 함수를 SendMessage로 호출하려고 함수 원형을 찾아보고 올려놓음.


UICamera sends out the following events to 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 a game object. Repeated presses on the same object won't result in a new OnSelect.
  • OnClick () is sent with the same conditions as OnSelect, with the added check to see if the mouse has not moved much. 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.
  • OnInput (text) is sent when typing (after selecting a collider by clicking on it).
  • 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.

To tap into them in your own custom scripts, simply create a script with the appropriate function, such as:
  1. void OnPress (bool isPressed)
  2. {
  3.     if (isPressed) Debug.Log("I was pressed on!");
  4.     else Debug.Log("I was unpressed");
  5. }

Pro-Tip #2

You can subscribe to events from any script using delegates: UICamera.onClick, UICamera.onHover, etc. These delegates will be called just before the actual notification gets sent to the proper object. You can use this functionality to listen in for events on a script regardless of whether they would be going to that script's game object or not.

Class Documentation

http://tasharen.com/ngui/docs/class_u_i_camera.html

If you have a question regarding this component or would like me to clarify something, just post a reply here.



출처 : http://www.tasharen.com/forum/index.php?topic=6711.0

반응형
Posted by blueasa
, |