Ejemplo n.º 1
0
        private void HandleAddClick()
        {
            AddInputBar.Reset();
            var commandString = AddInputBar.ValuesToString();

            try {
                var command = S2VXCommand.FromString(commandString);
                HandleAddCommand(command);
            } catch (Exception ex) {
                AddInputBar.AddErrorIndicator();
                Console.WriteLine(ex);
            }
        }
Ejemplo n.º 2
0
        private void HandleSaveCommand(S2VXCommand oldCommand)
        {
            var commandString = EditInputBar.ValuesToString();
            var addSuccessful = false;

            try {
                var newCommand = S2VXCommand.FromString(commandString);
                Editor.Reversibles.Push(new ReversibleUpdateCommand(oldCommand, newCommand, this));
                addSuccessful = true;
            } catch (Exception ex) {
                EditInputBar.AddErrorIndicator();
                Console.WriteLine(ex);
            }
            if (addSuccessful)
            {
                EditCommandReference = null;
                LoadCommandsList();
            }
        }
Ejemplo n.º 3
0
        public void FromString_ColorCommand()
        {
            var input    = "BackgroundColor|0.1|(0,0,0)|0.2|(1,1,1)|None";
            var expected = new BackgroundColorCommand()
            {
                StartTime  = 0.1f,
                EndTime    = 0.2f,
                Easing     = Enum.Parse <Easing>("None"),
                StartValue = Color4.Black,
                EndValue   = Color4.White,
            };
            var actual = (BackgroundColorCommand)S2VXCommand.FromString(input);

            Assert.AreEqual(expected.StartTime, actual.StartTime, FloatingPointTolerance);
            Assert.AreEqual(expected.EndTime, actual.EndTime, FloatingPointTolerance);
            Assert.AreEqual(expected.Easing, actual.Easing);
            Assert.AreEqual(expected.StartValue, actual.StartValue);
            Assert.AreEqual(expected.EndValue, actual.EndValue);
        }
Ejemplo n.º 4
0
        public void FromString_Vector2Command()
        {
            var input    = "CameraMove|0.1|(0,0)|0.2|(1,1)|None";
            var expected = new CameraMoveCommand()
            {
                StartTime  = 0.1f,
                EndTime    = 0.2f,
                Easing     = Enum.Parse <Easing>("None"),
                StartValue = Vector2.Zero,
                EndValue   = Vector2.One,
            };
            var actual = (CameraMoveCommand)S2VXCommand.FromString(input);

            Assert.AreEqual(expected.StartTime, actual.StartTime, FloatingPointTolerance);
            Assert.AreEqual(expected.EndTime, actual.EndTime, FloatingPointTolerance);
            Assert.AreEqual(expected.Easing, actual.Easing);
            Assert.AreEqual(expected.StartValue, actual.StartValue);
            Assert.AreEqual(expected.EndValue, actual.EndValue);
        }
Ejemplo n.º 5
0
        public void FromString_DoubleCommand()
        {
            var input    = "ApproachesDistance|0.1|0.1|0.2|1.0|None";
            var expected = new ApproachesDistanceCommand()
            {
                StartTime  = 0.1f,
                EndTime    = 0.2f,
                Easing     = Enum.Parse <Easing>("None"),
                StartValue = 0.1f,
                EndValue   = 1.0f,
            };
            var actual = (ApproachesDistanceCommand)S2VXCommand.FromString(input);

            Assert.AreEqual(expected.StartTime, actual.StartTime, FloatingPointTolerance);
            Assert.AreEqual(expected.EndTime, actual.EndTime, FloatingPointTolerance);
            Assert.AreEqual(expected.Easing, actual.Easing);
            Assert.AreEqual(expected.StartValue, actual.StartValue, FloatingPointTolerance);
            Assert.AreEqual(expected.EndValue, actual.EndValue, FloatingPointTolerance);
        }