private void OnClick() { if (dialogController != null) { dialogController.SendMessage("OnDisplayItemSelected", this, SendMessageOptions.DontRequireReceiver); } }
void OnSelect() { //Debug.Log( "########################### on Select ~~~~~" ); if (dialogController != null) { dialogController.SendMessage("OnSlotSelected", this, SendMessageOptions.DontRequireReceiver); } }
void Update() { //if (mSprite.atlas != null) { //Vector3 pos = Input.mousePosition; Vector3 pos = Vector3.zero; if (uiCamera != null) { if (Input.touchCount == 1) { // we've got only a single touch here, handle what it comes Touch touch = Input.GetTouch(0); pos = touch.position; } else { pos = Input.mousePosition; /* * if ( Input.touchCount == 0 && mSprite.atlas != null ) * { * Debug.Log ( "################### mouse down : " + Input.GetMouseButtonDown( 0 ) ); * Debug.Log ( "################### mouse up : " + Input.GetMouseButtonUp( 0 ) ); * } */ if ((Input.GetMouseButtonUp(0) && mSprite.atlas != null)) { if (dialogController != null) { mSprite.atlas = null; dialogController.SendMessage("OnCursorUpError", this, SendMessageOptions.DontRequireReceiver); } } } // Since the screen can be of different than expected size, we want to convert // mouse or touch coordinates to view space, then convert that to world position. pos.x = Mathf.Clamp01(pos.x / Screen.width); pos.y = Mathf.Clamp01(pos.y / Screen.height); mTrans.position = uiCamera.ViewportToWorldPoint(pos); //Debug.Log( "########################################## position: " + mTrans.position ); // For pixel-perfect results if (uiCamera.isOrthoGraphic) { mTrans.localPosition = NGUIMath.ApplyHalfPixelOffset(mTrans.localPosition, mTrans.localScale); } } else { // Simple calculation that assumes that the camera is of fixed size pos.x -= Screen.width * 0.5f; pos.y -= Screen.height * 0.5f; mTrans.localPosition = NGUIMath.ApplyHalfPixelOffset(pos, mTrans.localScale); } } }