FairyGUI.Stage.HandleTouchEvents C# (CSharp) Method

HandleTouchEvents() private method

private HandleTouchEvents ( ) : void
return void
		void HandleTouchEvents()
		{
			int tc = Input.touchCount;
			for (int i = 0; i < tc; ++i)
			{
				Touch uTouch = Input.GetTouch(i);

				if (uTouch.phase == TouchPhase.Stationary)
					continue;

				Vector2 pos = uTouch.position;
				pos.y = stageHeight - pos.y;

				TouchInfo touch = null;
				for (int j = 0; j < 5; j++)
				{
					if (_touches[j].touchId == uTouch.fingerId)
					{
						touch = _touches[j];
						break;
					}
				}
				if (touch == null)
					continue;

				if (touch.x != pos.x || touch.y != pos.y)
				{
					touch.x = pos.x;
					touch.y = pos.y;
					touch.UpdateEvent();
					onTouchMove.Call(touch.evt);

					//no rollover/rollout on mobile
				}

				if (uTouch.phase == TouchPhase.Began)
				{
					if (!touch.began)
					{
						_touchCount++;
						touch.begin();
						this.focus = touch.target;

						if (touch.target != null)
						{
							touch.UpdateEvent();
							touch.target.onTouchBegin.BubbleCall(touch.evt);
						}
					}
				}
				else if (uTouch.phase == TouchPhase.Canceled || uTouch.phase == TouchPhase.Ended)
				{
					if (touch.began)
					{
						_touchCount--;
						touch.end();

						DisplayObject clickTarget = touch.ClickTest();
						if (clickTarget != null)
						{
							touch.clickCount = uTouch.tapCount;
							touch.UpdateEvent();
							clickTarget.onClick.BubbleCall(touch.evt);
						}
					}

					touch.Reset();
				}
			}
		}