Пример #1
0
        public void SaveCursors()
        {
            Windows.ActivateGameWindow();

            if (System.IO.File.Exists(TargetFileName))
            {
                System.IO.File.Delete(TargetFileName);
            }

            if (System.IO.File.Exists(DefaultFileName))
            {
                System.IO.File.Delete(DefaultFileName);
            }

            Thread.Sleep(3000);

            Bitmap target = new Bitmap(Devices.Mouse.Image);

            target.Save(TargetFileName);
            TargetCursor = target;

            // dispose old one
            DefaultCursor = null;

            // when get is called cursor is regenerated
            // - then saved
            DefaultCursor.Save(DefaultFileName);

            Windows.ActivateBotWindow();
        }
Пример #2
0
        private void load(IBindable <WorkingBeatmap> beatmap)
        {
            InternalChild = defaultCursor = new DefaultCursor(beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize);

            this.beatmap.BindTo(beatmap);
        }
Пример #3
0
        /// <summary>
        /// Updates the canvas, returns true if a ui element is capturing the mouse
        /// </summary>
        /// <returns></returns>
        public override bool Update()
        {
            bool interacted = false;

            foreach (Control child in Children)
            {
                if (child is Form)
                {
                    if (child.Visible && child.Enabled)
                    {
                        Form form = child as Form;
                        if (form.AbsoluteBounds.Contains(InputManager.Instance.MouseScreenPos()) && InputManager.Instance.OnMouseUp(MouseButton.Left))
                        {
                            BringToFront(form);
                        }

                        if (form.Draggable && formDragging == null && InputManager.Instance.OnMouseDown(MouseButton.Left))
                        {
                            Rectangle titleBar = new Rectangle(form.AbsoluteLocation.X, form.AbsoluteLocation.Y, form.Size.Width - (PROP_FORM_CLOSE_BUTTON_DIM + PROP_FORM_CLOSE_BUTTON_PADDING), PROP_FORM_CLOSE_BUTTON_DIM + PROP_FORM_CLOSE_BUTTON_PADDING);
                            if (titleBar.Contains(InputManager.Instance.MouseScreenPos()))
                            {
                                formDragOffset = InputManager.Instance.MouseScreenPos() - form.AbsoluteLocation;
                                formDragging   = form;
                                BringToFront(formDragging);
                            }
                        }
                        if (formDragging != null && !InputManager.Instance.IsMouseDown(MouseButton.Left))
                        {
                            formDragging = null;
                        }
                        if (formDragging != null)
                        {
                            formDragging.AbsoluteLocation = InputManager.Instance.MouseScreenPos() - formDragOffset;
                        }
                    }
                }

                interacted = child.Update();
                if (interacted)
                {
                    break;
                }
            }

            foreach (Control control in ChildrenAndSubChildren)
            {
                TextBox tb = control as TextBox;
                if (tb != null && tb != selectedTextBox)
                {
                    tb.Selected = false;
                    continue;
                }

                ToolTip tt = control as ToolTip;
                if (tt != null)
                {
                    tt.Visible = tt.Parent.AbsoluteBounds.Contains(InputManager.Instance.MouseScreenPos());
                }
            }

            if (!GraphicsManager.Instance.Viewport.Bounds.Contains(InputManager.Instance.MouseScreenPos()))
            {
                interacted = true;
            }
            if (!interacted)
            {
                DefaultCursor.Enable();
            }
            return(interacted);
        }