Example #1
0
        public void MirrorProp()
        {
            var container = BeatmapObjectContainerCollection.GetCollectionForType(BeatmapObject.Type.EVENT);

            if (container is EventsContainer eventsContainer)
            {
                var root           = eventsContainer.transform.root;
                var eventPlacement = root.GetComponentInChildren <EventPlacement>();

                var eventA = new MapEvent(2, MapEvent.EVENT_TYPE_BACK_LASERS, MapEvent.LIGHT_VALUE_RED_FADE, JSON.Parse("{\"_lightID\": 2}"));

                eventPlacement.queuedData  = eventA;
                eventPlacement.queuedValue = eventPlacement.queuedData._value;
                eventPlacement.RoundedTime = eventPlacement.queuedData._time;
                eventPlacement.ApplyToMap();

                SelectionController.Select(eventA);

                eventsContainer.EventTypeToPropagate = eventA._type;
                eventsContainer.PropagationEditing   = EventsContainer.PropMode.Light;

                _mirror.Mirror();
                // I'm sorry if you're here after changing the prop mapping for default env
                EventTest.CheckEvent(eventsContainer, 0, 2, MapEvent.EVENT_TYPE_BACK_LASERS, MapEvent.LIGHT_VALUE_BLUE_FADE, JSON.Parse("{\"_lightID\": 9}"));

                // Undo mirror
                _actionContainer.Undo();
                EventTest.CheckEvent(eventsContainer, 0, 2, MapEvent.EVENT_TYPE_BACK_LASERS, MapEvent.LIGHT_VALUE_RED_FADE, JSON.Parse("{\"_lightID\": 2}"));

                eventsContainer.PropagationEditing = EventsContainer.PropMode.Off;
            }
        }
Example #2
0
        public void MirrorGradient()
        {
            var container = BeatmapObjectContainerCollection.GetCollectionForType(BeatmapObject.Type.EVENT);

            if (container is EventsContainer eventsContainer)
            {
                var root           = eventsContainer.transform.root;
                var eventPlacement = root.GetComponentInChildren <EventPlacement>();

                var eventA = new MapEvent(2, MapEvent.EVENT_TYPE_BACK_LASERS, MapEvent.LIGHT_VALUE_RED_FADE, JSON.Parse("{\"_lightGradient\": {\"_duration\": 1, \"_startColor\": [1, 0, 0, 1], \"_endColor\": [0, 1, 0, 1], \"_easing\": \"easeLinear\"}}"));

                eventPlacement.queuedData  = eventA;
                eventPlacement.queuedValue = eventPlacement.queuedData._value;
                eventPlacement.RoundedTime = eventPlacement.queuedData._time;
                eventPlacement.ApplyToMap();

                SelectionController.Select(eventA);

                _mirror.Mirror();
                EventTest.CheckEvent(eventsContainer, 0, 2, MapEvent.EVENT_TYPE_BACK_LASERS, MapEvent.LIGHT_VALUE_BLUE_FADE, JSON.Parse("{\"_lightGradient\": {\"_duration\": 1, \"_startColor\": [0, 1, 0, 1], \"_endColor\": [1, 0, 0, 1], \"_easing\": \"easeLinear\"}}"));

                // Undo mirror
                _actionContainer.Undo();
                EventTest.CheckEvent(eventsContainer, 0, 2, MapEvent.EVENT_TYPE_BACK_LASERS, MapEvent.LIGHT_VALUE_RED_FADE, JSON.Parse("{\"_lightGradient\": {\"_duration\": 1, \"_startColor\": [1, 0, 0, 1], \"_endColor\": [0, 1, 0, 1], \"_easing\": \"easeLinear\"}}"));
            }
        }
Example #3
0
        public void MirrorRotation()
        {
            var rotationCb = Object.FindObjectOfType <RotationCallbackController>();

            rotationCb.Start();

            var container = BeatmapObjectContainerCollection.GetCollectionForType(BeatmapObject.Type.EVENT);

            if (container is EventsContainer eventsContainer)
            {
                var root           = eventsContainer.transform.root;
                var eventPlacement = root.GetComponentInChildren <EventPlacement>();

                var eventA = new MapEvent(2, MapEvent.EVENT_TYPE_LATE_ROTATION, MapEvent.LIGHT_VALUE_TO_ROTATION_DEGREES.ToList().IndexOf(45), JSON.Parse("{\"_rotation\": 33}"));

                eventPlacement.queuedData  = eventA;
                eventPlacement.queuedValue = eventPlacement.queuedData._value;
                eventPlacement.RoundedTime = eventPlacement.queuedData._time;
                eventPlacement.ApplyToMap();

                SelectionController.Select(eventA);

                _mirror.Mirror();
                EventTest.CheckEvent(eventsContainer, 0, 2, MapEvent.EVENT_TYPE_LATE_ROTATION, MapEvent.LIGHT_VALUE_TO_ROTATION_DEGREES.ToList().IndexOf(-45), JSON.Parse("{\"_rotation\": -33}"));

                // Undo mirror
                _actionContainer.Undo();
                EventTest.CheckEvent(eventsContainer, 0, 2, MapEvent.EVENT_TYPE_LATE_ROTATION, MapEvent.LIGHT_VALUE_TO_ROTATION_DEGREES.ToList().IndexOf(45), JSON.Parse("{\"_rotation\": 33}"));
            }
        }
Example #4
0
        public void Mailbox_ReceiveOne()
        {
            var received  = false;
            var testEvent = new EventTest();

            var src = Observable
                      .FromEventPattern <BasicDeliverEventArgs>(testEvent, nameof(testEvent.FakeEvent))
                      .Select(e => new DeliveryContext(e.EventArgs, null));

            var c = new FakeSimpleMailbox(src, autoAck: true);

            c.Subscribe(m =>
                        received = true);

            testEvent.Raise(NewArgs());

            Assert.True(received);
        }