Esempio n. 1
0
        public bool ProcessTouch(GameTime gameTime, XTapType tapType, int x, int y)
        {
            var tapAreas = this.ScreenEngine.tapAreas;

            for (int j = tapAreas.Count - 1; j >= 0; j--)
            {
                var tapArea = tapAreas[j];

                if (!(tapArea.Enabled && tapArea.WasUpdated))
                {
                    continue;
                }

                var screenBounds = tapArea.GetScreenBounds();

                if (screenBounds.Contains(x, y))
                {
                    tapArea.TapType = tapType;
                    tapArea.TapX    = x - screenBounds.X;
                    tapArea.TapY    = y - screenBounds.Y;
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 2
0
        public override void Update(UpdateParameters p)
        {
            base.Update(p);


            if (this.TapType == XTapType.None)
            {
                // noop
            }
            else if (pressActions != null && this.TapType == XTapType.Press)
            {
                pressActions.ForEach(a => a.Call());
            }
            else if (moveActions != null && (this.TapType == XTapType.Press || this.TapType == XTapType.Move))
            {
                moveActions.ForEach(a => a.Call());
            }
            else if (releaseActions != null && this.TapType == XTapType.Release)
            {
                releaseActions.ForEach(a => a.Call());
            }

            this.TapType = XTapType.None;
        }
Esempio n. 3
0
		public override void Update(UpdateParameters p)
		{
			base.Update(p);


            if (this.TapType == XTapType.None)
            {
                // noop
            }
            else if (pressActions != null && this.TapType == XTapType.Press)
            {
                pressActions.ForEach(a => a.Call());
            }
            else if (moveActions != null && (this.TapType == XTapType.Press || this.TapType == XTapType.Move))
            {
                moveActions.ForEach(a => a.Call());
            }
            else if (releaseActions != null && this.TapType == XTapType.Release)
            {
                releaseActions.ForEach(a => a.Call());
            }
			
			this.TapType = XTapType.None;
		}