mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
internalize
This commit is contained in:
1 parent
8b55463fa0
commit
8195880464
9 files changed
+18
-18
No files matched your search
@@ -7,8 +7,7 @@ namespace MiraAPI.GameOptions.Attributes;
|
||||
public class ModdedEnumOptionAttribute(string title, Type enumType, Type roleType = null)
|
||||
: ModdedOptionAttribute(title, roleType)
|
||||
{
|
||||
|
||||
public override IModdedOption CreateOption(object value, PropertyInfo property)
|
||||
internal override IModdedOption CreateOption(object value, PropertyInfo property)
|
||||
{
|
||||
var opt = new ModdedEnumOption(Title, (int)value, enumType, RoleType);
|
||||
return opt;
|
||||
|
||||
@@ -14,7 +14,7 @@ public class ModdedNumberOptionAttribute(
|
||||
Type roleType = null)
|
||||
: ModdedOptionAttribute(title, roleType)
|
||||
{
|
||||
public override IModdedOption CreateOption(object value, PropertyInfo property)
|
||||
internal override IModdedOption CreateOption(object value, PropertyInfo property)
|
||||
{
|
||||
var toggleOpt = new ModdedNumberOption(Title, (float)value, min, max, increment, suffixType, zeroInfinity, RoleType);
|
||||
return toggleOpt;
|
||||
|
||||
@@ -15,6 +15,6 @@ public abstract class ModdedOptionAttribute(string title, Type roleType = null)
|
||||
public abstract void SetValue(object val);
|
||||
|
||||
public abstract object GetValue();
|
||||
|
||||
public abstract IModdedOption CreateOption(object value, PropertyInfo property);
|
||||
|
||||
internal abstract IModdedOption CreateOption(object value, PropertyInfo property);
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace MiraAPI.GameOptions.Attributes;
|
||||
public class ModdedStringOptionAttribute(string title, string[] values, Type roleType = null)
|
||||
: ModdedOptionAttribute(title, roleType)
|
||||
{
|
||||
public override IModdedOption CreateOption(object value, PropertyInfo property)
|
||||
internal override IModdedOption CreateOption(object value, PropertyInfo property)
|
||||
{
|
||||
var opt = new ModdedStringOption(Title, (int)value, values, RoleType);
|
||||
return opt;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace MiraAPI.GameOptions.Attributes;
|
||||
|
||||
public class ModdedToggleOptionAttribute(string title, Type roleType = null) : ModdedOptionAttribute(title, roleType)
|
||||
{
|
||||
public override IModdedOption CreateOption(object value, PropertyInfo property)
|
||||
internal override IModdedOption CreateOption(object value, PropertyInfo property)
|
||||
{
|
||||
var toggleOpt = new ModdedToggleOption(Title, (bool)value, RoleType);
|
||||
return toggleOpt;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ModdedOptionsManager
|
||||
public static uint NextId => _nextId++;
|
||||
private static uint _nextId = 1;
|
||||
|
||||
public static IModdedOption RegisterOption(Type type, ModdedOptionAttribute attribute, PropertyInfo property)
|
||||
internal static IModdedOption RegisterOption(Type type, ModdedOptionAttribute attribute, PropertyInfo property)
|
||||
{
|
||||
if (OptionAttributes.ContainsKey(property)) return null;
|
||||
object newObj = Activator.CreateInstance(type);
|
||||
@@ -66,7 +66,7 @@ public class ModdedOptionsManager
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void SyncAllOptions(int targetId=-1)
|
||||
internal static void SyncAllOptions(int targetId=-1)
|
||||
{
|
||||
List<NetData> data = [];
|
||||
int count = 0;
|
||||
@@ -88,9 +88,9 @@ public class ModdedOptionsManager
|
||||
Rpc<SyncOptionsRpc>.Instance.SendTo(PlayerControl.LocalPlayer, targetId, data.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void HandleSyncOptions(NetData[] data)
|
||||
|
||||
|
||||
internal static void HandleSyncOptions(NetData[] data)
|
||||
{
|
||||
foreach (var netData in data)
|
||||
{
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace MiraAPI.Hud;
|
||||
public static class CustomButtonManager
|
||||
{
|
||||
public static readonly List<CustomActionButton> CustomButtons = [];
|
||||
|
||||
public static void RegisterButton(Type buttonType)
|
||||
|
||||
internal static void RegisterButton(Type buttonType)
|
||||
{
|
||||
if (!typeof(CustomActionButton).IsAssignableFrom(buttonType))
|
||||
{
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace MiraAPI;
|
||||
public partial class MiraApiPlugin : BasePlugin
|
||||
{
|
||||
public Harmony Harmony { get; } = new(Id);
|
||||
public static MiraPluginManager PluginManager { get; private set; }
|
||||
private static MiraPluginManager PluginManager { get; set; }
|
||||
|
||||
public static Color MiraColor = new Color32(238, 154, 112, 255);
|
||||
|
||||
public override void Load()
|
||||
|
||||
@@ -13,7 +13,7 @@ using MiraAPI.Hud;
|
||||
|
||||
namespace MiraAPI.PluginLoading;
|
||||
|
||||
public class MiraPluginManager
|
||||
internal class MiraPluginManager
|
||||
{
|
||||
public readonly Dictionary<Assembly, MiraPluginInfo> RegisteredPlugins = [];
|
||||
|
||||
@@ -24,7 +24,7 @@ public class MiraPluginManager
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
internal void Initialize()
|
||||
{
|
||||
Instance = this;
|
||||
IL2CPPChainloader.Instance.PluginLoad += (_, assembly, plugin) =>
|
||||
@@ -127,7 +127,7 @@ public class MiraPluginManager
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void RegisterButtonAttribute(Assembly assembly)
|
||||
{
|
||||
foreach (var type in assembly.GetTypes())
|
||||
|
||||
Reference in new issue
Block a user