using System.Collections.Generic; using System.Runtime.CompilerServices; using IPA.Config.Stores; using IPA.Config.Stores.Attributes; using IPA.Config.Stores.Converters; [assembly: InternalsVisibleTo(GeneratedStore.AssemblyVisibilityTarget)] namespace Demo { /* public class PluginConfig */ internal class PluginConfig { public static PluginConfig Instance { get; set; } public class SubThingsObject { /* public double DoubleValue { get; set; } = 2.718281828459045; */ public virtual double DoubleValue { get; set; } = 2.718281828459045; } /* public int IntValue { get; set; } = 42; public float FloatValue { get; set; } = 3.14159f; [NonNullable] public SubThingsObject SubThings { get; set; } = new SubThingsObject(); [UseConverter(typeof(ListConverter))] public List ListValue { get; set; } = new List(); [UseConverter(typeof(CollectionConverter>))] public HashSet SetValue { get; set; } = new HashSet(); */ public virtual int IntValue { get; set; } = 42; public virtual float FloatValue { get; set; } = 3.14159f; [NonNullable] public virtual SubThingsObject SubThings { get; set; } = new SubThingsObject(); [UseConverter(typeof(ListConverter))] public virtual List ListValue { get; set; } = new List(); [UseConverter(typeof(CollectionConverter>))] public virtual HashSet SetValue { get; set; } = new HashSet(); public virtual void Changed() { // this is called whenever one of the virtual properties is changed // can be called to signal that the content has been changed } public virtual void OnReload() { // this is called whenever the config file is reloaded from disk // use it to tell all of your systems that something has changed // this is called off of the main thread, and is not safe to interact // with Unity in } public virtual void CopyFrom(PluginConfig cfg) { // you can call this to copy the structure from the parameter to this object // think of this as a magic function that "just works", and doesn't actually // have to have a body. // any code you put here will be called after the copy is complete though } } }