Ejemplo n.º 1
0
        private void OnPasteAcction(PasteActorsAction pasteAction)
        {
            pasteAction.Do(out _, out var nodeParents);

            // Select spawned objects
            var selectAction = new SelectionChangeAction(Selection.ToArray(), nodeParents.Cast <SceneGraphNode>().ToArray());

            selectAction.Do();

            Undo.AddAction(new MultiUndoAction(pasteAction, selectAction));
            OnSelectionChanged?.Invoke();
        }
Ejemplo n.º 2
0
 private void ZoomImage_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (!draged && e.Button == MouseButtons.Left)
     {
         var w = Width / (double)Grid_Columns;
         var h = Height / (double)Grid_Rows;
         _selectd_col = (int)Math.Floor(e.X / (w));
         _selectd_row = (int)Math.Floor(e.Y / (h));
         DrawSelection();
         OnSelectionChanged?.Invoke(this, null);
     }
     is_draging = false;
 }
Ejemplo n.º 3
0
        public override void OnPersistentDataReady()
        {
            base.OnPersistentDataReady();

            var key = GetFullHierarchicalPersistenceKey();

            m_Selection = GetOrCreatePersistentData <Selection>(m_Selection, key);

            if (OnSelectionChanged != null)
            {
                OnSelectionChanged.Invoke();
            }
        }
Ejemplo n.º 4
0
        // get all items in selectionbox
        public void UpdateSelection(bool isQueueButtonPressed)
        {
            if (isQueueButtonPressed && SelectedItems.Where((actions => actions != null)).Any())
            {
                SelectedItems.AddRange(SelectBuildings());
            }
            else
            {
                List <IGameActionHolder> selection = SelectUnits();
                SelectedItems = (selection.Count > 0) ? isQueueButtonPressed ? SelectedItems.Union(selection).ToList() : selection : SelectBuildings();
            }

            OnSelectionChanged?.Invoke(this, new EventArgsWithPayload <List <IGameActionHolder> >(SelectedItems));
        }
Ejemplo n.º 5
0
 private void Tree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
 {
     if (tree.SelectedItem == null)
     {
         selectedNode     = null;
         lblSelected.Text = "none";
     }
     else
     {
         selectedNode     = (tree.SelectedItem as TreeViewItem).Tag as CategoryModel;
         lblSelected.Text = selectedNode.id + " " + selectedNode.name;
     }
     OnSelectionChanged?.Invoke(selectedNode);
 }
Ejemplo n.º 6
0
        private void TheComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!_shouldFire)
            {
                _shouldFire = true;
            }
            else
            {
                OnSelectionChanged?.Invoke(SelectedValue, e);
            }

            _BACKWARD_BUTTON.IsEnabled = _THE_COMBO_BOX.SelectedIndex > 0;
            _FORWARD_BUTTON.IsEnabled  = (_THE_COMBO_BOX.SelectedIndex + 1) < _THE_COMBO_BOX.Items.Count;
        }
Ejemplo n.º 7
0
        private void OnScriptRemoved(int index)
        {
            var oldSelectedObject = treeListView.SelectedObject;

            m_Nodes.RemoveAtIndexRemoving4(index);
            RefreshTreeListViewAsync(() =>
            {
                if (treeListView.SelectedObject != oldSelectedObject)
                {
                    OnSelectionChanged?.Invoke(m_TestFixture, null);
                }
            });

            ASSERT_TreeViewIsTheSameAsInScriptManager();
        }
Ejemplo n.º 8
0
 private void SelectionChangeHandler(BaseListElementData data)
 {
     if (!multiSelection && data.Selected)
     {
         for (int i = 0; i < m_elementsData.Count; i++)
         {
             var elementData = m_elementsData[i];
             if (elementData != data)
             {
                 elementData.Selected = false;
             }
         }
     }
     OnSelectionChanged.Call(data);
 }
Ejemplo n.º 9
0
        private void SelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            if (e.IsSelected)
            {
                curentSelected   = e.Item;
                curentSelectedId = e.ItemIndex;
            }
            else
            {
                curentSelected   = null;
                curentSelectedId = -1;
            }

            OnSelectionChanged?.Invoke(e.IsSelected, e.Item);
        }
    public void ClearSelection()
    {
        if (_selectedEntity == null)
        {
            return;
        }

        Entity oldSelectedEntity = _selectedEntity;

        _selectedEntity = null;

        oldSelectedEntity.SetSelected(false);

        OnSelectionChanged?.Invoke(this, oldSelectedEntity, null);
    }
Ejemplo n.º 11
0
 private void Handle_SlotClicked(UIInventorySlot slot)
 {
     if (Selected != null)
     {
         Swap(slot);
         Selected.BecomesUnSelected();
         Selected = null;
     }
     else if (slot.IsEmpty == false)
     {
         Selected = slot;
         Selected.BecomesSelected();
     }
     OnSelectionChanged?.Invoke();
 }
        public OptionsMenu() :
            base(Engine.Instance.SpriteBatch, "MenuChoice", Engine.Instance.Width, Engine.Instance.Height, 250, 160)
        {
            Texture = Common.str2Tex("Menu/spaceBG");

            AddChoice("music", "Enable Music", "Yes", "No");
            if (!SettingsMgr.Instance.EnableMusic)
            {
                Choices[Choices.Count - 1].SetSelectedIdx(1);
            }

            AddChoice("fullscreen", "FullScreen", "Yes", "No");
            if (!SettingsMgr.Instance.IsFullScreen)
            {
                Choices[Choices.Count - 1].SetSelectedIdx(1);
            }

            AddChoice("ctrlType", "Control Type:", "Keyboard", "Mouse");
            if (SettingsMgr.Instance.ControlType1 == eControlType.Mouse)
            {
                Choices[Choices.Count - 1].SetSelectedIdx(1);
            }

            AddChoice("showSpawnTimer", "Show Spawn Timer:", "Yes", "No");
            if (!SettingsMgr.Instance.ShowSpawnTimer)
            {
                Choices[Choices.Count - 1].SetSelectedIdx(1);
            }

            AddChoice("skipTutorial", "Disable Tutorial:", "No", "Yes");
            if (SettingsMgr.Instance.SkipTutorial)
            {
                Choices[Choices.Count - 1].SetSelectedIdx(1);
            }

            AddChoice("showRoundGUI", "Enable Round GUI:", "No", "Yes");
            if (SettingsMgr.Instance.ShowRoundGUI)
            {
                Choices[Choices.Count - 1].SetSelectedIdx(1);
            }

            AddChoice("roundGUIAlpha", "Round GUI Alpha:", "32", "64", "96", "128", "160", "192", "224", "255");
            Choices[Choices.Count - 1].SetSelectedIdx((int)Math.Ceiling(SettingsMgr.Instance.RoundGUIAlpha / (float)32) - 1);

            AddChoice("back", "Back");
            SelectChoice     += new OnSelectChoice(OptionsMenu_SelectChoice);
            SelectionChanged += new OnSelectionChanged(OptionsMenu_SelectionChanged);
        }
        public void SetSelection(ILevelEditorObject target, bool registerUndo = true)
        {
            if (Selection == target)
            {
                return;
            }

            ILevelEditorObject old = Selection;

            Selection = target;
            OnSelectionChanged?.Invoke(this, new SelectionEventArgs(old, target));

            if (registerUndo && realUndo != null)
            {
                realUndo.AddAction(new SelectObjectUndoAction(old, target));
            }
        }
 private void HandleSlotClicked(UIInventorySlot slot)
 {
     // Swap slots if multiple were selected
     if (Selected != null)
     {
         Swap(slot);
         Selected.BecomeUnselected();
         Selected = null;
     }
     // Don't select empty slots
     else if (!slot.IsEmpty)
     {
         Selected = slot;
         Selected.BecomeSelected();
     }
     OnSelectionChanged?.Invoke();
 }
        /// <summary>
        /// Moves the selection.
        /// </summary>
        /// <param name="newX">The new x.</param>
        /// <param name="newY">The new y.</param>
        public bool MoveSelection(int newX, int newY)
        {
            if (selection == null)
            {
                selection = new TileMaskCollection(BytesPerColor);
            }
            if (selection.Left == newX && selection.Top == newY)
            {
                return(false);
            }
            bool b = selection.MoveTo(newX, newY);

            UpdateContainer();
            RequireRefresh = true;
            OnSelectionChanged?.Invoke(this, selection);
            return(b);
        }
    public void SetSelection(Entity newSelection)
    {
        // Empty to empty so no change
        if (_selectedEntity == null && newSelection == null)
        {
            return;
        }

        // Selecting an entity from empty
        if (_selectedEntity == null && newSelection != null)
        {
            _selectedEntity = newSelection;

            _selectedEntity.SetSelected(true);

            OnSelectionChanged?.Invoke(this, null, newSelection);
            return;
        }

        // Changing from one entity to another
        if (_selectedEntity != null && newSelection != null && _selectedEntity != newSelection)
        {
            Entity oldSelection = _selectedEntity;
            _selectedEntity = newSelection;

            oldSelection.SetSelected(false);
            newSelection.SetSelected(true);

            OnSelectionChanged?.Invoke(this, oldSelection, newSelection);
            return;
        }

        // Deselecting the current entity
        if (_selectedEntity != null && newSelection == null)
        {
            Entity oldSelection = _selectedEntity;
            _selectedEntity = null;

            oldSelection.SetSelected(false);

            OnSelectionChanged?.Invoke(this, oldSelection, null);

            return;
        }
    }
Ejemplo n.º 17
0
        private void RadioChecked(object sender, EventArgs e)
        {
            StackLayout stRadio = (StackLayout)sender;
            var         lb      = stRadio.Children.First(x => x.ClassId == rbClassId) as Label;

            if (lb.Text == unchckd)
            {
                if (SelectedIndex >= 0)
                {
                    lbRadios.Single(x => x.Text == chckd).Text = unchckd;
                }
                lb.Text       = chckd;
                SelectedItem  = stRadio.BindingContext;
                SelectedValue = SelectedValuePath == null ? null : SelectedItem.GetType().GetProperty(SelectedValuePath).GetValue(SelectedItem, null);
                SelectedIndex = ItemsSource.ToList().IndexOf(SelectedItem);
                OnSelectionChanged?.Invoke(this, new SelectionChangedEventArgs(SelectedItem, SelectedValue, SelectedIndex));
            }
        }
Ejemplo n.º 18
0
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------


        /// <summary>
        /// Handles the MouseLeftButtonDown event of the CustomMarkerDemo control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MouseButtonEventArgs"/> instance containing the event data.</param>
        private void MarkerControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (this.mcMapControl.DragButton == MouseButton.Left)
            {
                this.IsSelected = !this.IsSelected;

                OnSelectionChanged?.Invoke(this, this.bIsSelected);

                e.Handled = true;
                return;
            }

            if (!this.Shape.IsMouseCaptured)
            {
                Mouse.Capture(this.Shape);
                e.Handled = true;
            }
        }
 public void UpdateContent(ListViewItem[] Items)
 {
     foreach (ListViewItem i in Items)
     {
         if (i.Tag != null && i.Tag is String)
         {
             String cat = (String)i.Tag;
             i.Group = listView1.Groups[cat];
         }
     }
     listView1.BeginUpdate();
     listView1.Items.Clear();
     listView1.Items.AddRange(Items);
     listView1.EndUpdate();
     if (OnSelectionChanged != null)
     {
         OnSelectionChanged.Invoke(this, null);
     }
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Sets the selected item in the combo box.
 /// </summary>
 /// <param name="option">The option that was chosen.</param>
 /// <param name="fireListener">true to also fire the option selected listener, or false otherwise.</param>
 public void SetSelectedItem(IListableOption option, bool fireListener = false)
 {
     if (option != null)
     {
         SelectedLabel?.SetText(option.GetProperName());
         // No guarantee that the options are hashable
         foreach (var item in currentItems)
         {
             var data = item.data;
             // Show or hide the check mark next to the selected option
             item.rowImage.color = (data != null && data.Equals(option)) ? CheckColor :
                                   PUITuning.Colors.Transparent;
         }
         if (fireListener)
         {
             OnSelectionChanged?.Invoke(this, option);
         }
     }
 }
Ejemplo n.º 21
0
        private void WaveDisplay_MouseMove(object sender, MouseEventArgs e)
        {
            switch (CurrentMode)
            {
            case Mode.Idle:
                break;

            case Mode.Scroll:
                ScrollToMouseLocation(e.Location);
                Invalidate();
                break;

            case Mode.Select:
                SelectToMouseLocation(e.Location);
                Invalidate();
                OnSelectionChanged?.Invoke(this);
                break;
            }
        }
Ejemplo n.º 22
0
        private void editorAction_TextChanged(object sender, EventArgs e)
        {
            if (editorAction.Tag == m_tagIgnoreChangeEvents)
            {
                return;
            }

            if (SelectedObject is NodeFunctionProperties)
            {
                NodeFunctionProperties ncp = (NodeFunctionProperties)SelectedObject;

                editorAction.Tag = m_tagIgnoreChangeEvents;

                ncp.Code = editorAction.Text;

                OnSelectionChanged.Invoke(this);

                editorAction.Tag = null;
            }
        }
        public GameOptions() :
            base(Engine.Instance.SpriteBatch, "MenuChoice", Engine.Instance.Width, Engine.Instance.Height, 250, 160, 400)
        {
            Texture = Common.str2Tex("Menu/spaceBG");
            AddChoice("play", "Play");
            AddChoice("playerShip", "Ship:", "Normal", "Destroyer", "Regeneration", "Cruiser", "Tanker");
            AddChoice("startWave", "Starting Wave:", 1, 3, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50);
            AddChoice("area", "Area:", "Ireland", "Spain", "Siberia", "Artic Region");
            AddChoice("dropRate", "DropRate:", eDropRateMod.None, eDropRateMod.Low, eDropRateMod.Normal, eDropRateMod.High);
            Choices[Choices.Count - 1].SetSelectedIdx(2);
            AddChoice("waveDelay", "Wave Delay (s):", 10, 13, 16, 18, 20);
            Choices[Choices.Count - 1].SetSelectedIdx(3);
            AddChoice("music", "Music:", "Random", "Techno1", "Airship", "Poss");
            AddChoice("back", "Back");
            SelectChoice += new OnSelectChoice(GameOptions_SelectChoice);

            ScoreModifier     = GetScoreMod();
            SelectionChanged += new OnSelectionChanged(GameOptions_SelectionChanged);
            ValueChanged     += new OnValueChanged(GameOptions_ValueChanged);
        }
Ejemplo n.º 24
0
        internal void OnSelectionUndo(SceneGraphNode[] toSelect)
        {
            Selection.Clear();
            if (toSelect != null)
            {
                for (int i = 0; i < toSelect.Length; i++)
                {
                    if (toSelect[i] != null)
                    {
                        Selection.Add(toSelect[i]);
                    }
                    else
                    {
                        Editor.LogWarning("Null scene graph node to select");
                    }
                }
            }

            OnSelectionChanged?.Invoke();
        }
Ejemplo n.º 25
0
 private void SidebarItem_OnSelect(MusixDynamicSidebarItem item)
 {
     if (item == SelectedItem)
     {
         return;
     }
     else
     {
         SelectedItem = item;
     }
     item.MenuItem.OnSelect();
     OnSelectionChanged?.Invoke(item.MenuItem);
     foreach (MusixDynamicSidebarItem sidebarItem in flowElements.Controls.OfType <MusixDynamicSidebarItem>())
     {
         if (sidebarItem != item && sidebarItem.IsSelected)
         {
             sidebarItem.IsSelected = false;
             sidebarItem.MenuItem.OnDeselect();
         }
     }
 }
Ejemplo n.º 26
0
        void SelectRecorder(Type newSelection)
        {
            if (m_SelectedRecorder == newSelection)
            {
                return;
            }

            var recorderAttribs = newSelection.GetCustomAttributes(typeof(ObsoleteAttribute), false);

            if (recorderAttribs.Length > 0)
            {
                Debug.LogWarning("Recorder " + ((ObsoleteAttribute)recorderAttribs[0]).Message);
            }

            m_SelectedRecorder = newSelection;

            if (OnSelectionChanged != null)
            {
                OnSelectionChanged.Invoke(m_SelectedRecorder);
            }
        }
Ejemplo n.º 27
0
        private void RadioChecked(object sender, EventArgs e)
        {
            StackLayout stRadio = (StackLayout)sender;
            var         lb      = stRadio.Children.First(x => x.ClassId == "r") as SelectionFrame;

            if (lb is null)
            {
                return;
            }
            if (!lb.IsSelected)
            {
                if (SelectedIndex >= 0)
                {
                    lbRadios.Single(x => x.IsSelected).IsSelected = false;
                }
                lb.IsSelected = true;
                SelectedItem  = stRadio.BindingContext;
                SelectedValue = SelectedValuePath == null ? null : SelectedItem.GetType().GetProperty(SelectedValuePath).GetValue(SelectedItem, null);
                SelectedIndex = ItemsSource.ToList().IndexOf(SelectedItem);
                OnSelectionChanged?.Invoke(this, new SelectionChangedEventArgs(SelectedItem, SelectedValue, SelectedIndex));
            }
        }
        /// <summary>
        /// Finds the by position.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        public TileMaskCollection FindByPosition(int x, int y)
        {
            ClearSelection();

            TileMask tm = tiles.FirstOrDefault((t) =>
            {
                if (t.X <= x && t.X + t.Width >= x &&
                    t.Y <= y && t.Y + t.Height >= y)
                {
                    return(true);
                }

                return(false);
            });

            if (tm == default)
            {
                return(selection);
            }

            selection.Add(tm);
            OnSelectionChanged?.Invoke(this, selection);
            return(selection);
        }
Ejemplo n.º 29
0
 /// <summary>
 /// this method should not be used outside of this picker and it's datasource and delegate
 /// </summary>
 public void FireOnSelectionChanged()
 {
     OnSelectionChanged.Fire(this, EventArgs.Empty);
 }
Ejemplo n.º 30
0
 private void PlayerItemListOnOnItemDeselected(ItemList.ItemListDeselectedEventArgs obj)
 {
     OnSelectionChanged?.Invoke(null);
 }