优化,改bug

Signed-off-by: TRADER_FOER <lhf190@outlook.com>
This commit is contained in:
2026-07-09 23:25:02 +08:00
parent 879f1e49b8
commit fdc20cd66f
54 changed files with 288754 additions and 4266 deletions

View File

@@ -55,6 +55,10 @@ namespace Ichni.Editor
targetElement.connectedTab = this;
this.isExpanded = false;
this.isSelected = false;
if (BgImage != null)
{
BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0);
}
this.childTabList = new List<HierarchyTab>();
// 清除旧的缩进线
@@ -453,4 +457,4 @@ namespace Ichni.Editor
}
}
}
}

View File

@@ -25,7 +25,7 @@ namespace Ichni.Editor
this.parameterName = parameterName;
unitList = new List<DynamicUICompositeUnit>();
InitializeWindow(titleText, ApplyParameters);
InitializeWindow(titleText, () => ApplyParameters?.Invoke());
}
@@ -450,4 +450,4 @@ namespace Ichni.Editor
return this;
}
}
}
}

View File

@@ -58,6 +58,19 @@ namespace Ichni.RhythmGame
public Action PasteAction = null;
private void PasteTrackList()
{
if (parentElement is not ElementFolder folder)
{
LogWindow.Log("Paste Track List failed: parent element is not an ElementFolder.", Color.yellow);
return;
}
List<Track> trackList = folder.trackList;
if (trackList == null || trackList.Count == 0)
{
LogWindow.Log("Paste Track List failed: no tracks found in parent folder.", Color.yellow);
return;
}
if (PasteAction == null)
{
PasteAction = () =>
@@ -65,12 +78,19 @@ namespace Ichni.RhythmGame
PasteTrackList();
};
}
List<Track> trackList = (parentElement as ElementFolder).trackList;
trackSwitch = new FlexibleInt();
trackPercent = new FlexibleFloat();
foreach (Track track in trackList)
{
if (track == null) continue;
TrackTimeSubmoduleMovable trackTimeSubmodule = track.trackTimeSubmodule as TrackTimeSubmoduleMovable;
if (trackTimeSubmodule == null)
{
LogWindow.Log("Paste Track List skipped a track without movable time submodule.", Color.yellow);
continue;
}
trackSwitch.animations.Add(new AnimatedInt(trackTimeSubmodule.trackStartTime,
trackList.IndexOf(track)));
trackPercent.animations.Add(new AnimatedFloat(trackTimeSubmodule.trackStartTime,

View File

@@ -205,6 +205,7 @@ namespace Ichni.RhythmGame
{
if (nowEffectState == EffectState.Before)
{
PostProcessingManager.EnsureActiveCameraPostProcessing();
PreExecute();
}
@@ -294,4 +295,4 @@ namespace Ichni.RhythmGame
}
#endregion
}
}
}

View File

@@ -1,4 +1,5 @@
using Ichni.RhythmGame.Beatmap;
using SLSUtilities.Rendering.PostProcessing;
using UnityEngine;
using UnityEngine.Rendering.Universal;
@@ -10,7 +11,7 @@ namespace Ichni.RhythmGame
public float peak;
public AnimationCurve intensityCurve;
private Bloom _bloom;
private AnimeBloom _bloom;
#endregion
#region [] Generation & Initialization
@@ -36,6 +37,7 @@ namespace Ichni.RhythmGame
if (_bloom == null && PostProcessingManager.GlobalVolume != null)
{
PostProcessingManager.GlobalVolume.profile.TryGet(out _bloom);
}
}
#endregion

View File

@@ -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
}
}
}
}
}

View File

@@ -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;
}
}
}
}