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

@@ -69,11 +69,7 @@ namespace Ichni.Editor
tabMainRect.anchoredPosition = new Vector2(posX, tabMainRect.anchoredPosition.y);
tabButton.onClick.AddListener(SelectGameElement);
expandButton.onClick.AddListener(ExpandOrFold);
deleteButton.onConfirm = () =>
{
connectedGameElement.parentElement.childElementList.Remove(connectedGameElement);
connectedGameElement.Delete();
};
deleteButton.onConfirm = () => EditorManager.instance.operationManager.CopyPasteDeleteModule.DeleteElement(connectedGameElement);
}
}

View File

@@ -134,7 +134,7 @@ namespace Ichni.RhythmGame
OnDelete();
LogWindow.Log("Deleted element: " + elementName);
//LogWindow.Log("Deleted element: " + elementName);
EditorManager.instance.beatmapContainer.gameElementList.Remove(this); //从保存列表中剔除

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();