Exemplo n.º 1
0
 private void FireOnSelect(ArcadeDisk disk, Mod mod)
 {
     if (OnSelect != null)
     {
         OnSelect.Invoke(this, new DiskSelectEventArgs(disk, mod));
     }
 }
        public void Update(float diff)
        {
            bool stopDrag = dragging && !inputManager.Mouse.IsMouseDown(MouseButton.Left);

            dragging = dragging && inputManager.Mouse.IsMouseDown(MouseButton.Left);

            if (stopDrag)
            {
                var min = new Vector2(Math.Min(startDragPositionNormalized.X, currentDragPositionNormalized.X), Math.Min(startDragPositionNormalized.Y, currentDragPositionNormalized.Y));
                var max = new Vector2(Math.Max(startDragPositionNormalized.X, currentDragPositionNormalized.X), Math.Max(startDragPositionNormalized.Y, currentDragPositionNormalized.Y));
                OnSelect?.Invoke(min, max);
            }

            if (inputManager.Mouse.HasJustClicked(MouseButton.Left) &&
                inputManager.Keyboard.IsDown(Key.LeftShift))
            {
                startDragPosition           = inputManager.Mouse.ScreenPoint;
                startDragPositionNormalized = inputManager.Mouse.NormalizedPosition;
                dragging = true;
            }

            if (dragging)
            {
                currentDragPosition           = inputManager.Mouse.ScreenPoint;
                currentDragPositionNormalized = inputManager.Mouse.NormalizedPosition;
            }
        }
Exemplo n.º 3
0
        private void BuildLayout()
        {
            var main = new StackLayout();

            main.Spacing         = 0;
            main.BackgroundColor = Color.White;
            var rl = new RelativeLayout();

            rl.Children.Add(main, Constraint.Constant(0), Constraint.Constant(0),
                            Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height));
            Content = rl;

            BuildHeader(main, "Where + When");
            BuildLocationLayout(main);
            BuildTimeLayout(main);

            var btn = UIUtils.MakeButton("CONFIRM", UIUtils.FONT_SFUIDISPLAY_MEDIUM);

            btn.VerticalOptions = LayoutOptions.EndAndExpand;
            btn.Clicked        += (o, a) =>
            {
                this.Navigation.PopAsync();
                OnSelect?.Invoke(this, EventArgs.Empty);
            };
            main.Children.Add(btn);
        }
Exemplo n.º 4
0
 public TreeViewController(MultiselectTreeView treeView)
 {
     this.treeView          = treeView;
     treeView.BeforeExpand += (s, e) =>
     {
         if (updating)
         {
             return;
         }
         e.Cancel = true;
         OnExpand?.Invoke(Map(e.Node));
     };
     treeView.BeforeCollapse += (s, e) =>
     {
         if (updating)
         {
             return;
         }
         e.Cancel = true;
         OnCollapse?.Invoke(Map(e.Node));
     };
     treeView.BeforeMultiSelect += (s, e) =>
     {
         if (updating)
         {
             return;
         }
         e.Cancel = true;
         OnSelect?.Invoke(e.Nodes.OfType <ViewNode>().Select(n => n.Node).ToArray());
     };
 }
Exemplo n.º 5
0
 /// <summary>
 /// Clears the current selected.
 /// </summary>
 private void ClearSelected()
 {
     selectedControllableUnits.ForEach(unit => unit.SetSelected(false));
     selectedControllableUnits = Enumerable.Empty <Unit>();
     SetLastSelected(null);
     OnSelect?.Invoke(null);
 }
Exemplo n.º 6
0
        public void Select(IOption <T>?o, bool update = true)
        {
            if (o == null || _selectedSet.Contains(o.Value))
            {
                return;
            }

            _combobox.Deselect();

            // o.Selected = true;
            _selected.Add(o);
            _selectedSet.Add(o.Value);

            // o.Disabled = true;

            // InvalidateOptions();
            // _options.Invalidate();
            // _combobox.InvalidateOptions();
            // _combobox.Deselect(false);


            _stateHasChanged.Invoke();

            if (update)
            {
                OnSelect?.Invoke(_selected);
            }
        }
Exemplo n.º 7
0
 protected override void OnObjectSelect()
 {
     IsOn = isSelected;
     base.OnObjectSelect();
     onSelect?.Invoke();
     OnSelect?.Invoke();
 }
Exemplo n.º 8
0
        public override void OnMouseDown(MouseButton button, int x, int y)
        {
            if (ScrollThumbRect.Translated(0, TranslateY).Contains(x, y))
            {
                _scrolling = true;

                _lastMouseY = y;
            }
            else
            {
                if (HoveredIndex > -1)
                {
                    if (HoveredIndex == SelectedIndex)
                    {
                        SelectedIndex = -1;
                    }
                    else
                    {
                        SelectedIndex = HoveredIndex;

                        SelectedItem = Items[SelectedIndex];
                        OnSelect?.Invoke(SelectedItem);
                    }
                }
            }
        }
Exemplo n.º 9
0
        protected void OnCarbolistItemClick(object target, EventArgs e)
        {
            CarbolistItem item = ((Button)target).Parent as CarbolistItem;

            if (item == SelectedItem)
            {
                if (CanDeselect)
                {
                    item.Selected = false;
                    SelectedItem  = null;
                }
            }
            else
            {
                if (SelectedItem != null)
                {
                    SelectedItem.Selected = false;
                }

                item.Selected = true;
                SelectedItem  = item;
            }

            // callback event listener
            OnSelect?.Invoke(item);
        }
Exemplo n.º 10
0
 internal override void Handle(DiscordSocketClient client, DiscordInteraction interaction)
 {
     if (OnSelect != null)
     {
         Task.Run(() => OnSelect.Invoke(this, new FormSelectMenuEventArgs(client, interaction)));
     }
 }
Exemplo n.º 11
0
        protected override void KeyboardInput(InputEventArgs <TInput> args)
        {
            var key = args.Input;

            if (KeyboardAdapter.IsUp(key))
            {
                _unselectedItemIndex = _selectedItemIndex;
                _selectedItemIndex--;
                if (_selectedItemIndex < 0)
                {
                    _selectedItemIndex = _items.Count - 1;
                }
                OnSelectionChanged?.Invoke(this, _items[_unselectedItemIndex.Value], _items[_selectedItemIndex]);
            }
            else if (KeyboardAdapter.IsDown(key))
            {
                _unselectedItemIndex = _selectedItemIndex;
                _selectedItemIndex++;
                if (_selectedItemIndex >= _items.Count)
                {
                    _selectedItemIndex = 0;
                }
                OnSelectionChanged?.Invoke(this, _items[_unselectedItemIndex.Value], _items[_selectedItemIndex]);
            }
            else if (KeyboardAdapter.IsEnter(key))
            {
                OnSelect?.Invoke(this, _items[_selectedItemIndex]);
            }
        }
 protected override void ItemSelected(AdvancedDropdownItem item)
 {
     if (item is ProductDropdownItem productItem)
     {
         OnSelect?.Invoke(productItem.Product);
     }
 }
Exemplo n.º 13
0
        private void Container_MouseDown(object sender, MouseButtonEventArgs e)
        {
            //assign the node as a mask if possible
            if (UINodePoint.SelectOrigin != null)
            {
                var point = UINodePoint.SelectOrigin;
                if (point.Output != null && Item != null)
                {
                    Item.Mask = point.Output.Node;
                    MaskRemoveButton.Visibility = Visibility.Visible;
                    Item.ParentGraph?.CombineLayers();
                }
            }
            else
            {
                moveX     = 0;
                moveY     = 0;
                moveStart = e.GetPosition(this);
                moveDown  = true;

                OnSelect?.Invoke(this);

                if (state == LayerItemState.None)
                {
                    State = LayerItemState.Selected;
                }
                else if (state == LayerItemState.Viewing)
                {
                    State = LayerItemState.SelectedViewing;
                }
            }
        }
Exemplo n.º 14
0
 public void Select(SelectableInputEventArgs args)
 {
     if (!_isSelectable)
     {
         return;
     }
     OnSelect?.Invoke(args);
 }
Exemplo n.º 15
0
 public void Select()
 {
     if (isHidden && !isTurning)
     {
         TurnArround();
         OnSelect.Invoke(this);
     }
 }
Exemplo n.º 16
0
    public void OnMouseDown()
    {
        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }

        OnSelect?.Invoke(this, new EventArgs());
    }
Exemplo n.º 17
0
 private void ChangeSelected(T selected)
 {
     if (Selected == selected)
     {
         return;
     }
     Selected = selected;
     OnSelect?.Invoke();
 }
Exemplo n.º 18
0
        public void Deselect(bool update = true)
        {
            _selected = null;

            if (update)
            {
                OnSelect?.Invoke(null);
            }
        }
Exemplo n.º 19
0
 private void SelectCard(object card)
 {
     UnselectAllCards();
     Select(card as TV_Card);
     if (OnSelect != null)
     {
         OnSelect.Invoke(card as TV_Card);
     }
 }
Exemplo n.º 20
0
        protected void Dropdown_Click(object sender, EventArgs e)
        {
            int Idx = int.Parse(((Button)sender).CommandName);

            DropdownEntry Entry = Entries[Idx];

            OnSelect?.Invoke(Entry);
            Entry.OnClick?.Invoke();
        }
Exemplo n.º 21
0
        public void SetScript(BattleCardScript script)
        {
            BattleCardScript = script;

            BattleCardScript.OnSelectCard += delegate
            {
                OnSelect?.Invoke(this);
            };
        }
Exemplo n.º 22
0
 internal override void Request()
 {
     OnSelect?.Invoke(this, new EventArgs());
     foreach (PluginItem it in Items.Values)
     {
         Plugin.addDirectoryItem(Convert.ToInt32(Sys.argv[1]), Sys.argv[0], it);
     }
     Plugin.endOfDirectory(Convert.ToInt32(Sys.argv[1]));
 }
Exemplo n.º 23
0
 public ISelectable Select(object source)
 {
     if (Highlight != null)
     {
         Highlight.SetActive(true);
     }
     OnSelect?.Invoke();
     return(this);
 }
Exemplo n.º 24
0
 void Setup(GpioPin portX, GpioPin portY, GpioPin portA, GpioPin portB,
            GpioPin portSelect, GpioPin portJoyHorizontal, GpioPin portJoyVertical)
 {
     ButtonA.PressEnded      += (s, e) => OnA?.Invoke(s, e);
     ButtonB.PressEnded      += (s, e) => OnB?.Invoke(s, e);
     ButtonX.PressEnded      += (s, e) => OnX?.Invoke(s, e);
     ButtonY.PressEnded      += (s, e) => OnY?.Invoke(s, e);
     ButtonSelect.PressEnded += (s, e) => OnSelect?.Invoke(s, e);
 }
Exemplo n.º 25
0
        private void btn_Click(object sender, RoutedEventArgs e)
        {
            MapButton btn = (MapButton)sender;

            if (OnSelect != null)
            {
                OnSelect.Invoke(btn.X, btn.Y);
            }
        }
Exemplo n.º 26
0
    void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
    {
        IdLider = Convert.ToInt32(eventArgument);

        // Verifica se existe algum Evento relacionado
        if (OnSelect != null)
        {
            OnSelect.Invoke(this, new EventArgs());
        }
    }
Exemplo n.º 27
0
 private void DoSelect(SkillKindId skillId)
 {
     if (_selected == skillId)
     {
         return;
     }
     OnSelect?.Invoke(_wordIdx, skillId);
     _selected = skillId;
     UpdateSelected();
 }
Exemplo n.º 28
0
    public void Select(GameObject obj)
    {
        if (_selectedObject != null)
        {
            // Deselect();
        }

        _selectedObject = obj;
        OnSelect.Invoke(obj);
    }
Exemplo n.º 29
0
        // It is okay for Select() and similar methods to invoke immediately since the invocation methods only alter
        //   visual states. In fact, because they modify the queue, they should not be queued unless a queue swap clone
        //   is made. And even in that case, the swap queue would need to be invoked immediately after the regular
        //   queue.

        public void Select()
        {
            parent.Active = true;

            /*
             * if (OnSelect != null)
             *  parent.Scene.QueueMethod(OnSelect, parent);
             */
            OnSelect?.Invoke(parent);
        }
Exemplo n.º 30
0
 private void ActiveCheck_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
 {
     if (activeCheck.IsChecked != null && activeCheck.IsChecked.Value)
     {
         OnSelect?.Invoke(Region, Realm);
     }
     else
     {
         OnUnselect?.Invoke(Region, Realm);
     }
 }