2025-01-26 21:10:16 -05:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using Dreamteck.Splines;
|
2025-02-06 23:01:44 -05:00
|
|
|
|
using Ichni.RhythmGame.Beatmap;
|
2025-01-26 21:10:16 -05:00
|
|
|
|
using Unity.VisualScripting;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Ichni.RhythmGame
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class TrackPathSubmodule : TrackSubmodule
|
|
|
|
|
|
{
|
|
|
|
|
|
public SplineComputer path;
|
|
|
|
|
|
public List<PathNode> pathNodeList;
|
|
|
|
|
|
|
|
|
|
|
|
public Track.TrackSpaceType trackSpaceType;
|
|
|
|
|
|
public Track.TrackSamplingType trackSamplingType;
|
|
|
|
|
|
public bool isClosed;
|
|
|
|
|
|
|
2025-01-30 22:45:33 -05:00
|
|
|
|
public TrackPathSubmodule(Track track, Track.TrackSpaceType trackSpaceType, Track.TrackSamplingType trackSamplingType, bool isClosed) : base(track)
|
2025-01-26 21:10:16 -05:00
|
|
|
|
{
|
|
|
|
|
|
this.path = track.AddComponent<SplineComputer>();
|
|
|
|
|
|
track.trackPathSubmodule = this;
|
|
|
|
|
|
this.pathNodeList = new List<PathNode>();
|
|
|
|
|
|
this.trackSpaceType = trackSpaceType;
|
|
|
|
|
|
this.trackSamplingType = trackSamplingType;
|
|
|
|
|
|
this.isClosed = isClosed;
|
|
|
|
|
|
|
2025-01-30 22:45:33 -05:00
|
|
|
|
SetUpSplineComputer(this.trackSpaceType, this.trackSamplingType);
|
|
|
|
|
|
//闭合路径在PathNode生成时执行,在初始化的情况下,PathNode数量为0,不会执行闭合操作
|
2025-01-26 21:10:16 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public partial class TrackPathSubmodule
|
|
|
|
|
|
{
|
|
|
|
|
|
private void SetUpSplineComputer(Track.TrackSpaceType trackSpaceType, Track.TrackSamplingType trackSamplingType)
|
|
|
|
|
|
{
|
|
|
|
|
|
path.type = (Spline.Type)(int)trackSpaceType;
|
|
|
|
|
|
path.sampleMode = (SplineComputer.SampleMode)(int)trackSamplingType;
|
|
|
|
|
|
path.space = SplineComputer.Space.Local;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ClosePath(bool close)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (close)
|
|
|
|
|
|
{
|
|
|
|
|
|
path.Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
path.Break();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
isClosed = close;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetTrackSpaceType(int spaceType)
|
|
|
|
|
|
{
|
|
|
|
|
|
trackSpaceType = (Track.TrackSpaceType)spaceType;
|
|
|
|
|
|
path.type = (Spline.Type)spaceType;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetPathNode(PathNode point)
|
|
|
|
|
|
{
|
|
|
|
|
|
path.SetPoint(point.index, point.node, SplineComputer.Space.Local);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-02-06 23:01:44 -05:00
|
|
|
|
|
|
|
|
|
|
public partial class TrackPathSubmodule
|
|
|
|
|
|
{
|
|
|
|
|
|
override public void SaveBM()
|
|
|
|
|
|
{
|
|
|
|
|
|
matchedBM = new TrackPathSubmodule_BM(attachedElement, this);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace Beatmap
|
|
|
|
|
|
{
|
|
|
|
|
|
public class TrackPathSubmodule_BM : Submodule_BM
|
|
|
|
|
|
{
|
|
|
|
|
|
public Track.TrackSpaceType trackSpaceType;
|
|
|
|
|
|
public Track.TrackSamplingType trackSamplingType;
|
|
|
|
|
|
public bool isClosed;
|
|
|
|
|
|
|
|
|
|
|
|
public TrackPathSubmodule_BM()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public TrackPathSubmodule_BM(BaseElement attachedElement, TrackPathSubmodule trackPathSubmodule) : base(
|
|
|
|
|
|
attachedElement)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.trackSpaceType = trackPathSubmodule.trackSpaceType;
|
|
|
|
|
|
this.trackSamplingType = trackPathSubmodule.trackSamplingType;
|
|
|
|
|
|
this.isClosed = trackPathSubmodule.isClosed;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void ExecuteBM()
|
|
|
|
|
|
{
|
|
|
|
|
|
attachedElement = GetElement(attachedElementGuid);
|
|
|
|
|
|
(attachedElement as Track).trackPathSubmodule = new TrackPathSubmodule(attachedElement as Track, trackSpaceType, trackSamplingType, isClosed);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void DuplicateBM(BaseElement attached)
|
|
|
|
|
|
{
|
|
|
|
|
|
(attached as Track).trackPathSubmodule = new TrackPathSubmodule(attached as Track, trackSpaceType, trackSamplingType, isClosed);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2025-01-26 21:10:16 -05:00
|
|
|
|
}
|