复制粘贴删除
This commit is contained in:
@@ -17,6 +17,7 @@ namespace Ichni
|
||||
public ProjectManager projectManager;
|
||||
public EditorUIManager uiManager;
|
||||
public EditorSettings editorSettings;
|
||||
public OperationManager operationManager;
|
||||
public BackgroundController backgroundController;
|
||||
public CameraManager cameraManager;
|
||||
|
||||
@@ -32,6 +33,8 @@ namespace Ichni
|
||||
{
|
||||
instance = this;
|
||||
projectManager = new ProjectManager();
|
||||
operationManager = new OperationManager();
|
||||
|
||||
if (!ES3.FileExists(Application.streamingAssetsPath + "/EditorSettings.es3"))
|
||||
{
|
||||
editorSettings = new EditorSettings(300, 100, 100);
|
||||
|
||||
@@ -52,6 +52,14 @@ namespace Ichni.Editor
|
||||
EditorManager.instance.projectManager.exportManager.Export();
|
||||
}
|
||||
|
||||
if (Keyboard.current.cKey.wasPressedThisFrame)
|
||||
{
|
||||
EditorManager.instance.operationManager.copyPasteModule.CopyElement(EditorManager.instance.operationManager.currentSelectedElement);
|
||||
}
|
||||
else if (Keyboard.current.vKey.wasPressedThisFrame)
|
||||
{
|
||||
EditorManager.instance.operationManager.copyPasteModule.PasteElement(EditorManager.instance.operationManager.currentSelectedElement);
|
||||
}
|
||||
|
||||
if (Keyboard.current.digit1Key.wasPressedThisFrame)
|
||||
{
|
||||
|
||||
@@ -1,18 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
public class OperationManager : MonoBehaviour
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
public class OperationManager
|
||||
{
|
||||
public GameElement currentSelectedElement { get; private set; }
|
||||
|
||||
public CopyPasteModule copyPasteModule;
|
||||
|
||||
public OperationManager()
|
||||
{
|
||||
copyPasteModule = new CopyPasteModule();
|
||||
}
|
||||
|
||||
public void SelectElement(GameElement gameElement)
|
||||
{
|
||||
currentSelectedElement = gameElement;
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
public class CopyPasteModule
|
||||
{
|
||||
public GameElement copiedElement;
|
||||
|
||||
public void CopyElement(GameElement gameElement)
|
||||
{
|
||||
LogWindow.Log("Copied element: " + gameElement.elementName);
|
||||
copiedElement = gameElement;
|
||||
}
|
||||
|
||||
public void PasteElement(GameElement parentElement)
|
||||
{
|
||||
if (copiedElement == null)
|
||||
{
|
||||
LogWindow.Log("No element copied.");
|
||||
return;
|
||||
}
|
||||
|
||||
LogWindow.Log("Pasted element: " + copiedElement.elementName + " to " + parentElement.elementName);
|
||||
AffiliatedPaste(copiedElement, parentElement);
|
||||
}
|
||||
|
||||
private GameElement AffiliatedPaste(GameElement gameElement, GameElement parent)
|
||||
{
|
||||
gameElement.SaveBM();
|
||||
GameElement pastedElement = (gameElement.matchedBM as GameElement_BM).DuplicateBM(parent);
|
||||
|
||||
gameElement.submoduleList.ForEach(submodule =>
|
||||
{
|
||||
submodule.SaveBM();
|
||||
(submodule.matchedBM as Submodule_BM).DuplicateBM(pastedElement);
|
||||
});
|
||||
|
||||
if (gameElement.childElementList != null)
|
||||
{
|
||||
for (int i = 0; i < gameElement.childElementList.Count; i++)
|
||||
{
|
||||
AffiliatedPaste(gameElement.childElementList[i], pastedElement);
|
||||
}
|
||||
}
|
||||
|
||||
return pastedElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user