A stable modding interface between Techblox and mods https://mod.exmods.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1KB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Svelto.ECS;
  7. using GamecraftModdingAPI.Utility;
  8. namespace GamecraftModdingAPI.Events
  9. {
  10. /// <summary>
  11. /// A simple implementation of IEventEmitterEngine sufficient for most uses
  12. /// </summary>
  13. [Obsolete]
  14. public class SimpleEventEmitterEngine : IEventEmitterEngine
  15. {
  16. public string Name { get; set; }
  17. public int type { get; set; }
  18. public bool isRemovable { get; }
  19. public IEntityFactory Factory { private get; set; }
  20. public EntitiesDB entitiesDB { set; private get; }
  21. public void Ready() { }
  22. /// <summary>
  23. /// Emit the event
  24. /// </summary>
  25. public void Emit()
  26. {
  27. Factory.BuildEntity<ModEventEntityDescriptor>(ApiExclusiveGroups.eventID++, ApiExclusiveGroups.eventsExclusiveGroup)
  28. .Init(new ModEventEntityStruct { type = type });
  29. }
  30. public void Dispose() { }
  31. /// <summary>
  32. /// Construct the engine
  33. /// </summary>
  34. /// <param name="type">The EventType to use for ModEventEntityStruct.type</param>
  35. /// <param name="name">The name of this engine</param>
  36. /// <param name="isRemovable">Will removing this engine not break your code?</param>
  37. public SimpleEventEmitterEngine(EventType type, string name, bool isRemovable = true)
  38. {
  39. this.type = (int)type;
  40. this.Name = name;
  41. this.isRemovable = isRemovable;
  42. }
  43. /// <summary>
  44. /// Construct the engine
  45. /// </summary>
  46. /// <param name="type">The object to use for ModEventEntityStruct.type</param>
  47. /// <param name="name">The name of this engine</param>
  48. /// <param name="isRemovable">Will removing this engine not break your code?</param>
  49. public SimpleEventEmitterEngine(int type, string name, bool isRemovable = true)
  50. {
  51. this.type = type;
  52. this.Name = name;
  53. this.isRemovable = isRemovable;
  54. }
  55. }
  56. }