From bc1c5d65efa4483c80af46ce2bdcf4f79c74144f Mon Sep 17 00:00:00 2001 From: SoulliesOfficial <77235731+SoulliesOfficial@users.noreply.github.com> Date: Sun, 2 Feb 2025 21:59:43 -0500 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E5=86=85=E5=AE=B9-8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加BM存档类 --- .../Animations/Color/BaseColorChange.cs | 71 ++++++++++++++--- .../Animations/Color/EmissionColorChange.cs | 46 ++++++++++- .../Animations/Track/TrackTotalTimeChange.cs | 56 ++++++++++++-- .../Animations/Transform/Displacement.cs | 45 ++++++++++- Assets/Scripts/Animations/Transform/LookAt.cs | 45 ++++++++++- Assets/Scripts/Animations/Transform/Scale.cs | 64 ++++++++++++--- Assets/Scripts/Animations/Transform/Swirl.cs | 44 ++++++++++- .../Base/FlexibleTypes/FlexibleBool.cs | 70 +++++++++++++++-- .../Base/FlexibleTypes/FlexibleFloat.cs | 77 ++++++++++++++++--- .../Scripts/Base/FlexibleTypes/FlexibleInt.cs | 64 ++++++++++++++- .../EnvironmentObjects/EnvironmentObject.cs | 59 ++++++++++++-- .../GameElements/GameCamera/GameCamera.cs | 72 +++++++++++++++-- .../Notes/NoteVisual/NoteVisualBase.cs | 2 +- .../Scripts/GameElements/SubstantialObject.cs | 2 +- Assets/Scripts/GameElements/Track/PathNode.cs | 71 ++++++++++++++--- .../Track/TrackPoints/CrossTrackPoint.cs | 43 ++++++++++- .../Track/TrackPoints/TrackHeadPoint.cs | 45 ++++++++++- .../Track/TrackPoints/TrackPercentPoint.cs | 39 +++++++++- Assets/Scripts/GameElements/Track/Trail.cs | 53 +++++++++++-- .../Scripts/NoteVisual/BasicNoteVisual.cs | 48 +++++++++++- 20 files changed, 926 insertions(+), 90 deletions(-) diff --git a/Assets/Scripts/Animations/Color/BaseColorChange.cs b/Assets/Scripts/Animations/Color/BaseColorChange.cs index 4e256780..96c52bf2 100644 --- a/Assets/Scripts/Animations/Color/BaseColorChange.cs +++ b/Assets/Scripts/Animations/Color/BaseColorChange.cs @@ -1,25 +1,27 @@ using System; using System.Collections; using System.Collections.Generic; +using Ichni.RhythmGame.Beatmap; using Lean.Pool; using UnityEngine; namespace Ichni.RhythmGame { - public class BaseColorChange : AnimationBase + public partial class BaseColorChange : AnimationBase { public ColorSubmodule targetColorSubmodule; public FlexibleFloat colorR, colorG, colorB, colorA; - - public static BaseColorChange GenerateElement(string elementName, Guid id, + + public static BaseColorChange GenerateElement(string elementName, Guid id, List tags, BaseElement targetObject, FlexibleFloat colorR, FlexibleFloat colorG, FlexibleFloat colorB, FlexibleFloat colorA) { - BaseColorChange baseColorChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); - + BaseColorChange baseColorChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject) + .AddComponent(); + baseColorChange.Initialize(elementName, id, tags); baseColorChange.targetObject = targetObject; - + baseColorChange.colorR = colorR; baseColorChange.colorG = colorG; baseColorChange.colorB = colorB; @@ -34,7 +36,7 @@ namespace Ichni.RhythmGame { throw new System.Exception("Target object does not have a ColorSubmodule"); } - + baseColorChange.SetParent(targetObject); baseColorChange.timeDurationSubmodule.SetDuration(colorR, colorG, colorB, colorA); @@ -47,10 +49,10 @@ namespace Ichni.RhythmGame colorG.UpdateFlexibleFloat(songTime); colorB.UpdateFlexibleFloat(songTime); colorA.UpdateFlexibleFloat(songTime); - - if (colorR.returnType is FlexibleReturnType.MiddleExecuting || - colorG.returnType is FlexibleReturnType.MiddleExecuting || - colorB.returnType is FlexibleReturnType.MiddleExecuting || + + if (colorR.returnType is FlexibleReturnType.MiddleExecuting || + colorG.returnType is FlexibleReturnType.MiddleExecuting || + colorB.returnType is FlexibleReturnType.MiddleExecuting || colorA.returnType is FlexibleReturnType.MiddleExecuting) { animationReturnType = FlexibleReturnType.MiddleExecuting; @@ -64,4 +66,51 @@ namespace Ichni.RhythmGame } } } + + public partial class BaseColorChange + { + public override void SaveBM() + { + matchedBM = new BaseColorChange_BM(elementName, elementGuid, tags, targetObject.matchedBM as BaseElement_BM, + colorR.ConvertToBM(), colorG.ConvertToBM(), colorB.ConvertToBM(), colorA.ConvertToBM()); + } + } + + namespace Beatmap + { + public class BaseColorChange_BM : BaseElement_BM + { + public FlexibleFloat_BM colorR, colorG, colorB, colorA; + + public BaseColorChange_BM() + { + + } + + public BaseColorChange_BM(string elementName, Guid elementGuid, List tags, + BaseElement_BM attachedElement, FlexibleFloat_BM colorR, FlexibleFloat_BM colorG, + FlexibleFloat_BM colorB, FlexibleFloat_BM colorA) : base(elementName, elementGuid, tags, + attachedElement) + { + this.colorR = colorR; + this.colorG = colorG; + this.colorB = colorB; + this.colorA = colorA; + } + + public override void ExecuteBM() + { + BaseColorChange.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid), + colorR.ConvertToGameType(), colorG.ConvertToGameType(), colorB.ConvertToGameType(), + colorA.ConvertToGameType()); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return BaseColorChange.GenerateElement(elementName, elementGuid, tags, parent, + colorR.ConvertToGameType(), colorG.ConvertToGameType(), colorB.ConvertToGameType(), + colorA.ConvertToGameType()); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/Animations/Color/EmissionColorChange.cs b/Assets/Scripts/Animations/Color/EmissionColorChange.cs index fa104a85..247e027e 100644 --- a/Assets/Scripts/Animations/Color/EmissionColorChange.cs +++ b/Assets/Scripts/Animations/Color/EmissionColorChange.cs @@ -1,12 +1,13 @@ using System; using System.Collections; using System.Collections.Generic; +using Ichni.RhythmGame.Beatmap; using Lean.Pool; using UnityEngine; namespace Ichni.RhythmGame { - public class EmissionColorChange : AnimationBase + public partial class EmissionColorChange : AnimationBase { public ColorSubmodule targetColorSubmodule; public FlexibleFloat colorR, colorG, colorB, colorI; @@ -68,4 +69,47 @@ namespace Ichni.RhythmGame } } } + + public partial class EmissionColorChange + { + public override void SaveBM() + { + matchedBM = new EmissionColorChange_BM(elementName, elementGuid, tags, targetObject.matchedBM, + colorR.ConvertToBM(), colorG.ConvertToBM(), colorB.ConvertToBM(), colorI.ConvertToBM()); + } + } + + namespace Beatmap + { + public class EmissionColorChange_BM : BaseElement_BM + { + public FlexibleFloat_BM colorR, colorG, colorB, colorI; + + public EmissionColorChange_BM() + { + + } + + public EmissionColorChange_BM(string elementName, Guid elementGuid, List tags, BaseElement_BM parentElement, + FlexibleFloat_BM colorR, FlexibleFloat_BM colorG, FlexibleFloat_BM colorB, FlexibleFloat_BM colorI) : base(elementName, elementGuid, tags, parentElement) + { + this.colorR = colorR; + this.colorG = colorG; + this.colorB = colorB; + this.colorI = colorI; + } + + public override void ExecuteBM() + { + EmissionColorChange.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid), + colorR.ConvertToGameType(), colorG.ConvertToGameType(), colorB.ConvertToGameType(), colorI.ConvertToGameType()); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return EmissionColorChange.GenerateElement(elementName, elementGuid, tags, parent, + colorR.ConvertToGameType(), colorG.ConvertToGameType(), colorB.ConvertToGameType(), colorI.ConvertToGameType()); + } + } + } } diff --git a/Assets/Scripts/Animations/Track/TrackTotalTimeChange.cs b/Assets/Scripts/Animations/Track/TrackTotalTimeChange.cs index 87560c34..78d61463 100644 --- a/Assets/Scripts/Animations/Track/TrackTotalTimeChange.cs +++ b/Assets/Scripts/Animations/Track/TrackTotalTimeChange.cs @@ -1,24 +1,26 @@ using System; using System.Collections; using System.Collections.Generic; +using Ichni.RhythmGame.Beatmap; using Lean.Pool; using UnityEngine; namespace Ichni.RhythmGame { - public class TrackTotalTimeChange : AnimationBase + public partial class TrackTotalTimeChange : AnimationBase { public FlexibleFloat totalTime; public TrackTimeSubmoduleStatic targetTrackTimeSubmoduleStatic; - public static TrackTotalTimeChange GenerateElement(string elementName, Guid id, + public static TrackTotalTimeChange GenerateElement(string elementName, Guid id, List tags, Track targetTrack, FlexibleFloat totalTime) { - TrackTotalTimeChange trackTotalTimeChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); + TrackTotalTimeChange trackTotalTimeChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject) + .AddComponent(); trackTotalTimeChange.Initialize(elementName, id, tags); - + trackTotalTimeChange.targetObject = targetTrack; - + if (targetTrack.trackTimeSubmodule is TrackTimeSubmoduleStatic submoduleStatic) { trackTotalTimeChange.targetTrackTimeSubmoduleStatic = submoduleStatic; @@ -31,7 +33,7 @@ namespace Ichni.RhythmGame trackTotalTimeChange.totalTime = totalTime; trackTotalTimeChange.animationReturnType = FlexibleReturnType.Before; trackTotalTimeChange.timeDurationSubmodule.SetDuration(totalTime); - + trackTotalTimeChange.SetParent(targetTrack); return trackTotalTimeChange; } @@ -39,11 +41,51 @@ namespace Ichni.RhythmGame protected override void UpdateAnimation(float songTime) { totalTime.UpdateFlexibleFloat(songTime); - + if (totalTime.returnType == FlexibleReturnType.MiddleExecuting) { targetTrackTimeSubmoduleStatic.trackTotalTime = totalTime.value; } } } + + public partial class TrackTotalTimeChange + { + public override void SaveBM() + { + matchedBM = new TrackTotalTimeChange_BM(elementName, elementGuid, tags, targetObject.matchedBM as Track_BM, totalTime.ConvertToBM()); + } + } + + namespace Beatmap + { + public class TrackTotalTimeChange_BM : BaseElement_BM + { + public FlexibleFloat_BM totalTime; + + public TrackTotalTimeChange_BM() + { + + } + + public TrackTotalTimeChange_BM(string elementName, Guid elementGuid, List tags, + BaseElement_BM attachedElement, FlexibleFloat_BM totalTime) : base(elementName, elementGuid, tags, + attachedElement) + { + this.totalTime = totalTime; + } + + public override void ExecuteBM() + { + TrackTotalTimeChange.GenerateElement(elementName, elementGuid, tags, + GetElement(attachedElementGuid) as Track, totalTime.ConvertToGameType()); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return TrackTotalTimeChange.GenerateElement(elementName, elementGuid, tags, parent as Track, + totalTime.ConvertToGameType()); + } + } + } } diff --git a/Assets/Scripts/Animations/Transform/Displacement.cs b/Assets/Scripts/Animations/Transform/Displacement.cs index d67d0e55..7ac38cf2 100644 --- a/Assets/Scripts/Animations/Transform/Displacement.cs +++ b/Assets/Scripts/Animations/Transform/Displacement.cs @@ -10,7 +10,7 @@ using UnityEngine; namespace Ichni.RhythmGame { - public class Displacement : AnimationBase + public partial class Displacement : AnimationBase { public TransformSubmodule targetTransformSubmodule; public FlexibleFloat positionX, positionY, positionZ; @@ -84,4 +84,47 @@ namespace Ichni.RhythmGame // } } } + + public partial class Displacement + { + public override void SaveBM() + { + matchedBM = new Beatmap.Displacement_BM(elementName, elementGuid, tags, parentElement.matchedBM, + positionX.ConvertToBM(), positionY.ConvertToBM(), positionZ.ConvertToBM()); + } + } + + namespace Beatmap + { + public class Displacement_BM : BaseElement_BM + { + public FlexibleFloat_BM positionX, positionY, positionZ; + + public Displacement_BM() + { + + } + + public Displacement_BM(string elementName, Guid elementGuid, List tags, + BaseElement_BM attachedElement, FlexibleFloat_BM positionX, FlexibleFloat_BM positionY, FlexibleFloat_BM positionZ) + : base(elementName, elementGuid, tags, attachedElement) + { + this.positionX = positionX; + this.positionY = positionY; + this.positionZ = positionZ; + } + + public override void ExecuteBM() + { + Displacement.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid), + positionX.ConvertToGameType(), positionY.ConvertToGameType(), positionZ.ConvertToGameType()); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return Displacement.GenerateElement(elementName, elementGuid, tags, parent, + positionX.ConvertToGameType(), positionY.ConvertToGameType(), positionZ.ConvertToGameType()); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/Animations/Transform/LookAt.cs b/Assets/Scripts/Animations/Transform/LookAt.cs index 6a5150fb..f34cf6db 100644 --- a/Assets/Scripts/Animations/Transform/LookAt.cs +++ b/Assets/Scripts/Animations/Transform/LookAt.cs @@ -10,7 +10,7 @@ namespace Ichni.RhythmGame /// /// 将物体的z轴指向目标物体,注意,LookAt的启用期间,物体的旋转将被锁定 /// - public class LookAt : AnimationBase + public partial class LookAt : AnimationBase { public TransformSubmodule targetTransformSubmodule; public BaseElement lookAtObject; @@ -23,7 +23,7 @@ namespace Ichni.RhythmGame LookAt look = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); look.Initialize(elementName, id, tags); - + look.targetObject = targetObject; look.lookAtObject = lookAtTarget; look.enabling = enabling; @@ -37,7 +37,7 @@ namespace Ichni.RhythmGame { throw new System.Exception("Target object does not have a TransformSubmodule"); } - + look.SetParent(targetObject); look.timeDurationSubmodule.SetDuration(-999f, 999f); //TODO: 换为(-delay, songLength) @@ -71,5 +71,44 @@ namespace Ichni.RhythmGame targetTransformSubmodule.eulerAnglesOffsetLock = false; } } + + public override void SaveBM() + { + matchedBM = new Beatmap.LookAt_BM(elementName, elementGuid, tags, parentElement.matchedBM, + enabling.ConvertToBM(), lookAtObject.elementGuid); + } + } + + namespace Beatmap + { + public class LookAt_BM : BaseElement_BM + { + public FlexibleBool_BM enabling; + public Guid lookAtObjectGuid; + + public LookAt_BM() + { + } + + public LookAt_BM(string elementName, Guid elementGuid, List tags, + BaseElement_BM attachedElement, FlexibleBool_BM enabling, Guid lookAtObjectGuid) : base(elementName, + elementGuid, tags, attachedElement) + { + this.enabling = enabling; + this.lookAtObjectGuid = lookAtObjectGuid; + } + + public override void ExecuteBM() + { + matchedElement = LookAt.GenerateElement(elementName, elementGuid, tags, + GetElement(attachedElementGuid), GetElement(lookAtObjectGuid), enabling.ConvertToGameType()); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return LookAt.GenerateElement(elementName, elementGuid, tags, parent, + GetElement(lookAtObjectGuid), enabling.ConvertToGameType()); + } + } } } \ No newline at end of file diff --git a/Assets/Scripts/Animations/Transform/Scale.cs b/Assets/Scripts/Animations/Transform/Scale.cs index 3ce64f44..f7cd5890 100644 --- a/Assets/Scripts/Animations/Transform/Scale.cs +++ b/Assets/Scripts/Animations/Transform/Scale.cs @@ -5,26 +5,26 @@ using UnityEngine; namespace Ichni.RhythmGame { - public class Scale : AnimationBase + public partial class Scale : AnimationBase { public TransformSubmodule targetTransformSubmodule; public FlexibleFloat scaleX, scaleY, scaleZ; - - public static Scale GenerateElement(string elementName, Guid id, + + public static Scale GenerateElement(string elementName, Guid id, List tags, BaseElement targetObject, FlexibleFloat scaleX, FlexibleFloat scaleY, FlexibleFloat scaleZ) { Scale scale = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); scale.Initialize(elementName, id, tags); - + scale.targetObject = targetObject; - + scale.scaleX = scaleX; scale.scaleY = scaleY; scale.scaleZ = scaleZ; scale.animationReturnType = FlexibleReturnType.Before; - + if (targetObject.transformSubmodule != null) { scale.targetTransformSubmodule = targetObject.transformSubmodule; @@ -33,13 +33,13 @@ namespace Ichni.RhythmGame { throw new System.Exception("Target object does not have a TransformSubmodule"); } - + scale.SetParent(targetObject); scale.timeDurationSubmodule.SetDuration(scaleX, scaleY, scaleZ); - + return scale; } - + protected override void UpdateAnimation(float songTime) { scaleX.UpdateFlexibleFloat(songTime); @@ -54,11 +54,55 @@ namespace Ichni.RhythmGame Vector3 currentScale = new Vector3(scaleX.value, scaleY.value, scaleZ.value); targetTransformSubmodule.scaleOffset.Add(currentScale); targetTransformSubmodule.scaleDirtyMark = true; - } + } else { animationReturnType = FlexibleReturnType.MiddleInterval; } } } + + public partial class Scale + { + public override void SaveBM() + { + matchedBM = new Beatmap.Scale_BM(elementName, elementGuid, tags, parentElement.matchedBM, + scaleX.ConvertToBM(), scaleY.ConvertToBM(), scaleZ.ConvertToBM()); + } + } + + namespace Beatmap + { + public class Scale_BM : BaseElement_BM + { + public FlexibleFloat_BM scaleX, scaleY, scaleZ; + + public Scale_BM() + { + + } + + public Scale_BM(string elementName, Guid elementGuid, List tags, + BaseElement_BM attachedElement, FlexibleFloat_BM scaleX, FlexibleFloat_BM scaleY, + FlexibleFloat_BM scaleZ) + : base(elementName, elementGuid, tags, attachedElement) + { + this.scaleX = scaleX; + this.scaleY = scaleY; + this.scaleZ = scaleZ; + } + + public override void ExecuteBM() + { + Scale.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid), + scaleX.ConvertToGameType(), scaleY.ConvertToGameType(), scaleZ.ConvertToGameType()); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return Scale.GenerateElement(elementName, elementGuid, tags, parent, scaleX.ConvertToGameType(), + scaleY.ConvertToGameType(), scaleZ.ConvertToGameType()); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/Animations/Transform/Swirl.cs b/Assets/Scripts/Animations/Transform/Swirl.cs index 1f3614c0..7b1e22a5 100644 --- a/Assets/Scripts/Animations/Transform/Swirl.cs +++ b/Assets/Scripts/Animations/Transform/Swirl.cs @@ -6,7 +6,7 @@ using UnityEngine; namespace Ichni.RhythmGame { - public class Swirl : AnimationBase + public partial class Swirl : AnimationBase { public TransformSubmodule targetTransformSubmodule; public FlexibleFloat eulerAngleX, eulerAngleY, eulerAngleZ; @@ -63,4 +63,46 @@ namespace Ichni.RhythmGame } } } + + public partial class Swirl + { + public override void SaveBM() + { + matchedBM = new Beatmap.Swirl_BM(elementName, elementGuid, tags, parentElement.matchedBM, + eulerAngleX.ConvertToBM(), eulerAngleY.ConvertToBM(), eulerAngleZ.ConvertToBM()); + } + } + + namespace Beatmap + { + public class Swirl_BM : BaseElement_BM + { + public FlexibleFloat_BM eulerAngleX, eulerAngleY, eulerAngleZ; + public Swirl_BM() + { + + } + + public Swirl_BM(string elementName, Guid elementGuid, List tags, + BaseElement_BM attachedElement, FlexibleFloat_BM eulerAngleX, FlexibleFloat_BM eulerAngleY, FlexibleFloat_BM eulerAngleZ) + : base(elementName, elementGuid, tags, attachedElement) + { + this.eulerAngleX = eulerAngleX; + this.eulerAngleY = eulerAngleY; + this.eulerAngleZ = eulerAngleZ; + } + + public override void ExecuteBM() + { + Swirl.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid), + eulerAngleX.ConvertToGameType(), eulerAngleY.ConvertToGameType(), eulerAngleZ.ConvertToGameType()); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return Swirl.GenerateElement(elementName, elementGuid, tags, parent, + eulerAngleX.ConvertToGameType(), eulerAngleY.ConvertToGameType(), eulerAngleZ.ConvertToGameType()); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/Base/FlexibleTypes/FlexibleBool.cs b/Assets/Scripts/Base/FlexibleTypes/FlexibleBool.cs index 1e8e3c53..14423fe4 100644 --- a/Assets/Scripts/Base/FlexibleTypes/FlexibleBool.cs +++ b/Assets/Scripts/Base/FlexibleTypes/FlexibleBool.cs @@ -1,16 +1,16 @@ using System.Collections; using System.Collections.Generic; -using UnityEngine; +using Ichni.RhythmGame.Beatmap; -namespace Ichni +namespace Ichni.RhythmGame { [System.Serializable] public class AnimatedBool { public bool value; //bool值 public float time; //当前时间 - - public AnimatedBool(bool value, float time) + + public AnimatedBool(float time, bool value) { this.value = value; this.time = time; @@ -37,7 +37,7 @@ namespace Ichni { animations.Add(animatedBool); } - + /// /// 在动画脚本的Update中更新Bool Value /// @@ -48,7 +48,7 @@ namespace Ichni value = nowAnimatedBool.value; //更新value return FlexibleReturnType.MiddleExecuting; } - + /// /// 获取songTime对应的AnimatedBool的时间段 /// @@ -64,7 +64,63 @@ namespace Ichni } } - return new AnimatedBool(false, 0); + return new AnimatedBool(0, false); + } + + /// + /// 转换为Beatmap存档类型 + /// + /// + public FlexibleBool_BM ConvertToBM() + { + FlexibleBool_BM flexibleBool_BM = new FlexibleBool_BM(); + + foreach (AnimatedBool animatedBool in animations) + { + flexibleBool_BM.animatedBoolList.Add(new AnimatedBool(animatedBool.time, animatedBool.value)); + } + + return flexibleBool_BM; + } + } + + namespace Beatmap + { + public class FlexibleBool_BM + { + public List animatedBoolList; + + public FlexibleBool_BM() + { + this.animatedBoolList = new List(); + } + + public FlexibleBool_BM(List animatedBoolList) + { + this.animatedBoolList = animatedBoolList; + } + + public FlexibleBool ConvertToGameType() + { + FlexibleBool flexibleBool; + + if (this.animatedBoolList.Count == 0) + { + flexibleBool = new FlexibleBool(); + } + else + { + List animations = new List(); + foreach (AnimatedBool animatedBool in animatedBoolList) + { + animations.Add(new AnimatedBool(animatedBool.time, animatedBool.value)); + } + + flexibleBool = new FlexibleBool(animations); + } + + return flexibleBool; + } } } } \ No newline at end of file diff --git a/Assets/Scripts/Base/FlexibleTypes/FlexibleFloat.cs b/Assets/Scripts/Base/FlexibleTypes/FlexibleFloat.cs index 2d87e007..a0d96f29 100644 --- a/Assets/Scripts/Base/FlexibleTypes/FlexibleFloat.cs +++ b/Assets/Scripts/Base/FlexibleTypes/FlexibleFloat.cs @@ -1,23 +1,21 @@ using System; using System.Collections; using System.Collections.Generic; -using Unity.Burst; -using Unity.Collections; -using Unity.Jobs; -using UnityEngine; -using UnityEngine.Serialization; +using Ichni.RhythmGame.Beatmap; -namespace Ichni +namespace Ichni.RhythmGame { [System.Serializable] public class AnimatedFloat : IComparable { public float startValue, endValue; //起止值 - public float differenceValue; //差值 public float startTime, endTime; //起止时间 - public float totalTime; //总时间 public AnimationCurveType animationCurveType; //动画曲线类型 + + public float differenceValue => endValue - startValue; //差值 + public float totalTime => endTime - startTime; //总时间 + public AnimatedFloat(float startTime, float endTime, float startValue, float endValue, AnimationCurveType animationCurveType) @@ -26,8 +24,6 @@ namespace Ichni this.endValue = endValue; this.startTime = startTime; this.endTime = endTime; - totalTime = endTime - startTime; - differenceValue = endValue - startValue; this.animationCurveType = animationCurveType; } @@ -152,5 +148,66 @@ namespace Ichni return null; } + + + /// + /// 转换为Beatmap存档类型 + /// + public FlexibleFloat_BM ConvertToBM() + { + FlexibleFloat_BM flexibleFloat_BM = new FlexibleFloat_BM(); + + foreach (AnimatedFloat animatedFloat in animations) + { + flexibleFloat_BM.animatedFloatList.Add(new AnimatedFloat(animatedFloat.startTime, animatedFloat.endTime, + animatedFloat.startValue, animatedFloat.endValue, animatedFloat.animationCurveType)); + } + + return flexibleFloat_BM; + } + } + + namespace Beatmap + { + [System.Serializable] + public class FlexibleFloat_BM + { + public List animatedFloatList; + + public FlexibleFloat_BM() + { + this.animatedFloatList = new List(); + } + + public FlexibleFloat_BM(List animatedFloatList) + { + this.animatedFloatList = animatedFloatList; + } + + public FlexibleFloat ConvertToGameType() + { + FlexibleFloat flexibleFloat; + + if (animatedFloatList.Count == 0) + { + flexibleFloat = new FlexibleFloat(); + } + else + { + List animatedFloatList = new List(); + foreach (AnimatedFloat animatedFloat in this.animatedFloatList) + { + animatedFloatList.Add(new AnimatedFloat( + animatedFloat.startTime, animatedFloat.endTime, + animatedFloat.startValue, animatedFloat.endValue, + animatedFloat.animationCurveType)); + } + + flexibleFloat = new FlexibleFloat(animatedFloatList); + } + + return flexibleFloat; + } + } } } \ No newline at end of file diff --git a/Assets/Scripts/Base/FlexibleTypes/FlexibleInt.cs b/Assets/Scripts/Base/FlexibleTypes/FlexibleInt.cs index 6e84e192..1e150bba 100644 --- a/Assets/Scripts/Base/FlexibleTypes/FlexibleInt.cs +++ b/Assets/Scripts/Base/FlexibleTypes/FlexibleInt.cs @@ -1,8 +1,10 @@ using System.Collections; using System.Collections.Generic; +using System.Linq; +using Ichni.RhythmGame.Beatmap; using UnityEngine; -namespace Ichni +namespace Ichni.RhythmGame { [System.Serializable] public class AnimatedInt @@ -14,7 +16,7 @@ namespace Ichni { } - public AnimatedInt(int value, float time) + public AnimatedInt(float time, int value) { this.value = value; this.time = time; @@ -77,5 +79,63 @@ namespace Ichni return new AnimatedInt(0, 0); } + + /// + /// 转换为Beatmap存档类型 + /// + /// + public FlexibleInt_BM ConvertToBM() + { + FlexibleInt_BM flexibleInt_BM = new FlexibleInt_BM(); + + foreach (AnimatedInt animatedInt in animations) + { + flexibleInt_BM.animatedIntList.Add(new AnimatedInt(animatedInt.time, animatedInt.value)); + } + + return flexibleInt_BM; + } + } + + namespace Beatmap + { + [System.Serializable] + public class FlexibleInt_BM + { + public List animatedIntList; + + public FlexibleInt_BM() + { + this.animatedIntList = new List(); + } + + public FlexibleInt_BM(List animatedIntList) + { + this.animatedIntList = animatedIntList; + } + + public FlexibleInt ConvertToGameType() + { + FlexibleInt flexibleInt; + + if (animatedIntList.Count == 0) + { + flexibleInt = new FlexibleInt(); + } + else + { + List animations = new List(); + + foreach (AnimatedInt animatedInt in animatedIntList) + { + animations.Add(new AnimatedInt(animatedInt.time, animatedInt.value)); + } + + flexibleInt = new FlexibleInt(animations); + } + + return flexibleInt; + } + } } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/EnvironmentObjects/EnvironmentObject.cs b/Assets/Scripts/GameElements/EnvironmentObjects/EnvironmentObject.cs index 873678f8..76eadde3 100644 --- a/Assets/Scripts/GameElements/EnvironmentObjects/EnvironmentObject.cs +++ b/Assets/Scripts/GameElements/EnvironmentObjects/EnvironmentObject.cs @@ -6,20 +6,69 @@ using UnityEngine; namespace Ichni.RhythmGame { - public class EnvironmentObject : SubstantialObject + public partial class EnvironmentObject : SubstantialObject { public bool isStatic; - + public static SubstantialObject GenerateElement(string elementName, Guid id, List tags, string themeBundleName, string objectName, BaseElement parent, - Vector3 position, Vector3 eulerAngles, Vector3 scale, + Vector3 position, Vector3 eulerAngles, Vector3 scale, bool isStatic, bool isFirstGenerated = true) { - EnvironmentObject themeBundleObject = ThemeBundleManager.instance.GetObject(themeBundleName, objectName); - EnvironmentObject environmentObject = Instantiate(themeBundleObject, parent.transform).GetComponent(); + EnvironmentObject themeBundleObject = + ThemeBundleManager.instance.GetObject(themeBundleName, objectName); + EnvironmentObject environmentObject = + Instantiate(themeBundleObject, parent.transform).GetComponent(); environmentObject.Initialize(elementName, id, tags); environmentObject.isStatic = isStatic; return environmentObject; } } + + public partial class EnvironmentObject + { + public override void SaveBM() + { + matchedBM = new Beatmap.EnvironmentObject_BM(elementName, elementGuid, tags, parentElement.matchedBM, + themeBundleName, objectName, isStatic); + } + } + + namespace Beatmap + { + public class EnvironmentObject_BM : BaseElement_BM + { + public string themeBundleName; + public string objectName; + public bool isStatic; + + public EnvironmentObject_BM() + { + + } + + public EnvironmentObject_BM(string elementName, Guid elementGuid, List tags, + BaseElement_BM attachedElement, string themeBundleName, string objectName, bool isStatic) + : base(elementName, elementGuid, tags, attachedElement) + { + this.themeBundleName = themeBundleName; + this.objectName = objectName; + this.isStatic = isStatic; + } + + public override void ExecuteBM() + { + matchedElement = EnvironmentObject.GenerateElement(elementName, elementGuid, tags, + themeBundleName, objectName, GetElement(attachedElementGuid), + Vector3.zero, Vector3.zero, Vector3.one, isStatic, false); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return EnvironmentObject.GenerateElement(elementName, elementGuid, tags, + themeBundleName, objectName, parent, + Vector3.zero, Vector3.zero, Vector3.one, isStatic, false); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/GameCamera/GameCamera.cs b/Assets/Scripts/GameElements/GameCamera/GameCamera.cs index 6ec37fbd..6e07f731 100644 --- a/Assets/Scripts/GameElements/GameCamera/GameCamera.cs +++ b/Assets/Scripts/GameElements/GameCamera/GameCamera.cs @@ -15,25 +15,27 @@ namespace Ichni.RhythmGame public Transform rotationPoint; public Transform positionPoint; public Transform cameraTransform; - + public CameraViewType cameraViewType; public float perspectiveAngle; public float orthographicSize; - + public static GameCamera GenerateElement(string elementName, Guid id, List tags, BaseElement parentElement, CameraViewType cameraViewType, float perspectiveAngle, float orthographicSize, Vector3 initialPosition, Vector3 initialEulerAngles) { - GameCamera gameCamera = Instantiate(EditorManager.instance.basePrefabs.gameCamera).GetComponent(); - + GameCamera gameCamera = + Instantiate(EditorManager.instance.basePrefabs.gameCamera).GetComponent(); + gameCamera.Initialize(elementName, id, tags); gameCamera.parentElement = parentElement; gameCamera.cameraViewType = cameraViewType; gameCamera.camera.orthographic = cameraViewType == CameraViewType.Orthographic; gameCamera.perspectiveAngle = perspectiveAngle; gameCamera.orthographicSize = orthographicSize; - gameCamera.transformSubmodule = new TransformSubmodule(gameCamera, initialPosition, initialEulerAngles, Vector3.one); + gameCamera.transformSubmodule = + new TransformSubmodule(gameCamera, initialPosition, initialEulerAngles, Vector3.one); gameCamera.cameraTransform = gameCamera.transform; gameCamera.SetParent(parentElement); @@ -41,7 +43,7 @@ namespace Ichni.RhythmGame return gameCamera; } } - + public partial class GameCamera { public enum CameraViewType @@ -51,7 +53,7 @@ namespace Ichni.RhythmGame Orthographic = 1 } } - + public partial class GameCamera { public override void SetTransformObserver() @@ -69,11 +71,12 @@ namespace Ichni.RhythmGame { offset += eulerOffset; } + transformSubmodule.currentEulerAngles = transformSubmodule.originalEulerAngles + offset; rotationPoint.eulerAngles = transformSubmodule.currentEulerAngles; transformSubmodule.eulerAnglesDirtyMark = false; } - + if (transformSubmodule.positionDirtyMark) { Vector3 offset = Vector3.zero; @@ -81,6 +84,7 @@ namespace Ichni.RhythmGame { offset += posOffset; } + transformSubmodule.currentPosition = transformSubmodule.originalPosition + offset; positionPoint.localPosition = transformSubmodule.currentPosition; transformSubmodule.positionDirtyMark = false; @@ -88,4 +92,56 @@ namespace Ichni.RhythmGame }).AddTo(gameObject); } } + + public partial class GameCamera + { + public override void SaveBM() + { + matchedBM = new Beatmap.GameCamera_BM(elementName, elementGuid, tags, parentElement.matchedBM, + cameraViewType, perspectiveAngle, orthographicSize, transformSubmodule.currentPosition, + transformSubmodule.currentEulerAngles); + } + } + + namespace Beatmap + { + public class GameCamera_BM : BaseElement_BM + { + public GameCamera.CameraViewType cameraViewType; + public float perspectiveAngle; + public float orthographicSize; + public Vector3 initialPosition; + public Vector3 initialEulerAngles; + + public GameCamera_BM() + { + + } + + public GameCamera_BM(string elementName, Guid elementGuid, List tags, + BaseElement_BM attachedElement, + GameCamera.CameraViewType cameraViewType, float perspectiveAngle, float orthographicSize, + Vector3 initialPosition, Vector3 initialEulerAngles) + : base(elementName, elementGuid, tags, attachedElement) + { + this.cameraViewType = cameraViewType; + this.perspectiveAngle = perspectiveAngle; + this.orthographicSize = orthographicSize; + this.initialPosition = initialPosition; + this.initialEulerAngles = initialEulerAngles; + } + + public override void ExecuteBM() + { + GameCamera.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid), + cameraViewType, perspectiveAngle, orthographicSize, initialPosition, initialEulerAngles); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return GameCamera.GenerateElement(elementName, elementGuid, tags, parent, cameraViewType, + perspectiveAngle, orthographicSize, initialPosition, initialEulerAngles); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/Notes/NoteVisual/NoteVisualBase.cs b/Assets/Scripts/GameElements/Notes/NoteVisual/NoteVisualBase.cs index 80406c70..ac9ce03a 100644 --- a/Assets/Scripts/GameElements/Notes/NoteVisual/NoteVisualBase.cs +++ b/Assets/Scripts/GameElements/Notes/NoteVisual/NoteVisualBase.cs @@ -4,7 +4,7 @@ using UnityEngine; namespace Ichni.RhythmGame { - public class NoteVisualBase : SubstantialObject + public abstract class NoteVisualBase : SubstantialObject { public NoteBase note; diff --git a/Assets/Scripts/GameElements/SubstantialObject.cs b/Assets/Scripts/GameElements/SubstantialObject.cs index a421f115..563e8c5a 100644 --- a/Assets/Scripts/GameElements/SubstantialObject.cs +++ b/Assets/Scripts/GameElements/SubstantialObject.cs @@ -6,7 +6,7 @@ using UnityEngine; namespace Ichni.RhythmGame { - public class SubstantialObject : BaseElement + public abstract class SubstantialObject : BaseElement { public string themeBundleName, objectName; diff --git a/Assets/Scripts/GameElements/Track/PathNode.cs b/Assets/Scripts/GameElements/Track/PathNode.cs index 9fa17b9e..47eeac47 100644 --- a/Assets/Scripts/GameElements/Track/PathNode.cs +++ b/Assets/Scripts/GameElements/Track/PathNode.cs @@ -12,29 +12,31 @@ namespace Ichni.RhythmGame public partial class PathNode : BaseElement { public ColorSubmodule colorSubmodule; - + public Track track; - + public int index => track.trackPathSubmodule.pathNodeList.IndexOf(this); - + public SplinePoint node; - - public static PathNode GenerateElement(string elementName, Guid id, List tags, + + public static PathNode GenerateElement(string elementName, Guid id, List tags, Track track, Vector3 nodePosition, Vector3 nodeNormal, float nodeSize, Color nodeColor) { - PathNode pathNode = Instantiate(EditorManager.instance.basePrefabs.pathNode, track.transform).GetComponent(); + PathNode pathNode = Instantiate(EditorManager.instance.basePrefabs.pathNode, track.transform) + .GetComponent(); pathNode.Initialize(elementName, id, tags); pathNode.track = track; //pathNode.index = index; - pathNode.transformSubmodule = new TransformSubmodule(pathNode, nodePosition, Quaternion.LookRotation(nodeNormal, Vector3.up).eulerAngles, Vector3.one * nodeSize); + pathNode.transformSubmodule = new TransformSubmodule(pathNode, nodePosition, + Quaternion.LookRotation(nodeNormal, Vector3.up).eulerAngles, Vector3.one * nodeSize); pathNode.timeDurationSubmodule = new TimeDurationSubmodule(pathNode); pathNode.colorSubmodule = new ColorSubmodule(pathNode, nodeColor); - + track.trackPathSubmodule.pathNodeList.Add(pathNode); pathNode.SetParent(track); - + return pathNode; } @@ -47,7 +49,7 @@ namespace Ichni.RhythmGame } } } - + public partial class PathNode { public override void Refresh() @@ -61,4 +63,53 @@ namespace Ichni.RhythmGame track.trackPathSubmodule.SetPathNode(this); } } + + public partial class PathNode + { + public override void SaveBM() + { + matchedBM = new Beatmap.PathNode_BM(elementName, elementGuid, tags, parentElement.matchedBM, index, + node.position, node.normal, node.size, node.color); + } + } + + namespace Beatmap + { + public class PathNode_BM : BaseElement_BM + { + public int index; + public Vector3 position; + public Vector3 normal; + public float size; + public Color color; + + public PathNode_BM() + { + + } + + public PathNode_BM(string elementName, Guid elementGuid, List tags, BaseElement_BM attachedElement, + int index, Vector3 position, Vector3 normal, float size, Color color) + : base(elementName, elementGuid, tags, attachedElement) + { + this.index = index; + this.position = position; + this.normal = normal; + this.size = size; + this.color = color; + } + + public override void ExecuteBM() + { + matchedElement = PathNode.GenerateElement(elementName, elementGuid, tags, + GetElement(attachedElementGuid) as Track, position, normal, size, color); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return PathNode.GenerateElement(elementName, elementGuid, tags, parent as Track, + position, normal, size, color); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/Track/TrackPoints/CrossTrackPoint.cs b/Assets/Scripts/GameElements/Track/TrackPoints/CrossTrackPoint.cs index 885666bd..c5cc28ce 100644 --- a/Assets/Scripts/GameElements/Track/TrackPoints/CrossTrackPoint.cs +++ b/Assets/Scripts/GameElements/Track/TrackPoints/CrossTrackPoint.cs @@ -7,7 +7,7 @@ using UnityEngine; namespace Ichni.RhythmGame { - public class CrossTrackPoint : BaseElement + public partial class CrossTrackPoint : BaseElement { public ElementFolder trackListFolder; public Track nowAttachedTrack; @@ -56,4 +56,45 @@ namespace Ichni.RhythmGame trackPositioner.SetPercent(trackPercent.value); } } + + public partial class CrossTrackPoint + { + public override void SaveBM() + { + matchedBM = new Beatmap.CrossTrackPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM, trackSwitch, trackPercent); + } + } + + namespace Beatmap + { + public class CrossTrackPoint_BM : BaseElement_BM + { + public FlexibleInt trackSwitch; + public FlexibleFloat trackPercent; + public CrossTrackPoint_BM() + { + + } + + public CrossTrackPoint_BM(string elementName, Guid elementGuid, List tags, + BaseElement_BM attachedElement, FlexibleInt trackSwitch, FlexibleFloat trackPercent) + : base(elementName, elementGuid, tags, attachedElement) + { + this.trackSwitch = trackSwitch; + this.trackPercent = trackPercent; + } + + public override void ExecuteBM() + { + CrossTrackPoint.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid) as ElementFolder, + trackSwitch, trackPercent); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return CrossTrackPoint.GenerateElement(elementName, elementGuid, tags, parent as ElementFolder, + trackSwitch, trackPercent); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/Track/TrackPoints/TrackHeadPoint.cs b/Assets/Scripts/GameElements/Track/TrackPoints/TrackHeadPoint.cs index dc99b852..ae1c5e48 100644 --- a/Assets/Scripts/GameElements/Track/TrackPoints/TrackHeadPoint.cs +++ b/Assets/Scripts/GameElements/Track/TrackPoints/TrackHeadPoint.cs @@ -7,16 +7,17 @@ using UnityEngine; namespace Ichni.RhythmGame { - public class TrackHeadPoint : BaseElement + public partial class TrackHeadPoint : BaseElement { public Track track; public TrackTimeSubmoduleMovable trackTimeSubmoduleMovable; public SplinePositioner trackPositioner; - + public static TrackHeadPoint GenerateElement(string elementName, Guid id, List tags, Track track) { - TrackHeadPoint head = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform).AddComponent(); - + TrackHeadPoint head = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform) + .AddComponent(); + head.Initialize(elementName, id, tags); head.track = track; head.trackPositioner = head.gameObject.AddComponent(); @@ -34,4 +35,40 @@ namespace Ichni.RhythmGame } } } + + public partial class TrackHeadPoint + { + public override void SaveBM() + { + matchedBM = new Beatmap.TrackHeadPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM); + } + } + + namespace Beatmap + { + public class TrackHeadPoint_BM : BaseElement_BM + { + public TrackHeadPoint_BM() + { + + } + + public TrackHeadPoint_BM(string elementName, Guid elementGuid, List tags, + BaseElement_BM attachedElement) + : base(elementName, elementGuid, tags, attachedElement) + { + } + + public override void ExecuteBM() + { + TrackHeadPoint.GenerateElement(elementName, elementGuid, tags, + GetElement(attachedElementGuid) as Track); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return TrackHeadPoint.GenerateElement(elementName, elementGuid, tags, parent as Track); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/Track/TrackPoints/TrackPercentPoint.cs b/Assets/Scripts/GameElements/Track/TrackPoints/TrackPercentPoint.cs index 5640e9aa..1afc7404 100644 --- a/Assets/Scripts/GameElements/Track/TrackPoints/TrackPercentPoint.cs +++ b/Assets/Scripts/GameElements/Track/TrackPoints/TrackPercentPoint.cs @@ -12,7 +12,7 @@ namespace Ichni.RhythmGame /// /// 在轨道上根据百分比进行运动的点 /// - public class TrackPercentPoint : BaseElement + public partial class TrackPercentPoint : BaseElement { public Track track; public SplinePositioner trackPositioner; @@ -56,4 +56,41 @@ namespace Ichni.RhythmGame } } } + + public partial class TrackPercentPoint + { + public override void SaveBM() + { + matchedBM = new Beatmap.TrackPercentPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM, trackPercent.ConvertToBM()); + } + } + + namespace Beatmap + { + public class TrackPercentPoint_BM : BaseElement_BM + { + public FlexibleFloat_BM trackPercent; + public TrackPercentPoint_BM() + { + + } + + public TrackPercentPoint_BM(string elementName, Guid elementGuid, List tags, + BaseElement_BM attachedElement, FlexibleFloat_BM trackPercent) + : base(elementName, elementGuid, tags, attachedElement) + { + this.trackPercent = trackPercent; + } + + public override void ExecuteBM() + { + TrackPercentPoint.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid) as Track, trackPercent.ConvertToGameType()); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return TrackPercentPoint.GenerateElement(elementName, elementGuid, tags, parent as Track, trackPercent.ConvertToGameType()); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/Track/Trail.cs b/Assets/Scripts/GameElements/Track/Trail.cs index 31306407..16aae096 100644 --- a/Assets/Scripts/GameElements/Track/Trail.cs +++ b/Assets/Scripts/GameElements/Track/Trail.cs @@ -5,13 +5,13 @@ using UnityEngine; namespace Ichni.RhythmGame { - public class Trail : BaseElement + public partial class Trail : BaseElement { public TrailRenderer trailRenderer; public Material renderMaterial; public float visibleTimeLength; - + public static Trail GenerateElement(string name, Guid id, List tags, BaseElement parentElement, float visibleTimeLength, Material material = null) { @@ -19,14 +19,57 @@ namespace Ichni.RhythmGame trail.trailRenderer = trail.GetComponent(); trail.Initialize(name, id, tags); - trail.renderMaterial = material == null ? EditorManager.instance.basePrefabs.defaultTrailMaterial : material; + trail.renderMaterial = + material == null ? EditorManager.instance.basePrefabs.defaultTrailMaterial : material; trail.trailRenderer.material = trail.renderMaterial; trail.visibleTimeLength = visibleTimeLength; trail.SetParent(parentElement); - + trail.transformSubmodule = new TransformSubmodule(trail); - + return trail; } } + + public partial class Trail + { + public override void SaveBM() + { + matchedBM = new Beatmap.Trail_BM(elementName, elementGuid, tags, parentElement.matchedBM, visibleTimeLength, + renderMaterial); + } + } + + namespace Beatmap + { + public class Trail_BM : BaseElement_BM + { + public float visibleTimeLength; + public Material renderMaterial; + + public Trail_BM() + { + + } + + public Trail_BM(string elementName, Guid elementGuid, List tags, BaseElement_BM attachedElement, + float visibleTimeLength, Material renderMaterial) + : base(elementName, elementGuid, tags, attachedElement) + { + this.visibleTimeLength = visibleTimeLength; + this.renderMaterial = renderMaterial; + } + + public override void ExecuteBM() + { + matchedElement = Trail.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid), + visibleTimeLength, renderMaterial); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return Trail.GenerateElement(elementName, elementGuid, tags, parent, visibleTimeLength, renderMaterial); + } + } + } } \ No newline at end of file diff --git a/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteVisual.cs b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteVisual.cs index c8923688..194cf343 100644 --- a/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteVisual.cs +++ b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteVisual.cs @@ -1,12 +1,13 @@ using System; using System.Collections; using System.Collections.Generic; +using Ichni.RhythmGame.Beatmap; using Lean.Pool; using UnityEngine; namespace Ichni.RhythmGame.ThemeBundles.Basic { - public class BasicNoteVisual : NoteVisualBase + public partial class BasicNoteVisual : NoteVisualBase { public new static BasicNoteVisual GenerateElement(string elementName, Guid id, List tags, string themeBundleName, string objectName, @@ -33,4 +34,49 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic return noteVisual; } } + + public partial class BasicNoteVisual + { + public override void SaveBM() + { + + } + } + + namespace Beatmap + { + public class BasicNoteVisual_BM : BaseElement_BM + { + public BasicNoteVisual_BM() + { + + } + + public BasicNoteVisual_BM(string elementName, Guid id, List tags, BaseElement_BM parent, + string themeBundleName, string objectName, Vector3 position, Vector3 eulerAngles, Vector3 scale) : + base(elementName, id, tags, parent) + { + this.elementName = elementName; + this.elementGuid = id; + this.tags = tags; + // this.themeBundleName = themeBundleName; + // this.objectName = objectName; + // this.position = position; + // this.eulerAngles = eulerAngles; + // this.scale = scale; + // this.parent = parent; + } + + public override void ExecuteBM() + { + //TODO: 生成NoteVisual + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + //TODO: 生成NoteVisual + return null; + } + } + } } \ No newline at end of file