Esempio n. 1
0
        public GameTouchHandler(GameLayer gameLayer, HexMexCamera hexMexCamera)
        {
            GameLayer    = gameLayer;
            HexMexCamera = hexMexCamera;
            var eventListener = new CCEventListenerTouchOneByOne {
                IsEnabled = true, OnTouchBegan = OnTouchBegan, OnTouchCancelled = OnTouchCancelled, OnTouchEnded = OnTouchEnded, OnTouchMoved = OnTouchMoved
            };

            gameLayer.AddEventListener(eventListener);
        }
Esempio n. 2
0
        private void Pintching(CCTouch touch1, CCTouch touch2)
        {
            var prevDiff    = (touch1.PreviousLocation - touch2.PreviousLocation).Length;
            var currentDiff = (touch1.Location - touch2.Location).Length;

            if (currentDiff < MINTOUCHDISTANCE)
            {
                return;
            }

            var sizeFactor = currentDiff / prevDiff;

            sizeFactor = sizeFactor - (sizeFactor - 1) / 2;

            HexMexCamera.SetZoomFactor(sizeFactor * HexMexCamera.ZoomFactor);
        }
Esempio n. 3
0
 private void Dragging(CCPoint delta)
 {
     HexMexCamera.MoveToPosition(HexMexCamera.Position - delta / HexMexCamera.ZoomFactor);
 }
Esempio n. 4
0
 protected TouchLayer(HexMexCamera hexMexCamera) : base(hexMexCamera)
 {
 }