Exemplo n.º 1
0
 void HandleInputManagerInstanceTouchJustDownDetected(object sender, BaseTouchEventArgs e)
 {
     this.StopAllActions();
     TouchVelocity = 0.0f;
     TouchStartPosition = e.touchPosition;
     TouchPosition = TouchStartPosition.Xy;
     foreach (AnchorPoint point in AnchorPoints) {
         if (point.Node == null) {
             continue;
         }
         point.Node.StopAllActions();
     }
     EventHandler handler = OnSwipeStart;
         if ( handler != null ) {
             handler( this, null );
         }
 }
Exemplo n.º 2
0
 // EVENT HANDLERS ----------------------------------------------------------------------------------------------------------------
 void HandleInputManagerInstanceTouchJustUpDetected(object sender, BaseTouchEventArgs e)
 {
     var LastTouchPosition = TouchPosition.Xy;
     bool AdvancePanel = false;
     TouchPosition = e.touchPosition;
     // SWITCH ACTIVE PANELS IF PANEL MIDPOINT IS OFF THE SCREEN
     if (FMath.Abs(AnchorPoints[1].Node.Position.X - AnchorPoints[1].Position.X) > 0.5f*Width ||
         FMath.Abs (TouchVelocity * (TouchPosition.X - TouchStartPosition.X)) > 4000.0f) {
         // SWIPE TO RIGHT?
         AdvancePanel = (TouchPosition.X - TouchStartPosition.X) > 0;
         // CHECK IF RIGHTWARD MOVEMENT IS POSSIBLE
         if (AnchorPoints[0].Node != null && AdvancePanel) {
             foreach (AnchorPoint point in AnchorPoints) {
                 point.Index--;
                 if (point.Index < 0){
                     point.Node = null;
                 } else {
                     point.Node = Panels[point.Index];
                 }
             }
         // CHECK IF LEFTWARD MOVEMENT IS POSSIBLE
         } else if (AnchorPoints[2].Node != null && !AdvancePanel) {
             foreach (AnchorPoint point in AnchorPoints) {
                 point.Index++;
                 if (point.Index == Panels.Count) {
                     point.Node = null;
                 } else {
                     point.Node = Panels[point.Index];
                 }
             }
         }
     }
     // MOVE PANELS TO NEW RESTING PLACES
     foreach (AnchorPoint point in AnchorPoints) {
         if (point.Node == null) {
             continue;
         }
         point.Node.RunAction( new MoveTo(point.Position, 0.3f) {
             Tween = (t) => Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.ExpEaseOut(t,4.0f)
         } );
         point.Node.ScheduleUpdate(0);
     }
     Sequence sequence = new Sequence();
     sequence.Add( new DelayTime(0.35f) );
     sequence.Add ( new CallFunc( () => {
         EventHandler handler = OnSwipeComplete;
         if ( handler != null ) {
             handler( this, null );
         }
     } ) );
     this.RunAction(sequence);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Handles the input manager TouchJustUp event
 /// </summary>
 /// <param name='sender'>
 /// Sender.
 /// </param>
 /// <param name='e'>
 /// BaseTouchEventArgs
 /// </param>
 void HandleInputManagerInstanceTouchJustUpDetected(object sender, BaseTouchEventArgs e)
 {
     if( !Visible || (_status != PRESSED) ) {
         return;
     }
     _status = NORMAL;
     if(_bounds.IsInside( this.WorldToLocal(e.touchPosition) ) ) {
         OnButtonUp();
     }
 }
Exemplo n.º 4
0
 // EVENT HANDLERS -------------------------------------------------------------------------------------------------
 void HandleInputManagerInstanceTapDetected(object sender, BaseTouchEventArgs e)
 {
     Dismiss();
 }
Exemplo n.º 5
0
 // EVENT HANDLERS ----------------------------------------------------------------
 /// <summary>
 /// Handles the input manager TouchJustDown event
 /// </summary>
 /// <param name='sender'>
 /// Sender.
 /// </param>
 /// <param name='e'>
 /// BaseTouchEventArgs
 /// </param>
 void HandleInputManagerInstanceTouchJustDownDetected(object sender, BaseTouchEventArgs e)
 {
     _pressed = false;
     if(_bounds.IsInside( this.WorldToLocal(e.touchPosition) ) ) {
         OnButtonDown();
         _pressed = true;
     }
 }
Exemplo n.º 6
0
        void HandleInputManagerInstanceTouchJustUpDetected(object sender, BaseTouchEventArgs e)
        {
            if(active) {
                var percentage = Knob.Position.X / length;
                val = percentage * (max-min) + min;

                if ( discreteOptions != null && discreteOptions.Count > 0 ) {
                    float diff = float.MaxValue;
                    float finalVal = val;
                    foreach (float opt in discreteOptions) {
                        if (diff > Sce.PlayStation.Core.FMath.Abs(val - opt) ) {
                            finalVal = opt;
                            diff = val - opt;
                        } else {
                            break;
                        }
                    }
                    val = finalVal;
                }
                SetSliderValue(val);
                active = false;
            }
        }
Exemplo n.º 7
0
 void HandleInputManagerInstanceTouchJustDownDetected(object sender, BaseTouchEventArgs e)
 {
     if ( bounds.IsInside(this.WorldToLocal(e.touchPosition) ) ) {
         active = true;
         Knob.Position = new Vector2(this.WorldToLocal(e.touchPosition).X, Knob.Position.Y);
         if ( Knob.Position.X < 0.0f) {
             Knob.Position = new Vector2( 0.0f, Knob.Position.Y);
         } else if (Knob.Position.X > length) {
             Knob.Position = new Vector2(length, Knob.Position.Y);
         }
     }
 }
Exemplo n.º 8
0
 // EVENT HANDLERS -----------------------------------------------------------------------------------------------------------------------------
 void HandleInputManagerInstanceTouchJustUpDetected(object sender, BaseTouchEventArgs e)
 {
     MenuSystem.SetScreen("Menu");
     InputManager.Instance.TouchJustUpDetected -= HandleInputManagerInstanceTouchJustUpDetected;
 }
Exemplo n.º 9
0
 // EVENT HANDLERS -------------------------------------------------------------------------
 void HandleInputManagerInstanceTouchJustUpDetected(object sender, BaseTouchEventArgs e)
 {
     if(this.getNode().IsWorldPointInsideContentLocalBounds(e.touchPosition) ) {
         onButtonUp();
     }
 }