유니티 유/무료 강좌

|

http://www.unity3dstudy.com/


무료강좌에도 괜찮은 내용이 꾀 있는 것 같고 여유가 된다면 유료 강좌도 들을만 할 것 같다.


Trackback 0 And Comment 0

NGUI: Events

|

NGUI: Events

 

You can add the following functions to your scripts placed on widgets or in-game objects with a collider, provided they are drawn with a camera that has the UICamera script attached:

  • void OnHover (bool isOver) – Sent out when the mouse hovers over the collider or moves away from it.Not sent on touch-based devices.
  • void OnPress (bool isDown) – Sent when a mouse button (or touch event) gets pressed over the collider (with ‘true’) and when it gets released (with ‘false’, sent to the same collider even if it’s released elsewhere).
  • void OnClick() — Sent to a mouse button or touch event gets released on the same collider as OnPress. UICamera.currentTouchID tells you which button was clicked.
  • void OnDoubleClick () — Sent when the click happens twice within a fourth of a second. UICamera.currentTouchID tells you which button was clicked.
  • void OnSelect (bool selected) – Same as OnClick, but once a collider is selected it will not receive any further OnSelect events until you select some other collider.
  • void OnDrag (Vector2 delta) – Sent when the mouse or touch is moving in between of OnPress(true) and OnPress(false).
  • void OnDrop (GameObject drag) – Sent out to the collider under the mouse or touch when OnPress(false) is called over a different collider than triggered the OnPress(true) event. The passed parameter is the game object of the collider that received the OnPress(true) event.
  • void OnInput (string text) – Sent to the same collider that received OnSelect(true) message after typing something. You likely won’t need this, but it’s used by UIInput
  • void OnTooltip (bool show) – Sent after the mouse hovers over a collider without moving for longer thantooltipDelay, and when the tooltip should be hidden. Not sent on touch-based devices.
  • void OnScroll (float delta) is sent out when the mouse scroll wheel is moved.
  • void OnKey (KeyCode key) is sent when keyboard or controller input is used.

Inside your event functions you can always figure out who sent the event (UICamera.currentCamera), RaycastHit that resulted in this event (UICamera.lastHit), as well as the on-screen position of the touch or mouse (UICamera.lastTouchPosition). You can also determine the ID of the touch event (UICamera.currentTouchID), which is ‘-1′ for the left mouse button, ‘-2′ for right, and ‘-3′ for middle.

For example, the following script will print “Hello World!” when the collider it’s attached to gets clicked on.


'잡다한것들전부 > ' 카테고리의 다른 글

유니티 개발시 필요한 라이프 사이클  (0) 2014.01.04
유니티 유/무료 강좌  (0) 2014.01.04
NGUI: Events  (0) 2014.01.04
pc 마인드 맵 프로그램  (0) 2014.01.01
네이버 나눔고딕코딩 다운  (0) 2014.01.01
유니티 모바일 에서의 처리  (0) 2014.01.01
Trackback 0 And Comment 0

영어와 숫자만 가능하게 처리하기

|

//id 형식 체크

bool id_check(const char * text) {

const char c = *text;


if((c < '0' || c > '9') && (c < 'a' || c > 'z') && (c < 'A' || c > 'Z')) {

CCMessageBox("id는 영어와 숫자만 가능합니다","아이디체크");

return (false);             

}

return true;

}

'잡다한것들전부 > ' 카테고리의 다른 글

cocos2d-x 로딩 관련  (0) 2014.01.06
cocos2d-x 샘플 소스 소개  (0) 2014.01.06
영어와 숫자만 가능하게 처리하기  (0) 2014.01.02
TextInputTest 예제 소스  (0) 2014.01.02
string::find와 string::npos 관계  (0) 2013.12.24
sd 카드 접근  (0) 2013.12.23
Trackback 0 And Comment 0