91 lines
3.2 KiB
C#
91 lines
3.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Ichni.RhythmGame.Beatmap;
|
|
using Lean.Pool;
|
|
using UnityEngine;
|
|
|
|
namespace Ichni.RhythmGame
|
|
{
|
|
public partial class TrackTotalTimeChange : AnimationBase
|
|
{
|
|
public FlexibleFloat totalTime;
|
|
public TrackTimeSubmoduleStatic targetTrackTimeSubmoduleStatic;
|
|
|
|
public static TrackTotalTimeChange GenerateElement(string elementName, Guid id,
|
|
List<string> tags, bool isFirstGenerated, Track animatedTrack, FlexibleFloat totalTime)
|
|
{
|
|
TrackTotalTimeChange trackTotalTimeChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject)
|
|
.AddComponent<TrackTotalTimeChange>();
|
|
trackTotalTimeChange.Initialize(elementName, id, tags, isFirstGenerated);
|
|
|
|
trackTotalTimeChange.animatedObject = animatedTrack;
|
|
|
|
trackTotalTimeChange.targetTrackTimeSubmoduleStatic = animatedTrack.trackTimeSubmodule as TrackTimeSubmoduleStatic;
|
|
|
|
trackTotalTimeChange.totalTime = totalTime;
|
|
trackTotalTimeChange.animationReturnType = FlexibleReturnType.Before;
|
|
//trackTotalTimeChange.timeDurationSubmodule.SetDuration(totalTime);
|
|
|
|
trackTotalTimeChange.SetParent(animatedTrack);
|
|
return trackTotalTimeChange;
|
|
}
|
|
|
|
protected override void SetDefaultSubmodules()
|
|
{
|
|
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
|
submoduleList.Add(timeDurationSubmodule);
|
|
}
|
|
|
|
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, animatedObject.matchedBM as Track_BM, totalTime.ConvertToBM());
|
|
}
|
|
}
|
|
|
|
namespace Beatmap
|
|
{
|
|
public class TrackTotalTimeChange_BM : GameElement_BM
|
|
{
|
|
public FlexibleFloat_BM totalTime;
|
|
|
|
public TrackTotalTimeChange_BM()
|
|
{
|
|
|
|
}
|
|
|
|
public TrackTotalTimeChange_BM(string elementName, Guid elementGuid, List<string> tags,
|
|
GameElement_BM attachedElement, FlexibleFloat_BM totalTime) :
|
|
base(elementName, elementGuid, tags, attachedElement)
|
|
{
|
|
this.totalTime = totalTime;
|
|
}
|
|
|
|
public override void ExecuteBM()
|
|
{
|
|
TrackTotalTimeChange.GenerateElement(elementName, elementGuid, tags, false,
|
|
GetElement(attachedElementGuid) as Track, totalTime.ConvertToGameType());
|
|
}
|
|
|
|
public override GameElement DuplicateBM(GameElement parent)
|
|
{
|
|
return TrackTotalTimeChange.GenerateElement(elementName, elementGuid, tags, false,
|
|
parent as Track, totalTime.ConvertToGameType());
|
|
}
|
|
}
|
|
}
|
|
}
|