DragonECS/src/Utils/EcsPipelineTemplate.cs

36 lines
944 B
C#
Raw Normal View History

2024-06-26 00:07:31 +08:00
using System;
using System.Runtime.Serialization;
2024-06-26 00:14:58 +08:00
namespace DCFApixels.DragonECS
2024-06-26 00:07:31 +08:00
{
[Serializable]
[DataContract]
public class EcsPipelineTemplate : IEcsModule
{
[DataMember] public string[] layers;
2024-08-14 21:23:34 +08:00
[DataMember] public AddCommand[] systems;
void IEcsModule.Import(EcsPipeline.Builder b)
2024-06-26 00:07:31 +08:00
{
b.Layers.MergeWith(layers);
foreach (var s in systems)
{
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]
2024-08-14 21:23:34 +08:00
public struct AddCommand
{
2024-08-14 21:23:34 +08:00
[DataMember] public object target;
[DataMember] public AddParams parameters;
public AddCommand(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
}
}