@ -0,0 +1,16 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | |||||
<ItemGroup> | |||||
<ProjectReference Include="..\..\..\IPA.Loader\IPA.Loader.csproj" /> | |||||
</ItemGroup> | |||||
<PropertyGroup> | |||||
<TargetFramework>net472</TargetFramework> | |||||
<RootNamespace>Demo</RootNamespace> | |||||
</PropertyGroup> | |||||
<ItemGroup> | |||||
<EmbeddedResource Include="manifest.json" /> | |||||
<EmbeddedResource Include="description.md" /> | |||||
</ItemGroup> | |||||
</Project> |
@ -0,0 +1,61 @@ | |||||
using System; | |||||
using IPA; | |||||
using IPA.Logging; | |||||
using IPA.Config; | |||||
using IPA.Config.Stores; | |||||
namespace Demo | |||||
{ | |||||
/* | |||||
[Plugin(RuntimeOptions.DynamicInit)] | |||||
*/ | |||||
[Plugin(RuntimeOptions.SingleStartInit)] | |||||
internal class Plugin | |||||
{ | |||||
public static Logger log { get; private set; } | |||||
[Init] | |||||
public Plugin(Logger logger, Config conf) | |||||
{ | |||||
log = logger; | |||||
PluginConfig.Instance = conf.Generated<PluginConfig>(); | |||||
log.Debug("Config loaded"); | |||||
// setup that does not require game code | |||||
// this is only called once ever, so do once-ever initialization | |||||
} | |||||
/* | |||||
[Init] | |||||
public Plugin(Logger logger) | |||||
{ | |||||
log = logger; | |||||
log.Debug("Basic plugin running!"); | |||||
// setup that does not require game code | |||||
// this is only called once ever, so do once-ever initialization | |||||
} | |||||
*/ | |||||
/* | |||||
[OnEnable] | |||||
public void OnEnable() | |||||
*/ | |||||
[OnStart] | |||||
public void OnStart() | |||||
{ | |||||
// setup that requires game code | |||||
} | |||||
/* | |||||
[OnDisable] | |||||
public void OnDisable() | |||||
*/ | |||||
[OnExit] | |||||
public void OnExit() | |||||
{ | |||||
// teardown | |||||
// this may be called mid-game if you are using RuntimeOptions.DynamicInit | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,55 @@ | |||||
using System.Collections.Generic; | |||||
using System.Runtime.CompilerServices; | |||||
using IPA.Config.Stores; | |||||
using IPA.Config.Stores.Attributes; | |||||
using IPA.Config.Stores.Converters; | |||||
[assembly: InternalsVisibleTo(GeneratedExtension.AssemblyVisibilityTarget)] | |||||
namespace Demo | |||||
{ | |||||
/* | |||||
public class PluginConfig | |||||
*/ | |||||
internal class PluginConfig | |||||
{ | |||||
public static PluginConfig Instance { get; set; } | |||||
/* | |||||
public int IntValue { get; set; } = 42; | |||||
public float FloatValue { get; set; } = 3.14159f; | |||||
[UseConverter(typeof(ListConverter<string>))] | |||||
public List<string> ListValue { get; set; } = new List<string>(); | |||||
[UseConverter(typeof(CollectionConverter<string, HashSet<string>>))] | |||||
public HashSet<string> SetValue { get; set; } = new HashSet<string>(); | |||||
*/ | |||||
public virtual int IntValue { get; set; } = 42; | |||||
public virtual float FloatValue { get; set; } = 3.14159f; | |||||
[UseConverter(typeof(ListConverter<string>))] | |||||
public virtual List<string> ListValue { get; set; } = new List<string>(); | |||||
[UseConverter(typeof(CollectionConverter<string, HashSet<string>>))] | |||||
public virtual HashSet<string> SetValue { get; set; } = new HashSet<string>(); | |||||
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 | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,7 @@ | |||||
# Demo Plugin | |||||
A little demo for the BSIPA modding introduction. | |||||
--- | |||||
WE CAN USE MARKDOWN!!! |
@ -0,0 +1,23 @@ | |||||
{ | |||||
"$schema": "https://raw.githubusercontent.com/beat-saber-modding-group/BSIPA-MetadataFileSchema/master/Schema.json", | |||||
"author": "ExampleMan", | |||||
"description": [ | |||||
"#![Demo.description.md]", | |||||
"A demo plugin written for the BSIPA basic tutorial." | |||||
], | |||||
"gameVersion": "1.6.0", | |||||
"id": null, | |||||
"name": "Demo Plugin", | |||||
"version": "0.0.1", | |||||
"features": [ | |||||
], | |||||
"links": { | |||||
"project-home": "https://example.com/demo-plugin", | |||||
"project-source": "https://github.com/exampleman/demo-plugin/", | |||||
"donate": "https://ko-fi.com/exampleman" | |||||
}, | |||||
"misc": { | |||||
"plugin-hint": "Demo.Plugin" | |||||
} | |||||
} |