Пример #1
0
 /// <summary>
 /// Raises the TouchJustDownDetected event.
 /// </summary>
 /// <param name='e'>
 /// <see cref="Crystallography.InputManager.BaseTouchEventArgs"/>
 /// </param>
 protected void OnTouchJustDown( BaseTouchEventArgs e )
 {
     if(releaseDuration > MAX_RELEASE_DURATION) {
         tapCount = 0;
     }
     lastReleaseDuration = releaseDuration;
     pressDuration = 0.0f;
     EventHandler<BaseTouchEventArgs> handler = TouchJustDownDetected;
     if (handler != null ) {
         handler( this, e );
     }
 }
Пример #2
0
 /// <summary>
 /// Raises the TouchJustUpDetected event. Calls OnTap() if appropriate.
 /// </summary>
 /// <param name='e'>
 /// <see cref="Crystallography.InputManager.BaseTouchEventArgs"/>
 /// </param>
 protected void OnTouchJustUp( BaseTouchEventArgs e )
 {
     dragging = false;
     if (pressDuration < MAX_PRESS_DURATION ) {	// ------------------- on tap
         OnTap( e );
     } else {
         tapCount = 0;
     }
     lastPressDuration = pressDuration;
     releaseDuration = 0.0f;
     EventHandler<BaseTouchEventArgs> handler = TouchJustUpDetected;
     if (handler != null ) {
         handler( this, e );
     }
 }
Пример #3
0
 /// <summary>
 /// Raises the <c>TapDetected</c> event or calls OnDoubleTap() as appropriate.
 /// </summary>
 /// <param name='e'>
 /// <see cref="Crystallography.InputManager.BaseTouchEventArgs"/>
 /// </param>
 protected void OnTap( BaseTouchEventArgs e )
 {
     tapCount++;
     if ( lastReleaseDuration < MAX_RELEASE_DURATION ) {
         if ( tapCount > 1 ) {	// ----------------------------------- on double-tap
             OnDoubleTap ( e );
             return;
         }
     }
     EventHandler<BaseTouchEventArgs> handler = TapDetected;
     if ( handler != null ) {
         handler( this, e );
     }
 }
Пример #4
0
 /// <summary>
 /// Raises the <c>DoubleTapDetected</c> event.
 /// </summary>
 /// <param name='e'>
 /// <see cref="Crystallography.InputManager.BaseTouchEventArgs"/>
 /// </param>
 protected void OnDoubleTap( BaseTouchEventArgs e )
 {
     //			Console.WriteLine("DoubleTap!");
     EventHandler<BaseTouchEventArgs> handler = DoubleTapDetected;
     if ( handler != null ) {
         handler( this, e );
     }
 }
 /// <summary>
 /// Handles <c>InputManager.TouchJustUpDetected</c>.
 /// </summary>
 /// <param name='sender'>
 /// InputManager instance
 /// </param>
 /// <param name='e'>
 /// <see cref="Crystallography.InputManager.BaseTouchEventArgs"/>
 /// </param>
 void HandleInputManagerInstanceTouchJustUpDetected(object sender, BaseTouchEventArgs e)
 {
     lastPosition.Clear();
     if ( GameScene.paused ) return;
     if ( GameScene.Hud.MetGoalTime != 0.0f) return;
     LetGo();
     Scheduler.Instance.Unschedule(this.getNode(), AddParticle);
 }
        /// <summary>
        /// Handles <c>InputManager.TouchJustDownDetected</c>.
        /// </summary>
        /// <param name='sender'>
        /// Input Manager instance
        /// </param>
        /// <param name='e'>
        /// <see cref="Crystallography.InputManager.BaseTouchEventArgs"/>
        /// </param>
        void HandleInputManagerInstanceTouchJustDownDetected(object sender, BaseTouchEventArgs e)
        {
            if ( GameScene.paused ) return;
            if ( GameScene.Hud.MetGoalTime != 0.0f) return;
            setPosition( e.touchPosition );

            lastEntityTouched = justDownPositionEntity = GetEntityAtPosition( e.touchPosition ) as AbstractCrystallonEntity;

            AddParticle(0.0f);
            Scheduler.Instance.Schedule(this.getNode(), AddParticle, 0.1f, false, 1);

            if ( lastEntityTouched is CardCrystallonEntity ) {
                Add ( lastEntityTouched );
                justDownPositionEntity = null;
            }
        }
 // EVENT HANDLERS --------------------------------------------------------
 void HandleInputManagerInstanceTapDetected(object sender, BaseTouchEventArgs e)
 {
     if (lastEntityTouched != null ) {
         lastEntityTouched.BeTapped();
     }
 }