Ejemplo n.º 1
0
        public HtmlLink()
        {
            _shape = new SelectionShape();
            _shape.gameObject.name = "HtmlLink";

            _clickHandler = (EventContext context) =>
            {
                _owner.BubbleEvent("onClickLink", _element.GetString("href"));
            };
            _rolloverHandler = (EventContext context) =>
            {
                if (_owner.htmlParseOptions.linkHoverBgColor.a > 0 && _shape != null)
                {
                    _shape.color = _owner.htmlParseOptions.linkHoverBgColor;
                    _shape.alpha = _shape.color.a;
                }
            };
            _rolloutHandler = () =>
            {
                if (_owner.htmlParseOptions.linkHoverBgColor.a > 0 && _shape != null)
                {
                    _shape.color = _owner.htmlParseOptions.linkBgColor;
                    _shape.alpha = _shape.color.a;
                }
            };
        }
Ejemplo n.º 2
0
        public HtmlLink()
        {
            _shape = new SelectionShape();
            _shape.gameObject.name = "HtmlLink";

            _clickHandler = (EventContext context) =>
            {
                _owner.onClickLink.BubbleCall(_element.GetString("href"));
            };
            _rolloverHandler = (EventContext context) =>
            {
                context.CaptureTouch();
                if (_owner.htmlParseOptions.linkHoverBgColor.a > 0)
                {
                    _shape.color = _owner.htmlParseOptions.linkHoverBgColor;
                }
            };
            _rolloutHandler = () =>
            {
                if (_owner.htmlParseOptions.linkHoverBgColor.a > 0)
                {
                    _shape.color = _owner.htmlParseOptions.linkBgColor;
                }
            };
        }
Ejemplo n.º 3
0
 public void Enable(SelectionShape shape, int size)
 {
     _game.Active.HexCells.ForEach(c => c.ToggleHighlight(HiglightColor.WhiteOrange));
     IsEnabled = true;
     _shape    = shape;
     _size     = size;
 }
Ejemplo n.º 4
0
 public void Enable(SelectionShape shape, int size)
 {
     Game.Active.HexCells.ForEach(c => c.AddHighlight(Highlights.BlueTransparent));
     IsEnabled = true;
     _shape    = shape;
     _size     = size;
 }
Ejemplo n.º 5
0
        public void HandleMouseDragEvent(Event e)
        {
            if (_selectionGridSnapSession.IsActive)
            {
                _selectionGridSnapSession.UpdateForMouseMovement();
            }
            else
            if (_selectionGrabSession.IsActive)
            {
                _selectionGrabSession.Update();
                ObjectSelectionGizmos.OnObjectSelectionUpdated();
            }
            else
            if (_objectVertexSnapSession.IsActive)
            {
                e.DisableInSceneView();
                _objectVertexSnapSession.UpdateForMouseMovement();
                ObjectSelectionGizmos.OnObjectSelectionUpdated();
                return;
            }
            else
            {
                SelectionShape.HandleMouseDragEvent(e);

                var mouseDragSelectionUpdateOperation = ObjectSelectionUpdateOperationFactory.Create(ObjectSelectionUpdateOperationType.MouseDrag);
                mouseDragSelectionUpdateOperation.Perform();
            }

            SceneView.RepaintAll();
        }
Ejemplo n.º 6
0
        public void HandleMouseMoveEvent(Event e)
        {
            if (Mirror.IsInteractionSessionActive)
            {
                e.DisableInSceneView();
                Mirror.HandleMouseMoveEvent(e);
                return;
            }

            if (_objectVertexSnapSession.IsActive)
            {
                e.DisableInSceneView();
                _objectVertexSnapSession.UpdateForMouseMovement();
                return;
            }

            SelectionShape.HandleMouseMoveEvent(e);
            _selectionGridSnapSession.UpdateForMouseMovement();
            if (_selectionGrabSession.IsActive)
            {
                _selectionGrabSession.Update();
                ObjectSelectionGizmos.OnObjectSelectionUpdated();
            }

            if (_object2ObjectSnapSession.IsActive)
            {
                _object2ObjectSnapSession.UpdateOnMouseMove();
                ObjectSelectionGizmos.OnObjectSelectionUpdated();
            }
        }
Ejemplo n.º 7
0
        public void HandleMouseButtonDownEvent(Event e)
        {
            if (_object2ObjectSnapSession.IsActive && AllShortcutCombos.Instance.EndSelectionObject2ObjectSnap.IsActive())
            {
                e.DisableInSceneView();
                _object2ObjectSnapSession.End();
                return;
            }

            if (_selectionGridSnapSession.IsActive || _selectionGrabSession.IsActive || _object2ObjectSnapSession.IsActive || _objectVertexSnapSession.IsActive)
            {
                return;
            }
            if (AllShortcutCombos.Instance.SnapXZGridToCursorPickPointOnLeftClick_Selection.IsActive() && e.InvolvesLeftMouseButton())
            {
                e.DisableInSceneView();

                ObjectSnapping.Get().SnapXZGridToCursorPickPoint(e.clickCount == 2);
                return;
            }

            if (Mirror.IsInteractionSessionActive && e.InvolvesLeftMouseButton())
            {
                e.DisableInSceneView();
                Mirror.EndInteractionSession();
                return;
            }

            if (e.InvolvesLeftMouseButton() && NumberOfSelectedObjects != 0 &&
                !SelectionShape.IsVisible() && AllShortcutCombos.Instance.ReplacePrefabsForSelectedObjects_Scene.IsActive() &&
                !Mirror.IsInteractionSessionActive)
            {
                e.DisableInSceneView();
                UndoEx.RecordForToolAction(this);
                List <GameObject> newObjects = ObjectSelectionActions.ReplaceSelectedObjectsPrefabOnMouseClick();
                if (newObjects.Count != 0)
                {
                    AddGameObjectCollectionToSelection(newObjects);
                }

                return;
            }

            SelectionShape.HandleMouseButtonDownEvent(e);
            if (CanPerformClickSelectionUpdateOperation())
            {
                var clickSelectionUpdateOperation = ObjectSelectionUpdateOperationFactory.Create(ObjectSelectionUpdateOperationType.Click);
                clickSelectionUpdateOperation.Perform();

                SceneView.RepaintAll();
            }
        }
Ejemplo n.º 8
0
        public List <GameObject> GetAllGameObjectsOverlappedBySelectionShape()
        {
            if (SelectionShape.IsVisible())
            {
                List <GameObject> overlappedObjects = SelectionShape.GetOverlappedGameObjects();
                overlappedObjects.RemoveAll(item => !CanGameObjectBeSelected(item));

                return(overlappedObjects);
            }
            else
            {
                return(new List <GameObject>());
            }
        }
Ejemplo n.º 9
0
        public void HandleMouseMoveEvent(Event e)
        {
            if (Mirror.IsInteractionSessionActive)
            {
                e.DisableInSceneView();
                Mirror.HandleMouseMoveEvent(e);
                return;
            }

            SelectionShape.HandleMouseMoveEvent(e);
            _selectionSnapSession.UpdateForMouseMovement();
            if (_selectionGrabSession.IsActive)
            {
                _selectionGrabSession.Update();
                ObjectSelectionTransformGizmoSystem.OnObjectSelectionUpdated();
            }
        }
Ejemplo n.º 10
0
        public void RenderGizmos()
        {
            SelectionShape.RenderGizmos();
            _selectionSnapSession.RenderGizmos();
            _selectionGrabSession.RenderGizmos();

            IObjectSelectionRenderer objectSelectionRenderer = ObjectSelectionRendererFactory.Create();

            objectSelectionRenderer.Render(GetAllSelectedGameObjects());

            if (Mirror.IsActive)
            {
                Mirror.RenderGizmos();

                List <GameObject> topLevelParentsInSelection = GameObjectExtensions.GetTopParentsFromGameObjectCollection(_selectedObjects.HashSet);
                Mirror.RenderMirroredEntityOrientedBoxes(GameObjectExtensions.GetHierarchyWorldOrientedBoxes(topLevelParentsInSelection));
            }
        }
Ejemplo n.º 11
0
        public void UngroupSelected()
        {
            List <Shape> OldSelection = new List <Shape>(SelectionShape);

            SelectionShape.Clear();
            foreach (var item in OldSelection)
            {
                if (item is GroupShape)
                {
                    GroupShape group = (GroupShape)item;
                    foreach (var subItem in group.SubItems)
                    {
                        SelectionShape.Add(subItem);
                        ShapeList.Add(subItem);
                    }

                    ShapeList.Remove(item);
                }
            }
        }
Ejemplo n.º 12
0
        public HtmlLink()
        {
            _shape = new SelectionShape();
            _shape.gameObject.name = "HtmlLink";

            _clickHandler = (EventContext context) =>
            {
                _owner.onClickLink.BubbleCall(_element.GetString("href"));
            };
            _rolloverHandler = (EventContext context) =>
            {
                context.CaptureTouch();
                if (_owner.htmlParseOptions.linkHoverBgColor.a > 0)
                    _shape.color = _owner.htmlParseOptions.linkHoverBgColor;
            };
            _rolloutHandler = () =>
            {
                if (_owner.htmlParseOptions.linkHoverBgColor.a > 0)
                    _shape.color = _owner.htmlParseOptions.linkBgColor;
            };
        }
Ejemplo n.º 13
0
        public void HandleMouseDragEvent(Event e)
        {
            if (_selectionSnapSession.IsActive)
            {
                _selectionSnapSession.UpdateForMouseMovement();
            }
            else
            if (_selectionGrabSession.IsActive)
            {
                _selectionGrabSession.Update();
                ObjectSelectionTransformGizmoSystem.OnObjectSelectionUpdated();
            }
            else
            {
                SelectionShape.HandleMouseDragEvent(e);

                var mouseDragSelectionUpdateOperation = ObjectSelectionUpdateOperationFactory.Create(ObjectSelectionUpdateOperationType.MouseDrag);
                mouseDragSelectionUpdateOperation.Perform();
            }

            SceneView.RepaintAll();
        }
Ejemplo n.º 14
0
        public HtmlLink()
        {
            _shape = new SelectionShape();

            _clickHandler = (EventContext context) =>
            {
                _owner.BubbleEvent("onClickLink", _element.GetString("href"));
            };
            _rolloverHandler = (EventContext context) =>
            {
                if (_owner.htmlParseOptions.linkHoverBgColor.A > 0)
                {
                    _shape.color = _owner.htmlParseOptions.linkHoverBgColor;
                }
            };
            _rolloutHandler = () =>
            {
                if (_owner.htmlParseOptions.linkHoverBgColor.A > 0)
                {
                    _shape.color = _owner.htmlParseOptions.linkBgColor;
                }
            };
        }
Ejemplo n.º 15
0
 public void Disable()
 {
     IsEnabled = false;
     _shape    = SelectionShape.None;
     HexCells  = null;
 }
Ejemplo n.º 16
0
        public void HandleKeyboardButtonDownEvent(Event e)
        {
            if (AllShortcutCombos.Instance.ActivateObjectVertexSnapSession_Placement.IsActive() &&
                !_object2ObjectSnapSession.IsActive && !_selectionGrabSession.IsActive && !SelectionShape.IsVisible())
            {
                e.DisableInSceneView();
                _objectVertexSnapSession.Begin(GetAllSelectedGameObjects());
                return;
            }

            if (!_object2ObjectSnapSession.IsActive)
            {
                if (AllShortcutCombos.Instance.GrabSelection.IsActive() && NumberOfSelectedObjects != 0)
                {
                    if (_selectionGrabSession.IsActive)
                    {
                        _selectionGrabSession.End();
                    }
                    else
                    {
                        _selectionGrabSession.Settings = SelectionGrabSettings;
                        _selectionGrabSession.Begin(new List <GameObject>(_selectedObjects.HashSet));
                    }
                }
            }

            if (!_selectionGrabSession.IsActive)
            {
                if (AllShortcutCombos.Instance.ToggleSelectionObject2ObjectSnap.IsActive() && NumberOfSelectedObjects != 0)
                {
                    if (_object2ObjectSnapSession.IsActive)
                    {
                        _object2ObjectSnapSession.End();
                    }
                    else
                    {
                        _object2ObjectSnapSession.Begin();
                    }
                }
            }

            if (_object2ObjectSnapSession.IsActive)
            {
                if (AllShortcutCombos.Instance.SelectionRotateWorldX.IsActive())
                {
                    Rotate(Settings.XRotationStep, Vector3.right);
                }
                else if (AllShortcutCombos.Instance.SelectionRotateWorldY.IsActive())
                {
                    Rotate(Settings.YRotationStep, Vector3.up);
                }
                else if (AllShortcutCombos.Instance.SelectionRotateWorldZ.IsActive())
                {
                    Rotate(Settings.ZRotationStep, Vector3.forward);
                }
                else if (AllShortcutCombos.Instance.SetRotationToIdentity.IsActive())
                {
                    SetWorldRotation(Quaternion.identity);
                }
                return;
            }

            if (_selectionGrabSession.IsActive || _selectionGridSnapSession.IsActive || _object2ObjectSnapSession.IsActive)
            {
                return;
            }

            // Note: Don't disable this event if it's CTRL or CMD because transform
            //       handle snapping will no longer work.
            if (e.keyCode != KeyCode.LeftControl && e.keyCode != KeyCode.LeftCommand &&
                e.keyCode != KeyCode.RightControl && e.keyCode != KeyCode.RightCommand)
            {
                e.DisableInSceneView();
            }

            if (Mirror.IsInteractionSessionActive)
            {
                Mirror.HandleKeyboardButtonDownEvent(e);
                return;
            }

            if (Mirror.IsActive && AllShortcutCombos.Instance.MirrorSelectedObjects.IsActive())
            {
                List <GameObject> selectedRoots = Octave3DWorldBuilder.ActiveInstance.GetRoots(GetAllSelectedGameObjects());
                ObjectHierarchyRootsWerePlacedInSceneMessage.SendToInterestedListeners(Mirror.MirrorGameObjectHierarchies(selectedRoots), ObjectHierarchyRootsWerePlacedInSceneMessage.PlacementType.Selection);
                return;
            }

            if (AllShortcutCombos.Instance.DeleteSelectedObjects.IsActive())
            {
                UndoEx.RecordForToolAction(this);
                ObjectActions.EraseAllSelectedGameObjects();
            }
            else
            if (AllShortcutCombos.Instance.SelectAllObjectsWithSamePrefabAsCurrentSelection.IsActive())
            {
                UndoEx.RecordForToolAction(this);
                ObjectSelectionActions.SelectAllObjectsWithSamePrefabAsCurrentSelection();
                _objectSelectionGizmos.OnObjectSelectionUpdated();
            }
            else
            if (AllShortcutCombos.Instance.ActivateMoveGizmo.IsActive())
            {
                UndoEx.RecordForToolAction(_objectSelectionGizmos);
                _objectSelectionGizmos.ActiveGizmoType = GizmoType.Move;
                Octave3DWorldBuilder.ActiveInstance.Inspector.EditorWindow.Repaint();
            }
            else
            if (AllShortcutCombos.Instance.ActivateRotationGizmo.IsActive())
            {
                UndoEx.RecordForToolAction(_objectSelectionGizmos);
                _objectSelectionGizmos.ActiveGizmoType = GizmoType.Rotate;
                Octave3DWorldBuilder.ActiveInstance.Inspector.EditorWindow.Repaint();
            }
            else
            if (AllShortcutCombos.Instance.ActivateScaleGizmo.IsActive())
            {
                UndoEx.RecordForToolAction(_objectSelectionGizmos);
                _objectSelectionGizmos.ActiveGizmoType = GizmoType.Scale;
                Octave3DWorldBuilder.ActiveInstance.Inspector.EditorWindow.Repaint();
            }
            else
            if (AllShortcutCombos.Instance.ActivateObjectSelectionExtrudeGizmo.IsActive())
            {
                UndoEx.RecordForToolAction(_objectSelectionGizmos);
                _objectSelectionGizmos.ActiveGizmoType = GizmoType.Duplicate;
                Octave3DWorldBuilder.ActiveInstance.Inspector.EditorWindow.Repaint();
            }
            else
            if (AllShortcutCombos.Instance.ProjectSelectedObjects.IsActive())
            {
                ProjectSelectionOnProjectionSurface();
            }
            else if (AllShortcutCombos.Instance.SelectionGridSnap.IsActive())
            {
                _selectionGridSnapSession.Begin();
            }
            else if (AllShortcutCombos.Instance.SetRotationToIdentity.IsActive())
            {
                SetWorldRotation(Quaternion.identity);
            }
            else if (AllShortcutCombos.Instance.SelectionRotateWorldX.IsActive())
            {
                Rotate(Settings.XRotationStep, Vector3.right);
            }
            else if (AllShortcutCombos.Instance.SelectionRotateWorldY.IsActive())
            {
                Rotate(Settings.YRotationStep, Vector3.up);
            }
            else if (AllShortcutCombos.Instance.SelectionRotateWorldZ.IsActive())
            {
                Rotate(Settings.ZRotationStep, Vector3.forward);
            }
        }
Ejemplo n.º 17
0
 public void Dispose()
 {
     _shape.Dispose();
     _shape = null;
 }
Ejemplo n.º 18
0
 private bool CanAdjustSelectionShapeSizeForMouseScrollWheel()
 {
     return(_settings.SelectionMode == ObjectSelectionMode.Paint && SelectionShape.IsVisible() &&
            AllShortcutCombos.Instance.EnableScrollWheelSizeAdjustmentForSelectionShape.IsActive());
 }
Ejemplo n.º 19
0
 public void Dispose()
 {
     _shape.Dispose();
     _shape = null;
 }
Ejemplo n.º 20
0
 public void HandleMouseButtonUpEvent(Event e)
 {
     SelectionShape.HandleMouseButtonUpEvent(e);
 }