mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-19 15:51:52 +00:00
Rework BAUModdedSupport
This commit is contained in:
1 parent
91e1a205bd
commit
65d5eba3bf
9 files changed
+391
-267
No files matched your search
@@ -1,65 +0,0 @@
|
||||
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 game options have been loaded.
|
||||
/// Allows plugins to read or modify BAU game options.
|
||||
/// </summary>
|
||||
/// <param name="options">
|
||||
/// Array of game options objects from BetterAmongUs.
|
||||
/// The exact type of these objects depends on BAU's internal implementation.
|
||||
/// Common option types to check for:
|
||||
/// Modules.OptionItems.OptionItem,
|
||||
/// Modules.OptionItems.OptionItem{T},
|
||||
/// Modules.OptionItems.OptionCheckboxItem,
|
||||
/// Modules.OptionItems.OptionFloatItem,
|
||||
/// Modules.OptionItems.OptionIntItem,
|
||||
/// Modules.OptionItems.OptionPercentItem,
|
||||
/// Modules.OptionItems.OptionPlayerItem,
|
||||
/// Modules.OptionItems.OptionStringItem,
|
||||
/// </param>
|
||||
public void OnBAUOptionsLoaded(object[] options)
|
||||
{
|
||||
}
|
||||
|
||||
/// <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<T> 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,59 @@
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.Unity.IL2CPP;
|
||||
using BetterAmongUs.Helpers;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace BetterAmongUs.Examples;
|
||||
|
||||
/// <summary>
|
||||
/// Example class demonstrating how to create modded support for BetterAmongUs.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// All methods and fields must be static and decorated with the appropriate <see cref="CategoryAttribute"/>
|
||||
/// to be discovered by BetterAmongUs through reflection.
|
||||
/// </remarks>
|
||||
internal class ModdedSupportExampleClass
|
||||
{
|
||||
/// <summary>
|
||||
/// Array of flags to control BetterAmongUs behavior.
|
||||
/// Check BAUModdedSupportFlags for available flag constants.
|
||||
/// </summary>
|
||||
[Category("bau:flags")]
|
||||
public static string[] BAUFlags = [];
|
||||
|
||||
/// <summary>
|
||||
/// Called when BetterAmongUs is loading. Return false to prevent BAU from loading.
|
||||
/// </summary>
|
||||
/// <param name="bauPlugin">The BetterAmongUs plugin instance.</param>
|
||||
/// <returns>True to allow BAU to load, false to prevent it.</returns>
|
||||
[Category("bau:event.bau_load")]
|
||||
public static bool OnBAULoad(BasePlugin bauPlugin)
|
||||
{
|
||||
Logger_.Error("TEST 1");
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when BetterAmongUs game options have been loaded.
|
||||
/// </summary>
|
||||
/// <param name="options">
|
||||
/// Array of game option objects from BetterAmongUs. Common types include:
|
||||
/// OptionItem, OptionItem{T}, OptionCheckboxItem, OptionFloatItem,
|
||||
/// OptionIntItem, OptionPercentItem, OptionPlayerItem, OptionStringItem
|
||||
/// </param>
|
||||
[Category("bau:event.options_load")]
|
||||
public static void OnBAUOptionsLoaded(object[] options)
|
||||
{
|
||||
Logger_.Error("TEST 2");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when BetterAmongUs configuration entries have been loaded.
|
||||
/// </summary>
|
||||
/// <param name="configs">Array of BepInEx ConfigEntryBase objects from BetterAmongUs.</param>
|
||||
[Category("bau:event.configs_load")]
|
||||
public static void OnBAUConfigEntriesLoaded(ConfigEntryBase[] configs)
|
||||
{
|
||||
Logger_.Error("TEST 3");
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
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.
|
||||
/// Check 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
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user