修复头尾抖,auto orient完全胜利

Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-07-26 19:03:38 +08:00
parent b577cf7f8d
commit 428ca1d738
20 changed files with 120198 additions and 18641 deletions

View File

@@ -41,17 +41,30 @@ namespace Ichni.Editor
}
public static void Lgp(int loop, Vector3 start, Vector3 end)
public static void Lgp(int loop, Vector3 start, Vector3 end, bool Clear = false)
{
if (inspector.connectedGameElement == null || inspector.connectedGameElement.GetType() != typeof(Track))
{
LogWindow.Log("Please select a Track first!");
return;
}
if (loop <= 1)
{
LogWindow.Log("Loop must be greater than 1!");
return;
}
Track track = (Track)inspector.connectedGameElement;
if (Clear)
{
// 清除之前的PathNode
foreach (var node in track.trackPathSubmodule.pathNodeList.ToList())
{
EditorManager.instance.operationManager.CopyPasteDeleteModule.DeleteElement(node);
}
}
for (int i = 0; i < loop; i++)
{
float t = (float)i / loop;
float t = (float)i / (loop - 1); // 修正插值
float x = start.x + (end.x - start.x) * t;
float y = start.y + (end.y - start.y) * t;
float z = start.z + (end.z - start.z) * t;
@@ -270,8 +283,18 @@ namespace Ichni.Editor
{
foreach (var note in noteBases)
{
note.noteVisual.isHighlighted = false;
note.noteVisual.SetHighlight();
if (note.noteVisual != null)
{
note.noteVisual.isHighlighted = false;
try
{
note.noteVisual?.SetHighlight();
}
catch (Exception ex)
{
Debug.LogError($"Error setting highlight for note {note.name}: {ex.Message}");
}
}
}
}
@@ -287,8 +310,18 @@ namespace Ichni.Editor
{
foreach (var note in group)
{
note.noteVisual.isHighlighted = true;
note.noteVisual.SetHighlight();
if (note.noteVisual != null)
{
note.noteVisual.isHighlighted = true;
try
{
note.noteVisual?.SetHighlight();
}
catch (Exception ex)
{
Debug.LogError($"Error setting highlight for note {note.name}: {ex.Message}");
}
}
}
}
}
@@ -303,8 +336,18 @@ namespace Ichni.Editor
{
foreach (var note in noteBases)
{
note.noteVisual.isHighlighted = false;
note.noteVisual.SetHighlight();
if (note.noteVisual != null)
{
note.noteVisual.isHighlighted = false;
try
{
note.noteVisual?.SetHighlight();
}
catch (Exception ex)
{
Debug.LogError($"Error setting highlight for note {note.name}: {ex.Message}");
}
}
}
}
@@ -320,8 +363,19 @@ namespace Ichni.Editor
{
foreach (var note in group)
{
note.noteVisual.isHighlighted = true;
note.noteVisual.SetHighlight();
if (note.noteVisual != null)
{
note.noteVisual.isHighlighted = true;
try
{
note.noteVisual?.SetHighlight();
}
catch (Exception ex)
{
Debug.LogError($"Error setting highlight for note {note.name}: {ex.Message}");
}
}
}
}
}
@@ -501,5 +555,6 @@ namespace Ichni.Editor
LogWindow.Log("Colped Done!", Color.green);
}
}
}

View File

@@ -56,6 +56,10 @@ namespace Ichni.RhythmGame
timeDurationSubmodule.startTime += offset;
timeDurationSubmodule.endTime += offset;
}
public virtual void InvokeUpdate()
{
UpdateAnimation(EditorManager.instance.songInformation.songTime);
}
}
namespace Beatmap

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Ichni.RhythmGame.Beatmap;
using UniRx;
using UnityEngine;
@@ -11,10 +12,10 @@ namespace Ichni.RhythmGame
public class BeatmapContainer : IBaseElement
{
public List<GameElement> gameElementList;
[NonSerialized]
public List<UnityAction> lowPriorityActions;
public BaseElement_BM matchedBM { get; set; }
public BeatmapContainer()
@@ -23,7 +24,7 @@ namespace Ichni.RhythmGame
lowPriorityActions = new List<UnityAction>();
Observable.EveryUpdate().Subscribe(_ => ExecuteLowPriorityActions());
}
public void ExecuteLowPriorityActions()
{
if (lowPriorityActions.Count > 0)
@@ -47,6 +48,30 @@ namespace Ichni.RhythmGame
{
throw new System.NotImplementedException();
}
public IEnumerator AfterLoadSet()
{
Trail.FreezeAllTrails(true);
foreach (var element in gameElementList)
{
element.gameObject.SetActive(false);
if (element is IHaveTransformSubmodule haveTransform)
{
TransformSubmodule transformSubmodule = haveTransform.transformSubmodule;
foreach (AnimationBase i in element.childElementList.OfType<AnimationBase>())
{
i.InvokeUpdate();
}
transformSubmodule.Refresh();
}
}
yield return null;
foreach (var element in gameElementList)
{
element.gameObject.SetActive(true);
}
}
}
namespace Beatmap
@@ -54,7 +79,7 @@ namespace Ichni.RhythmGame
public partial class BeatmapContainer_BM : BaseElement_BM
{
public List<BaseElement_BM> elementList;
public BeatmapContainer_BM()
{
@@ -64,7 +89,7 @@ namespace Ichni.RhythmGame
public BeatmapContainer_BM(List<GameElement> gameElementList)
{
elementList = new List<BaseElement_BM>();
gameElementList.ForEach(e =>
{
e.SaveBM();
@@ -90,7 +115,7 @@ namespace Ichni.RhythmGame
EditorManager.instance.beatmapContainer = new BeatmapContainer();
EditorManager.instance.beatmapContainer.matchedBM = this;
GameElement_BM.identifier.Clear();
elementList.ForEach(element =>
{
if (element == null)
@@ -98,7 +123,7 @@ namespace Ichni.RhythmGame
Debug.LogError("Null element detected in elementList. Skipping execution.");
return;
}
if (LowPriorityGameElementTypes.Contains(element.GetType()))
{
return;
@@ -125,7 +150,7 @@ namespace Ichni.RhythmGame
element.ExecuteBM();
}
});
EditorManager.instance.beatmapContainer.ExecuteLowPriorityActions();
}
}
@@ -136,7 +161,7 @@ namespace Ichni.RhythmGame
{
//typeof(NoteJudgeSubmodule_BM),
};
public static readonly List<Type> LowPriorityDataTypes = new()
{
typeof(EnableControlEffect_BM),

View File

@@ -29,7 +29,7 @@ namespace Ichni.RhythmGame
public bool isShowingSphere;
public static PathNode GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated,
Track track, bool isShowingSphere)
Track track, bool isShowingSphere, int index = -1)
{
PathNode pathNode = Instantiate(EditorManager.instance.basePrefabs.pathNode, track.transform)
.GetComponent<PathNode>();
@@ -39,7 +39,15 @@ namespace Ichni.RhythmGame
pathNode.track = track;
pathNode.isShowingSphere = isShowingSphere;
pathNode.SetPathNodeSphere(isShowingSphere);
track.trackPathSubmodule.pathNodeList.Add(pathNode);
if (index < 0)
{
track.trackPathSubmodule.pathNodeList.Add(pathNode);
}
else
{
track.trackPathSubmodule.pathNodeList.Insert(index, pathNode);
}
return pathNode;
}

View File

@@ -92,6 +92,7 @@ namespace Ichni
musicPlayer.audioSource.clip = songInformation.song;
}
StartCoroutine(beatmapContainer.AfterLoadSet());
isLoaded = true;
songInformation.songTime = musicPlayer.audioSource.time - songInformation.offset;