Newer
Older
DungeonShooting / DungeonShooting_Godot / src / framework / activity / RegisterActivity.cs
  1.  
  2. using System;
  3. using System.Diagnostics.CodeAnalysis;
  4.  
  5. [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
  6. public class RegisterActivity : Attribute
  7. {
  8. /// <summary>
  9. /// 注册物体唯一ID, 该ID不能有重复
  10. /// </summary>
  11. public string Id { get; }
  12.  
  13. /// <summary>
  14. /// 模板Prefab的路径
  15. /// </summary>
  16. public string PrefabPath { get; protected set; }
  17.  
  18. public RegisterActivity(string id, string prefabPath)
  19. {
  20. Id = id;
  21. PrefabPath = prefabPath;
  22. }
  23.  
  24.  
  25. public virtual Func<ActivityObject> RegisterInstantiationCallback(Type type)
  26. {
  27. return () => { return (ActivityObject)Activator.CreateInstance(type); };
  28. }
  29. }