void wayPointsListBox_ItemSelect(object sender, MyGuiControlListboxItemEventArgs eventArgs)
        {
            var selectedPath = MyWayPointGraph.StoredPaths[eventArgs.Key];

            MyEditorGizmo.ClearSelection();

            MyWayPointGraph.SelectedPath = selectedPath;
            MyEditorGizmo.AddEntitiesToSelection(MyWayPointGraph.SelectedPath.WayPoints);
        }
Beispiel #2
0
        private void OnSelectGroup(MyGuiControlButton sender)
        {
            var group = GetFocusedGroup();

            if (group != null && group.GetCount() > 0)
            {
                var container = group.GetContainer();
                if (MyEditor.Static.IsEditingPrefabContainer() && MyEditor.Static.GetEditedPrefabContainer() == container)
                {
                    MyEditorGizmo.AddEntitiesToSelection(group.GetEntities());
                }
                else
                {
                    var editorState   = MyEditor.GetCurrentState();
                    var contextHelper = MyGuiContextMenuHelpers.GetEditorContextMenuHelper(editorState);

                    // If exit/enter to prefab container available
                    if (container != null &&
                        (editorState == MyEditorStateEnum.NOTHING_SELECTED ||
                         contextHelper.IsActionTypeAvailable(MyGuiContextMenuItemActionType.ENTER_PREFAB_CONTAINER) ||
                         contextHelper.IsActionTypeAvailable(MyGuiContextMenuItemActionType.EXIT_EDITING_MODE)))
                    {
                        // Switch to group container
                        if (MyEditor.Static.IsEditingPrefabContainer())
                        {
                            MyEditor.Static.ExitActivePrefabContainer();
                        }
                        MyEditor.Static.EditPrefabContainer(container);

                        if (MyEditor.Static.IsEditingPrefabContainer() && MyEditor.Static.GetEditedPrefabContainer() == container)
                        {
                            MyEditorGizmo.AddEntitiesToSelection(group.GetEntities());
                        }
                    }
                    else if (container == null)
                    {
                        if (MyEditor.Static.IsEditingPrefabContainer())
                        {
                            MyEditor.Static.ExitActivePrefabContainer();
                        }
                        MyEditorGizmo.ClearSelection();
                        MyEditorGizmo.AddEntitiesToSelection(group.GetEntities());
                    }
                    else
                    {
                        MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, new StringBuilder("Can't select group."), new StringBuilder("Select Group Error"), MyTextsWrapperEnum.Ok, null));
                    }
                }
            }
        }