基础内容-9

为次级模块增加存档类,仍在思考框架中
This commit is contained in:
SoulliesOfficial
2025-02-06 23:01:44 -05:00
parent bc1c5d65ef
commit 4cd90eaede
14 changed files with 436 additions and 19 deletions

View File

@@ -6,10 +6,47 @@ namespace Ichni.RhythmGame
{
public class NoteJudgeSubmodule : SubmoduleBase
{
public List<NoteJudgeUnit> judgeUnitList;
public NoteJudgeSubmodule(BaseElement attachedElement) : base(attachedElement)
{
}
public override void SaveBM()
{
matchedBM = new Beatmap.NoteJudgeSubmodule_BM(attachedElement);
}
}
namespace Beatmap
{
public class NoteJudgeSubmodule_BM : Submodule_BM
{
public List<NoteJudgeUnit> judgeUnitList;
public NoteJudgeSubmodule_BM()
{
}
public NoteJudgeSubmodule_BM(BaseElement attachedElement) : base(attachedElement)
{
judgeUnitList = new List<NoteJudgeUnit>();
}
public override void ExecuteBM()
{
attachedElement = GetElement(attachedElementGuid);
//(attachedElement as NoteElement).noteJudgeSubmodule = new NoteJudgeSubmodule(attachedElement);
}
public override void DuplicateBM(BaseElement attached)
{
//(attached as NoteElement).noteJudgeSubmodule = new NoteJudgeSubmodule(attached);
}
}
}
public class NoteJudgeUnit

View File

@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using Dreamteck.Splines;
using Ichni.RhythmGame.Beatmap;
using Unity.VisualScripting;
using UnityEngine;
@@ -63,4 +64,48 @@ namespace Ichni.RhythmGame
path.SetPoint(point.index, point.node, SplineComputer.Space.Local);
}
}
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);
}
}
}
}

View File

@@ -11,12 +11,17 @@ namespace Ichni.RhythmGame
public MeshGenerator meshGenerator;
public MeshRenderer meshRenderer;
public Material renderMaterial;
public TrackRendererSubmodule(Track track) : base(track)
{
this.track = track;
this.track.trackRendererSubmodule = this;
}
public override void SaveBM()
{
throw new System.NotImplementedException();
}
}
public class TrackRendererSubmoduleAutoOrient : TrackRendererSubmodule
@@ -44,5 +49,41 @@ namespace Ichni.RhythmGame
splineRenderer.clipTo = 0;
}
}
public override void SaveBM()
{
matchedBM = new Beatmap.TrackRendererSubmoduleAutoOrient_BM(attachedElement, this);
}
}
namespace Beatmap
{
public class TrackRendererSubmoduleAutoOrient_BM : Submodule_BM
{
public string renderMaterialName;
public TrackRendererSubmoduleAutoOrient_BM()
{
}
public TrackRendererSubmoduleAutoOrient_BM(BaseElement attachedElement,
TrackRendererSubmodule trackRendererSubmodule) : base(attachedElement)
{
renderMaterialName = trackRendererSubmodule.renderMaterial.name;
}
public override void ExecuteBM()
{
attachedElement = GetElement(attachedElementGuid);
(attachedElement as Track).trackRendererSubmodule =
new TrackRendererSubmodule(attachedElement as Track);
}
public override void DuplicateBM(BaseElement attached)
{
(attached as Track).trackRendererSubmodule = new TrackRendererSubmodule(attached as Track);
}
}
}
}

View File

@@ -7,14 +7,21 @@ namespace Ichni.RhythmGame
public class TrackTimeSubmodule : TrackSubmodule
{
public float headPercent, tailPercent;
public TrackTimeSubmodule(Track track) : base(track)
{
this.track = track;
this.track.trackTimeSubmodule = this;
}
public override void SaveBM()
{
throw new System.NotImplementedException();
}
}
#region Movable
public class TrackTimeSubmoduleMovable : TrackTimeSubmodule
{
public float trackStartTime;
@@ -40,40 +47,125 @@ namespace Ichni.RhythmGame
public void UpdateTrackPart()
{
float songTime = EditorManager.instance.songModule.songTime;
headPercent = GetTrackPercent(songTime);
tailPercent = GetTrackPercent(songTime - visibleTrackTimeLength);
if (track.trackRendererSubmodule != null)
{
track.trackRendererSubmodule.meshGenerator.clipFrom = tailPercent;
track.trackRendererSubmodule.meshGenerator.clipTo = headPercent;
}
}
public float GetTrackPercent(float songTimeInTime)
{
float per = AnimationCurveEvaluator.Evaluate(animationCurveType, (songTimeInTime - trackStartTime) / trackTotalTime);
float per = AnimationCurveEvaluator.Evaluate(animationCurveType,
(songTimeInTime - trackStartTime) / trackTotalTime);
return Mathf.Clamp01(per);
}
public override void SaveBM()
{
matchedBM = new Beatmap.TrackTimeSubmoduleMovable_BM(attachedElement, this);
}
}
namespace Beatmap
{
public class TrackTimeSubmoduleMovable_BM : Submodule_BM
{
public float trackStartTime;
public float trackEndTime;
public float visibleTrackTimeLength;
public AnimationCurveType animationCurveType;
public TrackTimeSubmoduleMovable_BM()
{
}
public TrackTimeSubmoduleMovable_BM(BaseElement attachedElement, TrackTimeSubmoduleMovable trackTimeSubmoduleMovable) : base(attachedElement)
{
trackStartTime = trackTimeSubmoduleMovable.trackStartTime;
trackEndTime = trackTimeSubmoduleMovable.trackEndTime;
visibleTrackTimeLength = trackTimeSubmoduleMovable.visibleTrackTimeLength;
animationCurveType = trackTimeSubmoduleMovable.animationCurveType;
}
public override void ExecuteBM()
{
attachedElement = GetElement(attachedElementGuid);
Track track = attachedElement as Track;
track.trackTimeSubmodule = new TrackTimeSubmoduleMovable(track, trackStartTime, trackEndTime, visibleTrackTimeLength, animationCurveType);
}
public override void DuplicateBM(BaseElement attached)
{
Track track = attached as Track;
track.trackTimeSubmodule = new TrackTimeSubmoduleMovable(track, trackStartTime, trackEndTime, visibleTrackTimeLength, animationCurveType);
}
}
}
#endregion
#region Static
public class TrackTimeSubmoduleStatic : TrackTimeSubmodule
{
public float trackTotalTime;
public AnimationCurveType animationCurveType;
public TrackTimeSubmoduleStatic(Track track, float trackTotalTime, AnimationCurveType animationCurveType) : base(track)
public TrackTimeSubmoduleStatic(Track track, float trackTotalTime, AnimationCurveType animationCurveType) :
base(track)
{
this.trackTotalTime = trackTotalTime;
this.animationCurveType = animationCurveType;
this.headPercent = 0;
this.tailPercent = 1;
track.timeDurationSubmodule.startTime = -999;
track.timeDurationSubmodule.endTime = 999;
//timeDurationSubmodule 根据下辖Note的时间来设置
}
public override void SaveBM()
{
matchedBM = new Beatmap.TrackTimeSubmoduleStatic_BM(attachedElement, this);
}
}
namespace Beatmap
{
public class TrackTimeSubmoduleStatic_BM : Submodule_BM
{
public float trackTotalTime;
public AnimationCurveType animationCurveType;
public TrackTimeSubmoduleStatic_BM()
{
}
public TrackTimeSubmoduleStatic_BM(BaseElement attachedElement, TrackTimeSubmoduleStatic trackTimeSubmoduleStatic) : base(attachedElement)
{
trackTotalTime = trackTimeSubmoduleStatic.trackTotalTime;
animationCurveType = trackTimeSubmoduleStatic.animationCurveType;
}
public override void ExecuteBM()
{
attachedElement = GetElement(attachedElementGuid);
Track track = attachedElement as Track;
track.trackTimeSubmodule = new TrackTimeSubmoduleStatic(track, trackTotalTime, animationCurveType);
}
public override void DuplicateBM(BaseElement attached)
{
Track track = attached as Track;
track.trackTimeSubmodule = new TrackTimeSubmoduleStatic(track, trackTotalTime, animationCurveType);
}
}
}
#endregion
}