mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-19 15:51:54 +00:00
Game bug fixes
This commit is contained in:
3 files changed
+58
No files matched your search
@@ -2,7 +2,9 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.Networking;
|
||||
@@ -123,6 +125,11 @@ namespace Reactor.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<MethodBase> GetMethods(this Type type, Type returnType, params Type[] parameterTypes)
|
||||
{
|
||||
return type.GetMethods(AccessTools.all).Where(x => x.ReturnType == returnType && x.GetParameters().Select(x => x.ParameterType).SequenceEqual(parameterTypes));
|
||||
}
|
||||
|
||||
public static void Send<TCustomRpc>(this InnerNetObject netObject, object data, bool immediately = false)
|
||||
{
|
||||
PluginSingleton<ReactorPlugin>.Instance.CustomRpcManager.Send<TCustomRpc>(netObject, data, immediately);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.IO;
|
||||
using HarmonyLib;
|
||||
using Steamworks;
|
||||
|
||||
namespace Reactor.Patches
|
||||
{
|
||||
internal static class SteamPatch
|
||||
{
|
||||
[HarmonyPatch(typeof(SteamAPI), nameof(SteamAPI.RestartAppIfNecessary))]
|
||||
public static class RestartAppIfNecessaryPatch
|
||||
{
|
||||
public static bool Prefix(out bool __result)
|
||||
{
|
||||
const string file = "steam_appid.txt";
|
||||
|
||||
if (!File.Exists(file))
|
||||
{
|
||||
File.WriteAllText(file, "945360");
|
||||
}
|
||||
|
||||
return __result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using Reactor.Extensions;
|
||||
|
||||
namespace Reactor.Patches
|
||||
{
|
||||
internal static class UiFocusPatch
|
||||
{
|
||||
// [HarmonyPatch(typeof(PassiveButtonManager), nameof(PassiveButtonManager.HandleFocus))]
|
||||
[HarmonyPatch]
|
||||
public static class HandleFocusPatch
|
||||
{
|
||||
public static IEnumerable<MethodBase> TargetMethods()
|
||||
{
|
||||
return typeof(PassiveButtonManager).GetMethods(typeof(void), typeof(PassiveUiElement), typeof(Collider2D));
|
||||
}
|
||||
|
||||
public static bool Prefix()
|
||||
{
|
||||
return Application.isFocused;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user