using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ComponentModel; using QURO; using System.Windows.Forms; namespace SpriteMapEditor.SpriteMapModifications { class AddSprite : ISpriteMapModification { private readonly BindingList allSprites; private readonly Sprite selectedSprite; private List preChangeSelection; private List postChangeSelection; public AddSprite(BindingList spriteList, Sprite selected = null) { allSprites = spriteList; selectedSprite = selected; } public void Do() { if (selectedSprite != null) allSprites.Add(new Sprite(selectedSprite.Name, selectedSprite.Bounds, selectedSprite.Origin)); else allSprites.Add(new Sprite()); } public void Undo() { allSprites.RemoveAt(allSprites.Count - 1); } public List GetPreChangeSelection() { return preChangeSelection; } public void SetPreChangeSelection(List currentSelection) { preChangeSelection = currentSelection; } public List GetPostChangeSelection() { return postChangeSelection; } public void SetPostChangeSelection(List currentSelection) { postChangeSelection = currentSelection; } public override string ToString() { return "Add Sprite"; } } }