/// <summary>
        ///     Create a new group and move the items into the group
        /// </summary>
        private void MoveToNewGroup()
        {
            // Create the group
            var state = new ItemState(
                _projectManager.GetNextGroupID(),
                "Group",
                item.transform.parent.name,
                Utility.GetNeighbourID(item.transform)
                );
            var createCommand = new CreateCommand(true, state);

            _commandGroup = new CommandGroup();
            _undoService.AddCommand(_commandGroup);
            _commandGroup.AddToGroup(createCommand);
            createCommand.Redo();

            // Move the items
            _dragItem =
                Utility.FindChild(hierarchyView.transform, state.ID).GetComponent <HierarchyItemController>();
            _insertion     = true;
            _selectedItems = hierarchyViewController.GetSelectedItems();
            InsertItems();

            // Scroll to First selected Game object
            var groupItem = gameObject.transform.parent.parent;

            hierarchyViewController.ScrollToItem(groupItem.GetComponent <RectTransform>());
            groupItem.GetComponent <HierarchyItemController>().RenameItem(true, _commandGroup);
        }
Beispiel #2
0
        /// <summary>
        ///     Create an assembly station
        /// </summary>
        private void CreateAssemblyStation()
        {
            var state = new ItemState(
                _projectManager.GetNextGroupID(),
                "Assembly Station",
                _projectManager.CurrentProject.ObjectModel.name,
                ItemState.Last
                );

            // Add the new action to the undo redo service
            var createCommand = new CreateCommand(true, state);
            var commandGroup  = new CommandGroup();

            _undoService.AddCommand(commandGroup);
            commandGroup.AddToGroup(createCommand);
            createCommand.Redo();

            // Scroll to the created station
            var stationItem = hierarchyView.transform.GetChild(hierarchyView.transform.childCount - 1);

            ScrollToItem(stationItem.GetComponent <RectTransform>());
            stationItem.GetComponent <HierarchyItemController>().RenameItem(true, commandGroup);
        }
        /// <summary>
        ///     Add new group
        /// </summary>
        private void AddGroup()
        {
            // Save the item state
            var state = new ItemState(
                _projectManager.GetNextGroupID(),
                "Group",
                item.name,
                ItemState.Last
                );

            // Add the new action to the undo redo service
            var createCommand = new CreateCommand(true, state);

            _commandGroup = new CommandGroup();
            _undoService.AddCommand(_commandGroup);
            _commandGroup.AddToGroup(createCommand);
            createCommand.Redo();

            // Scroll to the created group in the group
            var groupItem = childrenContainer.transform.GetChild(childrenContainer.transform.childCount - 1);

            hierarchyViewController.ScrollToItem(groupItem.GetComponent <RectTransform>());
            groupItem.GetComponent <HierarchyItemController>().RenameItem(true, _commandGroup);
        }