protected override void HandleEvent(MouseEventID id, Vector2 pos) { if (id == MouseEventID.LeftButtonDown) { node.Value = !node.Value; } }
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; }
protected override void HandleEvent(MouseEventID id, Vector2 pos) { if (id == MouseEventID.LeftButtonDown) { node.Value = !node.Value; } }
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); }
protected override void HandleEvent(MouseEventID id, Vec2 pos) { if (id == MouseEventID.LeftButtonDown) { this.isEnabled = !this.isEnabled; } Settings.SetBool(this.settingName, this.isEnabled); }
protected override void HandleEvent(MouseEventID id, Vec2 pos) { if (id == MouseEventID.LeftButtonDown) { this.isEnabled = !this.isEnabled; } Settings.SetBool(this.settingName, this.isEnabled); }
protected override void HandleEvent(MouseEventID id, Vec2 pos) { if (null == setting) return; if (id == MouseEventID.LeftButtonDown) { this.isEnabled = !this.isEnabled; setting.Value = this.isEnabled; } }
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)); }
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)); }
protected override void HandleEvent(MouseEventID id, Vec2 pos) { if (null == setting) { return; } if (id == MouseEventID.LeftButtonDown) { this.isEnabled = !this.isEnabled; setting.Value = this.isEnabled; } }
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); } }); } }
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); }
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); } }); } }
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; } }
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; } }
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(); }
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); } }
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); } } }
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); } } }
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(); } }
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); }
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); } }
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); } }
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; } }
protected override void HandleEvent(MouseEventID id, Vector2 pos) { }
protected abstract void HandleEvent(MouseEventID id, Vec2 pos);
protected override void HandleEvent(MouseEventID id, Vector2 pos) { }
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; }
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; }
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; }
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); }