private void CheckClickOutside()
 {
     if (MouseUtil.ClickOutside(userMenu.ClientRect))
     {
         isPopup = false;
     }
 }
Пример #2
0
 private void gridTitleBar_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (TitleBarMouseLeftUp != null)
     {
         TitleBarLeftUp(e);
     }
     else
     {
         mousePositionYStart = double.NaN;
     }
     if (moving && parentWindow.WindowState == WindowState.Normal)
     {
         System.Drawing.Point mousePosition = MouseUtil.GetMousePosition();
         List <ScreenInfo>    screens       = ScreenUtil.AllScreens;
         foreach (ScreenInfo siItem in screens)
         {
             if (mousePosition.X >= siItem.Bounds.X && mousePosition.X <= siItem.Bounds.X + siItem.Bounds.Size.Width &&
                 mousePosition.Y <= siItem.Bounds.Y + this.ActualHeight / 2)
             {
                 parentWindow.WindowState = WindowState.Maximized;
             }
         }
         moving = false;
     }
 }
Пример #3
0
Файл: Form1.cs Проект: sgww/cozy
        private void InitCallback()
        {
            MouseCallback = (code, wparam, lparam) =>
            {
                if ((int)wparam == MouseUtil.WM_MOUSEMOVE || (int)wparam == MouseUtil.WM_NCMOUSEMOVE)
                {
                    var mhs = (MouseUtil.MouseHookStruct)Marshal.PtrToStructure(lparam, typeof(MouseUtil.MouseHookStruct));

                    x = mhs.pt.x;
                    y = mhs.pt.y;
                    MouseUtil.InvalidateMouseWindow(x, y);

                    label1.Text = string.Format("x : {0} y : {1}", mhs.pt.x, mhs.pt.y);
                }
                return(IntPtr.Zero);
            };

            IPCCallback = (lpString, dwPid) =>
            {
                if (dwPid != 0 && dwPid != OutputUtil.GetCurrentProcessId() && dwPid == OutputUtil.GetMouseWindowPid(x, y))
                {
                    string str = Marshal.PtrToStringAuto(lpString);
                    syncContext.Post((o) =>
                    {
                        this.label2.Text = o.ToString();
                    }, str);
                }
                return(0);
            };
        }
Пример #4
0
 public static void smethod_9(IntPtr intptr_0, int int_0, int int_1)
 {
     MouseUtil.SetForegroundWindow(intptr_0);
     MouseUtil.SetCursorPos(int_0, int_1);
     MouseUtil.mouse_event(32770, int_0, int_1, 0, IntPtr.Zero);
     MouseUtil.mouse_event(32772, int_0, int_1, 0, IntPtr.Zero);
 }
Пример #5
0
 public void Update()
 {
     if (fadeTexture != null)
     {
         deltaFade += Time.deltaTime;
         if (deltaFade > 0.5f)
         {
             fadeTexture = null;
         }
     }
     if (BannerManager.Instance.Count() > 0)
     {
         Vector2 point = GlobalVars.Instance.PixelToGUIPoint(MouseUtil.ScreenToPixelPoint(Input.mousePosition));
         if (!GlobalVars.Instance.ToGUIRect(crdBanner).Contains(point))
         {
             deltaTimeChangeBanner += Time.deltaTime;
             if (deltaTimeChangeBanner > deltaTimeChangeBannerMax)
             {
                 int num = id;
                 deltaTimeChangeBanner = 0f;
                 id++;
                 if (id >= BannerManager.Instance.Count())
                 {
                     id = 0;
                 }
                 if (id != num)
                 {
                     OnChangeBanner(num);
                 }
             }
         }
     }
 }
Пример #6
0
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            MouseClickEvent clickEvent = MouseUtil.GetMousePositionInWorld();
            if (clickEvent.hitGameObject.tag == "Intractable")
            {
                target = clickEvent.hitGameObject;
                target.GetComponent <Collider>().enabled = false;
                Debug.Log("Picked Up " + target.name);
            }
        }
        if (Input.GetMouseButtonUp(0))
        {
            if (target)
            {
                MouseClickEvent clickEvent = MouseUtil.GetMousePositionInWorld();
                target.transform.position = clickEvent.point;
                target.GetComponent <Collider>().enabled = true;
                Debug.Log("Dropped " + target.name);
                target = null;
            }
        }

        if (target != null)
        {
            MouseClickEvent clickEvent = MouseUtil.GetMousePositionInWorld();
            target.transform.position = clickEvent.point + new Vector3(0, 0.2f, 0);
        }
    }
Пример #7
0
    void Update()
    {
        // Dash
        if (Input.GetKeyDown(KeyCode.Space))
        {
            // Positions
            Vector3 mousepos  = MouseUtil.GetMousePosition();
            Vector3 playerpos = transform.position;

            // Ignore z
            mousepos.z  = 0;
            playerpos.z = 0;

            // Direction
            Vector2 dashDir = (mousepos - playerpos).normalized;

            // Dash
            motion.jumpForce = dashDir * dashPower;
            motion.Jump();

            transform.DORotate(new Vector3(0, 0, 360), 1);

            // Tween down
            this.tt("DashSlowDown").ttReset().ttAdd(0.1f).ttLoop(0.2f, (ttHandler t) =>
            {
                motion.currentJump = Vector2.Lerp(motion.currentJump, Vector2.zero, t.deltaTime);
            });
        }
    }
Пример #8
0
 public static void ctrl_(byte byte_0)
 {
     MouseUtil.keybd_event(17, 0, 0, 0);
     MouseUtil.keybd_event(byte_0, 0, 0, 0);
     MouseUtil.keybd_event(17, 0, MouseUtil.uint_0, 0);
     MouseUtil.keybd_event(byte_0, 0, MouseUtil.uint_0, 0);
 }
Пример #9
0
    public static void smethod_11(char char_0)
    {
        byte num = MouseUtil.smethod_14(char_0);

        MouseUtil.keybd_event(num, 0, 0, 0);
        MouseUtil.keybd_event(num, 0, MouseUtil.uint_0, 0);
    }
Пример #10
0
 private void TabItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (MouseUtil.IsOver(this, "Border") && null != SharedData)
     {
         SharedData.AllowTabDrag = true;
         e.Handled = false;
     }
 }
Пример #11
0
        private void RightClick(Shape target)
        {
            Point pt = new Point(
                PpOperations.PointsToScreenPixelsX(target.Left + target.Width / 2),
                PpOperations.PointsToScreenPixelsY(target.Top + target.Height / 2));

            MouseUtil.SendMouseRightClick(pt.X, pt.Y);
        }
Пример #12
0
 public void method_0(IntPtr intptr_0, string string_0)
 {
     for (int i = 0; i < string_0.Length; i++)
     {
         Thread.Sleep(10);
         MouseUtil.SetForegroundWindow(intptr_0);
         SendKeys.SendWait(string_0.Substring(i, 1));
     }
 }
        private void CheckForHover()
        {
            Vector2 worldPos =
                MouseUtil.ScreenToWorldPosition(Raylib.GetMousePosition() / MoonVars.RenderScale, _camera);

            foreach (Planet p in Entities.OfType <Planet>())
            {
                p.Selected = p.Collides(worldPos);
            }
        }
    private void Start()
    {
        // Get direction based on mouse position.
        Plane   movementPlane = new Plane(transform.position, transform.position + transform.up, transform.position + transform.right);
        Vector3 mousePoint    = MouseUtil.ProjectMousePositionOntoPlane(movementPlane);

        direction   = Vector3.Normalize(mousePoint - transform.position);
        direction   = Quaternion.Euler(0, 0, Random.Range(-spread, spread)) * direction;
        wiggleNoise = new PerlinNoise(0.5f);
    }
Пример #15
0
Файл: Form1.cs Проект: sgww/cozy
        private void Form1_Load(object sender, EventArgs e)
        {
            InitCallback();
            OutputUtil.SetIPCCallback(IPCCallback);
            OutputUtil.SetCBTHook();
            OutputUtil.StartPipe();
            MouseUtil.SetMouseHook(MouseCallback);

            syncContext = SynchronizationContext.Current;
        }
Пример #16
0
        public void TryRemoveNote()
        {
            var        iconsUnderMouse = MouseUtil.IconsUnderMouse(timeline);
            TargetIcon targetIcon      = iconsUnderMouse.Length > 0 ? iconsUnderMouse[0] : null;

            if (targetIcon)
            {
                targetIcon.OnTryRemove();
            }
        }
        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var mouse        = MouseUtil.GetMousePosition();
            var compensatedX = mouse.X - SystemInformation.VirtualScreen.Left; // Compensate for potential negative position on multi-monitor
            var compensatedY = mouse.Y - SystemInformation.VirtualScreen.Top;  // Compensate for potential negative position on multi-monitor
            var rgb          = BitmapUtil.PixelToRgb(FreezeFrame.Instance.BitmapSource, compensatedX, compensatedY);

            _vm.RefreshFromRgb(rgb);
            ColorPicked?.Invoke(this, EventArgs.Empty);
            Close();
        }
Пример #18
0
 public static void smethod_8(string string_0, int int_0)
 {
     for (int i = 0; i < string_0.Length; i++)
     {
         if (int_0 != 0)
         {
             Thread.Sleep(int_0);
         }
         MouseUtil.smethod_11(string_0.Substring(i, 1).ToCharArray()[0]);
     }
 }
Пример #19
0
        /// <summary>
        /// Event raised on closed window.
        /// </summary>
        protected void OnClosed(object sender, EventArgs e)
        {
            KeyUtil.Source.RemoveHook(KeyUtil.HwndHook);
            KeyUtil.Source = null;
            KeyUtil.UnregisterKey(this);
            MouseUtil.Stop();

            #if DEBUG
            ConsoleUtil.Hide();
            #endif
        }
Пример #20
0
    public override void Init(Transform tgtTransform = null)
    {
        //_marume = 10f;//Random.value * 3f;
        // if(Random.value<0.5f) _marume = 1000f;
        //Debug.Log("Init");
        _property = new MaterialPropertyBlock();
        _renderer = GetComponent <MeshRenderer>();

        _property.SetFloat("_ClipTh", 0.5f + Random.value * 0.4f);
        _property.SetFloat("_Naname", 30f + Random.value * 20f);


        _zRad    = Random.value * Mathf.PI * 2f;
        _zRadSpd = Random.value * 0.3f;

        _mesh = MeshUtil.CloneMesh(_meshSrc, "test");
        //_mesh = MeshUtil.GetNewMesh(_mesh,MeshTopology.Lines);

        _catmullResolution = Mathf.FloorToInt(3 + 2 * Random.value); //Params.Instance.catmullResolution;

        if (Random.value < 0.2f)
        {
            _catmullResolution = 3;
        }


        GetComponent <MeshFilter>().mesh = _mesh;

        //あとでやる

        /*
         * if(Params.Instance){
         *  _speed = 0.05f + Params.Instance.brushSpeedRandomness * Random.value;
         *  _masatsu = 0.1f + Params.Instance.brushMasatsuRandomness * Random.value;
         *
         * }else{
         *  _speed = 0.05f + 0.2f * Random.value;
         *  _masatsu = 0.1f + 0.8f * Random.value;
         * }*/
        _speed   = 0.02f + 0.10f * Random.value;
        _masatsu = 0.5f + 0.45f * Random.value;

        _mouse = new MouseUtil(
            _speed,   //speed
            _masatsu, //masatsu
            _catmullResolution,
            tgtTransform
            );
        _brushWidth = 0.03f + 0.10f * Random.value;
        //if(Random.value<0.5f) _brushWidth = 0.02f + 0.07f * Random.value;
        //_vertices = _mesh.vertices;
        //_indices = _mesh.triangles;
        //Debug.Log(_mesh.vertexCount);
    }
Пример #21
0
 private void DragItem()
 {
     if (IsDragging)
     {
         Vector2 vector    = GlobalVars.Instance.PixelToGUIPoint(MouseUtil.ScreenToPixelPoint(Input.mousePosition));
         Rect    position  = new Rect(vector.x, vector.y, 90f, 90f);
         Rect    position2 = new Rect(vector.x + 3f, vector.y + 3f, 84f, 84f);
         GUI.Box(position, string.Empty, "BoxFadeBlue");
         GUI.Box(position2, string.Empty, "LineBoxBlue");
         TextureUtil.DrawTexture(position2, dragItem.Template.CurIcon(), ScaleMode.ScaleToFit);
     }
 }
Пример #22
0
 public void method_1(IntPtr intptr_0, string string_0, int int_0, int int_1)
 {
     for (int i = 0; i < string_0.Length; i++)
     {
         Thread.Sleep(200);
         MouseUtil.SetForegroundWindow(intptr_0);
         MouseUtil.SetCursorPos(int_0, int_1);
         MouseUtil.mouse_event(32770, int_0, int_1, 0, IntPtr.Zero);
         MouseUtil.mouse_event(32772, int_0, int_1, 0, IntPtr.Zero);
         SendKeys.SendWait(string_0.Substring(i, 1));
     }
 }
Пример #23
0
	void Start () {
		portal1 = Instantiate (portal1Prefab); //Load the two portals
		portal2 = Instantiate (portal2Prefab);
		laserLine = laser.GetComponent<LineRenderer> (); //Load the line renderer for the portal gun's lasers
		portalGunAnimator = portalGunObj.GetComponent<Animator> (); //Load the animator for the portal gun

		camFov = Camera.main.fieldOfView; //Initial Fov to zoom/reset
		camController = GetComponent<CameraController> ();
		initMouseSensitivity = camController.mouseSensitivity;
		mouse = GetComponent<MouseUtil>();
		rb = GetComponent<Rigidbody> ();
	}
Пример #24
0
    public static void smethod_13(int int_0, int int_1, int int_2)
    {
        MouseUtil.SetCursorPos(int_0, int_1);
        int int2 = (int_2 - int_0) / 9;

        MouseUtil.mouse_event(32770, int_0, int_1, 0, IntPtr.Zero);
        for (int i = 0; i < int2 + 1; i++)
        {
            MouseUtil.SetCursorPos(int_0 + i * 9, int_1);
            Thread.Sleep(20);
        }
        MouseUtil.mouse_event(32772, int_2, int_1, 0, IntPtr.Zero);
    }
Пример #25
0
        private void PlaceHome()
        {
            Raylib.PlaySound(AssetManager.GetSound("placeHome"));
            GameState.CurrentPhase = EGamePhase.Expanding;

            Vector2i worldPos = new Vector2i(MouseUtil.ScreenToWorldPosition(_mouseCursor.Position, _camera));

            Entities.Add(new HomePlanet(
                             worldPos.X,
                             worldPos.Y,
                             10
                             ));
        }
Пример #26
0
        private void TryToggleSelection()
        {
            var        iconsUnderMouse = MouseUtil.IconsUnderMouse(notesLayer);
            TargetIcon iconUnderMouse  = iconsUnderMouse.Length > 0 ? iconsUnderMouse[0] : null;

            if (iconUnderMouse && iconUnderMouse.isSelected)
            {
                iconUnderMouse.TryDeselect();
            }
            else if (iconUnderMouse && !iconUnderMouse.isSelected)
            {
                iconUnderMouse.TrySelect();
            }
        }
    void Start()
    {
        _mesh = MeshUtil.CloneMesh(_srcMesh, "test");
        //_mesh = MeshUtil.GetNewMesh(_mesh,MeshTopology.Lines);

        GetComponent <MeshFilter>().mesh = _mesh;

        _mouse     = new MouseUtil(0.1f + 0.1f * Random.value, 0.8f + 0.1f * Random.value, 3, null);
        _vertices  = _mesh.vertices;
        _binormals = new Vector3[_mesh.normals.Length];

        for (int i = 0; i < _vertices.Length; i++)
        {
            int idxX = i % 21;
            int idxY = Mathf.FloorToInt((float)i / 21f);

            float rx = (float)idxX / 20f;
            float ry = (float)idxY / 20f;

            _vertices[i] = new Vector3(
                1f * Mathf.Cos(-rx * Mathf.PI * 2f + Mathf.PI * 0.5f),
                1f * Mathf.Sin(-rx * Mathf.PI * 2f + Mathf.PI * 0.5f),
                ry
                );
        }
        _mesh.vertices = _vertices;
        _mesh.RecalculateNormals();
        _mesh.RecalculateTangents();

        _normals  = _mesh.normals;
        _tangents = _mesh.tangents;
        //_tangents   = new Vector3[_mesh.tangents.Length];
        var tangents = _mesh.tangents;


        /*
         * for(int i=0;i<_normals.Length;i++){
         *  //_normals[i] =
         *  var t = tangents[i];
         *  _tangents[i] = new Vector3(
         *      t.x,t.y,t.z
         *  );
         *  var tangent = tangents[i];
         *  var normal = _normals[i];
         *
         *  Debug.Log(i + " _ " + _normals.Length);
         *  _binormals[i] = Vector3.Cross(tangent, normal);
         * }*/
    }
Пример #28
0
 public static void smethod_10(string string_0, int int_0, IntPtr intptr_0, int int_1, int int_2)
 {
     for (int i = 0; i < string_0.Length; i++)
     {
         if (int_0 != 0)
         {
             Thread.Sleep(int_0);
         }
         MouseUtil.SetForegroundWindow(intptr_0);
         MouseUtil.SetCursorPos(int_1, int_2);
         MouseUtil.mouse_event(32770, int_1, int_2, 0, IntPtr.Zero);
         MouseUtil.mouse_event(32772, int_1, int_2, 0, IntPtr.Zero);
         MouseUtil.smethod_11(char.Parse(string_0.Substring(i, 1)));
     }
 }
Пример #29
0
    void Update()
    {
        Vector3 mousepos = MouseUtil.GetMousePosition();

        mousepos.z = -9;

        transform.position = mousepos;


        if (rotateUponOrigin)
        {
            Vector3 source = mousepos - origin.position;
            float   angle  = Mathf.Atan2(source.y, source.x) * Mathf.Rad2Deg;
            transform.rotation = Quaternion.Euler(0, 0, angle);
        }
    }
Пример #30
0
 private void UserControl_MouseMove(object sender, MouseEventArgs e)
 {
     if (mousePositionYStart != double.NaN &&
         Mouse.LeftButton == MouseButtonState.Pressed &&
         parentWindow.WindowState == WindowState.Maximized)
     {
         System.Drawing.Point mousePosition = MouseUtil.GetMousePosition();
         double delta = mousePositionYStart - mousePosition.Y;
         if (delta < -5)
         {
             Maximize_EventHandler(sender, e);
             parentWindow.Left = mousePosition.X - this.ActualWidth / 2;
             parentWindow.Top  = mousePosition.Y - titleBar.ActualHeight / 2;
             parentWindow.DragMove();
         }
     }
 }
Пример #31
0
    void Update()
    {
        // Check for movement inputs.
        if (Input.GetMouseButtonDown(1) && !EventSystem.current.IsPointerOverGameObject())
        {
            MouseClickEvent mouseClick = MouseUtil.GetMousePositionInWorld();
            targetPosition = mouseClick.point;
            SetMovementMarker(targetPosition);

            if (mouseClick.hitGameObject.tag == "Intractable")
            {
                // End old interaction
                if (interactedObject != null)
                {
                    interactedObject.EndInteraction();
                }

                // Interact with object
                interactedObject = mouseClick.hitGameObject.gameObject.GetComponent <Interactable>();
                interactedObject.SetInteraction(agentController);
            }
            else
            {
                agentController.MoveToPosition(targetPosition);
                if (interactedObject)
                {
                    // Stop focusing on an Item.
                    interactedObject.EndInteraction();
                }
            }
            UIEventHandler.ContainerClosed();
            UIEventHandler.DialogInterrupted();
        }

        if (agentController.HasReachedDestination())
        {
            RemoveMovementMarker();
        }
        else
        {
            SetMovementMarker(agentController.GetAgentDestination());
        }
    }
Пример #32
0
 private static void initMouse()
 {
     mouseUtil = camera.AddComponent("MouseUtil") as MouseUtil;
 }
Пример #33
0
	void Start () {
		rb = GetComponent<Rigidbody> ();
		mouse = GetComponent<MouseUtil>();
		distToGround = GetComponent<CapsuleCollider>().bounds.extents.y;
	}