mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-19 15:51:54 +00:00
Initial BepInEx upgrade
This commit is contained in:
6 files changed
+25
-42
No files matched your search
+2
-2
@@ -13,11 +13,11 @@ indent_size = 4
|
|||||||
|
|
||||||
# XML project files
|
# XML project files
|
||||||
[*.{csproj, vbproj, vcxproj, vcxproj.filters, proj, projitems, shproj}]
|
[*.{csproj, vbproj, vcxproj, vcxproj.filters, proj, projitems, shproj}]
|
||||||
indent_size = 2
|
indent_size = 4
|
||||||
|
|
||||||
# XML config files
|
# XML config files
|
||||||
[*.{props, targets, ruleset, config, nuspec, resx, vsixmanifest, vsct}]
|
[*.{props, targets, ruleset, config, nuspec, resx, vsixmanifest, vsct}]
|
||||||
indent_size = 2
|
indent_size = 4
|
||||||
|
|
||||||
# Dotnet code style settings:
|
# Dotnet code style settings:
|
||||||
[*.{cs, vb}]
|
[*.{cs, vb}]
|
||||||
|
|||||||
+7
-3
@@ -1,11 +1,15 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2021.6.30s</GameVersion>
|
<GamePlatform Condition="'$(GamePlatform)' == ''">Steam</GamePlatform>
|
||||||
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2021.6.30i</GameVersion>
|
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2021.6.30-s</GameVersion>
|
||||||
|
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2021.6.30-i</GameVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Reactor.MSBuild" Version="0.1.5" PrivateAssets="all" />
|
<PackageReference Include="BepInEx.AutoPlugin" Version="1.0.0" />
|
||||||
|
<PackageReference Include="BepInEx.IL2CPP" Version="6.0.0-be.426" />
|
||||||
|
<PackageReference Include="AmongUs.GameLibs" Version="$(GameVersion)" />
|
||||||
|
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="0.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''">
|
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''">
|
||||||
|
|||||||
@@ -11,21 +11,18 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Reactor.Debugger
|
namespace Reactor.Debugger
|
||||||
{
|
{
|
||||||
[BepInPlugin(Id)]
|
[BepInAutoPlugin("gg.reactor.debugger")]
|
||||||
[BepInProcess("Among Us.exe")]
|
[BepInProcess("Among Us.exe")]
|
||||||
[BepInDependency(ReactorPlugin.Id)]
|
[BepInDependency(ReactorPlugin.Id)]
|
||||||
[ReactorPluginSide(PluginSide.ClientOnly)]
|
[ReactorPluginSide(PluginSide.ClientOnly)]
|
||||||
public class DebuggerPlugin : BasePlugin
|
public partial class DebuggerPlugin : BasePlugin
|
||||||
{
|
{
|
||||||
public const string Id = "gg.reactor.debugger";
|
|
||||||
|
|
||||||
public Harmony Harmony { get; } = new Harmony(Id);
|
public Harmony Harmony { get; } = new Harmony(Id);
|
||||||
public DebuggerComponent Component { get; private set; }
|
public DebuggerComponent Component { get; private set; }
|
||||||
|
|
||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
var gameObject = new GameObject(nameof(DebuggerPlugin)).DontDestroy();
|
Component = this.AddComponent<DebuggerComponent>();
|
||||||
Component = gameObject.AddComponent<DebuggerComponent>();
|
|
||||||
|
|
||||||
GameOptionsData.MaxImpostors = GameOptionsData.RecommendedImpostors = Enumerable.Repeat((int) byte.MaxValue, byte.MaxValue).ToArray();
|
GameOptionsData.MaxImpostors = GameOptionsData.RecommendedImpostors = Enumerable.Repeat((int) byte.MaxValue, byte.MaxValue).ToArray();
|
||||||
GameOptionsData.MinPlayers = Enumerable.Repeat(1, 4).ToArray();
|
GameOptionsData.MinPlayers = Enumerable.Repeat(1, 4).ToArray();
|
||||||
|
|||||||
@@ -1,32 +1,24 @@
|
|||||||
using System;
|
using System;
|
||||||
using BepInEx;
|
using BepInEx;
|
||||||
using BepInEx.IL2CPP;
|
using BepInEx.IL2CPP;
|
||||||
using Reactor.Extensions;
|
|
||||||
using Reactor.Networking;
|
using Reactor.Networking;
|
||||||
using UnhollowerBaseLib.Attributes;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Reactor.Example
|
namespace Reactor.Example
|
||||||
{
|
{
|
||||||
[BepInPlugin(Id)]
|
[BepInAutoPlugin("gg.reactor.Example")]
|
||||||
[BepInProcess("Among Us.exe")]
|
[BepInProcess("Among Us.exe")]
|
||||||
[BepInDependency(ReactorPlugin.Id)]
|
[BepInDependency(ReactorPlugin.Id)]
|
||||||
public class ExamplePlugin : BasePlugin
|
public partial class ExamplePlugin : BasePlugin
|
||||||
{
|
{
|
||||||
public const string Id = "gg.reactor.Example";
|
|
||||||
|
|
||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
var gameObject = new GameObject(nameof(ReactorPlugin)).DontDestroy();
|
this.AddComponent<ExampleComponent>();
|
||||||
gameObject.AddComponent<ExampleComponent>().Plugin = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[RegisterInIl2Cpp]
|
[RegisterInIl2Cpp]
|
||||||
public class ExampleComponent : MonoBehaviour
|
public class ExampleComponent : MonoBehaviour
|
||||||
{
|
{
|
||||||
[HideFromIl2Cpp]
|
|
||||||
public ExamplePlugin Plugin { get; internal set; }
|
|
||||||
|
|
||||||
public ExampleComponent(IntPtr ptr) : base(ptr)
|
public ExampleComponent(IntPtr ptr) : base(ptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using BepInEx;
|
|||||||
using BepInEx.Configuration;
|
using BepInEx.Configuration;
|
||||||
using BepInEx.IL2CPP;
|
using BepInEx.IL2CPP;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using Reactor.Extensions;
|
|
||||||
using Reactor.Networking;
|
using Reactor.Networking;
|
||||||
using Reactor.Patches;
|
using Reactor.Patches;
|
||||||
using Reactor.Unstrip;
|
using Reactor.Unstrip;
|
||||||
@@ -13,27 +12,19 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Reactor
|
namespace Reactor
|
||||||
{
|
{
|
||||||
[BepInPlugin(Id)]
|
[BepInAutoPlugin("gg.reactor.api")]
|
||||||
[BepInProcess("Among Us.exe")]
|
[BepInProcess("Among Us.exe")]
|
||||||
public class ReactorPlugin : BasePlugin
|
public partial class ReactorPlugin : BasePlugin
|
||||||
{
|
{
|
||||||
public const string Id = "gg.reactor.api";
|
|
||||||
|
|
||||||
public Harmony Harmony { get; } = new Harmony(Id);
|
public Harmony Harmony { get; } = new Harmony(Id);
|
||||||
public CustomRpcManager CustomRpcManager { get; } = new CustomRpcManager();
|
public CustomRpcManager CustomRpcManager { get; } = new CustomRpcManager();
|
||||||
|
|
||||||
public ConfigEntry<bool> AllowVanillaServers;
|
public ConfigEntry<bool> AllowVanillaServers { get; private set; }
|
||||||
|
|
||||||
private GameObject _gameObject;
|
|
||||||
private RegionInfoWatcher RegionInfoWatcher { get; } = new RegionInfoWatcher();
|
private RegionInfoWatcher RegionInfoWatcher { get; } = new RegionInfoWatcher();
|
||||||
|
|
||||||
public ReactorPlugin()
|
public ReactorPlugin()
|
||||||
{
|
{
|
||||||
if (Paths.BepInExVersion < new SemVer.Version("6.0.0-reactor.23"))
|
|
||||||
{
|
|
||||||
throw new NotSupportedException("This version of BepInEx is not supported!");
|
|
||||||
}
|
|
||||||
|
|
||||||
PluginSingleton<BasePlugin>.Initialize();
|
PluginSingleton<BasePlugin>.Initialize();
|
||||||
RegisterInIl2CppAttribute.Initialize();
|
RegisterInIl2CppAttribute.Initialize();
|
||||||
RegisterCustomRpcAttribute.Initialize();
|
RegisterCustomRpcAttribute.Initialize();
|
||||||
@@ -47,9 +38,8 @@ namespace Reactor
|
|||||||
|
|
||||||
Harmony.PatchAll();
|
Harmony.PatchAll();
|
||||||
|
|
||||||
_gameObject = new GameObject(nameof(ReactorPlugin)).DontDestroy();
|
this.AddComponent<ReactorComponent>().Plugin = this;
|
||||||
_gameObject.AddComponent<ReactorComponent>().Plugin = this;
|
this.AddComponent<Coroutines.Component>();
|
||||||
_gameObject.AddComponent<Coroutines.Component>();
|
|
||||||
|
|
||||||
ReactorVersionShower.Initialize();
|
ReactorVersionShower.Initialize();
|
||||||
SplashSkip.Initialize();
|
SplashSkip.Initialize();
|
||||||
@@ -59,7 +49,6 @@ namespace Reactor
|
|||||||
public override bool Unload()
|
public override bool Unload()
|
||||||
{
|
{
|
||||||
Harmony.UnpatchSelf();
|
Harmony.UnpatchSelf();
|
||||||
_gameObject.Destroy();
|
|
||||||
RegionInfoWatcher?.Dispose();
|
RegionInfoWatcher?.Dispose();
|
||||||
|
|
||||||
return base.Unload();
|
return base.Unload();
|
||||||
|
|||||||
+5
-4
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<packageSources>
|
<packageSources>
|
||||||
<add key="BepInExLibs" value="https://pkgs.dev.azure.com/bepinex/BepInEx/_packaging/BepInExLibs/nuget/v3/index.json" />
|
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" />
|
||||||
</packageSources>
|
</packageSources>
|
||||||
</configuration>
|
</configuration>
|
||||||
Reference in new issue
Block a user