修复头尾抖,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

@@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -10
executionOrder: 3
icon: {fileID: 2800000, guid: 9bbaac8eb7021d44b9864113856c00fa, type: 3}
userData:
assetBundleName:

View File

@@ -1,11 +1,11 @@
fileFormatVersion: 2
guid: a212c074803b6824cae48ffa7abb84cf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -40
icon: {fileID: 2800000, guid: 09a5be8542799294ab31f6b97c88471b, type: 3}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a212c074803b6824cae48ffa7abb84cf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 8
icon: {fileID: 2800000, guid: 09a5be8542799294ab31f6b97c88471b, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,11 +1,11 @@
fileFormatVersion: 2
guid: 598e68924c9f6324bbfd049d3bae754c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -60
icon: {fileID: 2800000, guid: 3c4c2926f013fcf498c19b14b90050c5, type: 3}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 598e68924c9f6324bbfd049d3bae754c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 5
icon: {fileID: 2800000, guid: 3c4c2926f013fcf498c19b14b90050c5, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,11 +1,11 @@
fileFormatVersion: 2
guid: f3bc3656a791f444ca225a99f9333768
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -20
icon: {fileID: 2800000, guid: 5a7f65ad6116cff448644595264d0ae4, type: 3}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: f3bc3656a791f444ca225a99f9333768
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 9
icon: {fileID: 2800000, guid: 5a7f65ad6116cff448644595264d0ae4, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -44,7 +44,7 @@ namespace Dreamteck.Splines
if (Camera.current != null)
{
_orthographic = Camera.current.orthographic;
}
}
else if (Camera.main != null)
{
_orthographic = Camera.main.orthographic;
@@ -124,10 +124,12 @@ namespace Dreamteck.Splines
for (int i = 0; i < sampleCount; i++)
{
GetSample(i, ref evalResult);
// if (i == 0) evalResult.position = transform.position;
// else if (i == sampleCount - 1) evalResult.position = transform.position; // 或目标点
Vector3 center = evalResult.position;
if (hasOffset) center += offset.x * -Vector3.Cross(evalResult.forward, evalResult.up) + offset.y * evalResult.up + offset.z * evalResult.forward;
Vector3 vertexNormal;
if(orthoGraphic) vertexNormal = vertexDirection;
if (orthoGraphic) vertexNormal = vertexDirection;
else vertexNormal = (vertexDirection - center).normalized;
Vector3 vertexRight = Vector3.Cross(evalResult.forward, vertexNormal).normalized;
if (uvMode == UVMode.UniformClamp || uvMode == UVMode.UniformClip) AddUVDistance(i);

View File

@@ -1,6 +1,7 @@
using UnityEngine;
namespace Dreamteck.Splines {
namespace Dreamteck.Splines
{
[ExecuteInEditMode]
public class SplineUser : MonoBehaviour, ISerializationCallbackReceiver, ISampleModifier
{
@@ -10,7 +11,8 @@ namespace Dreamteck.Splines {
public SplineComputer spline
{
get {
get
{
return _spline;
}
set
@@ -104,7 +106,7 @@ namespace Dreamteck.Splines {
if (value != _loopSamples)
{
_loopSamples = value;
if(!_loopSamples && _clipTo < _clipFrom)
if (!_loopSamples && _clipTo < _clipFrom)
{
double temp = _clipTo;
_clipTo = _clipFrom;
@@ -218,7 +220,7 @@ namespace Dreamteck.Splines {
protected Transform trs
{
get { return _trs; }
get { return _trs; }
}
protected bool hasTransform
{
@@ -252,7 +254,8 @@ namespace Dreamteck.Splines {
}
#endif
protected virtual void Awake() {
protected virtual void Awake()
{
#if UNITY_EDITOR
_isPlaying = Application.isPlaying;
if (!_isPlaying)
@@ -272,7 +275,8 @@ namespace Dreamteck.Splines {
if (buildOnAwake && Application.isPlaying)
{
RebuildImmediate();
} else
}
else
{
GetSamples();
}
@@ -438,6 +442,8 @@ namespace Dreamteck.Splines {
/// <param name="sampleComputer">Should the SplineUser sample the SplineComputer</param>
public virtual void Rebuild()
{
_sampleCollection.Evaluate(clipFrom, ref _clipFromSample);
_sampleCollection.Evaluate(_clipTo, ref _clipToSample);
#if UNITY_EDITOR
if (!_hasTransform)
{
@@ -505,7 +511,7 @@ namespace Dreamteck.Splines {
LateRun();
}
#if UNITY_EDITOR
if(!_isPlaying && updateMethod == UpdateMethod.FixedUpdate)
if (!_isPlaying && updateMethod == UpdateMethod.FixedUpdate)
{
Run();
RunUpdate();
@@ -550,7 +556,7 @@ namespace Dreamteck.Splines {
{
PostBuild();
EmptySplineHandler postBuildHandler = onPostBuild;
if(postBuildHandler != null)
if (postBuildHandler != null)
{
postBuildHandler();
}
@@ -682,19 +688,22 @@ namespace Dreamteck.Splines {
if (_clipFrom != 0.0)
{
_sampleCollection.Evaluate(clipFrom, ref _clipFromSample);
} else
}
else
{
_clipFromSample = _sampleCollection.samples[0];
}
if(_clipTo != 1.0)
if (_clipTo != 1.0)
{
_sampleCollection.Evaluate(_clipTo, ref _clipToSample);
} else
}
else
{
_clipToSample = _sampleCollection.samples[_sampleCollection.length - 1];
}
int start, end;
_sampleCount = _sampleCollection.GetClippedSampleCount(_clipFrom, _clipTo, out start, out end);
double lerp;

File diff suppressed because it is too large Load Diff

View File

@@ -297,7 +297,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
@@ -2002,7 +2002,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
@@ -2123,7 +2123,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
@@ -2310,7 +2310,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
@@ -2989,7 +2989,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 47}
m_SizeDelta: {x: 100, y: 394}
m_SizeDelta: {x: 500, y: 394}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &7396740820777350136
MonoBehaviour:
@@ -3147,7 +3147,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}

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;

View File

@@ -97,5 +97,5 @@ Material:
- _Color: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
- _Tint2: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
- _Tint2: {r: 0.39999998, g: 0.39999998, b: 0.39999998, a: 0.5}
m_BuildTextureStacks: []

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@
"songName" : "Mr. Weq - Lunar Shade.wav",
"bpm" : 180,
"delay" : 0,
"offset" : 0,
"offset" : -0.05,
"attachedElementGuid" : {
"value" : "00000000-0000-0000-0000-000000000000"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff