コード例 #1
0
        public static bool FakeMouseClicks(CursorManager __instance, ref List <CursorAttachedObject> ____attachedObjects,
                                           ref DisplayObject ____mouseTarget, ref DisplayObject ____mouseDownTarget, ref Vector3 ____mouseDelta, ref Vector3 ____previousMousePosition)
        {
            //if (!stopwatch.IsRunning) stopwatch.Start();
            //Logger.LogMessage(stopwatch.ElapsedMilliseconds);
            Vector3 mousePosition = __instance.GetMousePosition();

            for (int i = 0; i < ____attachedObjects.Count; i++)
            {
                CursorAttachedObject cursorAttachedObject = ____attachedObjects[i];
                cursorAttachedObject.displayObject.gameObj.transform.position = new Vector3(mousePosition.x + cursorAttachedObject.xOffset, mousePosition.y + cursorAttachedObject.yOffset, cursorAttachedObject.displayObject.gameObj.transform.position.z);
            }

            DisplayObject displayObject = __instance.FindMouseTarget(mousePosition);

            if (displayObject != ____mouseTarget)
            {
                if (____mouseTarget != null)
                {
                    ____mouseTarget.MouseOut();
                    if (____mouseTarget == ____mouseDownTarget)
                    {
                        ____mouseDownTarget = null;
                    }
                }
                ____mouseTarget = displayObject;
                if (____mouseTarget != null)
                {
                    ____mouseTarget.MouseOver();
                }
            }

            if (Input.GetMouseButtonDown(0) || IsMouseKeyDown())
            {
                mouseDown = true;
                //mouseWasDown = true;
                if (____mouseTarget != null)
                {
                    ____mouseTarget.MouseDown();
                    ____mouseDownTarget = ____mouseTarget;
                }
                GameManager.Stage.MouseDown();
            }
            if (mouseDown && (Input.GetMouseButtonUp(0) || IsMouseKeyUp()))
            {
                mouseDown = false;
                //mouseWasClicked = true;
                if (____mouseTarget != null)
                {
                    ____mouseTarget.MouseUp();
                    if (____mouseTarget == ____mouseDownTarget)
                    {
                        ____mouseTarget.MouseClick();
                    }
                }
                GameManager.Stage.MouseUp();
                ____mouseDownTarget = null;
            }
            ____mouseDelta            = mousePosition - ____previousMousePosition;
            ____previousMousePosition = mousePosition;

            for (int i = 0; i <= BaseHunieModPlugin.AXISES; i++)
            {
                prevAxises[i] = Input.GetAxisRaw("Axis " + i);
            }

            return(false);
        }