Пример #1
0
 protected override void HandleEvent(MouseEventID id, Vector2 pos)
 {
     if (id == MouseEventID.LeftButtonDown)
     {
         node.Value = !node.Value;
     }
 }
Пример #2
0
        public bool OnMouseEvent(MouseEventID id, Vector2 pos)
        {
            if (currentHover != null && currentHover.TestHit(pos))
            {
                currentHover.OnEvent(id, pos);
                return id != MouseEventID.MouseMove;
            }

            if (id == MouseEventID.MouseMove)
            {
                MenuItem button = Children.FirstOrDefault(b => b.TestHit(pos));
                if (button != null)
                {
                    if (currentHover != null)
                    {
                        currentHover.SetHovered(false);
                    }
                    currentHover = button;
                    button.SetHovered(true);
                }
                return false;
            }

            if (Bounds.Contains(pos) && id == MouseEventID.LeftButtonDown)
            {
                visible = !visible;
                currentHover = null;
                Children.ForEach(button => button.SetVisible(visible));
                return true;
            }

            return false;
        }
Пример #3
0
 protected override void HandleEvent(MouseEventID id, Vector2 pos)
 {
     if (id == MouseEventID.LeftButtonDown)
     {
         node.Value = !node.Value;
     }
 }
Пример #4
0
        public bool OnMouseEvent(MouseEventID id, Vector2 pos)
        {
            if (currentHover != null && currentHover.TestHit(pos))
            {
                currentHover.OnEvent(id, pos);
                return(id != MouseEventID.MouseMove);
            }

            if (id == MouseEventID.MouseMove)
            {
                MenuItem button = Children.FirstOrDefault(b => b.TestHit(pos));
                if (button != null)
                {
                    currentHover?.SetHovered(false);
                    currentHover = button;
                    button.SetHovered(true);
                }
                return(false);
            }

            if (Bounds.Contains(pos) && id == MouseEventID.LeftButtonDown)
            {
                visible      = !visible;
                currentHover = null;
                Children.ForEach(button => button.SetVisible(visible));
                return(true);
            }

            return(false);
        }
Пример #5
0
 protected override void HandleEvent(MouseEventID id, Vec2 pos)
 {
     if (id == MouseEventID.LeftButtonDown)
     {
         this.isEnabled = !this.isEnabled;
     }
     Settings.SetBool(this.settingName, this.isEnabled);
 }
Пример #6
0
 protected override void HandleEvent(MouseEventID id, Vec2 pos)
 {
     if (id == MouseEventID.LeftButtonDown)
     {
         this.isEnabled = !this.isEnabled;
     }
     Settings.SetBool(this.settingName, this.isEnabled);
 }
Пример #7
0
 protected override void HandleEvent(MouseEventID id, Vec2 pos)
 {
     if (null == setting)
         return;
     if (id == MouseEventID.LeftButtonDown)
     {
         this.isEnabled = !this.isEnabled;
         setting.Value = this.isEnabled;
     }
 }
Пример #8
0
        private bool OnMouseEvent(MouseEventID id, Point position)
        {
            if (!Settings.Enable || !(Settings.AreoMode? GameController.Window.IsForeground() : WinApi.IsForegroundWindow(handleHud)))
            {
                return(false);
            }

            Vector2 mousePosition = Settings.AreoMode ? GameController.Window.ScreenToClient(position.X, position.Y) : ScreenToHud(position.X, position.Y);

            return(root.OnMouseEvent(id, mousePosition));
        }
Пример #9
0
        private bool OnMouseEvent(MouseEventID id, Point position)
        {
            if (!Settings.Enable || !GameController.Window.IsForeground())
            {
                return(false);
            }

            Vector2 mousePosition = GameController.Window.ScreenToClient(position.X, position.Y);

            return(root.OnMouseEvent(id, mousePosition));
        }
Пример #10
0
 protected override void HandleEvent(MouseEventID id, Vec2 pos)
 {
     if (null == setting)
     {
         return;
     }
     if (id == MouseEventID.LeftButtonDown)
     {
         this.isEnabled = !this.isEnabled;
         setting.Value  = this.isEnabled;
     }
 }
Пример #11
0
 protected override async void HandleEvent(MouseEventID id, Vector2 pos)
 {
     if (id == MouseEventID.LeftButtonDown)
     {
         var colorDialog = new CustomColorDialog(GetColorGdi(node));
         await Task.Run(() =>
         {
             if (colorDialog.Show())
             {
                 node.Value = GetColor(colorDialog.SelectedColor);
             }
         });
     }
 }
Пример #12
0
        private bool OnMouseEvent(MouseEventID id, int x, int y)
        {
            if (Settings.GetBool("Window.RequireForeground") && !this.poe.Window.IsForeground())
            {
                return(false);
            }
            Vec2 vec = this.poe.Window.ScreenToClient(new Vec2(x, y));

            if (id == MouseEventID.MouseMove)
            {
                if (this.currentHover != null && this.currentHover.TestHit(vec))
                {
                    this.currentHover.OnEvent(id, vec);
                    return(false);
                }
                using (List <BooleanButton> .Enumerator enumerator = this.buttons.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        BooleanButton current = enumerator.Current;
                        if (current.TestHit(vec))
                        {
                            if (this.currentHover != null)
                            {
                                this.currentHover.SetHovered(false);
                            }
                            this.currentHover = current;
                            current.SetHovered(true);
                            return(false);
                        }
                    }
                    return(false);
                }
            }
            if (this.bounds.HasPoint(vec) && id == MouseEventID.LeftButtonDown)
            {
                this.menuVisible = !this.menuVisible;
                foreach (BooleanButton current2 in this.buttons)
                {
                    current2.SetVisible(this.menuVisible);
                }
                return(true);
            }
            if (this.currentHover != null && this.currentHover.TestHit(vec))
            {
                this.currentHover.OnEvent(id, vec);
                return(true);
            }
            return(false);
        }
Пример #13
0
 protected override async void HandleEvent(MouseEventID id, Vector2 pos)
 {
     if (id == MouseEventID.LeftButtonDown)
     {
         var colorDialog = new CustomColorDialog(GetColorGdi(node));
         await Task.Run(() =>
         {
             if (colorDialog.Show())
             {
                 node.Value = GetColor(colorDialog.SelectedColor);
             }
         });
     }
 }
Пример #14
0
 public void OnEvent(MouseEventID id, Vec2 pos)
 {
     if (id == MouseEventID.MouseMove)
     {
         if (this.TestBounds(pos))
         {
             this.HandleEvent(id, pos);
             if (this.currentHover != null)
             {
                 this.currentHover.SetHovered(false);
                 this.currentHover = null;
             }
             return;
         }
         if (this.currentHover != null)
         {
             if (this.currentHover.TestHit(pos))
             {
                 this.currentHover.OnEvent(id, pos);
                 return;
             }
             this.currentHover.SetHovered(false);
         }
         MenuItem childAt = this.GetChildAt(pos);
         if (childAt != null)
         {
             childAt.SetHovered(true);
             this.currentHover = childAt;
             return;
         }
         this.currentHover = null;
         return;
     }
     else
     {
         if (this.TestBounds(pos))
         {
             this.HandleEvent(id, pos);
             return;
         }
         if (this.currentHover != null)
         {
             this.currentHover.OnEvent(id, pos);
         }
         return;
     }
 }
Пример #15
0
 public void OnEvent(MouseEventID id, Vec2 pos)
 {
     if (id == MouseEventID.MouseMove)
     {
         if (this.TestBounds(pos))
         {
             this.HandleEvent(id, pos);
             if (this.currentHover != null)
             {
                 this.currentHover.SetHovered(false);
                 this.currentHover = null;
             }
             return;
         }
         if (this.currentHover != null)
         {
             if (this.currentHover.TestHit(pos))
             {
                 this.currentHover.OnEvent(id, pos);
                 return;
             }
             this.currentHover.SetHovered(false);
         }
         MenuItem childAt = this.GetChildAt(pos);
         if (childAt != null)
         {
             childAt.SetHovered(true);
             this.currentHover = childAt;
             return;
         }
         this.currentHover = null;
         return;
     }
     else
     {
         if (this.TestBounds(pos))
         {
             this.HandleEvent(id, pos);
             return;
         }
         if (this.currentHover != null)
         {
             this.currentHover.OnEvent(id, pos);
         }
         return;
     }
 }
Пример #16
0
 protected override void HandleEvent(MouseEventID id, Vector2 pos)
 {
     if (id != MouseEventID.LeftButtonDown) return;
     Thread thread = new Thread(() =>
     {
         var filedialog = new OpenFileDialog
         {
             Filter = "filter files (*.filter)|*.filter|All files (*.*)|*.*"
         };
         if (filedialog.ShowDialog() == DialogResult.OK)
         {
             path.Value = filedialog.FileName;
         }
     });
     thread.SetApartmentState(ApartmentState.STA);
     thread.Start();
 }
Пример #17
0
 protected override void HandleEvent(MouseEventID id, Vec2 pos)
 {
     if (id == MouseEventID.LeftButtonDown)
     {
         this.isHolding = true;
         return;
     }
     if (id == MouseEventID.LeftButtonUp)
     {
         this.CalcValue(pos.X);
         this.isHolding = false;
         return;
     }
     if (this.isHolding && id == MouseEventID.MouseMove)
     {
         this.CalcValue(pos.X);
     }
 }
Пример #18
0
 public void OnEvent(MouseEventID id, Vector2 pos)
 {
     if (id == MouseEventID.MouseMove)
     {
         if (TestBounds(pos))
         {
             HandleEvent(id, pos);
             if (currentHover != null)
             {
                 currentHover.SetHovered(false);
                 currentHover = null;
             }
             return;
         }
         if (currentHover != null)
         {
             if (currentHover.TestHit(pos))
             {
                 currentHover.OnEvent(id, pos);
                 return;
             }
             currentHover.SetHovered(false);
         }
         MenuItem childAt = Children.FirstOrDefault(current => current.TestHit(pos));
         if (childAt != null)
         {
             childAt.SetHovered(true);
             currentHover = childAt;
             return;
         }
         currentHover = null;
     }
     else
     {
         if (TestBounds(pos))
         {
             HandleEvent(id, pos);
         }
         else
         {
             currentHover?.OnEvent(id, pos);
         }
     }
 }
Пример #19
0
 public void OnEvent(MouseEventID id, Vector2 pos)
 {
     if (id == MouseEventID.MouseMove)
     {
         if (TestBounds(pos))
         {
             HandleEvent(id, pos);
             if (currentHover != null)
             {
                 currentHover.SetHovered(false);
                 currentHover = null;
             }
             return;
         }
         if (currentHover != null)
         {
             if (currentHover.TestHit(pos))
             {
                 currentHover.OnEvent(id, pos);
                 return;
             }
             currentHover.SetHovered(false);
         }
         MenuItem childAt = Children.FirstOrDefault(current => current.TestHit(pos));
         if (childAt != null)
         {
             childAt.SetHovered(true);
             currentHover = childAt;
             return;
         }
         currentHover = null;
     }
     else
     {
         if (TestBounds(pos))
         {
             HandleEvent(id, pos);
         }
         else
         {
             currentHover?.OnEvent(id, pos);
         }
     }
 }
Пример #20
0
 protected override void HandleEvent(MouseEventID id, Vector2 pos)
 {
     if (id == MouseEventID.LeftButtonDown)
     {
         Thread thread = new Thread(() =>
         {
             var filedialog = new OpenFileDialog
             {
                 Filter = "filter files (*.filter)|*.filter|All files (*.*)|*.*"
             };
             if (filedialog.ShowDialog() == DialogResult.OK)
             {
                 path.Value = filedialog.FileName;
             }
         });
         thread.SetApartmentState(ApartmentState.STA);
         thread.Start();
     }
 }
Пример #21
0
        private bool OnMouseEvent(MouseEventID id, int x, int y)
        {
            if (Settings.Global.RequireForeground && !this.model.Window.IsForeground())
            {
                return(false);
            }
            Vec2 vec = this.model.Window.ScreenToClient(new Vec2(x, y));

            if (id == MouseEventID.MouseMove)
            {
                if (this.currentHover != null && this.currentHover.TestHit(vec))
                {
                    this.currentHover.OnEvent(id, vec);
                    return(false);
                }
                foreach (var current in buttons.Where(current => current.TestHit(vec)))
                {
                    if (this.currentHover != null)
                    {
                        this.currentHover.SetHovered(false);
                    }
                    this.currentHover = current;
                    current.SetHovered(true);
                    return(false);
                }
                return(false);
            }
            if (this.bounds.HasPoint(vec) && id == MouseEventID.LeftButtonDown)
            {
                this.menuVisible = !this.menuVisible;
                foreach (BooleanButton current2 in this.buttons)
                {
                    current2.SetVisible(this.menuVisible);
                }
                return(true);
            }
            if (this.currentHover != null && this.currentHover.TestHit(vec))
            {
                this.currentHover.OnEvent(id, vec);
                return(true);
            }
            return(false);
        }
Пример #22
0
        protected override void HandleEvent(MouseEventID id, Vec2 pos)
        {
            int colorHovered = (int)Math.Floor((double)(pos.Y - base.Bounds.Y) / (double)(base.Bounds.H / 3));

            if (id == MouseEventID.LeftButtonDown)
            {
                this.barBeingDragged = colorHovered;
                return;
            }
            if (id == MouseEventID.LeftButtonUp)
            {
                this.CalcValue(pos.X);
                this.barBeingDragged = -1;
                return;
            }
            if (this.barBeingDragged != -1 && id == MouseEventID.MouseMove)
            {
                this.CalcValue(pos.X);
            }
        }
Пример #23
0
        protected override void HandleEvent(MouseEventID id, Vec2 pos)
        {
            int colorHovered = (int)Math.Floor((double)(pos.Y - base.Bounds.Y) / (double)(base.Bounds.H / 3));

            if (id == MouseEventID.LeftButtonDown)
            {
                this.barBeingDragged = colorHovered;
                return;
            }
            if (id == MouseEventID.LeftButtonUp)
            {
                this.CalcValue(pos.X);
                this.barBeingDragged = -1;
                return;
            }
            if (this.barBeingDragged != -1 && id == MouseEventID.MouseMove)
            {
                this.CalcValue(pos.X);
            }
        }
Пример #24
0
        protected override void HandleEvent(MouseEventID id, Vector2 pos)
        {
            switch (id)
            {
            case MouseEventID.LeftButtonDown:
                isHolding = true;
                break;

            case MouseEventID.LeftButtonUp:
                CalcValue(pos.X);
                isHolding = false;
                break;

            default:
                if (isHolding && id == MouseEventID.MouseMove)
                {
                    CalcValue(pos.X);
                }
                break;
            }
        }
Пример #25
0
 protected override void HandleEvent(MouseEventID id, Vector2 pos)
 {
 }
Пример #26
0
 protected abstract void HandleEvent(MouseEventID id, Vec2 pos);
Пример #27
0
 protected override void HandleEvent(MouseEventID id, Vector2 pos)
 {
 }
Пример #28
0
 private bool OnMouseEvent(MouseEventID id, int x, int y)
 {
     if (Settings.Global.RequireForeground && !this.model.Window.IsForeground())
     {
         return false;
     }
     Vec2 vec = this.model.Window.ScreenToClient(new Vec2(x, y));
     if (id == MouseEventID.MouseMove)
     {
         if (this.currentHover != null && this.currentHover.TestHit(vec))
         {
             this.currentHover.OnEvent(id, vec);
             return false;
         }
         foreach (var current in buttons.Where(current => current.TestHit(vec)))
         {
             if (this.currentHover != null)
                 this.currentHover.SetHovered(false);
             this.currentHover = current;
             current.SetHovered(true);
             return false;
         }
         return false;
     }
     if (this.bounds.HasPoint(vec) && id == MouseEventID.LeftButtonDown)
     {
         this.menuVisible = !this.menuVisible;
         foreach (BooleanButton current2 in this.buttons)
         {
             current2.SetVisible(this.menuVisible);
         }
         return true;
     }
     if (this.currentHover != null && this.currentHover.TestHit(vec))
     {
         this.currentHover.OnEvent(id, vec);
         return true;
     }
     return false;
 }
Пример #29
0
        private void OnMouseEvent(MouseEventID eventId, Vector2 pos)
        {
            try
            {
                if (!Settings.Enable || !GameController.Window.IsForeground() || eventId != MouseEventID.LeftButtonDown)
                {
                    return;
                }
                Element uiHover       = GameController.Game.IngameState.UIHover;
                var     HoverItemIcon = uiHover.AsObject <HoverItemIcon>();

                if (HoverItemIcon.ToolTipType == ToolTipType.ItemOnGround)
                {
                    var item = HoverItemIcon.Item;

                    var filteredItemResult = ProcessItem(item);

                    if (filteredItemResult == null)
                    {
                        return;
                    }

                    if (++CurPickItemCount > long.MaxValue)
                    {
                        CurPickItemCount = 0;
                    }

                    Task.Factory.StartNew(async() =>
                    {
                        long curItemPickCount = CurPickItemCount;
                        Stopwatch sw          = Stopwatch.StartNew();
                        while (item.IsValid)
                        {
                            await Task.Delay(30);

                            //We want to prevent the item was added more than once
                            if (curItemPickCount != CurPickItemCount)
                            {
                                return;
                            }

                            if (sw.ElapsedMilliseconds <= 10000)
                            {
                                continue;
                            }
                            sw.Stop();
                            break;
                        }

                        //We want to prevent the item was added more than once
                        if (curItemPickCount != CurPickItemCount)
                        {
                            return;
                        }

                        if (!item.IsValid)
                        {
                            filteredItemResult.BInPlayerInventory = true;
                            _sData.PlayerInventory.StashTabItems.Add(filteredItemResult);
                            UpdateItemsSetsInfo();
                        }
                    });
                }
            }
            catch (Exception e)
            {
                LogError("OnMouseEvent error: " + e.Message, 4);
                return;
            }
            return;
        }
Пример #30
0
 protected abstract void HandleEvent(MouseEventID id, Vector2 pos);
        private void OnMouseEvent(MouseEventID eventId, Vector2 pos)
        {
            try
            {
                if (!Settings.Enable || !Settings.AutoUpdate || !GameController.Window.IsForeground() || eventId != MouseEventID.LeftButtonDown)
                {
                    return;
                }
                Element uiHover       = GameController.Game.IngameState.UIHover;
                var     HoverItemIcon = uiHover.AsObject <HoverItemIcon>();

                if (HoverItemIcon.ToolTipType == ToolTipType.ItemOnGround)
                {
                    var item = HoverItemIcon.Item;

                    var rendertItem = item.GetComponent <RenderItem>();

                    bool   stackable    = false;
                    string itemName     = "";
                    int    stackSize    = 0;
                    int    maxStackSize = 0;
                    string resourcePath = rendertItem.ResourcePath;

                    var stack = item.GetComponent <Stack>();
                    if (stack != null && stack.Info != null)
                    {
                        stackable = true;
                        BaseItemType bit = GameController.Files.BaseItemTypes.Translate(item.Path);
                        itemName     = bit.BaseName;
                        stackSize    = stack.Size;
                        maxStackSize = stack.Info.MaxStackSize;
                    }

                    var baseC = item.GetComponent <Base>();

                    int ItemCellsSizeX = baseC.ItemCellsSizeX;
                    int ItemCellsSizeY = baseC.ItemCellsSizeY;

                    CurPickItemCount++;

                    Task.Factory.StartNew(async() =>
                    {
                        long curItemPickCount = CurPickItemCount;
                        Stopwatch sw          = Stopwatch.StartNew();
                        while (item.IsValid)
                        {
                            await Task.Delay(30);

                            //We want to prevent the item was added more than once
                            if (curItemPickCount != CurPickItemCount)
                            {
                                return;
                            }

                            if (sw.ElapsedMilliseconds <= 10000)
                            {
                                continue;
                            }
                            sw.Stop();
                            break;
                        }

                        //We want to prevent the item was added more than once
                        if (curItemPickCount != CurPickItemCount)
                        {
                            return;
                        }

                        if (!item.IsValid)
                        {
                            TryToAutoAddItem(itemName, stackable, stackSize, maxStackSize, ItemCellsSizeX, ItemCellsSizeY, resourcePath);
                        }
                    });
                }
            }
            catch (Exception e)
            {
                LogError("OnMouseEvent error: " + e.Message, 4);
                return;
            }
            return;
        }
Пример #32
0
        private bool OnMouseEvent(MouseEventID id, Vector2 position)
        {
            if (!Settings.Enable)
            {
                return(false);
            }
            Mouse_Pos = position;

            if (id == MouseEventID.LeftButtonDown)
            {
                if (DrawRect.Contains(Mouse_Pos))
                {
                    bMouse_Drag        = true;
                    Mouse_StartDragPos = position;
                    StartDragWinPosX   = Settings.WindowPosX;
                    StartDragWinPosY   = Settings.WindowPosY;
                }
            }
            else if (id == MouseEventID.LeftButtonUp)
            {
                bMouse_Drag = false;
            }
            else if (bMouse_Drag && id == MouseEventID.MouseMove)
            {
                Mouse_DragDelta = position - Mouse_StartDragPos;

                Settings.WindowPosX = StartDragWinPosX + Mouse_DragDelta.X;
                Settings.WindowPosY = StartDragWinPosY + Mouse_DragDelta.Y;

                if (Settings.WindowPosX < 0)
                {
                    Settings.WindowPosX = 0;
                }

                if (Settings.WindowPosY < 0)
                {
                    Settings.WindowPosY = 0;
                }

                var clientRect = GameController.Window.GetWindowRectangle();

                if (Settings.WindowPosX + WindowWidth > clientRect.Width)
                {
                    Settings.WindowPosX = clientRect.Width - WindowWidth;
                }

                if (Settings.WindowPosY + WindowHeight > clientRect.Height)
                {
                    Settings.WindowPosY = clientRect.Height - WindowHeight;
                }
            }


            if (id != MouseEventID.LeftButtonUp && id != MouseEventID.LeftButtonDown)
            {
                return(false);
            }

            var hitWindow = DrawRect.Contains(position);

            bMouse_Click = hitWindow && id == MouseEventID.LeftButtonUp;
            if (bMouse_Click)
            {
                Mouse_ClickPos = position;
            }

            return(hitWindow);
        }