Inheritance: MonoBehaviour
Exemplo n.º 1
0
 void button_MouseDrag(Widget source, EventArgs e)
 {
     if (MouseDrag != null)
     {
         MouseDrag.Invoke(this, (MouseEventArgs)e);
     }
 }
Exemplo n.º 2
0
    // This function is implemented from the IPointerDownHandler, and
    // so this function will be called whenever the pointer is clicked on this object.
    public void OnPointerDown(PointerEventData eventData)
    {
        MouseDrag parent = this.transform.parent.GetComponentInChildren <MouseDrag>();

        if (parent.doMove)
        {
            return;
        }
        parent.doMove = true;
        // Sets the direction variable to the axis
        // dependant on the arrow type.
        switch (axis)
        {
        case Axis.X:
            parent.dir = Vector3.right;
            break;

        case Axis.Y:
            parent.dir = Vector3.up;
            break;

        case Axis.Z:
            parent.dir = Vector3.forward;
            break;
        }
        // Sets the color of the arrow to yellow when it is clicked.
        GetComponent <Renderer>().material.color = Color.yellow;
    }
        private void CheckMouseDragged(Func <MouseState, ButtonState> getButtonState, MouseButton button)
        {
            if ((getButtonState(_currentState) == ButtonState.Pressed) &&
                (getButtonState(_previousState) == ButtonState.Pressed))
            {
                var args = new MouseEventArgs(ViewportAdapter, _gameTime.TotalGameTime, _previousState, _currentState, button);

                if (_mouseDownArgs.Button == args.Button)
                {
                    if (_dragging)
                    {
                        MouseDrag?.Invoke(this, args);
                    }
                    else
                    {
                        // Only start to drag based on DragThreshold
                        var clickMovement = DistanceBetween(args.Position, _mouseDownArgs.Position);

                        if (clickMovement > DragThreshold)
                        {
                            _dragging = true;
                            MouseDragStart?.Invoke(this, args);
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 private void Awake()
 {
     rigidbody2d     = GetComponent <Rigidbody2D>();
     mouseDrag       = GetComponent <MouseDrag>();
     spring          = GetComponent <SpringJoint2D>();
     initialPosition = transform.position;
 }
Exemplo n.º 5
0
 protected void fireMouseDrag(MouseEventArgs me)
 {
     if (MouseDrag != null)
     {
         MouseDrag.Invoke(this, me.Position.x, me.Position.y);
     }
 }
Exemplo n.º 6
0
        private void DoDragDropFromWebBrowser(DragEventArgs e, AppTile newTile)
        {
            var url      = e.Data.GetData(DataFormats.Text) as string ?? "";
            var resolver = new PathResolver(url);

            if (resolver.Type != PathType.Web && resolver.Type != PathType.UnknownProtocol)
            {
                return;
            }
            var host = new Uri(url).Host;

            _window.Activate();
            var result =
                MessageBox.Show($"Do you want to replace the current path '{newTile.Path}' with '{url}'?",
                                $"Replacing '{_tile.Text}'", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.No)
            {
                return;
            }
            var text = newTile.Text == "-" ? host : newTile.Text;

            newTile.Path = url;
            newTile.Text = text;
            Settings.SetChanged();
            MouseDrag.ResetAll();
        }
Exemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        GameObject objColliderTriggerParent = gameObject.transform.parent.gameObject;

        playerMove = objColliderTriggerParent.GetComponent <PlayerMove>();
        mouseDrag  = ArrowCube.GetComponent <MouseDrag>();
    }
Exemplo n.º 8
0
 public DisplayPanelBox(PictureBox pBox, VScrollBar vs, HScrollBar hs)
 {
     pictureBox            = pBox;
     pictureBox.MouseDown += (s, e) =>
     {
         clicking = true;
         MouseDown.Invoke(e);
     };
     pictureBox.MouseMove += (s, e) =>
     {
         if (clicking)
         {
             MouseDrag.Invoke(e);
         }
         else
         {
             MouseMove.Invoke(e);
         }
     };
     pictureBox.MouseUp += (s, e) =>
     {
         clicking = false;
         MouseUp.Invoke(e);
     };
     vScroll = vs;
     hScroll = hs;
 }
Exemplo n.º 9
0
        private void _mouseListener_MouseDrag(object sender, MouseEventArgs e)
        {
            _scene?.FireMouseDrag(e);
            MouseDrag?.Invoke(sender, e);
#if DEBUG
            Logger.Log("Mouse drag.");
#endif
        }
Exemplo n.º 10
0
    public static void DragZoom(IPlotControl control, MouseDrag drag, LockedAxes locked)
    {
        Pixel to2 = new(
            x: locked.X ? drag.From.X : drag.To.X,
            y: locked.Y ? drag.From.Y : drag.To.Y);

        control.Plot.MouseZoom(drag.InitialLimits, drag.From, to2);
        control.Refresh();
    }
Exemplo n.º 11
0
    void Start()
    {
        SwpanEnemy.PauseBool = false;
        insatce = this;

        SingleFire = true;
        rb         = GetComponent <Rigidbody2D>();
        Invoke("GunFire", AmmoFireTime);
    }
Exemplo n.º 12
0
 void Start()
 {
     ropeArr = GameObject.FindGameObjectsWithTag("rope");
     if (isHanging)
     {
         IgnoreRopeCollision();
     }
     inst = GetComponent <MouseDrag>();
 }
Exemplo n.º 13
0
 private void OnMouseUp()
 {
     if (Time.unscaledTime - _startTime > _timeout &&
         (Input.mousePosition - _startPos).sqrMagnitude > _deadZone * _deadZone)
     {
         MouseDrag?.Invoke(_startPos, Input.mousePosition);
     }
     _mouseService.MouseUp   -= OnMouseUp;
     _mouseService.MouseDown += OnMouseDown;
 }
Exemplo n.º 14
0
        /// <summary>
        /// Called by Interfacable when this Player ends an ItemStack drag.
        /// </summary>
        public void OnEndDrag(Interfacable i)
        {
            if (m_endDragDrop != null)
            {
                MouseDrag drag = new MouseDrag(m_startDragDrop.Index, m_endDragDrop.Index, m_dragButton);
                ExecuteDragCommand(drag);
            }

            m_dragButton = MouseButton.None;
        }
Exemplo n.º 15
0
 void IEventListener.ListenMouseMove(UIMouseMoveEventArgs e)
 {
     if (e.IsDragging)
     {
         MouseDrag?.Invoke(this, e);
     }
     else
     {
         MouseMove?.Invoke(this, e);
     }
 }
Exemplo n.º 16
0
	void Awake()
	{
		if( SupportMouseControl ) {
			mMouseDrag = gameObject.AddComponent<MouseDrag>();
			Rect dragArea = new Rect(0f, 0f, 200f, 150f);
			mMouseDrag.DragArea = dragArea;
			mMouseDrag.MessageTarget = gameObject;
		}
		if( SupportKeyboardControl ) {
			mKeyboard = gameObject.AddComponent<KeyBoardController>();
		}	
	}
Exemplo n.º 17
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        // Otherwise if the script isn't there, then check for a MouseDrag script.
        MouseDrag mouseDrag = eventData.pointerDrag.transform.GetComponent <MouseDrag>();

        if (mouseDrag != null && !mouseDrag.doMove)
        {
            // Sets the mode of the MouseDrag to drag anywhere on the xz plane.
            mouseDrag.doMove = true;
            mouseDrag.dir    = null;
        }
    }
Exemplo n.º 18
0
    void Start()
    {
        instance   = this;
        mainCam    = Camera.main;
        BallComp   = BallObj.GetComponent <Ball>();
        DragComp   = GetComponent <MouseDrag>();
        lineRender = GetComponent <LineRenderer>();

        TargetDecalObj.SetActive(false);

        SetCamera(EPlayerState.Prepare);
    }
Exemplo n.º 19
0
        public TaskContainer()
        {
            InitializeComponent();

            foreach (FrameworkElement tb in Stack1.Children)
            {
                var mouseDrag    = new MouseDrag(tb);
                var betweenDrags = new BetweenDrag(mouseDrag,
                                                   new[] { (Panel)Stack1, (Panel)Stack2, (Canvas)Canvas1 });
            }

            MainPanel = new Panel[] { Stack1, Stack2, Canvas1 };
        }
Exemplo n.º 20
0
 void Awake()
 {
     if (SupportMouseControl)
     {
         mMouseDrag = gameObject.AddComponent <MouseDrag>();
         Rect dragArea = new Rect(0f, 0f, 200f, 150f);
         mMouseDrag.DragArea      = dragArea;
         mMouseDrag.MessageTarget = gameObject;
     }
     if (SupportKeyboardControl)
     {
         mKeyboard = gameObject.AddComponent <KeyBoardController>();
     }
 }
Exemplo n.º 21
0
        private void Button_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            if (!MouseDrag.IsBeingPerformed)
            {
                return;
            }
            var pos = e.GetPosition(this);

            if (!MouseDrag.HasMoved(pos))
            {
                return;
            }
            new MoveTileCommand().Execute(MouseDrag.LastSender._tile);
            MouseDrag.ResetPosition();
        }
Exemplo n.º 22
0
        public virtual void Update(Game context)
        {
            #region Fire Mouse Events
            int mouseX = context.MouseX;
            int mouseY = context.MouseY;

            if ((mouseX != mouseLastX || mouseY != mouseLastY) && PointWithin(mouseX, mouseY, TopLeft, BottomRight))
            {
                MouseMove?.Invoke(mouseX, mouseY);
                if (context.GetMouse(Mouse.Any).Down)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        Mouse current = (Mouse)i;
                        if (context.GetMouse(current).Down)
                        {
                            MouseDrag?.Invoke(mouseX, mouseY, current);
                        }
                    }
                }
            }
            mouseLastX = mouseX;
            mouseLastY = mouseY;

            for (int i = 0; i < 3; i++)
            {
                Mouse current = (Mouse)i;
                if (context.GetMouse(current).Down)
                {
                    MouseDown?.Invoke(mouseX, mouseY, current);
                }
                if (context.GetMouse(current).Up)
                {
                    MouseUp?.Invoke(mouseX, mouseY, current);
                }
                if (context.GetMouse(current).Pressed)
                {
                    MousePress?.Invoke(mouseX, mouseY, current);
                }
            }
            #endregion Fire Mouse Events
        }
Exemplo n.º 23
0
        private void DoDragDropFromFileExplorer(DragEventArgs e, AppTile newTile)
        {
            var paths = e.Data.GetData(DataFormats.FileDrop) as string[];
            var path  = paths?.FirstOrDefault() ?? "";

            _window.Activate();
            var result =
                MessageBox.Show($"Do you want to replace the current path '{newTile.Path}' with '{path}'?",
                                $"Replacing '{_tile.Text}'", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.No)
            {
                return;
            }
            var text = newTile.Text == "-" ? System.IO.Path.GetFileNameWithoutExtension(path) : newTile.Text;

            newTile.Path = path;
            newTile.Text = text;
            Settings.SetChanged();
            MouseDrag.ResetAll();
        }
Exemplo n.º 24
0
        /// <summary>
        /// Interprets the Drag this Player just made and runs any operations that should happen here.
        /// </summary>
        private void ExecuteDragCommand(MouseDrag drag)
        {
            //We can now use guard clauses to simplify the logic for this mess dramatically! :D

            if (drag.Button == MouseButton.None)
            {
                return;
            }

            switch (drag.Button)
            {
            case MouseButton.Left:
                InventoryManager.OnItemStackMoved(m_startDragDrop.Inventory, drag.Start, m_endDragDrop.Inventory, drag.End);
                break;

            case MouseButton.Right:
                InventoryManager.OnItemStackSplit(m_startDragDrop.Inventory, drag.Start, 0.5F, m_endDragDrop.Inventory, drag.End);
                break;

            case MouseButton.Unknown:
                Debug.LogError("Player is attempting to make a mouse drag with a button that couldn't be identified!");
                return;
            }
        }
Exemplo n.º 25
0
        private void DoDragDropFromTileToTile(ITile newTile, ITile oldTile)
        {
            _window.Activate();
            var result = MessageBox.Show($"Do you want to replace '{newTile.Text}' with '{oldTile.Text}'?",
                                         "Replacing", MessageBoxButton.YesNo, MessageBoxImage.Question);

            MouseDrag.ResetAll();
            if (result == MessageBoxResult.No)
            {
                return;
            }
            Settings.SetChanged();
            int tempCol = newTile.Column, tempRow = newTile.Row;
            var tempButton = newTile.Button;

            // update the buttons' references
            oldTile.Button.Update(newTile);
            tempButton.Update(oldTile);
            // update the tiles' saved location
            newTile.Move(oldTile.Column, oldTile.Row);
            oldTile.Move(tempCol, tempRow);

            MouseDrag.ResetAll();
        }
Exemplo n.º 26
0
 internal void FireMouseDrag(MouseEventArgs e)
 {
     OnMouseDrag(e);
     MouseDrag?.Invoke(this, e);
 }
Exemplo n.º 27
0
        private void TileViewer_MouseMove(object sender, MouseEventArgs e)
        {
            Point p    = e.GetPosition(MainGrid);
            int   newX = Convert.ToInt32(Math.Floor(p.X / TileSize));
            int   newY = Convert.ToInt32(Math.Floor(p.Y / TileSize));

            if (newX < 0 || newX >= ColCount || newY < 0 || newY >= RowCount)
            {
                if (!mouseDown)
                {
                    Selection.Visibility = Visibility.Hidden;
                }
                mouseOver = false;
                return;
            }
            Selection.Visibility = Visibility.Visible;
            mouseOver            = true;
            if (System.Windows.Input.Mouse.LeftButton != MouseButtonState.Pressed &&
                System.Windows.Input.Mouse.MiddleButton != MouseButtonState.Pressed &&
                System.Windows.Input.Mouse.RightButton != MouseButtonState.Pressed)
            {
                mouseDown = false;
                panning   = false;
            }
            TileOverX = newX;
            TileOverY = newY;
            OverX     = p.X / TileSize;
            OverY     = p.Y / TileSize;

            if (panning)
            {
                Point q = e.GetPosition(Parent);
                Parent.ScrollToHorizontalOffset(PanningOriginX + PanningStartX - q.X);
                Parent.ScrollToVerticalOffset(PanningOriginY + PanningStartY - q.Y);
            }
            else if (mouseDown)
            {
                Selection.SetValue(Grid.RowProperty, Math.Min(TileOverY, TileClickY));
                Selection.SetValue(Grid.ColumnProperty, Math.Min(TileOverX, TileClickX));
                Selection.SetValue(Grid.RowSpanProperty, Math.Abs(TileOverY - TileClickY) + 1);
                Selection.SetValue(Grid.ColumnSpanProperty, Math.Abs(TileOverX - TileClickX) + 1);

                var a = new TileViewerMouseEventArgs()
                {
                    TileClickX = TileClickX,
                    TileClickY = TileClickY,
                    PosTileX   = TileOverX,
                    PosTileY   = TileOverY,
                    ClickX     = ClickX,
                    ClickY     = ClickY,
                    PosX       = OverX,
                    PosY       = OverY
                };
                MouseDrag?.Invoke(this, a);
            }
            else
            {
                Selection.SetValue(Grid.RowProperty, TileOverY);
                Selection.SetValue(Grid.ColumnProperty, TileOverX);
                Selection.SetValue(Grid.RowSpanProperty, 1);
                Selection.SetValue(Grid.ColumnSpanProperty, 1);
            }
        }
Exemplo n.º 28
0
 private void Panel_MouseMove(object sender, MouseEventArgs e)
 {
     mouseCurrentPos = e.Location;
     MouseDrag?.Invoke(mouseDownPos, mouseCurrentPos);
 }
Exemplo n.º 29
0
 private void Start()
 {
     _mouseDrag = new MouseDrag(StartMove, FinishMove);
     GameManager.Instance.RegisterGameOver(GameOver);
     GameManager.Instance.RegisterRestart(Restart);
 }
        //
        // Get available screens
        //
        System.Windows.Forms.Screen[] GetAvailableScreens()
        {
            System.Windows.Forms.Screen[] screens;

            // Windows 8 or greater needed for the multiscreen absolute mode
            if (VersionHelper.IsWindows8OrGreater() || config.OutputMode == Configuration.OutputModes.Digitizer)
            {
                screens = System.Windows.Forms.Screen.AllScreens;
            }
            else
            {
                screens = new System.Windows.Forms.Screen[] { System.Windows.Forms.Screen.PrimaryScreen }
            };
            return(screens);
        }

        #region Canvas stuff

        //
        // Create canvas elements
        //
        void CreateCanvasElements()
        {
            //
            // Screen map canvas
            //
            // Clear canvas
            canvasScreenMap.Children.Clear();


            // Monitor rectangles
            rectangleMonitors = new Rectangle[16];
            for (int i = 0; i < 16; i++)
            {
                rectangleMonitors[i] = new Rectangle
                {
                    Width           = 10,
                    Height          = 10,
                    Stroke          = Brushes.Black,
                    StrokeThickness = 1.0,
                    Fill            = Brushes.Transparent,
                    Visibility      = Visibility.Hidden
                };
                canvasScreenMap.Children.Add(rectangleMonitors[i]);
            }

            //
            // Desktop area rectangle
            //
            rectangleDesktop = new Rectangle
            {
                Stroke          = Brushes.Black,
                StrokeThickness = 2.0,
                Fill            = Brushes.Transparent
            };
            canvasScreenMap.Children.Add(rectangleDesktop);


            //
            // Screen map area rectangle
            //
            Brush brushScreenMap = new SolidColorBrush(Color.FromArgb(50, 20, 20, 20));

            rectangleScreenMap = new Rectangle
            {
                Stroke          = Brushes.Black,
                StrokeThickness = 2.0,
                Fill            = brushScreenMap
            };
            canvasScreenMap.Children.Add(rectangleScreenMap);

            //
            // Screen aspect ratio text
            //
            textScreenAspectRatio = new TextBlock
            {
                Text       = "",
                Foreground = Brushes.Black,
                FontSize   = 13,
                FontWeight = FontWeights.Bold
            };
            canvasScreenMap.Children.Add(textScreenAspectRatio);



            //
            // Tablet area canvas
            //
            //
            // Clear
            canvasTabletArea.Children.Clear();

            //
            // Tablet full area polygon
            //
            polygonTabletFullArea = new Polygon
            {
                Stroke          = new SolidColorBrush(Color.FromRgb(100, 100, 100)),
                StrokeThickness = 2.0,
                Points          = new PointCollection
                {
                    new Point(0, 0),
                    new Point(0, 0),
                    new Point(0, 0),
                    new Point(0, 0)
                },
            };
            canvasTabletArea.Children.Add(polygonTabletFullArea);

            //
            // Tablet area polygon
            //
            polygonTabletArea = new Polygon
            {
                Stroke          = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
                Fill            = new SolidColorBrush(Color.FromArgb(50, 20, 20, 20)),
                StrokeThickness = 2.0,
                Points          = new PointCollection
                {
                    new Point(0, 0),
                    new Point(0, 0),
                    new Point(0, 0),
                    new Point(0, 0)
                },
            };
            canvasTabletArea.Children.Add(polygonTabletArea);


            //
            // Tablet area arrow polygon
            //
            polygonTabletAreaArrow = new Polygon
            {
                Fill   = new SolidColorBrush(Color.FromArgb(50, 20, 20, 20)),
                Points = new PointCollection
                {
                    new Point(0, 0),
                    new Point(0, 0),
                    new Point(0, 0)
                },
            };
            canvasTabletArea.Children.Add(polygonTabletAreaArrow);


            //
            // Tablet area aspect ratio text
            //
            textTabletAspectRatio = new TextBlock
            {
                Text       = "",
                Foreground = Brushes.Black,
                FontSize   = 13,
                FontWeight = FontWeights.Bold
            };
            canvasTabletArea.Children.Add(textTabletAspectRatio);



            //
            // Canvas mouse drag
            //
            mouseDrag = new MouseDrag();
        }

        //
        // Update canvas elements
        //
        void UpdateCanvasElements()
        {
            UpdateScreenMapCanvas();
            UpdateTabletAreaCanvas();
        }

        //
        // Update screen map canvas elements
        //
        void UpdateScreenMapCanvas()
        {
            // Canvas element scaling
            double scaleX = (canvasScreenMap.ActualWidth - 2) / config.DesktopSize.Width;
            double scaleY = (canvasScreenMap.ActualHeight - 2) / config.DesktopSize.Height;
            double scale  = scaleX;

            if (scaleX > scaleY)
            {
                scale = scaleY;
            }

            // Centered offset
            double offsetX = canvasScreenMap.ActualWidth / 2.0 - config.DesktopSize.Width * scale / 2.0;
            double offsetY = canvasScreenMap.ActualHeight / 2.0 - config.DesktopSize.Height * scale / 2.0;


            // Full desktop area
            rectangleDesktop.Width  = config.DesktopSize.Width * scale;
            rectangleDesktop.Height = config.DesktopSize.Height * scale;
            Canvas.SetLeft(rectangleDesktop, offsetX);
            Canvas.SetTop(rectangleDesktop, offsetY);


            // Screen map area
            rectangleScreenMap.Width  = config.ScreenArea.Width * scale;
            rectangleScreenMap.Height = config.ScreenArea.Height * scale;
            Canvas.SetLeft(rectangleScreenMap, offsetX + config.ScreenArea.X * scale);
            Canvas.SetTop(rectangleScreenMap, offsetY + config.ScreenArea.Y * scale);

            // Screen aspect ratio text
            textScreenAspectRatio.Text = Utils.GetNumberString(config.ScreenArea.Width / config.ScreenArea.Height, "0.###") + ":1";
            Canvas.SetLeft(textScreenAspectRatio, offsetX +
                           (config.ScreenArea.X + config.ScreenArea.Width / 2.0) * scale -
                           textScreenAspectRatio.ActualWidth / 2.0
                           );
            Canvas.SetTop(textScreenAspectRatio, offsetY +
                          (config.ScreenArea.Y + config.ScreenArea.Height / 2.0) * scale -
                          textScreenAspectRatio.ActualHeight / 2.0
                          );



            // Screens
            System.Windows.Forms.Screen[] screens = GetAvailableScreens();

            // Monitor minimums
            double minX = 99999;
            double minY = 99999;

            foreach (System.Windows.Forms.Screen screen in screens)
            {
                if (screen.Bounds.X < minX)
                {
                    minX = screen.Bounds.X;
                }
                if (screen.Bounds.Y < minY)
                {
                    minY = screen.Bounds.Y;
                }
            }


            // Monitor rectangles
            int rectangeIndex = 0;

            foreach (System.Windows.Forms.Screen screen in screens)
            {
                double x = screen.Bounds.X - minX;
                double y = screen.Bounds.Y - minY;

                rectangleMonitors[rectangeIndex].Visibility = Visibility.Visible;
                rectangleMonitors[rectangeIndex].Width      = screen.Bounds.Width * scale;
                rectangleMonitors[rectangeIndex].Height     = screen.Bounds.Height * scale;
                Canvas.SetLeft(rectangleMonitors[rectangeIndex], offsetX + x * scale);
                Canvas.SetTop(rectangleMonitors[rectangeIndex], offsetY + y * scale);

                rectangeIndex++;
                if (rectangeIndex >= 16)
                {
                    break;
                }
            }
        }

        //
        // Update tablet area canvas elements
        //
        void UpdateTabletAreaCanvas()
        {
            double fullWidth  = config.TabletFullArea.Width;
            double fullHeight = config.TabletFullArea.Height;

            // Canvas element scaling
            double scaleX = (canvasTabletArea.ActualWidth - 2) / fullWidth;
            double scaleY = (canvasTabletArea.ActualHeight - 2) / fullHeight;
            double scale  = scaleX;

            if (scaleX > scaleY)
            {
                scale = scaleY;
            }


            double offsetX = canvasTabletArea.ActualWidth / 2.0 - fullWidth * scale / 2.0;
            double offsetY = canvasTabletArea.ActualHeight / 2.0 - fullHeight * scale / 2.0;

            //
            // Tablet full area
            //
            Point[] corners = config.TabletFullArea.Corners;
            for (int i = 0; i < 4; i++)
            {
                Point p = corners[i];
                p.X *= scale;
                p.Y *= scale;
                p.X += config.TabletFullArea.X * scale + offsetX;
                p.Y += config.TabletFullArea.Y * scale + offsetY;
                polygonTabletFullArea.Points[i] = p;
            }


            //
            // Tablet area
            //
            corners = config.TabletArea.Corners;
            for (int i = 0; i < 4; i++)
            {
                Point p = corners[i];
                p.X *= scale;
                p.Y *= scale;
                p.X += config.TabletArea.X * scale + offsetX;
                p.Y += config.TabletArea.Y * scale + offsetY;
                polygonTabletArea.Points[i] = p;
            }

            //
            // Tablet area arrow
            //
            polygonTabletAreaArrow.Points[0] = new Point(
                offsetX + config.TabletArea.X * scale,
                offsetY + config.TabletArea.Y * scale
                );

            polygonTabletAreaArrow.Points[1] = new Point(
                offsetX + corners[2].X * scale + config.TabletArea.X * scale,
                offsetY + corners[2].Y * scale + config.TabletArea.Y * scale
                );

            polygonTabletAreaArrow.Points[2] = new Point(
                offsetX + corners[3].X * scale + config.TabletArea.X * scale,
                offsetY + corners[3].Y * scale + config.TabletArea.Y * scale
                );


            //
            // Tablet area aspect ratio text
            //
            textTabletAspectRatio.Text = Utils.GetNumberString(config.TabletArea.Width / config.TabletArea.Height, "0.###") + ":1";
            Canvas.SetLeft(textTabletAspectRatio, offsetX + (config.TabletArea.X) * scale - textTabletAspectRatio.ActualWidth / 2.0);
            Canvas.SetTop(textTabletAspectRatio, offsetY + (config.TabletArea.Y) * scale - textTabletAspectRatio.ActualHeight / 2.0);
        }
Exemplo n.º 31
0
 void Start()
 {
     mouseDrag = projectile.GetComponent <MouseDrag>();
     spring    = projectile.GetComponent <SpringJoint2D>();
 }