Timeline's Note And Sth Submodule
This commit is contained in:
@@ -12,53 +12,53 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public bool isOverridingDuration; //是否手动设置了时间区间,开启时,子物体的时间区间将被忽略,且在自动计算区间时跳过此模块
|
||||
public float startTime, endTime; //起止时间
|
||||
|
||||
|
||||
public TimeDurationSubmodule(GameElement attachedGameElement) : base(attachedGameElement)
|
||||
{
|
||||
isOverridingDuration = false;
|
||||
startTime = -32767;//TODO: 换为-delay
|
||||
endTime = 32767;//TODO: 换为songLength
|
||||
startTime = -EditorManager.instance.songInformation.delay;//TODO: 换为-delay
|
||||
endTime = EditorManager.instance.songInformation.songTime;//TODO: 换为songLength
|
||||
|
||||
(attachedGameElement as IHaveTimeDurationSubmodule).timeDurationSubmodule = this;
|
||||
}
|
||||
|
||||
|
||||
public TimeDurationSubmodule(GameElement attachedGameElement, bool isOverridingDuration, float startTime, float endTime) : base(attachedGameElement)
|
||||
{
|
||||
this.isOverridingDuration = isOverridingDuration;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
|
||||
|
||||
(attachedGameElement as IHaveTimeDurationSubmodule).timeDurationSubmodule = this;
|
||||
}
|
||||
|
||||
|
||||
public bool CheckTimeInDuration(float time, float offset = 0.2f)
|
||||
{
|
||||
return time >= startTime - offset && time <= endTime + offset;
|
||||
}
|
||||
|
||||
|
||||
public void SetDuration(float startTime, float endTime)
|
||||
{
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.isOverridingDuration = true;
|
||||
}
|
||||
|
||||
|
||||
public void SetDuration(params FlexibleFloat[] flexibleFloats)
|
||||
{
|
||||
List<float> startTimes = new List<float>();
|
||||
List<float> endTimes = new List<float>();
|
||||
|
||||
|
||||
foreach (FlexibleFloat flexibleFloat in flexibleFloats)
|
||||
{
|
||||
flexibleFloat.Sort();
|
||||
|
||||
|
||||
if (flexibleFloat.animations.Count > 0)
|
||||
{
|
||||
startTimes.Add(flexibleFloat.animations[0].startTime);
|
||||
endTimes.Add(flexibleFloat.animations[^1].endTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
startTime = startTimes.Min();
|
||||
endTime = endTimes.Max();
|
||||
}
|
||||
@@ -102,19 +102,19 @@ namespace Ichni.RhythmGame
|
||||
startTimeInputField.inputField.interactable = interactable;
|
||||
endTimeInputField.inputField.interactable = interactable;
|
||||
}
|
||||
|
||||
|
||||
SetInputFieldInteractable(isOverridingDuration);
|
||||
overrideToggle.AddListenerFunction(SetInputFieldInteractable);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public interface IHaveTimeDurationSubmodule
|
||||
{
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
}
|
||||
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class TimeDurationSubmodule_BM : Submodule_BM
|
||||
@@ -124,7 +124,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public TimeDurationSubmodule_BM()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public TimeDurationSubmodule_BM(GameElement attachedElement) : base(attachedElement)
|
||||
@@ -142,7 +142,7 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
{
|
||||
(attached as IHaveTimeDurationSubmodule).timeDurationSubmodule = new TimeDurationSubmodule(attached, isOverridingDuration, startTime, endTime);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user