Fix player info not updating

This commit is contained in:
D1GQ committed 2024-10-26 15:49:30 -05:00
1 parent 4f7860fd93
commit 5330d9535c
4 files changed
+12 -10

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ public class BetterAccountInfo
public bool? IsSponsor = false;
public int? SponsorTier = 0;
public static BetterAccountInfo GenerateInfo(string allUserInfo, NetworkedPlayerInfo data)
public static BetterAccountInfo SerializeInfo(string allUserInfo, NetworkedPlayerInfo data)
{
BetterAccountInfo accInfo = new();
+2 -2
View File
@@ -245,13 +245,13 @@ class ChatPatch
if (Main.ChatDarkMode.Value)
{
chatBubble.transform.Find("ChatText (TMP)").GetComponent<TextMeshPro>().color = new Color(1f, 1f, 1f, 1f);
chatBubble.transform.Find("Background").GetComponent<SpriteRenderer>().color = new Color(0.05f, 0.05f, 0.05f, 1f);
chatBubble.transform.Find("Background").GetComponent<SpriteRenderer>().color = new Color(0.15f, 0.15f, 0.15f, 1f);
if (chatBubble.transform.Find("PoolablePlayer/xMark") != null)
{
if (chatBubble.transform.Find("PoolablePlayer/xMark").GetComponent<SpriteRenderer>().enabled == true)
{
chatBubble.transform.Find("Background").GetComponent<SpriteRenderer>().color = new Color(0.05f, 0.05f, 0.05f, 0.5f);
chatBubble.transform.Find("Background").GetComponent<SpriteRenderer>().color = new Color(0.15f, 0.15f, 0.15f, 0.5f);
}
}
}
+8 -4
View File
@@ -13,7 +13,7 @@ namespace BetterAmongUs.Patches;
[HarmonyPatch(typeof(PlayerControl))]
class PlayerControlPatch
{
public static float infotime = 0f;
public static Dictionary<byte, float> time = [];
[HarmonyPatch(nameof(PlayerControl.FixedUpdate))]
[HarmonyPrefix]
public static void FixedUpdate_Prefix(PlayerControl __instance)
@@ -60,12 +60,16 @@ class PlayerControlPatch
}
// Set text info
infotime -= Time.deltaTime;
if (!time.ContainsKey(__instance.PlayerId))
{
time[__instance.PlayerId] = 0f;
}
time[__instance.PlayerId] -= Time.deltaTime;
if (infotime <= 0)
if (time[__instance.PlayerId] <= 0)
{
SetPlayerInfo(__instance);
infotime = 0.4f;
time[__instance.PlayerId] = 0.4f;
}
// Reset player data in lobby
+1 -3
View File
@@ -13,7 +13,7 @@ class OnGameJoinedPatch
{
PlayerControlDataExtension.playerInfo.Clear();
PlayerControlPatch.infotime = 0f;
PlayerControlPatch.time.Clear();
AntiCheat.PauseAntiCheat();
@@ -35,8 +35,6 @@ public static class OnPlayerJoinedPatch
{
public static void Postfix(/*AmongUsClient __instance,*/ [HarmonyArgument(0)] ClientData client)
{
PlayerControlPatch.infotime = 0f;
_ = new LateTask(() =>
{
if (GameStates.IsInGame)