基础内容-8
添加BM存档类
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user