Added SpriteMapModifications for use in Form1
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using QURO;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SpriteMapEditor.SpriteMapModifications
|
||||
{
|
||||
class RemoveSprite : ISpriteMapModification
|
||||
{
|
||||
private readonly BindingList<SpriteMapRegion> allSprites;
|
||||
|
||||
private readonly int index;
|
||||
|
||||
private readonly SpriteMapRegion removedSprite;
|
||||
|
||||
public RemoveSprite(BindingList<SpriteMapRegion> spriteList, int indexToRemove)
|
||||
{
|
||||
allSprites = spriteList;
|
||||
index = indexToRemove;
|
||||
removedSprite = allSprites[index];
|
||||
}
|
||||
|
||||
public void Do()
|
||||
{
|
||||
allSprites.RemoveAt(index);
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
allSprites.Insert(index, removedSprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user