예제 #1
0
 private void HandleSelection()
 {
     if (m_setting)
     {
         return;
     }
     SelectionChange?.Invoke(this, new EventArgs());
 }
 protected override void SelectionChanged(IList <int> selectedIds)
 {
     if (selectionChanged != null)
     {
         var row = rows[selectedIds[0]];
         if (row is EntityElement entityElement)
         {
             selectionChanged.Invoke(entityElement.Entity, world, ComponentType.Create <Entity>());
         }
         else if (row is ComponentElement componentElement)
         {
             entityElement = componentElement.parent as EntityElement;
             if (entityElement != null)
             {
                 selectionChanged.Invoke(entityElement.Entity, world, componentElement.Type);
             }
         }
     }
 }
        public void SetSelectionTo(SceneEntity entity)
        {
            if (!Gizmo.GetSelectionPool().Contains(entity))
            {
                return;
            }

            Gizmo.Selection.Clear();
            Gizmo.Selection.Add(entity);
            SelectionChange?.Invoke();
        }
예제 #4
0
 protected override void SelectionChanged(IList <int> selectedIds)
 {
     if (FindItem(selectedIds[0], rootItem) is ComponentElement element)
     {
         if (Objects.TryGetValue(element.Type, out var obj) == false)
         {
             return;
         }
         selectionChanged?.Invoke(element.Type, ref obj);
         Objects[element.Type] = obj;
     }
     shouldUpdate = true;
 }
예제 #5
0
        private void dgvMain_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex > -1 && e.Button == MouseButtons.Right && dgvMain.SelectedRows.Count < 2)
            {
                m_setting = true;
                dgvMain.ClearSelection();
                dgvMain.Rows[e.RowIndex].Selected          = true;
                dgvMain.Rows[e.RowIndex].Cells[0].Selected = true;

                SelectionChange?.Invoke(this, new EventArgs());
                m_setting = false;
            }
        }
예제 #6
0
 private void OnSelectionChange()
 {
     SelectionChange?.Invoke(this);
 }
예제 #7
0
 private void TeklaObject_SelectionChange()
 {
     SelectionChange?.Invoke();
 }
        private void UpdateGizmo()
        {
            // update camera properties for rendering and ray-casting.
            Gizmo.UpdateCameraProperties(Engine.View, Engine.Projection, Engine.CameraPosition);

            if (this.Focused)
            {
                // select entities with your cursor (add the desired keys for add-to / remove-from -selection)
                if (STATIC_GLOBAL_INPUT.IsNewLeftClick())
                {
                    //if (System.Windows.Input.Mouse.LeftButton == MouseButtonState.Pressed)
                    Gizmo.SelectEntities(STATIC_GLOBAL_INPUT.currMouse.Position.ToVector2(),
                                         STATIC_GLOBAL_INPUT.currKeys.IsKeyDown(Keys.LeftControl),
                                         STATIC_GLOBAL_INPUT.currKeys.IsKeyDown(Keys.LeftAlt));
                    SelectionChange?.Invoke();
                }


                // set the active mode like translate or rotate
                if (STATIC_GLOBAL_INPUT.currKeys.IsKeyDown(Keys.D1))
                {
                    Gizmo.ActiveMode = GizmoMode.Translate;
                    Translation_GUI_Update?.Invoke(null, null);
                }
                if (STATIC_GLOBAL_INPUT.currKeys.IsKeyDown(Keys.D2))
                {
                    Gizmo.ActiveMode = GizmoMode.Rotate;
                    Rotation_GUI_Update?.Invoke(null, null);
                }
                if (STATIC_GLOBAL_INPUT.currKeys.IsKeyDown(Keys.D3))
                {
                    Gizmo.ActiveMode = GizmoMode.NonUniformScale;
                    ScaleNonUniform_GUI_Update?.Invoke(null, null);
                }
                if (STATIC_GLOBAL_INPUT.currKeys.IsKeyDown(Keys.D4))
                {
                    Gizmo.ActiveMode = GizmoMode.UniformScale;
                    ScaleUniform_GUI_Update?.Invoke(null, null);
                }
                // toggle precision mode
                if (STATIC_GLOBAL_INPUT.currKeys.IsKeyDown(Keys.LeftShift) || STATIC_GLOBAL_INPUT.currKeys.IsKeyDown(Keys.RightShift))
                {
                    Gizmo.PrecisionModeEnabled = true;
                }
                else
                {
                    Gizmo.PrecisionModeEnabled = false;
                }

                // toggle active space
                if (STATIC_GLOBAL_INPUT.currKeys.IsKeyDown(Keys.O))
                {
                    Gizmo.ToggleActiveSpace();
                }

                // toggle snapping
                if (STATIC_GLOBAL_INPUT.currKeys.IsKeyDown(Keys.I))
                {
                    Gizmo.SnapEnabled = !Gizmo.SnapEnabled;
                }

                // select pivot types
                if (STATIC_GLOBAL_INPUT.currKeys.IsKeyDown(Keys.P))
                {
                    Gizmo.NextPivotType();
                }

                // clear selection
                if (STATIC_GLOBAL_INPUT.currKeys.IsKeyDown(Keys.Escape))
                {
                    Gizmo.Clear();
                }
            }

            Gizmo.Update(gameTime);
            Engine.Update();
        }
예제 #9
0
 private void cbxComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     SelectionChange?.Invoke(this, EventArgs.Empty);
 }