Example #1
0
        public void Select(IEnumerable <MapObject> objs)
        {
            var list = objs.ToList();

            foreach (var o in list)
            {
                o.IsSelected = true;
            }
            SelectedObjects.UnionWith(list);
        }
Example #2
0
        private IList <string> GetSelectedEntities()
        {
            var result = new List <string>();

            result.AddRange(Environment.UserDomainName.Equals(Environment.MachineName)
                ? SelectedObjects.Select(o => string.Format(EntityNameFormat, Environment.MachineName, o.Name))
                : SelectedObjects.Select(o => GetEntityNameFromPath(o.Path)));

            return(result);
        }
Example #3
0
        public void Deselect(IEnumerable <MapObject> objs)
        {
            var list = objs.ToList();

            SelectedObjects.ExceptWith(list);
            foreach (var o in list)
            {
                o.IsSelected = false;
            }
        }
 /// <summary>
 /// Removes selection icon from tile and requeues it in object pool
 /// </summary>
 /// <param name="selection"></param>
 void RemoveSelection(Transform selection)
 {
     //Queue up removed selection to inactive pool
     InactiveSelectionObjects.Enqueue(SelectedObjects[selection]);
     //Set gameobject to inactive
     SelectedObjects[selection].SetActive(false);
     //Remove selection gameobject from active objects
     ActiveSelectionIconObjects.Remove(SelectedObjects[selection]);
     //Remove from select dictionary
     SelectedObjects.Remove(selection);
 }
Example #5
0
        public virtual bool CutCopy(bool cut)
        {
            if (!CanCut())
            {
                return(false);
            }
            var data = new ObjectCutCopyPasteData(this, cut, (object[])SelectedObjects.Clone());

            ClipboardManager.CopyToClipboard(data);
            return(true);
        }
        private async void RequestBindingObject()
        {
            if (!TargetPlatform.EditorProvider.KnownTypes.TryGetValue(typeof(PropertyBinding), out ITypeInfo bindingType))
            {
                throw new InvalidOperationException("IEditorProvider does not have a known type for PropertyBinding");
            }

            object binding = await TargetPlatform.EditorProvider.CreateObjectAsync(bindingType);

            SelectedObjects.Add(binding);
        }
 protected override void CalcSelectedObjects()
 {
     base.CalcSelectedObjects();
     if (!ListView.Id.ToLower().Contains("lookup"))
     {
         var rootObjects = collection.List.OfType <ITreeNode>().Where(f => f.Parent == null || !collection.List.Contains(f.Parent)).OfType <Object>().ToList();
         SelectedObjects = SelectedObjects.OfType <ITreeNode>().Where(f => f.Parent == null || !collection.List.Contains(f.Parent)).OfType <Object>().ToList();
         foreach (var item in rootObjects)
         {
             CalcNestedSelectedObjects((item as ITreeNode), SelectedObjects.Contains(item));
         }
     }
 }
        /// <summary>
        /// 如果当前属性面板窗体有效(可见状态)
        /// 将实体对象提取出来,然后设置到属性网格中
        /// </summary>
        private void UpdateSelectedObjectIfActive()
        {
            //如果窗体不可见,不更新属性网格
            if (!this.Visible)
            {
                return;
            }

            //加载当前可用的设计器谓词
            //先加载设计器谓词,避免先显示了属性行再显示谓词面板造成属性行部分滚动条闪动
            if (this.Host != null)
            {
                IMenuCommandService menuCommandService =
                    this.Host.GetService(typeof(IMenuCommandService)) as IMenuCommandService;
                Debug.Assert(menuCommandService != null, "menuCommandService 为 null");
                if (menuCommandService != null)
                {
                    this.PropertyGrid.Verbs = menuCommandService.Verbs;
                }
            }

            if (SelectedObjects != null)
            {
                EntityBase[] entity   = new EntityBase[SelectedObjects.Length];
                object[]     selArray = new object[SelectedObjects.Length];
                SelectedObjects.CopyTo(selArray, 0);

                for (int i = 0; i < SelectedObjects.Length; i++)
                {
                    IShellControlDev shellControlDev = selArray[i] as IShellControlDev;
                    //entity[i] = shellControlDev.GetEntity();
                    entity[i] = shellControlDev.Entity;
                }

                SetDesignableObjects(entity);
            }
            else
            {
                IShellControlDev shellControlDev = SelectedObject as IShellControlDev;

                if (shellControlDev != null)
                {
                    //SetDesignableObject(shellControlDev.GetEntity());
                    SetDesignableObjects(new object[] { shellControlDev.Entity });
                }
                else
                {
                    SetDesignableObjects(null);
                }
            }
        }
        private void GenerateSymmetrySelectionRing(SelectedObjects Sel)
        {
            int count  = Sel.Ids.Count;
            int count2 = Sel.Empty.Count;

            Sel.SelectionRings = new GameObject[count + count2];
            for (int i = 0; i < count; i++)
            {
                int ID = Sel.Ids[i];

                Sel.SelectionRings[i] = Instantiate(RingPrefabs[SelPrefab].SmallRingSymmetry, transform) as GameObject;
                SelectionRings.Add(Sel.SelectionRings[i]);
                Sel.SelectionRings[i].transform.localPosition = AffectedGameObjects[ID].transform.localPosition;
                Sel.SelectionRings[i].SetActive(true);

                if (LastControlType == SelectionControlTypes.Decal)
                {
                    Sel.SelectionRings[i].transform.localScale    = AffectedGameObjects[ID].transform.localScale;
                    Sel.SelectionRings[i].transform.localRotation = AffectedGameObjects[ID].transform.localRotation;
                }
                else if (LastControlType == SelectionControlTypes.Units)
                {
                    Sel.SelectionRings[i].transform.localScale    = AffectedGameObjects[ID].GetComponent <UnitInstance>().UnitRenderer.BP.SkirtSize;
                    Sel.SelectionRings[i].transform.localRotation = AffectedGameObjects[ID].transform.localRotation;
                }
                else if (LastControlType == SelectionControlTypes.Props)
                {
                    Sel.SelectionRings[i].transform.localScale    = AffectedGameObjects[ID].GetComponent <PropGameObject>().Col.bounds.size;
                    Sel.SelectionRings[i].transform.localRotation = AffectedGameObjects[ID].transform.localRotation;
                }
                else
                {
                    MeshRenderer Mr = AffectedGameObjects[ID].GetComponent <MeshRenderer>();
                    if (Mr)
                    {
                        Sel.SelectionRings[i].transform.localScale = new Vector3(Mr.bounds.size.x + 0.2f, 1, Mr.bounds.size.z + 0.2f);
                    }
                }
            }

            for (int e = 0; e < count2; e++)
            {
                int i = e + count;

                Sel.SelectionRings[i] = Instantiate(RingPrefabs[SelPrefab].SmallRingEmpty, transform) as GameObject;
                SelectionRings.Add(Sel.SelectionRings[i]);
                Sel.SelectionRings[i].transform.localPosition = Sel.Empty[e];
                Sel.SelectionRings[i].SetActive(true);
            }
        }
Example #10
0
        public void Clear()
        {
            foreach (var obj in SelectedObjects)
            {
                obj.IsSelected = false;
            }
            SelectedObjects.Clear();

            foreach (var face in SelectedFaces)
            {
                face.IsSelected = false;
            }
            SelectedFaces.Clear();
        }
Example #11
0
        public void OnCollapsedGUI()
        {
            if (Event.current.commandName == "UndoRedoPerformed")
            {
                ObjectPathTimeline.BuildCurveFromKeyframes();
                return;
            }

            if (ObjectPathTimeline.ObjectSpline == null)
            {
                ObjectPathTimeline.BuildCurveFromKeyframes();
            }

            cachedObjectPathRenderData[0].Keyframe = ObjectPathTimeline.FirstNode;
            cachedObjectPathRenderData[1].Keyframe = ObjectPathTimeline.LastNode;

            if (ObjectPathTimeline.ObjectSpline.SplineSolver == null)
            {
                ObjectPathTimeline.BuildCurveFromKeyframes();
            }

            GUILayout.Box("", TimelineBackground, GUILayout.MaxHeight(17.0f), GUILayout.ExpandWidth(true));
            if (Event.current.type == EventType.Repaint)
            {
                DisplayArea = GUILayoutUtility.GetLastRect();
            }

            var startX = ConvertTimeToXPos(ObjectPathTimeline.StartTime);
            var endX   = ConvertTimeToXPos(ObjectPathTimeline.EndTime);

            var splineAreaBox = new Rect(startX, DisplayArea.y, endX - startX, DisplayArea.height);

            GUI.Box(splineAreaBox, "");

            var width = 2.0f;

            cachedObjectPathRenderData[0].RenderRect = new Rect(startX, DisplayArea.y, width * 2.0f, DisplayArea.height);
            cachedObjectPathRenderData[1].RenderRect = new Rect(endX - (width * 2.0f), DisplayArea.y, width * 2.0f, DisplayArea.height);

            cachedObjectPathRenderData[0].RenderPosition = new Vector2(startX, DisplayArea.y);
            cachedObjectPathRenderData[1].RenderPosition = new Vector2(endX, DisplayArea.y);

            using (new GUIChangeColor(SelectedObjects.Contains(cachedObjectPathRenderData[0].Keyframe) ? Color.yellow : GUI.color))
                GUI.Box(cachedObjectPathRenderData[0].RenderRect, "");
            using (new GUIChangeColor(SelectedObjects.Contains(cachedObjectPathRenderData[1].Keyframe) ? Color.yellow : GUI.color))
                GUI.Box(cachedObjectPathRenderData[1].RenderRect, "");

            GUI.Label(splineAreaBox, "Double Click on an existing keyframe in the Scene view to add a new one (backspace or delete to remove).");
        }
Example #12
0
        /// <summary>
        /// Selects the given nodes.
        /// </summary>
        /// <param name="items"></param>
        private void SetSelectedObjects(IEnumerable <Item> items)
        {
            // Updates selection
            SelectedObjects = items == null ? new List <Item>() : new List <Item>(items);

            // Selects the proper nodes
            if (SelectedObjects.Count() == 1)
            {
                // If the object is not already selected
                Item obj = SelectedObjects.First();
                tvItems.SelectNodeWithTag(obj);
            }

            // Notify subscribers
            SelectionChanged?.ThreadSafeInvoke(this, new EventArgs());
        }
    /// <summary>
    /// Adds selection icon to tile and stores reference to it
    /// </summary>
    /// <param name="selection"></param>
    void AddSelection(Transform selection)
    {
        //Dequeue inactive object from queue
        GameObject newSelectionIcon = InactiveSelectionObjects.Dequeue();

        //Set object to active in scene
        newSelectionIcon.SetActive(true);
        //Sets new object to correct position
        newSelectionIcon.transform.position = selection.position;
        //Add new object to dictionary
        SelectedObjects.Add(selection, newSelectionIcon);
        //Add to active selection list
        ActiveSelectionIconObjects.Add(newSelectionIcon);
        //Add tile to current tiles selected
        SelectedTiles.Add(selection.gameObject);
    }
Example #14
0
        public void SelectNextAt(IntVec3 c, Map map)
        {
            if (SelectedObjects.Count() != 1)
            {
                Log.Error("Cannot select next at with < or > 1 selected.");
                return;
            }
            List <object> list = SelectableObjectsAt(c, map).ToList();
            int           num  = list.IndexOf(SingleSelectedThing) + 1;

            if (num >= list.Count)
            {
                num -= list.Count;
            }
            ClearSelection();
            Select(list[num]);
        }
        private void btnDone_Click(object sender, EventArgs e)
        {
            SelectedObjects = "";

            for (int i = 0; i < clbTables.Items.Count; i++)
            {
                if (clbTables.GetItemChecked(i))
                    SelectedObjects = SelectedObjects + clbTables.Items[i] + ";";
            }
            for (int i = 0; i < clbViews.Items.Count; i++)
            {
                if (clbViews.GetItemChecked(i))
                    SelectedObjects = SelectedObjects + clbViews.Items[i] + ";";
            }
            SelectedObjects = SelectedObjects.TrimEnd(';');
            DialogResult = DialogResult.OK;
        }
        private void ShowPropertySheetDailog(string propertySheetName, string dialogNamePrefix, bool bulkEditing)
        {
            SelectedObjects selectedComponents = new SelectedObjects(base.ResultPane.SelectedObjects);
            Guid            value = Guid.Empty;

            if (this.SelectedObjectsDictionary.ContainsKey(selectedComponents))
            {
                value = this.SelectedObjectsDictionary[selectedComponents];
            }
            else
            {
                value = Guid.NewGuid();
                this.SelectedObjectsDictionary[selectedComponents] = value;
            }
            string text = dialogNamePrefix + value.ToString();

            if (!ExchangeForm.ActivateSingleInstanceForm(text))
            {
                ExchangePropertyPageControl[] array = bulkEditing ? this.OnGetBulkSelectionPropertyPageControls() : this.OnGetSingleSelectionPropertyPageControls();
                if (!bulkEditing)
                {
                    List <ExchangePropertyPageControl> list = new List <ExchangePropertyPageControl>();
                    foreach (ExchangePropertyPageControl exchangePropertyPageControl in array)
                    {
                        if (exchangePropertyPageControl.HasPermission())
                        {
                            list.Add(exchangePropertyPageControl);
                        }
                    }
                    array = list.ToArray();
                }
                this.ApplyOptionsOnPage(array, bulkEditing);
                PropertySheetDialog propertySheetDialog = new PropertySheetDialog(propertySheetName, array);
                propertySheetDialog.Name      = text;
                propertySheetDialog.HelpTopic = base.ResultPane.SelectionHelpTopic + "Property";
                propertySheetDialog.Closed   += delegate(object param0, EventArgs param1)
                {
                    if (this.SelectedObjectsDictionary.ContainsKey(selectedComponents))
                    {
                        this.SelectedObjectsDictionary.Remove(selectedComponents);
                    }
                };
                propertySheetDialog.ShowModeless(base.ResultPane, null);
            }
        }
Example #17
0
 private void MoveObject(DrawableObject @object, Point offset)
 {
     foreach (Transition trans in @object.OutTransitions)
     {
         if (!SelectedObjects.Contains(trans) && trans.StartObject == @object)
         {
             trans.MoveStart(offset);
         }
     }
     foreach (Transition trans in @object.InTransitions)
     {
         if (!SelectedObjects.Contains(trans))
         {
             trans.MoveEnd(offset);
         }
     }
     @object.Move(offset);
 }
        public virtual void CalcNestedSelectedObjects(ITreeNode obj, Boolean parentStatus)
        {
            if (obj == null)
            {
                return;
            }
            var children = GetChildren(obj);

            foreach (ITreeNode child in children)
            {
                var status = false;
                if (parentStatus == !MarkedObjects.Contains(String.Concat(GetMemberValue((child as Object), collection.ObjectSpace.GetKeyPropertyName(child.GetType())))))
                {
                    SelectedObjects.Add(child as Object);
                    status = true;
                }
                CalcNestedSelectedObjects(child, status);
            }
        }
Example #19
0
        public void OnLeftDown()
        {
            Vector2       worldSpaceCursor = Camera.ScreenToWorldCoordinates(MousePosition);
            KeyboardState state            = Keyboard.GetState();

            foreach (LevelGeometry geom in Map.Geometry)
            {
                Rectangle rect = new Rectangle(geom.Position.ToPoint(), geom.Size.ToPoint());
                if (rect.Contains(worldSpaceCursor))
                {
                    if (SelectedObjects.Contains(geom) == false)
                    {
                        SelectedObjects.Add(geom);
                    }
                    draggingElement = true;
                    draggingOffst   = new Vector2(worldSpaceCursor.X, worldSpaceCursor.Y);
                }
            }
        }