Пример #1
0
 public void Initialize(Contexts contexts, MessageBus messageBus)
 {
     _contexts           = contexts;
     _assetFactory       = GetComponent <AssetFactory>();
     _entityViewDatabase = GetComponent <EntityViewDatabase <TScope> >();
     _orientationHandler = GetComponent <IOrientationHandler <TScope> >();
     _positionHandler    = GetComponent <IPositionHandler <TScope> >();
     _contexts.Singleton().AddGlobalComponentListener(this);
 }
Пример #2
0
 public PlayerEntityHandler(IMinecraftClientAdapter adapter, int entityId, Uuid playerUuid, Vector3d position, Vector2 rotation)
 {
     _adapter         = adapter;
     EntityId         = entityId;
     EntityUuid       = playerUuid;
     _positionHandler = new EntityPositionHandler(adapter, entityId, position, rotation);
     //TODO: add events
     _adapter.EntitiesDestroyed += Adapter_EntitiesDestroyed;
 }
Пример #3
0
        /// <summary>
        /// The subtree is upon to be dragged.
        /// </summary>
        public void InitializeDrag(IInputModeContext context)
        {
            subtree      = new Subtree(context.GetGraph(), node);
            layoutHelper = new RelocateSubtreeLayoutHelper((GraphControl)context.CanvasControl, subtree);
            layoutHelper.InitializeLayout();

            compositeHandler = CreateCompositeHandler(subtree);
            compositeHandler.InitializeDrag(context);
        }
Пример #4
0
            public object Lookup(object item, Type type)
            {
                INode node = (INode)item;

                // see if the node is styled using UMLClassStyle
                if (node.Style is NodeControlNodeStyle)
                {
                    // then customize the behavior

                    // for dragging the item using a shadow and grid
                    if (type == typeof(IPositionHandler))
                    {
                        IPositionHandler positionHandler = (IPositionHandler)LookupNext(item, type);
                        if (positionHandler != null)
                        {
                            return(new UMLPositionHandler(positionHandler, node));
                        }
                        else
                        {
                            return(null);
                        }
                    }
                    if (type == typeof(IReshapeHandler))
                    {
                        return(new UMLReshapeHandler((IReshapeHandler)LookupNext(item, type)));
                    }
                    // for resizing the item using a shadow and grid
                    if (type == typeof(IReshapeHandleProvider))
                    {
                        var result = LookupNext(item, type);
                        if (result is ReshapeHandleProviderBase)
                        {
                            ((ReshapeHandleProviderBase)result).HandlePositions = HandlePositions.East | HandlePositions.West;
                        }
                        return(result);
                    }

                    if (type == typeof(INodeSnapResultProvider))
                    {
                        return(new MyNodeSnapResultProvider());
                    }
                    // for constraining the size
                    if (type == typeof(INodeSizeConstraintProvider))
                    {
                        double height = double.MaxValue;
                        return(new NodeSizeConstraintProvider(new SizeD(100, 0), new SizeD(800, height)));
                    }

                    // for providing the ClassInfo
                    // Allows direct access without having to use ITagOwner.Tag
                    if (type == typeof(ClassInfo))
                    {
                        return(node.Tag as ClassInfo);
                    }
                }
                return(LookupNext(item, type));
            }
        // Returns true if an AdditionalSnapLine can be found in a close surrounding of the given location.
        private bool IsValidHit(IInputModeContext context, PointD location)
        {
            AdditionalSnapLineVisualCreator line = TryGetAdditionalSnapLineAt(location);

            if (line != null)
            {
                handler = new AdditionalSnapLinePositionHandler(line, location);
                return(true);
            }
            handler = null;
            return(false);
        }
Пример #6
0
 public MovementHandler
 (
     IPositionHandler positionHandler,
     IPointReplacer pointReplacer,
     IAnimalFinder animalFinder,
     IHealthHandler healthHandler,
     IField field
 )
 {
     _field           = field;
     _positionHandler = positionHandler;
     _pointReplacer   = pointReplacer;
     _animalFinder    = animalFinder;
     _healthHandler   = healthHandler;
 }
 public LayerPositionHandler(LayerVisualCreator layerVisualCreator, INode node, IPositionHandler positionHandler, IMapper <INode, int> newLayerMapper) : base(positionHandler)
 {
     this.layerVisualCreator = layerVisualCreator;
     this.node           = node;
     this.newLayerMapper = newLayerMapper;
 }
 public ZOrderNodePositionHandler(INode node, IPositionHandler wrappedHandler = null) : base(node, wrappedHandler)
 {
     this.node = node;
 }
 public GreenPositionHandler(IPositionHandler handler)
 {
     this.handler = handler;
 }
 public OrangePositionHandler(MutableRectangle boundaryRectangle, INode node, IPositionHandler wrappedHandler)
     : base(wrappedHandler)
 {
     this.boundaryRectangle = boundaryRectangle;
     this.node = node;
 }
 public NonOverlapPositionHandler(INode node, IPositionHandler handler)
 {
     this.node    = node;
     this.handler = handler;
 }
 public CollectingPositionHandlerWrapper(INode item, ICollection <INode> movedNodes, IPositionHandler baseImplementation) : base(baseImplementation)
 {
     this.item       = item;
     this.movedNodes = movedNodes;
 }
Пример #13
0
 public SubtreePositionHandler(INode node, IPositionHandler original)
 {
     this.node           = node;
     nodePositionHandler = original;
 }
 public HorizontallyConstrainedPositionHandler(IPositionHandler wrappedHandler) : base(wrappedHandler)
 {
 }
Пример #15
0
 public UMLPositionHandler([NotNull] IPositionHandler wrappedHandler, [NotNull] INode node)
 {
     this.wrappedHandler = wrappedHandler;
     this.node           = node;
 }