修改crosstrackpiont并且使其支持两种模式(注意:本体理论同步,需要实测)

Signed-off-by: TRADER_FOER <lhf190@outlook.com>
This commit is contained in:
2026-07-10 15:10:00 +08:00
parent 13750487cf
commit 9ce3173697
23 changed files with 289986 additions and 406 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8085560939c7d8943af1b052b47fe39b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
using System.Collections.Generic;
using ES3Types;
namespace ES3Types
{
/// <summary>
/// 兼容旧存档FlexibleBool_BM 在旧数据中存为 "animations" 字段名Runtime 遗留),
/// 新数据使用 "animatedBoolList"。Read 过程自动识别两种格式。
/// </summary>
[UnityEngine.Scripting.Preserve]
public class ES3Type_FlexibleBool_BM : ES3ObjectType
{
public ES3Type_FlexibleBool_BM() : base(typeof(Ichni.RhythmGame.Beatmap.FlexibleBool_BM))
{
priority = 1;
}
protected override void WriteObject(object obj, ES3Writer writer)
{
var instance = (Ichni.RhythmGame.Beatmap.FlexibleBool_BM)obj;
writer.WriteProperty("animatedBoolList", instance.animatedBoolList);
}
protected override object ReadObject<T>(ES3Reader reader)
{
var instance = new Ichni.RhythmGame.Beatmap.FlexibleBool_BM();
foreach (string propertyName in reader.Properties)
{
if (propertyName == "animatedBoolList" || propertyName == "animations")
{
instance.animatedBoolList = reader.Read<List<Ichni.RhythmGame.AnimatedBool>>();
}
else
{
reader.Skip();
}
}
return instance;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d6f9c73884bda4242b47ff6c46ddcccc

View File

@@ -0,0 +1,41 @@
using System.Collections.Generic;
using ES3Types;
namespace ES3Types
{
/// <summary>
/// 兼容旧存档FlexibleFloat_BM 在旧数据中存为 "animations" 字段名Runtime 遗留),
/// 新数据使用 "animatedFloatList"。Read 过程自动识别两种格式。
/// </summary>
[UnityEngine.Scripting.Preserve]
public class ES3Type_FlexibleFloat_BM : ES3ObjectType
{
public ES3Type_FlexibleFloat_BM() : base(typeof(Ichni.RhythmGame.Beatmap.FlexibleFloat_BM))
{
priority = 1;
}
protected override void WriteObject(object obj, ES3Writer writer)
{
var instance = (Ichni.RhythmGame.Beatmap.FlexibleFloat_BM)obj;
writer.WriteProperty("animatedFloatList", instance.animatedFloatList);
}
protected override object ReadObject<T>(ES3Reader reader)
{
var instance = new Ichni.RhythmGame.Beatmap.FlexibleFloat_BM();
foreach (string propertyName in reader.Properties)
{
if (propertyName == "animatedFloatList" || propertyName == "animations")
{
instance.animatedFloatList = reader.Read<List<Ichni.RhythmGame.AnimatedFloat>>();
}
else
{
reader.Skip();
}
}
return instance;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: af78df6a5dc19dd44acc3e39caf5d57a

View File

@@ -0,0 +1,41 @@
using System.Collections.Generic;
using ES3Types;
namespace ES3Types
{
/// <summary>
/// 兼容旧存档FlexibleInt_BM 在旧数据中存为 "animations" 字段名Runtime 遗留),
/// 新数据使用 "animatedIntList"。Read 过程自动识别两种格式。
/// </summary>
[UnityEngine.Scripting.Preserve]
public class ES3Type_FlexibleInt_BM : ES3ObjectType
{
public ES3Type_FlexibleInt_BM() : base(typeof(Ichni.RhythmGame.Beatmap.FlexibleInt_BM))
{
priority = 1; // 优先级高于反射自动生成的 ES3ReflectedObjectType
}
protected override void WriteObject(object obj, ES3Writer writer)
{
var instance = (Ichni.RhythmGame.Beatmap.FlexibleInt_BM)obj;
writer.WriteProperty("animatedIntList", instance.animatedIntList);
}
protected override object ReadObject<T>(ES3Reader reader)
{
var instance = new Ichni.RhythmGame.Beatmap.FlexibleInt_BM();
foreach (string propertyName in reader.Properties)
{
if (propertyName == "animatedIntList" || propertyName == "animations")
{
instance.animatedIntList = reader.Read<List<Ichni.RhythmGame.AnimatedInt>>();
}
else
{
reader.Skip();
}
}
return instance;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0e28d98af48261e4a8b77a74c63ce72c

View File

@@ -5,8 +5,8 @@ namespace Ichni.RhythmGame.Beatmap
{
public class CrossTrackPoint_BM : GameElement_BM
{
public FlexibleInt trackSwitch;
public FlexibleFloat trackPercent;
public FlexibleInt_BM trackSwitch;
public FlexibleFloat_BM trackPercent;
public bool MotionAngles = false;
public CrossTrackPoint_BM()
@@ -15,7 +15,7 @@ namespace Ichni.RhythmGame.Beatmap
}
public CrossTrackPoint_BM(string elementName, Guid elementGuid, List<string> tags,
GameElement_BM attachedElement, FlexibleInt trackSwitch, FlexibleFloat trackPercent)
GameElement_BM attachedElement, FlexibleInt_BM trackSwitch, FlexibleFloat_BM trackPercent)
: base(elementName, elementGuid, tags, attachedElement)
{
this.trackSwitch = trackSwitch;
@@ -25,7 +25,9 @@ namespace Ichni.RhythmGame.Beatmap
public override void ExecuteBM()
{
var element = CrossTrackPoint.GenerateElement(elementName, elementGuid, tags, false,
GetElement(attachedElementGuid) as ElementFolder, trackSwitch, trackPercent);
GetElement(attachedElementGuid) as ElementFolder,
trackSwitch?.ConvertToGameType() ?? new FlexibleInt(),
trackPercent?.ConvertToGameType() ?? new FlexibleFloat());
matchedElement = element;
// 还原MotionAngles
if (element is CrossTrackPoint ctp && this != null)
@@ -38,7 +40,9 @@ namespace Ichni.RhythmGame.Beatmap
public override GameElement DuplicateBM(GameElement parent)
{
var newElement = CrossTrackPoint.GenerateElement(elementName, Guid.NewGuid(), tags, false,
parent as ElementFolder, trackSwitch, trackPercent);
parent as ElementFolder,
trackSwitch?.ConvertToGameType() ?? new FlexibleInt(),
trackPercent?.ConvertToGameType() ?? new FlexibleFloat());
// 复制MotionAngles
if (newElement is CrossTrackPoint ctp)
{

View File

@@ -13,7 +13,7 @@ namespace Ichni.RhythmGame
public override void SaveBM()
{
matchedBM = new CrossTrackPoint_BM(elementName, elementGuid, tags,
parentElement.matchedBM as GameElement_BM, trackSwitch, trackPercent)
parentElement.matchedBM as GameElement_BM, trackSwitch?.ConvertToBM(), trackPercent?.ConvertToBM())
{
MotionAngles = this.MotionAngles
};