大活:Tracker和Interferometer

等待改进
Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-11-02 03:08:40 +08:00
parent eab38e36fe
commit 1280e32612
53 changed files with 3446 additions and 35373 deletions

View File

@@ -53,11 +53,16 @@ namespace Ichni.RhythmGame
public FlexibleReturnType lastReturnType;
public FlexibleReturnType returnType;
public FlexibleFloat()
public FlexibleFloat(bool withFirstAnimation = false)
{
animations = new List<AnimatedFloat>();
if (withFirstAnimation)
{
animations.Add(new AnimatedFloat(0f, 1f, 0f, 0f, AnimationCurveType.Linear));
}
}
public FlexibleFloat(List<AnimatedFloat> anim)
{
animations = anim;
@@ -198,9 +203,18 @@ namespace Ichni.RhythmGame
{
UpdateFlexibleFloat(songtime);
float a = value;
UpdateFlexibleFloat(EditorManager.instance.songInformation.songTime);
return a;
}
public (FlexibleReturnType, bool) getReturnType(float Songtime)
{
UpdateFlexibleFloat(Songtime);
return (returnType, isSwitchingReturnType);
}
public (FlexibleReturnType, bool, float) GetReturnTypeAndValue(float songtime)
{
UpdateFlexibleFloat(songtime);
return (returnType, isSwitchingReturnType, value);
}
/// <summary>
/// 转换为Beatmap存档类型
/// </summary>
@@ -216,6 +230,14 @@ namespace Ichni.RhythmGame
return flexibleFloat_BM;
}
public void ApplyTimeOffset(float OffsetTime)
{
animations.ForEach(i =>
{
i.ApplyTimeOffset(OffsetTime);
});
}
}
namespace Beatmap
@@ -259,6 +281,26 @@ namespace Ichni.RhythmGame
return flexibleFloat;
}
public FlexibleFloat_BM DeepCopyBM()
{
FlexibleFloat_BM copy = new FlexibleFloat_BM();
foreach (AnimatedFloat animatedFloat in animatedFloatList)
{
copy.animatedFloatList.Add(new AnimatedFloat(
animatedFloat.startTime, animatedFloat.endTime,
animatedFloat.startValue, animatedFloat.endValue,
animatedFloat.animationCurveType));
}
return copy;
}
public void ApplyTimeOffset(float OffsetTime)
{
animatedFloatList.ForEach(i =>
{
i.ApplyTimeOffset(OffsetTime);
});
}
}
}
}

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Beatmap;
using Ichni.RhythmGame.Beatmap;
using UniRx;
using UnityEngine;
@@ -9,7 +10,7 @@ using UnityEngine.Events;
namespace Ichni.RhythmGame
{
public class BeatmapContainer : IBaseElement
public class BeatmapContainer : IBaseElement, IBeChangeInExport
{
public List<GameElement> gameElementList;
@@ -17,6 +18,7 @@ namespace Ichni.RhythmGame
public List<UnityAction> lowPriorityActions;
public BaseElement_BM matchedBM { get; set; }
public BaseElement_BM MatchingExportElement { get; set; }
public BeatmapContainer()
{
@@ -72,6 +74,15 @@ namespace Ichni.RhythmGame
}
public void SaveExportBM()
{
MatchingExportElement = new BeatmapContainer_BM(gameElementList, true);
if (((BeatmapContainer_BM)MatchingExportElement).elementList.Any(i => i is ICanNotInExport))
{
Debug.LogError("Export Error!");
}
}
}
namespace Beatmap
@@ -86,7 +97,7 @@ namespace Ichni.RhythmGame
}
public BeatmapContainer_BM(List<GameElement> gameElementList)
public BeatmapContainer_BM(List<GameElement> gameElementList, bool forExport = false)
{
elementList = new List<BaseElement_BM>();
@@ -95,18 +106,39 @@ namespace Ichni.RhythmGame
e.SaveBM();
e.submoduleList.RemoveAll(s => s == null);
e.submoduleList.ForEach(s => s.SaveBM());
if (forExport && e is IBeChangeInExport changeInExport)
{
changeInExport.SaveExportBM();
}
});
foreach (var gameElement in gameElementList)
{
if (gameElement.matchedBM != null)
{
elementList.Add(gameElement.matchedBM);
}
if (forExport && gameElement is IBeChangeInExport changeInExport)
{
if (changeInExport.MatchingExportElement != null)
{
elementList.Add(changeInExport.MatchingExportElement);
List<BaseElement_BM> submodules = gameElement.submoduleList.ConvertAll(s => s.matchedBM);
submodules.RemoveAll(s => s == null);
submodules.ForEach(e => { e.attachedElementGuid = ((GameElement_BM)changeInExport.MatchingExportElement).elementGuid; });
elementList.AddRange(submodules);
}
}
else
{
elementList.Add(gameElement.matchedBM);
List<BaseElement_BM> submodules = gameElement.submoduleList.ConvertAll(s => s.matchedBM);
submodules.RemoveAll(s => s == null);
elementList.AddRange(submodules);
}
List<BaseElement_BM> submodules = gameElement.submoduleList.ConvertAll(s => s.matchedBM);
submodules.RemoveAll(s => s == null);
elementList.AddRange(submodules);
}
}
}