using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Photon.Pun;
using UnityEngine;
using UnityEngine.UI;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("FixUnlimitedEndScreen")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FixUnlimitedEndScreen")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("68abd587-8299-4aa8-99ec-f1599ff1e52e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.kaosz.FixUnlimitedEndScreen", "FixUnlimitedEndScreen", "1.0.0")]
public class FixUnlimitedEndScreen : BaseUnityPlugin
{
private Harmony _harmony;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
_harmony = new Harmony("com.kaosz.FixUnlimitedEndScreen");
_harmony.PatchAll();
}
}
[HarmonyPatch(typeof(WaitingForPlayersUI))]
[HarmonyPatch("Update", new Type[] { })]
public static class WaitingForPlayersUI_Update_Patch
{
private static readonly Dictionary<WaitingForPlayersUI, List<Image>> _slotsMap = new Dictionary<WaitingForPlayersUI, List<Image>>();
public static bool Prefix(WaitingForPlayersUI __instance)
{
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
List<Player> list = (from p in PlayerHandler.GetAllPlayers()
where ((MonoBehaviourPun)p).photonView.Owner != null && !((MonoBehaviourPun)p).photonView.Owner.IsInactive
select p).ToList();
if (!_slotsMap.TryGetValue(__instance, out var value))
{
value = new List<Image>(__instance.scoutImages);
_slotsMap[__instance] = value;
}
for (int i = value.Count; i < list.Count; i++)
{
Image obj = __instance.scoutImages[0];
Image item = Object.Instantiate<Image>(obj, ((Component)obj).transform.parent);
value.Add(item);
}
foreach (Image item2 in value)
{
((Component)item2).gameObject.SetActive(false);
}
for (int j = 0; j < list.Count; j++)
{
Player val = list[j];
bool hasClosedEndScreen = val.hasClosedEndScreen;
PersistentPlayerData playerData = GameHandler.GetService<PersistentPlayerDataService>().GetPlayerData(((MonoBehaviourPun)val).photonView.Owner);
Color color = Singleton<Customization>.Instance.skins[playerData.customizationData.currentSkin].color;
Image obj2 = value[j];
((Component)obj2).gameObject.SetActive(true);
((Graphic)obj2).color = (hasClosedEndScreen ? color : __instance.notReadyColor);
}
return false;
}
}