@@ -25,6 +25,9 @@ namespace Ichni.Editor
|
||||
|
||||
public void AddSelectElement(GameElement gameElement)
|
||||
{
|
||||
if (gameElement == null || gameElement.connectedTab == null) return;
|
||||
if (currentSelectedElements.Contains(gameElement)) return;
|
||||
|
||||
currentSelectedElements.Add(gameElement);
|
||||
|
||||
gameElement.connectedTab.isSelected = true;
|
||||
@@ -36,8 +39,12 @@ namespace Ichni.Editor
|
||||
|
||||
public void RemoveSelectElement(GameElement gameElement)
|
||||
{
|
||||
if (gameElement == null) return;
|
||||
|
||||
currentSelectedElements.Remove(gameElement);
|
||||
|
||||
if (gameElement.connectedTab == null) return;
|
||||
|
||||
gameElement.connectedTab.isSelected = false;
|
||||
if (gameElement.connectedTab.BgImage != null)
|
||||
{
|
||||
@@ -47,6 +54,7 @@ namespace Ichni.Editor
|
||||
|
||||
public void ClearSelectedElements()
|
||||
{
|
||||
currentSelectedElements.RemoveAll(gameElement => gameElement == null);
|
||||
currentSelectedElements.ForEach(gameElement =>
|
||||
{
|
||||
if (gameElement == null || gameElement.connectedTab == null) return;
|
||||
@@ -108,12 +116,24 @@ namespace Ichni.Editor
|
||||
|
||||
public void CopyElement(GameElement gameElement)
|
||||
{
|
||||
if (gameElement == null)
|
||||
{
|
||||
LogWindow.Log("No element selected to copy.", Color.red);
|
||||
return;
|
||||
}
|
||||
|
||||
LogWindow.Log("Copied element: " + gameElement.elementName);
|
||||
copiedElement = gameElement;
|
||||
}
|
||||
|
||||
public void PasteElement(GameElement parentElement)
|
||||
{
|
||||
if (parentElement == null)
|
||||
{
|
||||
LogWindow.Log("No parent element selected to paste.", Color.red);
|
||||
return;
|
||||
}
|
||||
|
||||
if (copiedElement == null)
|
||||
{
|
||||
LogWindow.Log("No element copied.");
|
||||
@@ -128,6 +148,7 @@ namespace Ichni.Editor
|
||||
// 与 EditorManager.LoadProject 的加载后流程对齐,确保 Manager 注册等关键步骤不遗漏。
|
||||
foreach (GameElement pasted in pastedElementList)
|
||||
{
|
||||
if (pasted == null) continue;
|
||||
pasted.AfterInitialize();
|
||||
pasted.Refresh();
|
||||
}
|
||||
@@ -135,6 +156,12 @@ namespace Ichni.Editor
|
||||
|
||||
public void DeleteElement(GameElement gameElement)
|
||||
{
|
||||
if (gameElement == null)
|
||||
{
|
||||
LogWindow.Log("No element selected to delete.", Color.red);
|
||||
return;
|
||||
}
|
||||
|
||||
LogWindow.Log("Deleted element: " + gameElement.elementName + " and all its children.");
|
||||
|
||||
if (gameElement.parentElement != null)
|
||||
@@ -144,6 +171,7 @@ namespace Ichni.Editor
|
||||
gameElement.parentElement.connectedTab.SetStatus();
|
||||
}
|
||||
|
||||
EditorManager.instance.operationManager.RemoveSelectElement(gameElement);
|
||||
gameElement.Delete();
|
||||
EditorManager.instance.uiManager.inspector.ClearInspector();
|
||||
}
|
||||
@@ -156,17 +184,38 @@ namespace Ichni.Editor
|
||||
/// <returns></returns>
|
||||
private void AffiliatedPaste(GameElement gameElement, GameElement parent)
|
||||
{
|
||||
if (gameElement == null || parent == null) return;
|
||||
|
||||
gameElement.SaveBM();
|
||||
GameElement pastedElement = (gameElement.matchedBM as GameElement_BM).DuplicateBM(parent);
|
||||
if (gameElement.matchedBM is not GameElement_BM gameElementBM)
|
||||
{
|
||||
LogWindow.Log("Paste failed: " + gameElement.elementName + " did not create a valid BM.", Color.red);
|
||||
return;
|
||||
}
|
||||
|
||||
GameElement pastedElement = gameElementBM.DuplicateBM(parent);
|
||||
if (pastedElement == null)
|
||||
{
|
||||
LogWindow.Log("Paste failed: " + gameElement.elementName + " could not be duplicated.", Color.red);
|
||||
return;
|
||||
}
|
||||
|
||||
pastedElementList.Add(pastedElement);
|
||||
|
||||
gameElement.submoduleList.ForEach(submodule =>
|
||||
{
|
||||
Debug.Log(submodule.GetType() + " is pasted.");
|
||||
submodule.SaveBM();
|
||||
try { (submodule.matchedBM as Submodule_BM).DuplicateBM(pastedElement); }
|
||||
catch { Debug.LogWarning("Submodule paste error: " + submodule.GetType()); }
|
||||
});
|
||||
gameElement.submoduleList.ForEach(submodule =>
|
||||
{
|
||||
if (submodule == null) return;
|
||||
Debug.Log(submodule.GetType() + " is pasted.");
|
||||
submodule.SaveBM();
|
||||
if (submodule.matchedBM is not Submodule_BM submoduleBM) return;
|
||||
|
||||
SubmoduleBase existingSubmodule = pastedElement.submoduleList
|
||||
.FirstOrDefault(pastedSubmodule => pastedSubmodule != null && pastedSubmodule.GetType() == submodule.GetType());
|
||||
existingSubmodule?.Delete();
|
||||
|
||||
try { submoduleBM.DuplicateBM(pastedElement); }
|
||||
catch { Debug.LogWarning("Submodule paste error: " + submodule.GetType()); }
|
||||
});
|
||||
|
||||
if (gameElement.childElementList != null)
|
||||
{
|
||||
@@ -178,4 +227,4 @@ namespace Ichni.Editor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,5 +17,16 @@ namespace Ichni
|
||||
|
||||
[ShowInInspector, SerializeField]
|
||||
private Volume globalVolume;
|
||||
|
||||
public static void EnsureActiveCameraPostProcessing()
|
||||
{
|
||||
Camera camera = EditorManager.instance?.cameraManager?.currentCamera;
|
||||
if (camera == null) return;
|
||||
|
||||
UniversalAdditionalCameraData cameraData = camera.GetComponent<UniversalAdditionalCameraData>();
|
||||
if (cameraData == null) return;
|
||||
|
||||
cameraData.renderPostProcessing = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user