Game bug fixes

This commit is contained in:
js6pak committed 2021-01-19 17:06:00 +01:00
1 parent 98bcc20bae
commit 96a1b3ec47
3 files changed
+58

No files matched your search

+7
View File
@@ -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);
+25
View File
@@ -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;
}
}
}
}
+26
View File
@@ -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;
}
}
}
}