示例#1
0
 private void AddCommandToCommandsList(int localIndex, S2VXCommand command) =>
 CommandsList.Add(new FillFlowContainer {
     AutoSizeAxes = Axes.Both,
     Children     = new Drawable[] {
         new IconButton {
             Action = () => HandleRemoveClick(localIndex),
             Width  = InputSize.Y,
             Height = InputSize.Y,
             Icon   = FontAwesome.Solid.Trash
         },
         new IconButton {
             Action = () => HandleCopyClick(localIndex),
             Width  = InputSize.Y,
             Height = InputSize.Y,
             Icon   = FontAwesome.Solid.Clone
         },
         new IconButton {
             Action = () => HandleEditClick(command),
             Width  = InputSize.Y,
             Height = InputSize.Y,
             Icon   = FontAwesome.Solid.Edit
         },
         new SpriteText {
             Text = command.ToString()
         },
     }
 });
示例#2
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);
            }
        }
示例#3
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();
            }
        }
示例#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);
        }
示例#5
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);
        }
示例#6
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);
        }
示例#7
0
 // Non-reversibly remove a command and reload command list
 public void RemoveCommand(S2VXCommand command)
 {
     Story.RemoveCommand(command);
     LoadCommandsList();
 }
示例#8
0
 // Non-reversibly add a command and reload command list
 public void AddCommand(S2VXCommand command)
 {
     Story.AddCommand(command);
     LoadCommandsList();
 }
示例#9
0
 private void ResetEditInputBar(S2VXCommand command)
 {
     EditInputBar = CreateEditInputBar();
     EditInputBar.CommandToValues(command);
 }
示例#10
0
 private void HandleCopyCommand(S2VXCommand command)
 {
     AddInputBar.CommandToValues(command);
     LoadCommandsList();
 }
示例#11
0
 private void HandleRemoveCommand(S2VXCommand command) => Editor.Reversibles.Push(new ReversibleRemoveCommand(command, this));
示例#12
0
 private void HandleCancelCommand()
 {
     EditCommandReference = null;
     LoadCommandsList();
 }
示例#13
0
 private void HandleEditClick(S2VXCommand command)
 {
     EditCommandReference = command;
     LoadCommandsList();
 }
示例#14
0
 public ReversibleAddCommand(S2VXCommand command, CommandPanel commandPanel)
 {
     Command      = command;
     CommandPanel = commandPanel;
 }
示例#15
0
 public ReversibleUpdateCommand(S2VXCommand oldCommand, S2VXCommand newCommand, CommandPanel commandPanel)
 {
     OldCommand   = oldCommand;
     NewCommand   = newCommand;
     CommandPanel = commandPanel;
 }
示例#16
0
 public CommandTimeInfo(S2VXCommand command)
 {
     Type      = command.GetCommandName();
     StartTime = command.StartTime;
     EndTime   = command.EndTime;
 }