Ejemplo n.º 1
0
        protected override void Start()
        {
            Debug.Log("start GUIRouter");

            if (renderSupport != null)
            {
                return;
            }
            renderSupport = new RenderSupport();
            base.Start();

            _stage = new StageX();
            sceneMachine.target = _stage;
        }
Ejemplo n.º 2
0
        private void touchHandle(EventX e)
        {
            Vector2X p      = (Vector2X)e.data;
            float    stageX = p.x;
            float    stageY = p.y;

            switch (e.type)
            {
            case MouseEventX.MOUSE_DOWN:
                mx = mx0 = stageX;
                my = my0 = stageY;

                _stage = stage;

                _stage.addEventListener(MouseEventX.MOUSE_MOVE, touchMoveHandle);
                _stage.addEventListener(MouseEventX.MOUSE_UP, touchHandle);
                break;

            case MouseEventX.MOUSE_UP:

                _stage.removeEventListener(MouseEventX.MOUSE_MOVE, touchMoveHandle);
                _stage.removeEventListener(MouseEventX.MOUSE_UP, touchHandle);

                if (_isDragging)
                {
                    touchEnd(stageX - mx, stageY - my, stageX - mx0, stageY - my0);
                    if (hasEventListener(TouchEventX.TOUCH_END))
                    {
                        this.dispatchEvent(new TouchEventX(TouchEventX.TOUCH_END, stageX - mx, stageY - my, stageX - mx0, stageY - my0));
                    }
                    _isDragging = false;
                    CallLater.Add(touchEndHandle);
                }

                break;
            }
        }