DragonECS/src/Utils/EcsPipelineTemplate.cs

46 lines
1.2 KiB
C#
Raw Normal View History

2025-03-14 16:53:25 +08:00
#if DISABLE_DEBUG
#undef DEBUG
#endif
using System;
2024-06-26 00:07:31 +08:00
using System.Runtime.Serialization;
2024-06-26 00:14:58 +08:00
namespace DCFApixels.DragonECS
2024-06-26 00:07:31 +08:00
{
2024-10-12 14:48:13 +08:00
using static EcsConsts;
2024-06-26 00:07:31 +08:00
[Serializable]
[DataContract]
[MetaTags(MetaTags.HIDDEN)]
2024-10-12 14:48:13 +08:00
[MetaDescription(AUTHOR, "...")]
[MetaGroup(PACK_GROUP, OTHER_GROUP)]
2024-10-12 00:08:12 +08:00
[MetaID("128D547C9201EEAC49B05F89E4A253DF")]
2024-10-12 14:48:13 +08:00
[MetaColor(MetaColor.DragonRose)]
2024-06-26 00:07:31 +08:00
public class EcsPipelineTemplate : IEcsModule
{
[DataMember] public string[] layers;
[DataMember] public Record[] records;
void IEcsModule.Import(EcsPipeline.Builder b)
2024-06-26 00:07:31 +08:00
{
b.Layers.MergeWith(layers);
foreach (var s in records)
2024-06-26 00:07:31 +08:00
{
2024-08-14 21:23:34 +08:00
if (s.target == null) { continue; }
2024-08-14 21:23:34 +08:00
b.Add(s.target, s.parameters);
2024-06-26 00:07:31 +08:00
}
}
[Serializable]
[DataContract]
public struct Record
{
2024-08-14 21:23:34 +08:00
[DataMember] public object target;
[DataMember] public AddParams parameters;
public Record(object target, AddParams parameters)
{
2024-08-14 21:23:34 +08:00
this.target = target;
this.parameters = parameters;
}
}
2024-06-26 00:07:31 +08:00
}
}