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.

54 lines
1.8 KiB

  1. using System.Collections.Generic;
  2. using System.Runtime.CompilerServices;
  3. using IPA.Config.Stores;
  4. using IPA.Config.Stores.Attributes;
  5. using IPA.Config.Stores.Converters;
  6. [assembly: InternalsVisibleTo(GeneratedExtension.AssemblyVisibilityTarget)]
  7. namespace Demo
  8. {
  9. /*
  10. public class PluginConfig
  11. */
  12. internal class PluginConfig
  13. {
  14. public static PluginConfig Instance { get; set; }
  15. /*
  16. public int IntValue { get; set; } = 42;
  17. public float FloatValue { get; set; } = 3.14159f;
  18. [UseConverter(typeof(ListConverter<string>))]
  19. public List<string> ListValue { get; set; } = new List<string>();
  20. [UseConverter(typeof(CollectionConverter<string, HashSet<string>>))]
  21. public HashSet<string> SetValue { get; set; } = new HashSet<string>();
  22. */
  23. public virtual int IntValue { get; set; } = 42;
  24. public virtual float FloatValue { get; set; } = 3.14159f;
  25. [UseConverter(typeof(ListConverter<string>))]
  26. public virtual List<string> ListValue { get; set; } = new List<string>();
  27. [UseConverter(typeof(CollectionConverter<string, HashSet<string>>))]
  28. public virtual HashSet<string> SetValue { get; set; } = new HashSet<string>();
  29. public virtual void Changed()
  30. {
  31. // this is called whenever one of the virtual properties is changed
  32. // can be called to signal that the content has been changed
  33. }
  34. public virtual void OnReload()
  35. {
  36. // this is called whenever the config file is reloaded from disk
  37. // use it to tell all of your systems that something has changed
  38. // this is called off of the main thread, and is not safe to interact
  39. // with Unity in
  40. }
  41. }
  42. }