基础内容-8

添加BM存档类
This commit is contained in:
SoulliesOfficial
2025-02-02 21:59:43 -05:00
parent efca87e9cd
commit bc1c5d65ef
20 changed files with 926 additions and 90 deletions

View File

@@ -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<string> tags, Track targetTrack, FlexibleFloat totalTime)
{
TrackTotalTimeChange trackTotalTimeChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent<TrackTotalTimeChange>();
TrackTotalTimeChange trackTotalTimeChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject)
.AddComponent<TrackTotalTimeChange>();
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<string> 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());
}
}
}
}