LeopotamGroup.Gui.Common.GuiSystem.ProcessInput C# (CSharp) Method

ProcessInput() public method

public ProcessInput ( ) : void
return void
        void ProcessInput()
        {
            var touchCount = Mathf.Min (_touches.Length, Input.touchCount);
            bool isMouse;
            var scaleFactor = 1f / _camera.pixelHeight * ScreenHeight;
            if (touchCount == 0 && _touches[0].ProcessMouse (_camera, scaleFactor)) {
                touchCount = 1;
                isMouse = true;
            } else {
                isMouse = false;
            }

            GuiEventReceiver newReceiver;
            Vector3 worldPos;

            _eventReceivers.Sort ((a, b) => b.GlobalDepthOrder - a.GlobalDepthOrder);

            for (var i = 0; i < touchCount; i++) {
                if (!isMouse) {
                    _touches[i].UpdateChanges (Input.GetTouch (i), _camera, scaleFactor);
                } else {
                    isMouse = false;
                }

                if (_touches[i].IsStateChanged || _touches[i].IsDeltaChanged) {
                    worldPos = _touches[i].GuiWorldPosition;
                    newReceiver = null;
                    for (int j = _eventReceivers.Count - 1; j >= 0; j--) {
                        if (_eventReceivers[j].IsPointInside (worldPos.x, worldPos.y)) {
                            newReceiver = _eventReceivers[j];
                            break;
                        }
                    }

                    _touchEventArg.SetData (_touches[i].State, _touches[i].ScreenPosition, worldPos, _touches[i].Delta);

                    if (_touches[i].IsCumulativeDeltaChanged) {
                        if (_touches[i].Receiver != null) {
                            _touches[i].Receiver.RaiseDragEvent (_touchEventArg);
                        }
                    }

                    if (_touches[i].IsStateChanged) {
                        if (!_touches[i].State) {
                            if (_touches[i].Receiver != null) {
                                _touches[i].Receiver.RaisePressEvent (_touchEventArg);
                                if (!_touches[i].IsCumulativeDeltaChanged && _touches[i].Receiver == newReceiver) {
                                    _touches[i].Receiver.RaiseClickEvent (_touchEventArg);
                                }
                            }
                            newReceiver = null;
                        } else {
                            _touches[i].Receiver = newReceiver;
                        }
                        if (_touches[i].Receiver != null) {
                            _touches[i].Receiver.RaisePressEvent (_touchEventArg);
                        }
                    }
                }
                _touches[i].ResetChanges ();
            }
        }