Add examples

This commit is contained in:
D1GQ committed 2026-01-29 13:58:05 -06:00
1 parent 03a02e259a
commit 6849dee20d
2 files changed
+95

No files matched your search

@@ -0,0 +1,56 @@
using BepInEx.Configuration;
using BepInEx.Unity.IL2CPP;
namespace BetterAmongUs.Examples;
/// <summary>
/// Example event handler class demonstrating how to respond to BetterAmongUs events.
/// This class must be instantiated and assigned to the BAUEvents field in the plugin.
/// </summary>
/// <remarks>
/// Each method in this class corresponds to a different lifecycle event in BetterAmongUs.
/// Methods are optional - only implement the ones your plugin needs.
/// </remarks>
internal class ModdedSupportBAUEventExample
{
/// <summary>
/// Called when BetterAmongUs is loading. Can be used to prevent BAU from loading.
/// </summary>
/// <param name="bauPlugin">The BetterAmongUs plugin instance.</param>
/// <returns>
/// Return true to allow BAU to continue loading, or false to prevent BAU from loading.
/// This can be useful if your plugin has compatibility issues with specific BAU versions.
/// </returns>
public bool OnBAULoad(BasePlugin bauPlugin)
{
return true;
}
/// <summary>
/// Called when BetterAmongUs settings have been loaded.
/// Allows plugins to read or modify BAU settings.
/// </summary>
/// <param name="settings">
/// Array of setting objects from BetterAmongUs.
/// The exact type of these objects depends on BAU's internal implementation.
/// </param>
public void OnBAUSettingsLoaded(object[] settings)
{
}
/// <summary>
/// Called when BetterAmongUs configuration entries have been loaded.
/// Allows plugins to read or modify BAU's BepInEx configuration entries.
/// </summary>
/// <param name="configs">
/// Array of BepInEx configuration entries from BetterAmongUs.
/// These can be cast to ConfigEntry&lt;T&gt; to access their values.
/// </param>
/// <remarks>
/// This is useful for plugins that need to interact with BAU's configuration,
/// such as reading default values or adding validation to certain settings.
/// </remarks>
public void OnBAUConfigEntriesLoaded(ConfigEntryBase[] configs)
{
}
}
@@ -0,0 +1,39 @@
using BepInEx.Unity.IL2CPP;
namespace BetterAmongUs.Examples;
/// <summary>
/// Example plugin demonstrating how to integrate with BetterAmongUs modded support system.
/// Shows the structure required for a plugin to declare BAU events and flags.
/// </summary>
/// <remarks>
/// This example shows a minimal plugin that implements both event handlers and flags.
/// In a real implementation, you would add your plugin's actual logic in the Load() method.
/// </remarks>
internal class ModdedSupportPluginExample : BasePlugin
{
/// <summary>
/// Event handler instance for BetterAmongUs events.
/// This field must be named exactly "BAUEvents" to be detected by the reflection system.
/// </summary>
public static ModdedSupportBAUEventExample BAUEvents = new();
/// <summary>
/// Array of flags to control BetterAmongUs behavior.
/// This field must be named exactly "BAUFlags" to be detected by the reflection system.
/// </summary>
/// <remarks>
/// Flags can disable specific BAU features or modify its behavior.
/// See <see cref="Modules.Support.BAUModdedSupportFlags"/> for available flag constants.
/// </remarks>
public static string[] BAUFlags = [];
/// <summary>
/// Main plugin load method.
/// In a real implementation, this is where your plugin initialization would occur.
/// </summary>
public override void Load()
{
// Plugin initialization logic would go here
}
}