small fix

This commit is contained in:
SoulliesOfficial
2025-02-19 19:06:26 -05:00
parent 0d69138e1b
commit a00797dc99
4 changed files with 19 additions and 11 deletions

View File

@@ -54,11 +54,11 @@ namespace Ichni.Editor
if (Keyboard.current.cKey.wasPressedThisFrame)
{
EditorManager.instance.operationManager.copyPasteModule.CopyElement(EditorManager.instance.operationManager.currentSelectedElement);
EditorManager.instance.operationManager.CopyPasteDeleteModule.CopyElement(EditorManager.instance.operationManager.currentSelectedElement);
}
else if (Keyboard.current.vKey.wasPressedThisFrame)
{
EditorManager.instance.operationManager.copyPasteModule.PasteElement(EditorManager.instance.operationManager.currentSelectedElement);
EditorManager.instance.operationManager.CopyPasteDeleteModule.PasteElement(EditorManager.instance.operationManager.currentSelectedElement);
}
if (Keyboard.current.digit1Key.wasPressedThisFrame)

View File

@@ -10,11 +10,11 @@ namespace Ichni.Editor
{
public GameElement currentSelectedElement { get; private set; }
public CopyPasteModule copyPasteModule;
public CopyPasteDeleteModule CopyPasteDeleteModule;
public OperationManager()
{
copyPasteModule = new CopyPasteModule();
CopyPasteDeleteModule = new CopyPasteDeleteModule();
}
public void SelectElement(GameElement gameElement)
@@ -23,7 +23,7 @@ namespace Ichni.Editor
}
}
public class CopyPasteModule
public class CopyPasteDeleteModule
{
public GameElement copiedElement;
@@ -45,6 +45,18 @@ namespace Ichni.Editor
AffiliatedPaste(copiedElement, parentElement);
}
public void DeleteElement(GameElement gameElement)
{
LogWindow.Log("Deleted element: " + gameElement.elementName + " and all its children.");
if (gameElement.parentElement != null)
{
gameElement.parentElement.childElementList.Remove(gameElement);
}
gameElement.Delete();
}
private GameElement AffiliatedPaste(GameElement gameElement, GameElement parent)
{
gameElement.SaveBM();