Example #1
0
        public void SetCommands()
        {
            var leftClickTrigger = new MouseButtonTrigger();

            leftClickTrigger.AddTag("temporary");
            var leftClickCommand = new Command(LeftMouseButton).Add(leftClickTrigger);

            leftClickCommand.AddTag("temporary");
            var middleDragTrigger = new MouseDragTrigger(MouseButton.Middle);

            middleDragTrigger.AddTag("temporary");
            var middleDragCommand = new Command(MiddleMouseDrag).Add(middleDragTrigger);

            middleDragCommand.AddTag("temporary");
            var dragLeftTrigger = new MouseDragTrigger();

            dragLeftTrigger.AddTag("temporary");
            var dragLeftCommand = new Command(LeftMouseDrag).Add(dragLeftTrigger);

            dragLeftCommand.AddTag("temporary");
            var zoomTrigger = new MouseZoomTrigger();

            zoomTrigger.AddTag("temporary");
            var zoomCommand = new Command(Zoom).Add(zoomTrigger);

            zoomCommand.AddTag("temporary");
            var leftReleaseTrigger = new MouseButtonTrigger(State.Releasing);

            leftReleaseTrigger.AddTag("temporary");
            var leftReleaseCommand = new Command(LeftMouseRelease).Add(leftReleaseTrigger);

            leftReleaseCommand.AddTag("temporary");
        }
Example #2
0
        protected override void Preview(string contentName)
        {
            var verdana = ContentLoader.Load <Font>("Verdana12");

            new FontText(verdana, "Play", Rectangle.One);
            if (Sound != null)
            {
                DisposeData();
            }
            Sound   = ContentLoader.Load <Sound>(contentName);
            trigger = new MouseButtonTrigger();
            trigger.AddTag("temporary");
            soundCommand = new Command(() => Sound.Play(1)).Add(trigger);
            soundCommand.AddTag("temporary");
        }
Example #3
0
        private void SetMouseCommands(string obj)
        {
            var leftClickTriggerReleasing = new MouseButtonTrigger(MouseButton.Left, State.Releasing);

            leftClickTriggerReleasing.AddTag("temporary");
            var findEntityCommand = new Command(FindEntity2DOnPosition).Add(leftClickTriggerReleasing);

            findEntityCommand.AddTag("temporary");
            var releaseMiddleMouse = new MouseButtonTrigger(MouseButton.Left, State.Releasing);

            releaseMiddleMouse.AddTag("temporary");
            var setReleasingCommand =
                new Command(position => AddControlToScene(position)).Add(releaseMiddleMouse);

            setReleasingCommand.AddTag("temporary");
            UiEditorScene.SetMousePosition();
        }
        protected override void Preview(string contentName)
        {
            verdana = ContentLoader.Load <Font>("Verdana12");
            new FontText(verdana, "Play/Stop", Rectangle.One);
            music = ContentLoader.Load <Music>(contentName);
            music.Play(1);
            var trigger = new MouseButtonTrigger();

            trigger.AddTag("temporary");
            var musicCommand = new Command(() =>             //ncrunch: no coverage start
            {
                if (music.IsPlaying())
                {
                    music.Stop();
                }
                else
                {
                    music.Play(1);
                }
            }).Add(trigger);

            musicCommand.AddTag("temporary");
            //ncrunch: no coverage end
        }
Example #5
0
        public void SetMousePosition()
        {
            var middleClick = new MouseButtonTrigger();

            middleClick.AddTag("temporary");
            var setLastPositionCommand = new Command(position => SetPosition(position)).Add(middleClick);

            setLastPositionCommand.AddTag("temporary");
            var moveMouse = new MousePositionTrigger(MouseButton.Left, State.Released);

            moveMouse.AddTag("temporary");
            var checkTransformationCommand =
                new Command(position => CheckIfCanTransformControl(position)).Add(moveMouse);

            checkTransformationCommand.AddTag("temporary");
            var pressAndMoveMouse = new MousePositionTrigger(MouseButton.Left, State.Pressed);

            pressAndMoveMouse.AddTag("temporary");
            var pressOnControlCommand =
                new Command(position => TransformSelectedControl(position)).Add(pressAndMoveMouse);

            pressOnControlCommand.AddTag("temporary");
            var pressControl = new KeyTrigger(Key.LeftControl);

            pressControl.AddTag("temporary");
            var multiSelectControl = new Command(() => SetMultiSelection(true)).Add(pressControl);

            multiSelectControl.AddTag("temporary");
            var releaseControl = new KeyTrigger(Key.LeftControl, State.Releasing);

            releaseControl.AddTag("temporary");
            var disableMultiSelectControl =
                new Command(() => SetMultiSelection(false)).Add(releaseControl);

            disableMultiSelectControl.AddTag("temporary");
        }