Ejemplo n.º 1
0
        public static void Select(DocumentObject documentObject, bool silently = false)
        {
            if (currentObject == documentObject)
            {
                return;
            }

            currentObject = documentObject;

            if (!silently)
            {
                OnSelectionChange?.Invoke(documentObject);
            }

#if DEBUG
            // For Debug
            if (documentObject != null)
            {
                Console.WriteLine("Selected object : " + currentObject.Name);
            }
            else
            {
                Console.WriteLine("UnSelecting object");
            }
#endif
        }
Ejemplo n.º 2
0
        private void _treeList_OnSelect(UIActionEvent e, UIElement sender)
        {
            var list   = (UIBrowserTreeList)sender;
            var target = (BrowserTreeDisplayNode)list.SelectedElement;

            OnSelectionChange?.Invoke(new UIActionEvent(target.BindingElement, e.TimeStamp), this);
        }
Ejemplo n.º 3
0
        protected override void PostConstruct()
        {
            base.PostConstruct();

            Tree.CreateItem();

            Tree.SetColumnTitle(0, Translate("ui.InventoryView.name"));
            Tree.SetColumnTitle(1, Translate("ui.InventoryView.type"));
            Tree.SetColumnTitle(2, Translate("ui.InventoryView.slot"));
            Tree.SetColumnTitle(3, Translate("ui.InventoryView.weight"));

            Tree.SetColumnTitlesVisible(true);

            var onDispose = Disposed.Where(identity);

            OnItemsChange
            .Do(_ => Tree.RemoveAllNodes())
            .CombineLatest(OnEquipmentContainerChange, (list, parent) => (list, parent))
            .TakeUntil(onDispose)
            .Subscribe(t => t.list.ToList().ForEach(item => CreateNode(item, t.parent)), this);

            OnSelectionChange
            .TakeUntil(onDispose)
            .Subscribe(DisplayItem, this);
        }
Ejemplo n.º 4
0
 public void ClearSelection()
 {
     foreach (NodeUi node in UiManager.GetNodes())
     {
         node.selected    = false;
         node.preSelected = false;
     }
     OnSelectionChange.Invoke(box.GetAllSelected());
 }
Ejemplo n.º 5
0
        protected override void OnMouseUp(MouseButtonEventArgs e)
        {
            base.OnMouseUp(e);

            if (isSelected)
            {
                isSelected = false;
            }

            if (Core.IsDragging)
            {
                if (isDragging)
                {
                    onMouseUpTimestamp = e.Timestamp & Int32.MaxValue;
                    isDragging         = false;
                    Debug.WriteLine("IsDragging = " + isDragging);
                    Cursor = cursorBefore;
                    Mouse.Capture(null);
                }
                Core.EndDrag();

                if (BoundsOfMap.HasValue && !BoundsOfMap.Value.Contains(Position))
                {
                    if (Core.LastLocationInBounds.HasValue)
                    {
                        Position = Core.LastLocationInBounds.Value;
                    }
                }
            }
            else
            {
                if (e.ChangedButton == DragButton)
                {
                    Core.mouseDown = GPoint.Empty;
                }

                if (!selectionEnd.IsEmpty && !selectionStart.IsEmpty)
                {
                    bool zoomtofit = false;

                    if (!SelectedArea.IsEmpty && Keyboard.Modifiers == ModifierKeys.Shift)
                    {
                        zoomtofit = SetZoomToFitRect(SelectedArea);
                    }

                    OnSelectionChange?.Invoke(SelectedArea, zoomtofit);
                }
                else
                {
                    InvalidateVisual();
                }
            }
        }
Ejemplo n.º 6
0
 public void ChangeSelection(PlanetNode node)
 {
     if (isCursorActive)
     {
         currentSelectedNode = node;
         if (OnSelectionChange != null)
         {
             OnSelectionChange.Invoke(node);
         }
         UpdateSelectionUI();
     }
 }
 public void OnClick(object sender, MouseButtonEventArgs e)
 {
     if (e.Button == MouseButton.Left)
     {
         _selectedObject = GetNearestObject(GetOnRaycast(GetVisibleObjects()));
         if (_selectedObject != null)
         {
             OnSelectionChange?.Invoke(this, new SelectObjectEventArgs()
             {
                 SelectedObject = _selectedObject
             });
         }
     }
 }
Ejemplo n.º 8
0
        private void changeSelection(PixControl obj)
        {
            if (DisableSelection)
            {
                return;
            }

            radios.ForEach(s => s.Active = false);
            var radio = obj as IndexedButton;

            radio.Active = true;
            Selection    = radios.IndexOf(radio);
            OnSelectionChange?.Invoke(this, new SelectionEventArgs(radio));
        }
Ejemplo n.º 9
0
        public async Task SetSelectedItem(AutoCompleteOption item)
        {
            if (item != null)
            {
                this.SelectedValue = item?.Value;
                this.SelectedItem  = item;
                _inputComponent?.SetValue(this.SelectedItem.Label);

                if (OnSelectionChange.HasDelegate)
                {
                    await OnSelectionChange.InvokeAsync(this.SelectedItem);
                }
            }
            this.ClosePanel();
        }
Ejemplo n.º 10
0
        public override void UpdateSelf(GameTime gameTime)
        {
            base.UpdateSelf(gameTime);
            Browser.Position   = new Vector2(0, Navigator.Position.Y + Navigator.Height);
            Browser.Size       = new Vector2(0f, -(Navigator.Position.Y + Navigator.Height));
            Viewer.Position    = new Vector2(Browser.Width, Navigator.Position.Y + Navigator.Height);
            Viewer.Size        = new Vector2(0, -(Navigator.Position.Y + Navigator.Height));
            Inspecter.Position = new Vector2(Browser.Width, Viewer.Height + Navigator.Position.Y + Navigator.Height);
            var selected = (BrowserTreeDisplayNode)Browser.SelectedElement;
            var e        = (selected == null) ? null : selected.BindingElement;

            if (_lastFocusElement != e)
            {
                OnSelectionChange.Invoke(new UIActionEvent(e, gameTime.TotalGameTime), this);
                _lastFocusElement = e;
            }
        }
Ejemplo n.º 11
0
 public void SelectionChanged(int id)
 {
     OnSelectionChange?.Invoke(id);
 }
Ejemplo n.º 12
0
 public void NotifySelectionChange()
 {
     OnSelectionChange.Invoke(new UIActionEvent(_lastFocusElement, Main._drawInterfaceGameTime.TotalGameTime), this);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Removes Listener from Selection-Event
 /// </summary>
 /// <param name="listener">Listener to Remove</param>
 public void RemoveSelectionListener(OnSelectionChange listener)
 {
     selectionEvent -= listener;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Adds Listener to Selection-Event
 /// </summary>
 /// <param name="listener">Listener to Add</param>
 public void AddSelectionListener(OnSelectionChange listener)
 {
     selectionEvent += listener;
     // Set initial value
     listener.Invoke(selectedSpellIndex);
 }