/// <summary> /// Creates a swipe detector with no related UI /// </summary> public static UISwipeDetector create( UIToolkit manager, Rect frame, int depth ) { // create the swipe detector var detector = new UISwipeDetector( frame, depth, UIUVRect.zero ); manager.addTouchableSprite( detector ); return detector; }
/// <summary> /// Creates a swipe detector with no related UI /// </summary> public static UISwipeDetector create(UIToolkit manager, Rect frame, int depth) { // create the swipe detector var detector = new UISwipeDetector(frame, depth, UIUVRect.zero); manager.addTouchableSprite(detector); return(detector); }
/// <summary> /// Creates a swipe detector with a texture backing the hit area /// </summary> public static UISwipeDetector create( UIToolkit manager, string filename, int xPos, int yPos, int depth ) { // grab the texture details var normalTI = manager.textureInfoForFilename( filename ); var frame = new Rect( xPos, yPos, normalTI.frame.width, normalTI.frame.height ); // create the swipe detector var detector = new UISwipeDetector( frame, depth, normalTI.uvRect ); manager.addTouchableSprite( detector ); return detector; }
/// <summary> /// Creates a swipe detector with a texture backing the hit area /// </summary> public static UISwipeDetector create(UIToolkit manager, string filename, int xPos, int yPos, int depth) { // grab the texture details var normalTI = manager.textureInfoForFilename(filename); var frame = new Rect(xPos, yPos, normalTI.frame.width, normalTI.frame.height); // create the swipe detector var detector = new UISwipeDetector(frame, depth, normalTI.uvRect); manager.addTouchableSprite(detector); return(detector); }
// Swipe callback public void onSwipe( UISwipeDetector sender, SwipeDirection direction ) { swipeText.text = direction.ToString(); }
void Start() { var swipeDetector = UISwipeDetector.create(new Rect(0, 0, Screen.width, Screen.height), 1); swipeDetector.onSwipe += detectedSwipe; }
void detectedSwipe(UISwipeDetector sender, SwipeDirection direction) { Debug.Log("swipe direction: " + direction); }
void detectedSwipe( UISwipeDetector sender, SwipeDirection direction ) { Debug.Log( "swipe direction: " + direction ); }
// Swipe callback public void onSwipe(UISwipeDetector sender, SwipeDirection direction) { swipeText.text = direction.ToString(); }