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() }, } });
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); } }
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(); } }
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); }
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); }
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); }
// Non-reversibly remove a command and reload command list public void RemoveCommand(S2VXCommand command) { Story.RemoveCommand(command); LoadCommandsList(); }
// Non-reversibly add a command and reload command list public void AddCommand(S2VXCommand command) { Story.AddCommand(command); LoadCommandsList(); }
private void ResetEditInputBar(S2VXCommand command) { EditInputBar = CreateEditInputBar(); EditInputBar.CommandToValues(command); }
private void HandleCopyCommand(S2VXCommand command) { AddInputBar.CommandToValues(command); LoadCommandsList(); }
private void HandleRemoveCommand(S2VXCommand command) => Editor.Reversibles.Push(new ReversibleRemoveCommand(command, this));
private void HandleCancelCommand() { EditCommandReference = null; LoadCommandsList(); }
private void HandleEditClick(S2VXCommand command) { EditCommandReference = command; LoadCommandsList(); }
public ReversibleAddCommand(S2VXCommand command, CommandPanel commandPanel) { Command = command; CommandPanel = commandPanel; }
public ReversibleUpdateCommand(S2VXCommand oldCommand, S2VXCommand newCommand, CommandPanel commandPanel) { OldCommand = oldCommand; NewCommand = newCommand; CommandPanel = commandPanel; }
public CommandTimeInfo(S2VXCommand command) { Type = command.GetCommandName(); StartTime = command.StartTime; EndTime = command.EndTime; }