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.

66 lines
1.6 KiB

  1. using System;
  2. using IPA;
  3. using IPA.Logging;
  4. using IPA.Config;
  5. using IPA.Config.Stores;
  6. namespace Demo
  7. {
  8. /*
  9. [Plugin(RuntimeOptions.DynamicInit)]
  10. */
  11. [Plugin(RuntimeOptions.SingleStartInit)]
  12. internal class Plugin
  13. {
  14. public static Logger log { get; private set; }
  15. [Init]
  16. public Plugin(Logger logger, Config conf)
  17. {
  18. log = logger;
  19. PluginConfig.Instance = conf.Generated<PluginConfig>();
  20. log.Debug("Config loaded");
  21. // setup that does not require game code
  22. // this is only called once ever, so do once-ever initialization
  23. }
  24. /*
  25. [Init]
  26. public Plugin(Logger logger)
  27. {
  28. log = logger;
  29. log.Debug("Basic plugin running!");
  30. // setup that does not require game code
  31. // this is only called once ever, so do once-ever initialization
  32. }
  33. */
  34. [Init]
  35. public void Init(Logger logger)
  36. {
  37. // logger will be the same instance as log currently is
  38. }
  39. /*
  40. [OnEnable]
  41. public void OnEnable()
  42. */
  43. [OnStart]
  44. public void OnStart()
  45. {
  46. // setup that requires game code
  47. }
  48. /*
  49. [OnDisable]
  50. public void OnDisable()
  51. */
  52. [OnExit]
  53. public void OnExit()
  54. {
  55. // teardown
  56. // this may be called mid-game if you are using RuntimeOptions.DynamicInit
  57. }
  58. }
  59. }