mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-19 15:51:58 +00:00
complete
This commit is contained in:
1 parent
ba293614eb
commit
56d510116d
20 files changed
+192
-21
No files matched your search
@@ -14,15 +14,17 @@ using EHR.Modules;
|
||||
using EHR.Patches;
|
||||
using EHR.Roles;
|
||||
using HarmonyLib;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
#if IL2CPP
|
||||
using BepInEx.Unity.IL2CPP;
|
||||
using BepInEx.Unity.IL2CPP.Utils.Collections;
|
||||
using Il2CppInterop.Runtime.Injection;
|
||||
using System.Text.Json;
|
||||
#else
|
||||
using BepInEx.Bootstrap;
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
|
||||
// ReSharper disable RedundantNameQualifier
|
||||
@@ -42,7 +44,11 @@ namespace EHR;
|
||||
[BepInDependency(SubmergedCompatibility.SubmergedGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
||||
[BepInProcess("Among Us.exe")]
|
||||
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")]
|
||||
#if IL2CPP
|
||||
public class Main : BasePlugin
|
||||
#else
|
||||
public class Main : BaseUnityPlugin
|
||||
#endif
|
||||
{
|
||||
private const string DebugKeyHash = "c0fd562955ba56af3ae20d7ec9e64c664f0facecef4b3e366e109306adeae29d";
|
||||
private const string DebugKeySalt = "59687b";
|
||||
@@ -1066,7 +1072,7 @@ public class Main : BasePlugin
|
||||
private static void HandleRoleColorFiles()
|
||||
{
|
||||
#if IL2CPP
|
||||
string serialized = System.Text.Json.JsonSerializer.Serialize(RoleHtmlColors, new System.Text.Json.JsonSerializerOptions { WriteIndented = true });
|
||||
string serialized = JsonSerializer.Serialize(RoleHtmlColors, new JsonSerializerOptions { WriteIndented = true });
|
||||
#else
|
||||
string serialized = JsonConvert.SerializeObject(RoleHtmlColors, Formatting.Indented);
|
||||
#endif
|
||||
@@ -1085,7 +1091,11 @@ public class Main : BasePlugin
|
||||
string json = File.ReadAllText(path);
|
||||
if (string.IsNullOrWhiteSpace(json) || json == serialized) return;
|
||||
|
||||
#if IL2CPP
|
||||
Dictionary<string, string> dictionary = JsonSerializer.Deserialize<Dictionary<string, string>>(json);
|
||||
#else
|
||||
Dictionary<string, string> dictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
|
||||
#endif
|
||||
|
||||
if (dictionary != null)
|
||||
{
|
||||
|
||||
+16
-3
@@ -1,10 +1,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
#if IL2CPP
|
||||
using System.Text.Json;
|
||||
#else
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace EHR.Modules;
|
||||
@@ -214,7 +219,7 @@ public static class Achievements
|
||||
private static void SaveAllData()
|
||||
{
|
||||
#if IL2CPP
|
||||
string json = System.Text.Json.JsonSerializer.Serialize(CompletedAchievements);
|
||||
string json = JsonSerializer.Serialize(CompletedAchievements);
|
||||
#else
|
||||
string json = JsonConvert.SerializeObject(CompletedAchievements);
|
||||
#endif
|
||||
@@ -237,7 +242,7 @@ public static class Achievements
|
||||
};
|
||||
|
||||
#if IL2CPP
|
||||
string payload = System.Text.Json.JsonSerializer.Serialize(data);
|
||||
string payload = JsonSerializer.Serialize(data);
|
||||
#else
|
||||
string payload = JsonConvert.SerializeObject(data);
|
||||
#endif
|
||||
@@ -261,7 +266,11 @@ public static class Achievements
|
||||
if (File.Exists(SaveFilePath))
|
||||
{
|
||||
string json = File.ReadAllText(SaveFilePath);
|
||||
#if IL2CPP
|
||||
CompletedAchievements = JsonSerializer.Deserialize<HashSet<Type>>(json);
|
||||
#else
|
||||
CompletedAchievements = JsonConvert.DeserializeObject<HashSet<Type>>(json);
|
||||
#endif
|
||||
}
|
||||
else if (Options.StoreCompletedAchievementsOnEHRDatabase.GetBool())
|
||||
{
|
||||
@@ -285,7 +294,11 @@ public static class Achievements
|
||||
else
|
||||
{
|
||||
string json = request.downloadHandler.text;
|
||||
#if IL2CPP
|
||||
CompletedAchievements = JsonSerializer.Deserialize<HashSet<Type>>(json);
|
||||
#else
|
||||
CompletedAchievements = JsonConvert.DeserializeObject<HashSet<Type>>(json);
|
||||
#endif
|
||||
File.WriteAllText(SaveFilePath, json);
|
||||
Logger.Info("Achievements loaded successfully.", "Achievements.LoadAllData");
|
||||
}
|
||||
|
||||
+10
-1
@@ -2,10 +2,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
#if IL2CPP
|
||||
using System.Text.Json;
|
||||
#else
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
|
||||
namespace EHR;
|
||||
|
||||
public static class DevManager
|
||||
@@ -46,7 +51,11 @@ public static class DevManager
|
||||
try
|
||||
{
|
||||
string json = request.downloadHandler.text.Trim();
|
||||
#if IL2CPP
|
||||
Tags = JsonSerializer.Deserialize<Dictionary<string, TagInfo>>(json);
|
||||
#else
|
||||
Tags = JsonConvert.DeserializeObject<Dictionary<string, TagInfo>>(json);
|
||||
#endif
|
||||
Logger.Info($"Tags successfully fetched: {Tags.Count} tags loaded.", "DevManager.FetchTags");
|
||||
}
|
||||
catch (Exception ex) { Logger.Error($"Error parsing tags JSON: {ex.Message}", "DevManager.FetchTags"); }
|
||||
|
||||
@@ -5,10 +5,15 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using HarmonyLib;
|
||||
using InnerNet;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
#if IL2CPP
|
||||
using System.Text.Json;
|
||||
#else
|
||||
using Newtonsoft.Json.Linq;
|
||||
#endif
|
||||
|
||||
namespace EHR.Modules;
|
||||
|
||||
public static class LobbySharingAPI
|
||||
@@ -70,8 +75,13 @@ public static class LobbySharingAPI
|
||||
string responseText = request.downloadHandler.text;
|
||||
Logger.Msg("Response from server: " + responseText, "LobbyNotifierForDiscord.SendLobbyCreatedRequest");
|
||||
|
||||
#if IL2CPP
|
||||
using JsonDocument doc = JsonDocument.Parse(responseText);
|
||||
Token = doc.RootElement.GetProperty("token").GetString();
|
||||
#else
|
||||
JObject doc = JObject.Parse(responseText);
|
||||
Token = doc["token"]?.ToString();
|
||||
#endif
|
||||
|
||||
Logger.Msg($"Token for room {roomCode}: {Token}", "LobbyNotifierForDiscord.SendLobbyCreatedRequest");
|
||||
}
|
||||
|
||||
+42
-2
@@ -4,13 +4,18 @@ using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using Twitch;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using static EHR.Translator;
|
||||
|
||||
#if IL2CPP
|
||||
using System.Text.Json;
|
||||
#else
|
||||
using Newtonsoft.Json.Linq;
|
||||
#endif
|
||||
|
||||
namespace EHR;
|
||||
|
||||
[HarmonyPatch]
|
||||
@@ -86,13 +91,31 @@ public static class ModUpdater
|
||||
yield break;
|
||||
}
|
||||
|
||||
#if IL2CPP
|
||||
JsonDocument data = JsonDocument.Parse(request.downloadHandler.text);
|
||||
|
||||
LatestTitleModName = data.RootElement.GetProperty("name").GetString();
|
||||
|
||||
if (beta)
|
||||
{
|
||||
LatestTitle = LatestTitleModName;
|
||||
|
||||
// Beta builds still use the same EHR.dll release asset.
|
||||
DownloadUrl = FindDllAssetUrl(data);
|
||||
|
||||
HasUpdate = LatestTitle != ThisAssembly.Git.Commit;
|
||||
}
|
||||
else
|
||||
{
|
||||
string versionString = data.RootElement.GetProperty("tag_name").GetString()?
|
||||
#else
|
||||
JObject data = JObject.Parse(request.downloadHandler.text);
|
||||
|
||||
LatestTitleModName = data["name"]?.ToString();
|
||||
|
||||
if (beta)
|
||||
{
|
||||
LatestTitle = data["name"]?.ToString();
|
||||
LatestTitle = LatestTitleModName;
|
||||
|
||||
// Beta builds still use the same EHR.dll release asset.
|
||||
DownloadUrl = FindDllAssetUrl(data);
|
||||
@@ -103,6 +126,7 @@ public static class ModUpdater
|
||||
{
|
||||
string versionString = data["tag_name"]?
|
||||
.ToString()
|
||||
#endif
|
||||
.TrimStart('v');
|
||||
|
||||
LatestVersion = new Version(versionString!);
|
||||
@@ -142,6 +166,21 @@ public static class ModUpdater
|
||||
}
|
||||
}
|
||||
|
||||
#if IL2CPP
|
||||
private static string FindDllAssetUrl(JsonDocument release)
|
||||
{
|
||||
if (!release.RootElement.TryGetProperty("assets", out JsonElement assets))
|
||||
return null;
|
||||
|
||||
foreach (JsonElement asset in assets.EnumerateArray())
|
||||
{
|
||||
if (asset.GetProperty("name").GetString() == "EHR.dll")
|
||||
return asset.GetProperty("browser_download_url").GetString();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
#else
|
||||
private static string FindDllAssetUrl(JObject release)
|
||||
{
|
||||
if (release["assets"] is not JArray assets)
|
||||
@@ -157,6 +196,7 @@ public static class ModUpdater
|
||||
|
||||
return null;
|
||||
}
|
||||
#endif
|
||||
|
||||
public static void StartUpdate(string url)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace System.Runtime.CompilerServices
|
||||
#if !IL2CPP
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
internal sealed class CallerArgumentExpressionAttribute : Attribute
|
||||
@@ -10,3 +11,4 @@
|
||||
public string ParameterName { get; }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if !IL2CPP
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
// Since EHR was originally made for net6.0 and uses the newer LINQ methods from it,
|
||||
@@ -494,3 +495,4 @@ namespace EHR
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
#if !IL2CPP
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace EHR;
|
||||
@@ -12,3 +13,4 @@ public static class LinqHelpers
|
||||
return first.Zip(second, (f, s) => (First: f, Second: s));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -4,11 +4,16 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
#if IL2CPP
|
||||
using System.Text.Json;
|
||||
#else
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
|
||||
namespace EHR.Modules;
|
||||
|
||||
public static class OnlinePresetsManager
|
||||
@@ -197,7 +202,7 @@ public static class OnlinePresetsManager
|
||||
};
|
||||
|
||||
#if IL2CPP
|
||||
string json = System.Text.Json.JsonSerializer.Serialize(body);
|
||||
string json = JsonSerializer.Serialize(body);
|
||||
#else
|
||||
string json = JsonConvert.SerializeObject(body);
|
||||
#endif
|
||||
@@ -224,7 +229,11 @@ public static class OnlinePresetsManager
|
||||
|
||||
try
|
||||
{
|
||||
#if IL2CPP
|
||||
response = JsonSerializer.Deserialize<PresetDraftResponse>(request.downloadHandler.text);
|
||||
#else
|
||||
response = JsonConvert.DeserializeObject<PresetDraftResponse>(request.downloadHandler.text);
|
||||
#endif
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -285,7 +294,11 @@ public static class OnlinePresetsManager
|
||||
|
||||
try
|
||||
{
|
||||
#if IL2CPP
|
||||
response = JsonSerializer.Deserialize<PresetDownloadResponse>(request.downloadHandler.text);
|
||||
#else
|
||||
response = JsonConvert.DeserializeObject<PresetDownloadResponse>(request.downloadHandler.text);
|
||||
#endif
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -324,7 +337,11 @@ public static class OnlinePresetsManager
|
||||
|
||||
try
|
||||
{
|
||||
#if IL2CPP
|
||||
response = JsonSerializer.Deserialize<PresetListResponse>(request.downloadHandler.text.Trim());
|
||||
#else
|
||||
response = JsonConvert.DeserializeObject<PresetListResponse>(request.downloadHandler.text.Trim());
|
||||
#endif
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
+11
-2
@@ -8,9 +8,14 @@ using EHR.Gamemodes;
|
||||
using EHR.Modules;
|
||||
using EHR.Roles;
|
||||
using HarmonyLib;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
#if IL2CPP
|
||||
using System.Text.Json;
|
||||
#else
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace EHR;
|
||||
@@ -1208,7 +1213,7 @@ public static class Options
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
#if IL2CPP
|
||||
File.WriteAllText(path + "/friendcode#1234.txt", System.Text.Json.JsonSerializer.Serialize(new UserData { Tag = string.Empty }, new System.Text.Json.JsonSerializerOptions { WriteIndented = true }));
|
||||
File.WriteAllText(path + "/friendcode#1234.txt", JsonSerializer.Serialize(new UserData { Tag = string.Empty }, new JsonSerializerOptions { WriteIndented = true }));
|
||||
#else
|
||||
File.WriteAllText(path + "/friendcode#1234.txt", JsonConvert.SerializeObject(new UserData { Tag = string.Empty }, Formatting.Indented));
|
||||
#endif
|
||||
@@ -1221,7 +1226,11 @@ public static class Options
|
||||
try
|
||||
{
|
||||
string content = File.ReadAllText(file);
|
||||
#if IL2CPP
|
||||
var userData = JsonSerializer.Deserialize<UserData>(content);
|
||||
#else
|
||||
var userData = JsonConvert.DeserializeObject<UserData>(content);
|
||||
#endif
|
||||
if (userData == null) throw new FormatException($"The data in {file} was not in the correct format.");
|
||||
string fileName = Path.GetFileNameWithoutExtension(file);
|
||||
Main.UserData[fileName] = userData;
|
||||
|
||||
+10
-1
@@ -1,6 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
#if IL2CPP
|
||||
using System.Text.Json;
|
||||
#else
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
|
||||
namespace EHR.Modules;
|
||||
|
||||
@@ -94,7 +99,7 @@ public static class OptionSaver
|
||||
if (AmongUsClient.Instance && !AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
#if IL2CPP
|
||||
string jsonString = System.Text.Json.JsonSerializer.Serialize(GenerateOptionsData(), new System.Text.Json.JsonSerializerOptions { WriteIndented = true });
|
||||
string jsonString = JsonSerializer.Serialize(GenerateOptionsData(), new JsonSerializerOptions { WriteIndented = true });
|
||||
#else
|
||||
string jsonString = JsonConvert.SerializeObject(GenerateOptionsData(), Formatting.Indented);
|
||||
#endif
|
||||
@@ -113,7 +118,11 @@ public static class OptionSaver
|
||||
return;
|
||||
}
|
||||
|
||||
#if IL2CPP
|
||||
LoadOptionsData(JsonSerializer.Deserialize<SerializableOptionsData>(jsonString));
|
||||
#else
|
||||
LoadOptionsData(JsonConvert.DeserializeObject<SerializableOptionsData>(jsonString));
|
||||
#endif
|
||||
}
|
||||
|
||||
public class SerializableOptionsData
|
||||
|
||||
@@ -9,6 +9,7 @@ using EHR.Gamemodes;
|
||||
#if IL2CPP
|
||||
using System.Text.Json;
|
||||
#else
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#endif
|
||||
|
||||
|
||||
+11
-2
@@ -19,11 +19,16 @@ using EHR.Roles;
|
||||
using HarmonyLib;
|
||||
using Hazel;
|
||||
using InnerNet;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
using static EHR.Translator;
|
||||
using Tree = EHR.Roles.Tree;
|
||||
|
||||
#if IL2CPP
|
||||
using System.Text.Json;
|
||||
#else
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
|
||||
namespace EHR;
|
||||
/*
|
||||
List of symbols that work in game
|
||||
@@ -408,7 +413,7 @@ public static class Utils
|
||||
});
|
||||
|
||||
#if IL2CPP
|
||||
File.WriteAllText(path, System.Text.Json.JsonSerializer.Serialize(data, new System.Text.Json.JsonSerializerOptions { WriteIndented = true }));
|
||||
File.WriteAllText(path, JsonSerializer.Serialize(data, new JsonSerializerOptions { WriteIndented = true }));
|
||||
#else
|
||||
File.WriteAllText(path, JsonConvert.SerializeObject(data, Formatting.Indented));
|
||||
#endif
|
||||
@@ -433,7 +438,11 @@ public static class Utils
|
||||
{
|
||||
if (!File.Exists(path)) return;
|
||||
|
||||
#if IL2CPP
|
||||
var data = JsonSerializer.Deserialize<Dictionary<int, Dictionary<string, List<string>>>>(File.ReadAllText(path));
|
||||
#else
|
||||
var data = JsonConvert.DeserializeObject<Dictionary<int, Dictionary<string, List<string>>>>(File.ReadAllText(path));
|
||||
#endif
|
||||
Dictionary<int, Dictionary<CustomRoles, List<CustomRoles>>> dict = path.Contains("Always") ? Main.AlwaysSpawnTogetherCombos : Main.NeverSpawnTogetherCombos;
|
||||
dict.Clear();
|
||||
|
||||
|
||||
@@ -6,11 +6,13 @@ using AmongUs.Data;
|
||||
using AmongUs.Data.Player;
|
||||
using Assets.InnerNet;
|
||||
using HarmonyLib;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
#if IL2CPP
|
||||
using Il2CppInterop.Runtime.InteropTypes.Arrays;
|
||||
using System.Text.Json;
|
||||
#else
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
|
||||
namespace EHR;
|
||||
@@ -47,7 +49,11 @@ public class ModNews
|
||||
|
||||
public static List<ModNews> FromJson(string json)
|
||||
{
|
||||
#if IL2CPP
|
||||
return JsonSerializer.Deserialize<List<ModNews>>(json);
|
||||
#else
|
||||
return JsonConvert.DeserializeObject<List<ModNews>>(json);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using HarmonyLib;
|
||||
#if IL2CPP
|
||||
using Il2CppInterop.Runtime.Attributes;
|
||||
#endif
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using static EHR.GameStates;
|
||||
@@ -439,6 +442,9 @@ public class AbstractPagingBehaviour : MonoBehaviour
|
||||
public class MeetingHudPagingBehaviour : AbstractPagingBehaviour
|
||||
{
|
||||
internal MeetingHud meetingHud = null!;
|
||||
#if IL2CPP
|
||||
[HideFromIl2Cpp]
|
||||
#endif
|
||||
private IEnumerable<PlayerVoteArea> Targets => meetingHud.playerStates.OrderBy(p => p.AmDead);
|
||||
|
||||
protected override int MaxPageIndex => (Targets.Count() - 1) / MaxPerPage;
|
||||
@@ -488,6 +494,9 @@ public class ShapeShifterPagingBehaviour : AbstractPagingBehaviour
|
||||
{
|
||||
public ShapeshifterMinigame shapeshifterMinigame = null!;
|
||||
private TextMeshPro PageText = null!;
|
||||
#if IL2CPP
|
||||
[HideFromIl2Cpp]
|
||||
#endif
|
||||
private IEnumerable<ShapeshifterPanel> Targets => shapeshifterMinigame.potentialVictims.ToArray();
|
||||
|
||||
protected override int MaxPageIndex => (Targets.Count() - 1) / MaxPerPage;
|
||||
@@ -536,6 +545,9 @@ public class VitalsPagingBehaviour : AbstractPagingBehaviour
|
||||
{
|
||||
public VitalsMinigame vitalsMinigame = null!;
|
||||
private TextMeshPro PageText = null!;
|
||||
#if IL2CPP
|
||||
[HideFromIl2Cpp]
|
||||
#endif
|
||||
private IEnumerable<VitalsPanel> Targets => vitalsMinigame.vitals.ToArray();
|
||||
|
||||
protected override int MaxPageIndex => (Targets.Count() - 1) / MaxPerPage;
|
||||
|
||||
@@ -5,6 +5,9 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using AmongUs.GameOptions;
|
||||
#if IL2CPP
|
||||
using BepInEx.Unity.IL2CPP.Utils.Collections;
|
||||
#endif
|
||||
using EHR.Gamemodes;
|
||||
using EHR.Modules;
|
||||
using EHR.Patches;
|
||||
@@ -42,7 +45,11 @@ static class ShowRoleMoveNextPatch
|
||||
[HarmonyPatch(typeof(HudManager), nameof(HudManager.CoShowIntro))]
|
||||
static class CoShowIntroPatch
|
||||
{
|
||||
#if IL2CPP
|
||||
public static bool Prefix(HudManager __instance, ref Il2CppSystem.Collections.IEnumerator __result)
|
||||
#else
|
||||
public static bool Prefix(HudManager __instance, ref IEnumerator __result)
|
||||
#endif
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || !GameStates.IsModHost) return true;
|
||||
|
||||
@@ -66,7 +73,11 @@ static class CoShowIntroPatch
|
||||
catch { Logger.Warn($"Game ended? {AmongUsClient.Instance.IsGameOver || GameStates.IsLobby || GameEndChecker.Ended}", "ShipStatus.Begin"); }
|
||||
}, 4f, "Assign Tasks");
|
||||
|
||||
#if IL2CPP
|
||||
__result = CoShowIntro().WrapToIl2Cpp();
|
||||
#else
|
||||
__result = CoShowIntro();
|
||||
#endif
|
||||
return false;
|
||||
|
||||
IEnumerator CoShowIntro()
|
||||
|
||||
@@ -22,7 +22,7 @@ public static class TextBoxPatch
|
||||
[HarmonyPrefix]
|
||||
// Use the character provided by IsCharAllowed directly.
|
||||
// Tracking a separate character position desyncs when the caret is moved.
|
||||
public static bool ValidateChatCharacter(char c, ref bool __result)
|
||||
public static bool ValidateChatCharacter([HarmonyArgument(0)] char c, ref bool __result)
|
||||
{
|
||||
// Do not interfere with IME composition input.
|
||||
if (!string.IsNullOrEmpty(Input.compositionString))
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules.Extensions;
|
||||
|
||||
#if IL2CPP
|
||||
using System.Linq;
|
||||
#endif
|
||||
|
||||
namespace EHR.Roles;
|
||||
|
||||
public class Tar : RoleBase
|
||||
|
||||
@@ -5,6 +5,10 @@ using Hazel;
|
||||
using UnityEngine;
|
||||
using static EHR.Translator;
|
||||
|
||||
#if IL2CPP
|
||||
using System.Linq;
|
||||
#endif
|
||||
|
||||
namespace EHR.Roles;
|
||||
|
||||
public class Sniper : RoleBase
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" />
|
||||
<add key="Samboy" value="https://nuget.samboy.dev/v3/index.json" />
|
||||
<add key="Local Packages" value="packages.local/" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
Reference in new issue
Block a user