Decompiled source of Passportcustomxreportcard v2.0.0

passportcustom.dll

Decompiled 15 hours ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("passportcustom")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyProduct("passportcustom")]
[assembly: AssemblyTitle("passportcustom")]
[assembly: AssemblyVersion("2.0.0.0")]
namespace passportcustom;

public static class PassportPaginationAPI
{
	private static readonly Dictionary<int, List<CustomizationOption>> _extraItems = new Dictionary<int, List<CustomizationOption>>();

	public static event Action<int, int, int> OnPageChanged;

	public static void RegisterExtraItems(int typeKey, IEnumerable<CustomizationOption> options)
	{
		if (options != null)
		{
			if (!_extraItems.ContainsKey(typeKey))
			{
				_extraItems[typeKey] = new List<CustomizationOption>();
			}
			_extraItems[typeKey].AddRange(options);
			ManualLogSource log = Plugin.Log;
			if (log != null)
			{
				log.LogInfo((object)$"[PassportPaginationAPI] Registered {_extraItems[typeKey].Count} extra item(s) for type key {typeKey}.");
			}
		}
	}

	public static void UnregisterExtraItems(int typeKey)
	{
		if (_extraItems.Remove(typeKey))
		{
			ManualLogSource log = Plugin.Log;
			if (log != null)
			{
				log.LogInfo((object)$"[PassportPaginationAPI] Unregistered extra items for type key {typeKey}.");
			}
		}
	}

	public static CustomizationOption[] GetMergedList(int typeKey, CustomizationOption[] nativeList)
	{
		if (!_extraItems.TryGetValue(typeKey, out var value) || value.Count == 0)
		{
			return nativeList;
		}
		CustomizationOption[] array = (CustomizationOption[])(object)new CustomizationOption[nativeList.Length + value.Count];
		nativeList.CopyTo(array, 0);
		for (int i = 0; i < value.Count; i++)
		{
			array[nativeList.Length + i] = value[i];
		}
		return array;
	}

	public static bool HasExtraItems(int typeKey)
	{
		return _extraItems.ContainsKey(typeKey) && _extraItems[typeKey].Count > 0;
	}

	internal static void RaisePageChanged(int typeKey, int page, int maxPage)
	{
		PassportPaginationAPI.OnPageChanged?.Invoke(typeKey, page, maxPage);
	}
}
[BepInPlugin("radsi.pagination", "passportcustom", "2.0.0")]
public class Plugin : BaseUnityPlugin
{
	private class Patcher
	{
		[HarmonyPatch(typeof(PassportManager), "Awake")]
		[HarmonyPostfix]
		private static void OnPassportManagerAwake(PassportManager __instance)
		{
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			CurrentPassportManager = __instance;
			Log.LogInfo((object)"[passportcustom] PassportManager.Awake — instance capturée.");
			GameObject val = FindTemplateButton();
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Transform parent = val.transform.parent;
			object obj;
			if (parent == null)
			{
				obj = null;
			}
			else
			{
				Transform parent2 = parent.parent;
				obj = ((parent2 != null) ? parent2.parent : null);
			}
			Transform val2 = (Transform)obj;
			if ((Object)(object)val2 == (Object)null)
			{
				Log.LogError((object)"[passportcustom] Impossible de remonter au parent des boutons (parent.parent.parent == null).");
				return;
			}
			DestroyModButtons();
			ButtonRight = Object.Instantiate<GameObject>(val);
			ButtonLeft = Object.Instantiate<GameObject>(val);
			ButtonRight.transform.SetParent(val2, false);
			ButtonLeft.transform.SetParent(val2, false);
			ButtonRight.transform.localScale = new Vector3(1f, 0.4f, 1f);
			ButtonLeft.transform.localScale = new Vector3(-1f, 0.4f, 1f);
			TrySetArrowTexture(ButtonRight);
			TrySetArrowTexture(ButtonLeft);
			ButtonRight.transform.localPosition = new Vector3(276.6f, -196.6f, 0f);
			ButtonLeft.transform.localPosition = new Vector3(-56.6f, -196.6f, 0f);
			PassportButton component = ButtonRight.GetComponent<PassportButton>();
			PassportButton component2 = ButtonLeft.GetComponent<PassportButton>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			if ((Object)(object)component2 != (Object)null)
			{
				Object.Destroy((Object)(object)component2);
			}
			((Object)ButtonRight).name = "passportcustom_right";
			((Object)ButtonLeft).name = "passportcustom_left";
			ButtonRight.SetActive(false);
			ButtonLeft.SetActive(false);
			SetButtonAction(ButtonRight, "right_mod", delegate
			{
				int maxPage2 = GetMaxPage(CurrentPassportManager);
				CurrentPage = Mathf.Min(CurrentPage + 1, maxPage2);
				Log.LogInfo((object)$"[passportcustom] → Page {CurrentPage}/{maxPage2}");
				UpdatePage(CurrentPassportManager);
			});
			SetButtonAction(ButtonLeft, "left_mod", delegate
			{
				int maxPage = GetMaxPage(CurrentPassportManager);
				CurrentPage = Mathf.Max(CurrentPage - 1, 0);
				Log.LogInfo((object)$"[passportcustom] ← Page {CurrentPage}/{maxPage}");
				UpdatePage(CurrentPassportManager);
			});
			Log.LogInfo((object)"[passportcustom] Boutons de navigation créés avec succès.");
		}

		[HarmonyPatch(typeof(PassportManager), "OpenTab")]
		[HarmonyPostfix]
		private static void OnOpenTab(PassportManager __instance)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			CurrentPassportManager = __instance;
			CurrentPage = 0;
			Log.LogInfo((object)$"[passportcustom] OpenTab — reset page 0 (type={__instance.activeType})");
			UpdatePage(__instance);
		}

		[HarmonyPatch(typeof(PassportManager), "SetButtons")]
		[HarmonyPrefix]
		private static bool OnSetButtonsPrefix(PassportManager __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			int typeKey = Convert.ToInt32(__instance.activeType);
			bool flag = PassportPaginationAPI.HasExtraItems(typeKey);
			if (CurrentPage == 0 && !flag)
			{
				Log.LogDebug((object)"[passportcustom] SetButtons — page 0, pas d'extras, passage au natif.");
				return true;
			}
			Log.LogDebug((object)$"[passportcustom] SetButtons — bridge actif (page={CurrentPage}, extras={flag})");
			UpdatePage(__instance);
			return false;
		}

		[HarmonyPatch(typeof(PassportManager), "SetButtons")]
		[HarmonyPostfix]
		private static void OnSetButtonsPostfix(PassportManager __instance)
		{
			RefreshNavButtons(__instance);
		}
	}

	internal static ManualLogSource Log;

	internal static PassportManager CurrentPassportManager;

	internal static Texture2D ArrowImage;

	internal static int CurrentPage;

	internal static GameObject ButtonRight;

	internal static GameObject ButtonLeft;

	private static MethodInfo _setActiveButtonMethod;

	private static FieldInfo _buttonsPerPageField;

	private void Awake()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"[passportcustom] Initialisation du bridge de pagination...");
		ArrowImage = new Texture2D(2, 2);
		ImageConversion.LoadImage(ArrowImage, Resource1.arrow);
		Type typeFromHandle = typeof(PassportManager);
		_setActiveButtonMethod = typeFromHandle.GetMethod("SetActiveButton", BindingFlags.Instance | BindingFlags.NonPublic);
		if (_setActiveButtonMethod == null)
		{
			Log.LogWarning((object)"[passportcustom] SetActiveButton introuvable — la sélection active ne sera pas mise à jour.");
		}
		_buttonsPerPageField = typeFromHandle.GetField("buttonsPerPage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (_buttonsPerPageField == null)
		{
			Log.LogWarning((object)"[passportcustom] buttonsPerPage introuvable — fallback sur buttons.Length.");
		}
		Harmony val = new Harmony("radsi.pagination");
		val.PatchAll(typeof(Patcher));
		val.PatchAll(typeof(ReportCardInjector));
		Log.LogInfo((object)"[passportcustom] Harmony patches appliqués.");
	}

	internal static int GetButtonsPerPage(PassportManager pm)
	{
		if (_buttonsPerPageField != null && _buttonsPerPageField.GetValue(pm) is int num && num > 0)
		{
			return num;
		}
		PassportButton[] buttons = pm.buttons;
		return (buttons != null) ? buttons.Length : 28;
	}

	internal static void InvokeSetActiveButton(PassportManager pm)
	{
		_setActiveButtonMethod?.Invoke(pm, null);
	}

	internal static GameObject FindTemplateButton()
	{
		GameObject val = GameObject.Find("GAME/PassportManager/PassportUI/Canvas/Panel/Panel/BG/Options/Grid/UI_PassportGridButton");
		if ((Object)(object)val != (Object)null)
		{
			Log.LogInfo((object)"[passportcustom] Bouton template trouvé via path complet.");
			return val;
		}
		PassportButton[] array = Object.FindObjectsByType<PassportButton>((FindObjectsSortMode)0);
		if (array != null && array.Length != 0)
		{
			Log.LogInfo((object)$"[passportcustom] Bouton template trouvé via FindObjectsOfType<PassportButton> ({array.Length} bouton(s)).");
			return ((Component)array[0]).gameObject;
		}
		if ((Object)(object)CurrentPassportManager != (Object)null)
		{
			Transform val2 = FindChildRecursive(((Component)CurrentPassportManager).transform, "Grid");
			if ((Object)(object)val2 != (Object)null && val2.childCount > 0)
			{
				Log.LogInfo((object)"[passportcustom] Bouton template trouvé via Grid child.");
				return ((Component)val2.GetChild(0)).gameObject;
			}
		}
		Log.LogError((object)"[passportcustom] IMPOSSIBLE de trouver le bouton template. Le nom de l'objet a probablement changé dans cette version de PEAK. Les boutons de navigation ne seront pas créés.");
		return null;
	}

	private static Transform FindChildRecursive(Transform parent, string name)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		foreach (Transform item in parent)
		{
			Transform val = item;
			if (((Object)val).name.Contains(name))
			{
				return val;
			}
			Transform val2 = FindChildRecursive(val, name);
			if ((Object)(object)val2 != (Object)null)
			{
				return val2;
			}
		}
		return null;
	}

	internal static void UpdatePage(PassportManager pm)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)pm == (Object)null)
		{
			Log.LogError((object)"[passportcustom] UpdatePage appelé avec pm == null !");
			return;
		}
		int typeKey = Convert.ToInt32(pm.activeType);
		int buttonsPerPage = GetButtonsPerPage(pm);
		CustomizationOption[] list = Singleton<Customization>.Instance.GetList(pm.activeType);
		CustomizationOption[] mergedList = PassportPaginationAPI.GetMergedList(typeKey, list);
		int num = mergedList.Length;
		int num2 = CurrentPage * buttonsPerPage;
		int maxPage = GetMaxPage(pm, num, buttonsPerPage);
		Log.LogDebug((object)($"[passportcustom] UpdatePage — type={pm.activeType} page={CurrentPage}/{maxPage} " + $"total={num} perPage={buttonsPerPage} nativeItems={list.Length} mergedItems={num}"));
		for (int i = 0; i < pm.buttons.Length; i++)
		{
			int num3 = num2 + i;
			if (num3 < num)
			{
				pm.buttons[i].SetButton(mergedList[num3], num3);
			}
			else
			{
				pm.buttons[i].SetButton((CustomizationOption)null, -1);
			}
		}
		InvokeSetActiveButton(pm);
		RefreshNavButtons(pm, maxPage);
		PassportPaginationAPI.RaisePageChanged(typeKey, CurrentPage, maxPage);
	}

	internal static void RefreshNavButtons(PassportManager pm, int maxPage = -1)
	{
		if (!((Object)(object)ButtonLeft == (Object)null) && !((Object)(object)ButtonRight == (Object)null))
		{
			if (maxPage < 0)
			{
				maxPage = GetMaxPage(pm);
			}
			ButtonLeft.SetActive(CurrentPage > 0);
			ButtonRight.SetActive(CurrentPage < maxPage);
		}
	}

	internal static int GetMaxPage(PassportManager pm)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		int typeKey = Convert.ToInt32(pm.activeType);
		CustomizationOption[] list = Singleton<Customization>.Instance.GetList(pm.activeType);
		CustomizationOption[] mergedList = PassportPaginationAPI.GetMergedList(typeKey, list);
		return GetMaxPage(pm, mergedList.Length, GetButtonsPerPage(pm));
	}

	private static int GetMaxPage(PassportManager pm, int total, int perPage)
	{
		return Mathf.Max((total - 1) / perPage, 0);
	}

	private static void TrySetArrowTexture(GameObject btn)
	{
		try
		{
			RawImage component = ((Component)btn.transform.GetChild(1).GetChild(0)).GetComponent<RawImage>();
			if ((Object)(object)component != (Object)null)
			{
				component.texture = (Texture)(object)ArrowImage;
				return;
			}
		}
		catch
		{
		}
		RawImage componentInChildren = btn.GetComponentInChildren<RawImage>(true);
		if ((Object)(object)componentInChildren != (Object)null)
		{
			componentInChildren.texture = (Texture)(object)ArrowImage;
		}
		else
		{
			Log.LogWarning((object)"[passportcustom] Impossible de trouver le RawImage sur le bouton cloné.");
		}
	}

	private static void SetButtonAction(GameObject btn, string name, Action onClick)
	{
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Expected O, but got Unknown
		((Object)btn).name = name;
		Button component = btn.GetComponent<Button>();
		if ((Object)(object)component == (Object)null)
		{
			Log.LogError((object)("[passportcustom] Le bouton '" + name + "' n'a pas de composant Button !"));
			return;
		}
		((UnityEventBase)component.onClick).RemoveAllListeners();
		((UnityEvent)component.onClick).AddListener((UnityAction)delegate
		{
			onClick();
		});
	}

	private static void DestroyModButtons()
	{
		string[] array = new string[4] { "passportcustom_right", "passportcustom_left", "right_mod", "left_mod" };
		string[] array2 = array;
		foreach (string text in array2)
		{
			GameObject val = GameObject.Find(text);
			if ((Object)(object)val != (Object)null)
			{
				Log.LogInfo((object)("[passportcustom] Nettoyage bouton orphelin '" + text + "'."));
				Object.Destroy((Object)(object)val);
			}
		}
		ButtonLeft = (ButtonRight = null);
	}
}
public static class ReportEvents
{
	public const byte EVT_SUBMIT_REPORT = 211;

	public const byte EVT_NOTIFY_BANNED = 212;

	public const byte EVT_BROADCAST_BAN = 213;
}
public class ReportEntry
{
	public int ReporterActorNumber;

	public string ReporterName;

	public int TargetActorNumber;

	public string TargetName;

	public string Reason;

	public float Timestamp;

	public ReportEntry(int rActor, string rName, int tActor, string tName, string reason)
	{
		ReporterActorNumber = rActor;
		ReporterName = rName;
		TargetActorNumber = tActor;
		TargetName = tName;
		Reason = reason;
		Timestamp = Time.time;
	}
}
public class ReportCardManager : MonoBehaviour, IOnEventCallback
{
	public const int REPORTS_THRESHOLD = 3;

	public const int MAX_REASON_LENGTH = 120;

	public const KeyCode OPEN_KEY = 282;

	private static readonly RaiseEventOptions _toMaster = new RaiseEventOptions
	{
		Receivers = (ReceiverGroup)2
	};

	private static readonly RaiseEventOptions _toOthers = new RaiseEventOptions
	{
		Receivers = (ReceiverGroup)0
	};

	private static readonly RaiseEventOptions _toAll = new RaiseEventOptions
	{
		Receivers = (ReceiverGroup)1
	};

	private static readonly SendOptions _reliable = SendOptions.SendReliable;

	private readonly Dictionary<int, List<ReportEntry>> _reports = new Dictionary<int, List<ReportEntry>>();

	private readonly HashSet<int> _alreadyReported = new HashSet<int>();

	private readonly HashSet<int> _banned = new HashSet<int>();

	private ReportCardUI _ui;

	public static ReportCardManager Instance { get; private set; }

	private static ManualLogSource Log => Plugin.Log;

	private void Awake()
	{
		if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		Instance = this;
		Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
	}

	private void Start()
	{
		PhotonNetwork.AddCallbackTarget((object)this);
		Log.LogInfo((object)"[ReportCard] Callbacks Photon enregistrés.");
		_ui = ((Component)this).gameObject.AddComponent<ReportCardUI>();
		_ui.Manager = this;
	}

	private void OnDestroy()
	{
		PhotonNetwork.RemoveCallbackTarget((object)this);
	}

	private void Update()
	{
		if (Input.GetKeyDown((KeyCode)282) && PhotonNetwork.IsConnected)
		{
			_ui.ToggleReportMenu();
		}
	}

	public void SubmitReport(int targetActor, string reason)
	{
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		if (!PhotonNetwork.IsConnected)
		{
			Log.LogWarning((object)"[ReportCard] Non connecté.");
			return;
		}
		if (PhotonNetwork.LocalPlayer.ActorNumber == targetActor)
		{
			_ui.ShowToast("Tu ne peux pas te reporter toi-même.");
			return;
		}
		if (_alreadyReported.Contains(targetActor))
		{
			_ui.ShowToast("Tu as déjà reporté ce joueur.");
			return;
		}
		reason = (reason ?? "").Trim();
		if (string.IsNullOrEmpty(reason))
		{
			_ui.ShowToast("La raison ne peut pas être vide.");
			return;
		}
		if (reason.Length > 120)
		{
			reason = reason.Substring(0, 120);
		}
		_alreadyReported.Add(targetActor);
		Player localPlayer = PhotonNetwork.LocalPlayer;
		object[] array = new object[4]
		{
			localPlayer.ActorNumber,
			localPlayer.NickName ?? "?",
			targetActor,
			reason
		};
		PhotonNetwork.RaiseEvent((byte)211, (object)array, _toMaster, _reliable);
		Log.LogInfo((object)$"[ReportCard] Report envoyé → actor {targetActor}, raison: '{reason}'");
		_ui.ShowToast("Report envoyé sur " + GetPlayerName(targetActor) + ".");
		_ui.CloseAll();
	}

	public void BanPlayer(int targetActor)
	{
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Expected O, but got Unknown
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		if (!PhotonNetwork.IsMasterClient)
		{
			return;
		}
		if (_banned.Contains(targetActor))
		{
			Log.LogInfo((object)$"[ReportCard] Actor {targetActor} déjà banni.");
			return;
		}
		Room currentRoom = PhotonNetwork.CurrentRoom;
		Player val = ((currentRoom != null) ? currentRoom.GetPlayer(targetActor, false) : null);
		if (val == null)
		{
			Log.LogError((object)$"[ReportCard] Actor {targetActor} introuvable.");
			return;
		}
		_banned.Add(targetActor);
		string text = val.NickName ?? $"Actor#{targetActor}";
		Log.LogInfo((object)$"[ReportCard] BAN de {text} (actor {targetActor}).");
		RaiseEventOptions val2 = new RaiseEventOptions();
		val2.TargetActors = new int[1] { targetActor };
		RaiseEventOptions val3 = val2;
		PhotonNetwork.RaiseEvent((byte)212, (object)null, val3, _reliable);
		PhotonNetwork.RaiseEvent((byte)213, (object)text, _toOthers, _reliable);
		PhotonNetwork.CloseConnection(val);
		_reports.Remove(targetActor);
		_ui.CloseAll();
		_ui.ShowToast(text + " a été banni.", 3f);
	}

	public void DismissReports(int targetActor)
	{
		if (PhotonNetwork.IsMasterClient)
		{
			string playerName = GetPlayerName(targetActor);
			_reports.Remove(targetActor);
			Log.LogInfo((object)("[ReportCard] Reports ignorés pour " + playerName + "."));
			_ui.CloseAll();
			_ui.ShowToast("Reports sur " + playerName + " effacés.");
		}
	}

	public void OnEvent(EventData photonEvent)
	{
		switch (photonEvent.Code)
		{
		case 211:
			HandleSubmitReport(photonEvent);
			break;
		case 212:
			HandleNotifyBanned(photonEvent);
			break;
		case 213:
			HandleBroadcastBan(photonEvent);
			break;
		}
	}

	private void HandleSubmitReport(EventData e)
	{
		if (!PhotonNetwork.IsMasterClient)
		{
			return;
		}
		object[] array = (object[])e.CustomData;
		int reporterActor = (int)array[0];
		string rName = (string)array[1];
		int num = (int)array[2];
		string text = (string)array[3];
		if (e.Sender != reporterActor)
		{
			Log.LogWarning((object)$"[ReportCard] Report frauduleux ignoré (sender={e.Sender} ≠ reporter={reporterActor}).");
			return;
		}
		Room currentRoom = PhotonNetwork.CurrentRoom;
		Player val = ((currentRoom != null) ? currentRoom.GetPlayer(num, false) : null);
		string text2 = ((val != null) ? val.NickName : null) ?? $"Actor#{num}";
		if (!_reports.ContainsKey(num))
		{
			_reports[num] = new List<ReportEntry>();
		}
		if (_reports[num].Any((ReportEntry r) => r.ReporterActorNumber == reporterActor))
		{
			Log.LogWarning((object)$"[ReportCard] Report dupliqué ignoré (reporter={reporterActor}).");
			return;
		}
		_reports[num].Add(new ReportEntry(reporterActor, rName, num, text2, text));
		int count = _reports[num].Count;
		Log.LogInfo((object)$"[ReportCard] Report enregistré ({count}/{3}) contre {text2} : '{text}'");
		if (count >= 3)
		{
			Log.LogInfo((object)("[ReportCard] ⚠ Seuil atteint pour " + text2 + "."));
			_ui.ShowHostPanel(num, text2, _reports[num]);
		}
	}

	private void HandleNotifyBanned(EventData e)
	{
		Log.LogInfo((object)"[ReportCard] Tu as été banni par le host.");
		_ui.ShowToast("Tu as été banni de la partie par le host.", 8f);
	}

	private void HandleBroadcastBan(EventData e)
	{
		Room currentRoom = PhotonNetwork.CurrentRoom;
		Player val = ((currentRoom != null) ? currentRoom.GetPlayer(e.Sender, false) : null);
		if (val != null && val.IsMasterClient)
		{
			string text = (string)e.CustomData;
			Log.LogInfo((object)("[ReportCard] " + text + " a été banni."));
			_ui.ShowToast(text + " a été banni de la partie.", 3f);
		}
	}

	public List<ReportEntry> GetReportsFor(int actor)
	{
		List<ReportEntry> value;
		return _reports.TryGetValue(actor, out value) ? value : new List<ReportEntry>();
	}

	public Player[] GetOtherPlayers()
	{
		Player[] playerListOthers = PhotonNetwork.PlayerListOthers;
		return (playerListOthers != null && playerListOthers.Length != 0) ? playerListOthers : Array.Empty<Player>();
	}

	public bool AlreadyReported(int actor)
	{
		return _alreadyReported.Contains(actor);
	}

	public static string GetPlayerName(int actor)
	{
		Room currentRoom = PhotonNetwork.CurrentRoom;
		object obj;
		if (currentRoom == null)
		{
			obj = null;
		}
		else
		{
			Player player = currentRoom.GetPlayer(actor, false);
			obj = ((player != null) ? player.NickName : null);
		}
		if (obj == null)
		{
			obj = $"Actor#{actor}";
		}
		return (string)obj;
	}
}
public class ReportCardUI : MonoBehaviour
{
	internal ReportCardManager Manager;

	private GameObject _menuRoot;

	private GameObject _reasonRoot;

	private GameObject _hostRoot;

	private GameObject _toastRoot;

	private TMP_InputField _reasonInput;

	private TextMeshProUGUI _toastText;

	private TextMeshProUGUI _hostTitle;

	private Transform _hostReportList;

	private Button _hostBanBtn;

	private Button _hostDismissBtn;

	private Transform _playerListContent;

	private int _pendingTargetActor;

	private string _pendingTargetName;

	private Coroutine _toastCoroutine;

	private static readonly Color C_BG = new Color(0.07f, 0.07f, 0.09f, 0.96f);

	private static readonly Color C_ACCENT = new Color(0.85f, 0.18f, 0.18f, 1f);

	private static readonly Color C_GREY = new Color(0.2f, 0.2f, 0.23f, 1f);

	private static readonly Color C_GREEN = new Color(0.12f, 0.52f, 0.18f, 1f);

	private static readonly Color C_TEXT = new Color(0.92f, 0.92f, 0.92f, 1f);

	private static readonly Color C_DIM = new Color(0.55f, 0.55f, 0.58f, 1f);

	private Canvas _canvas;

	private void Awake()
	{
		BuildCanvas();
		BuildReportMenu();
		BuildReasonPanel();
		BuildHostPanel();
		BuildToast();
	}

	public void ToggleReportMenu()
	{
		if (_menuRoot.activeSelf)
		{
			CloseAll();
		}
		else
		{
			OpenReportMenu();
		}
	}

	public void OpenReportMenu()
	{
		CloseAll();
		RefreshPlayerList();
		_menuRoot.SetActive(true);
	}

	public void CloseAll()
	{
		_menuRoot.SetActive(false);
		_reasonRoot.SetActive(false);
		_hostRoot.SetActive(false);
	}

	public void ShowToast(string msg, float duration = 2.5f)
	{
		((TMP_Text)_toastText).text = msg;
		_toastRoot.SetActive(true);
		if (_toastCoroutine != null)
		{
			((MonoBehaviour)this).StopCoroutine(_toastCoroutine);
		}
		_toastCoroutine = ((MonoBehaviour)this).StartCoroutine(CoHideToast(duration));
	}

	private IEnumerator CoHideToast(float t)
	{
		yield return (object)new WaitForSeconds(t);
		_toastRoot.SetActive(false);
	}

	private void RefreshPlayerList()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		foreach (Transform item in _playerListContent)
		{
			Transform val = item;
			Object.Destroy((Object)(object)((Component)val).gameObject);
		}
		Player[] otherPlayers = Manager.GetOtherPlayers();
		if (otherPlayers.Length == 0)
		{
			MakeTextLine(_playerListContent, "Aucun autre joueur dans la partie.", C_DIM);
			return;
		}
		Player[] array = otherPlayers;
		foreach (Player val2 in array)
		{
			int actor = val2.ActorNumber;
			string name = val2.NickName ?? $"Joueur {actor}";
			bool flag = Manager.AlreadyReported(actor);
			string label = (flag ? (name + "  ✓") : name);
			Color bg = (flag ? (C_GREY * 0.6f) : C_GREY);
			GameObject val3 = MakeButton(_playerListContent, label, bg, delegate
			{
				if (!Manager.AlreadyReported(actor))
				{
					OpenReasonPanel(actor, name);
				}
			});
			((Selectable)val3.GetComponent<Button>()).interactable = !flag;
		}
	}

	private void OpenReasonPanel(int actor, string name)
	{
		_pendingTargetActor = actor;
		_pendingTargetName = name;
		_menuRoot.SetActive(false);
		((TMP_Text)((Component)_reasonRoot.transform.Find("Label")).GetComponent<TextMeshProUGUI>()).text = "Reporter  <b>" + name + "</b>\nDécris le comportement :";
		_reasonInput.text = "";
		_reasonRoot.SetActive(true);
		_reasonInput.ActivateInputField();
	}

	public void ShowHostPanel(int targetActor, string targetName, List<ReportEntry> entries)
	{
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Expected O, but got Unknown
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Expected O, but got Unknown
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Expected O, but got Unknown
		if (!PhotonNetwork.IsMasterClient)
		{
			return;
		}
		((TMP_Text)_hostTitle).text = $"⚠  <b>{entries.Count}</b> reports sur  <b>{targetName}</b>";
		foreach (Transform hostReport in _hostReportList)
		{
			Transform val = hostReport;
			Object.Destroy((Object)(object)((Component)val).gameObject);
		}
		foreach (ReportEntry entry in entries)
		{
			MakeTextLine(_hostReportList, "<color=#888888>" + entry.ReporterName + "</color>  →  " + entry.Reason, C_TEXT, 12);
		}
		int actor = targetActor;
		((UnityEventBase)_hostBanBtn.onClick).RemoveAllListeners();
		((UnityEvent)_hostBanBtn.onClick).AddListener((UnityAction)delegate
		{
			Manager.BanPlayer(actor);
		});
		((TMP_Text)((Component)_hostBanBtn).GetComponentInChildren<TextMeshProUGUI>()).text = "\ud83d\udd28  Bannir " + targetName;
		((UnityEventBase)_hostDismissBtn.onClick).RemoveAllListeners();
		((UnityEvent)_hostDismissBtn.onClick).AddListener((UnityAction)delegate
		{
			Manager.DismissReports(actor);
		});
		CloseAll();
		_hostRoot.SetActive(true);
	}

	private void BuildCanvas()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("RC_Canvas", new Type[3]
		{
			typeof(Canvas),
			typeof(CanvasScaler),
			typeof(GraphicRaycaster)
		});
		Object.DontDestroyOnLoad((Object)(object)val);
		_canvas = val.GetComponent<Canvas>();
		_canvas.renderMode = (RenderMode)0;
		_canvas.sortingOrder = 300;
		CanvasScaler component = val.GetComponent<CanvasScaler>();
		component.uiScaleMode = (ScaleMode)1;
		component.referenceResolution = new Vector2(1920f, 1080f);
	}

	private void BuildReportMenu()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		_menuRoot = Panel("RC_Menu", new Vector2(360f, 400f), new Vector2(-680f, 0f));
		MakeLabel(_menuRoot.transform, "\ud83d\udea9  Reporter un joueur", 16, C_ACCENT, new Vector2(0f, 160f));
		MakeLabel(_menuRoot.transform, "[F1] pour fermer", 10, C_DIM, new Vector2(0f, 140f));
		Transform val = MakeScrollView(_menuRoot.transform, new Vector2(330f, 260f), new Vector2(0f, -10f));
		_playerListContent = val.Find("Viewport/Content");
		MakeSmallClose(_menuRoot.transform, new Vector2(155f, 163f), CloseAll);
		_menuRoot.SetActive(false);
	}

	private void BuildReasonPanel()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Expected O, but got Unknown
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		_reasonRoot = Panel("RC_Reason", new Vector2(400f, 230f), new Vector2(-680f, 0f));
		GameObject val = new GameObject("Label", new Type[2]
		{
			typeof(RectTransform),
			typeof(TextMeshProUGUI)
		});
		val.transform.SetParent(_reasonRoot.transform, false);
		TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
		((TMP_Text)component).text = "";
		((TMP_Text)component).fontSize = 14f;
		((Graphic)component).color = C_TEXT;
		((TMP_Text)component).alignment = (TextAlignmentOptions)514;
		val.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 78f);
		_reasonInput = MakeInputField(_reasonRoot.transform, new Vector2(360f, 50f), new Vector2(0f, 14f), "Décris le comportement...");
		MakeButton(_reasonRoot.transform, "Envoyer", C_ACCENT, delegate
		{
			Manager.SubmitReport(_pendingTargetActor, _reasonInput.text);
		}, new Vector2(160f, 36f), new Vector2(72f, -65f));
		MakeButton(_reasonRoot.transform, "Annuler", C_GREY, delegate
		{
			_reasonRoot.SetActive(false);
			_menuRoot.SetActive(true);
		}, new Vector2(120f, 36f), new Vector2(-95f, -65f));
		_reasonRoot.SetActive(false);
	}

	private void BuildHostPanel()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Expected O, but got Unknown
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_0196: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		_hostRoot = Panel("RC_Host", new Vector2(440f, 460f), new Vector2(680f, 0f));
		GameObject val = new GameObject("Title", new Type[2]
		{
			typeof(RectTransform),
			typeof(TextMeshProUGUI)
		});
		val.transform.SetParent(_hostRoot.transform, false);
		_hostTitle = val.GetComponent<TextMeshProUGUI>();
		((TMP_Text)_hostTitle).fontSize = 15f;
		((Graphic)_hostTitle).color = C_ACCENT;
		((TMP_Text)_hostTitle).alignment = (TextAlignmentOptions)514;
		((TMP_Text)_hostTitle).textWrappingMode = (TextWrappingModes)1;
		val.GetComponent<RectTransform>().sizeDelta = new Vector2(400f, 50f);
		val.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 185f);
		MakeDivider(_hostRoot.transform, new Vector2(0f, 158f));
		Transform val2 = MakeScrollView(_hostRoot.transform, new Vector2(410f, 290f), new Vector2(0f, 10f));
		_hostReportList = val2.Find("Viewport/Content");
		GameObject val3 = MakeButton(_hostRoot.transform, "\ud83d\udd28  Bannir", C_ACCENT, delegate
		{
		}, new Vector2(185f, 42f), new Vector2(100f, -183f));
		_hostBanBtn = val3.GetComponent<Button>();
		GameObject val4 = MakeButton(_hostRoot.transform, "✓  Ignorer les reports", C_GREEN, delegate
		{
		}, new Vector2(195f, 42f), new Vector2(-103f, -183f));
		_hostDismissBtn = val4.GetComponent<Button>();
		MakeSmallClose(_hostRoot.transform, new Vector2(183f, 193f), CloseAll);
		_hostRoot.SetActive(false);
	}

	private void BuildToast()
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Expected O, but got Unknown
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Expected O, but got Unknown
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		_toastRoot = new GameObject("RC_Toast", new Type[3]
		{
			typeof(RectTransform),
			typeof(Image),
			typeof(CanvasGroup)
		});
		_toastRoot.transform.SetParent(((Component)_canvas).transform, false);
		Object.DontDestroyOnLoad((Object)(object)_toastRoot);
		RectTransform component = _toastRoot.GetComponent<RectTransform>();
		component.anchorMin = new Vector2(0.5f, 0f);
		component.anchorMax = new Vector2(0.5f, 0f);
		component.pivot = new Vector2(0.5f, 0f);
		component.anchoredPosition = new Vector2(0f, 90f);
		component.sizeDelta = new Vector2(440f, 46f);
		((Graphic)_toastRoot.GetComponent<Image>()).color = new Color(0.08f, 0.08f, 0.1f, 0.93f);
		GameObject val = new GameObject("T", new Type[2]
		{
			typeof(RectTransform),
			typeof(TextMeshProUGUI)
		});
		val.transform.SetParent(_toastRoot.transform, false);
		_toastText = val.GetComponent<TextMeshProUGUI>();
		((TMP_Text)_toastText).alignment = (TextAlignmentOptions)514;
		((Graphic)_toastText).color = C_TEXT;
		((TMP_Text)_toastText).fontSize = 13f;
		FillParent(val.GetComponent<RectTransform>(), 10f, 4f);
		_toastRoot.SetActive(false);
	}

	private GameObject Panel(string name, Vector2 size, Vector2 pos)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(name, new Type[2]
		{
			typeof(RectTransform),
			typeof(Image)
		});
		val.transform.SetParent(((Component)_canvas).transform, false);
		Object.DontDestroyOnLoad((Object)(object)val);
		RectTransform component = val.GetComponent<RectTransform>();
		component.sizeDelta = size;
		component.anchoredPosition = pos;
		((Graphic)val.GetComponent<Image>()).color = C_BG;
		Outline val2 = val.AddComponent<Outline>();
		((Shadow)val2).effectColor = C_ACCENT * 0.35f;
		((Shadow)val2).effectDistance = new Vector2(1f, -1f);
		return val;
	}

	private void MakeLabel(Transform parent, string text, int size, Color color, Vector2 pos)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Lbl", new Type[2]
		{
			typeof(RectTransform),
			typeof(TextMeshProUGUI)
		});
		val.transform.SetParent(parent, false);
		TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
		((TMP_Text)component).text = text;
		((TMP_Text)component).fontSize = size;
		((Graphic)component).color = color;
		((TMP_Text)component).alignment = (TextAlignmentOptions)514;
		val.GetComponent<RectTransform>().anchoredPosition = pos;
	}

	private void MakeTextLine(Transform parent, string text, Color color, int size = 13)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Line", new Type[2]
		{
			typeof(RectTransform),
			typeof(TextMeshProUGUI)
		});
		val.transform.SetParent(parent, false);
		TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
		((TMP_Text)component).text = text;
		((TMP_Text)component).fontSize = size;
		((Graphic)component).color = color;
		((TMP_Text)component).alignment = (TextAlignmentOptions)513;
		((TMP_Text)component).textWrappingMode = (TextWrappingModes)1;
		RectTransform component2 = val.GetComponent<RectTransform>();
		component2.sizeDelta = new Vector2(380f, 0f);
	}

	private GameObject MakeButton(Transform parent, string label, Color bg, Action onClick, Vector2 size, Vector2 pos)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected O, but got Unknown
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Expected O, but got Unknown
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Expected O, but got Unknown
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Btn", new Type[3]
		{
			typeof(RectTransform),
			typeof(Image),
			typeof(Button)
		});
		val.transform.SetParent(parent, false);
		RectTransform component = val.GetComponent<RectTransform>();
		component.sizeDelta = size;
		component.anchoredPosition = pos;
		((Graphic)val.GetComponent<Image>()).color = bg;
		Button component2 = val.GetComponent<Button>();
		ColorBlock colors = ((Selectable)component2).colors;
		((ColorBlock)(ref colors)).normalColor = bg;
		((ColorBlock)(ref colors)).highlightedColor = bg * 1.25f;
		((ColorBlock)(ref colors)).pressedColor = bg * 0.65f;
		((Selectable)component2).colors = colors;
		((UnityEvent)component2.onClick).AddListener((UnityAction)delegate
		{
			onClick();
		});
		GameObject val2 = new GameObject("T", new Type[2]
		{
			typeof(RectTransform),
			typeof(TextMeshProUGUI)
		});
		val2.transform.SetParent(val.transform, false);
		TextMeshProUGUI component3 = val2.GetComponent<TextMeshProUGUI>();
		((TMP_Text)component3).text = label;
		((TMP_Text)component3).fontSize = 13f;
		((Graphic)component3).color = Color.white;
		((TMP_Text)component3).alignment = (TextAlignmentOptions)514;
		FillParent(val2.GetComponent<RectTransform>(), 4f, 2f);
		return val;
	}

	private GameObject MakeButton(Transform parent, string label, Color bg, Action onClick)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		return MakeButton(parent, label, bg, onClick, new Vector2(310f, 38f), Vector2.zero);
	}

	private void MakeSmallClose(Transform parent, Vector2 pos, Action onClick)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = MakeButton(parent, "✕", C_GREY * 0.8f, onClick, new Vector2(28f, 28f), pos);
	}

	private TMP_InputField MakeInputField(Transform parent, Vector2 size, Vector2 pos, string placeholder)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Input", new Type[3]
		{
			typeof(RectTransform),
			typeof(Image),
			typeof(TMP_InputField)
		});
		val.transform.SetParent(parent, false);
		RectTransform component = val.GetComponent<RectTransform>();
		component.sizeDelta = size;
		component.anchoredPosition = pos;
		((Graphic)val.GetComponent<Image>()).color = new Color(0.13f, 0.13f, 0.16f, 1f);
		TMP_InputField component2 = val.GetComponent<TMP_InputField>();
		component2.characterLimit = 120;
		TextMeshProUGUI val2 = MakeTMPChild(val.transform, "TextArea", 13, C_TEXT);
		FillParent(((Component)val2).GetComponent<RectTransform>(), 8f, 4f);
		component2.textComponent = (TMP_Text)(object)val2;
		TextMeshProUGUI val3 = MakeTMPChild(val.transform, "Placeholder", 13, C_DIM);
		((TMP_Text)val3).text = placeholder;
		FillParent(((Component)val3).GetComponent<RectTransform>(), 8f, 4f);
		component2.placeholder = (Graphic)(object)val3;
		return component2;
	}

	private Transform MakeScrollView(Transform parent, Vector2 size, Vector2 pos)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Expected O, but got Unknown
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Expected O, but got Unknown
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Expected O, but got Unknown
		GameObject val = new GameObject("Scroll", new Type[3]
		{
			typeof(RectTransform),
			typeof(Image),
			typeof(ScrollRect)
		});
		val.transform.SetParent(parent, false);
		RectTransform component = val.GetComponent<RectTransform>();
		component.sizeDelta = size;
		component.anchoredPosition = pos;
		((Graphic)val.GetComponent<Image>()).color = Color.clear;
		GameObject val2 = new GameObject("Viewport", new Type[3]
		{
			typeof(RectTransform),
			typeof(Image),
			typeof(Mask)
		});
		val2.transform.SetParent(val.transform, false);
		RectTransform component2 = val2.GetComponent<RectTransform>();
		component2.anchorMin = Vector2.zero;
		component2.anchorMax = Vector2.one;
		component2.offsetMin = Vector2.zero;
		component2.offsetMax = Vector2.zero;
		((Graphic)val2.GetComponent<Image>()).color = Color.clear;
		val2.GetComponent<Mask>().showMaskGraphic = false;
		GameObject val3 = new GameObject("Content", new Type[3]
		{
			typeof(RectTransform),
			typeof(VerticalLayoutGroup),
			typeof(ContentSizeFitter)
		});
		val3.transform.SetParent(val2.transform, false);
		RectTransform component3 = val3.GetComponent<RectTransform>();
		component3.anchorMin = new Vector2(0f, 1f);
		component3.anchorMax = new Vector2(1f, 1f);
		component3.pivot = new Vector2(0.5f, 1f);
		component3.offsetMin = Vector2.zero;
		component3.offsetMax = Vector2.zero;
		VerticalLayoutGroup component4 = val3.GetComponent<VerticalLayoutGroup>();
		((HorizontalOrVerticalLayoutGroup)component4).childControlWidth = true;
		((HorizontalOrVerticalLayoutGroup)component4).childControlHeight = true;
		((HorizontalOrVerticalLayoutGroup)component4).spacing = 5f;
		((LayoutGroup)component4).padding = new RectOffset(6, 6, 6, 6);
		ContentSizeFitter component5 = val3.GetComponent<ContentSizeFitter>();
		component5.verticalFit = (FitMode)2;
		ScrollRect component6 = val.GetComponent<ScrollRect>();
		component6.viewport = component2;
		component6.content = component3;
		component6.horizontal = false;
		component6.vertical = true;
		component6.scrollSensitivity = 25f;
		component6.movementType = (MovementType)2;
		return val.transform;
	}

	private void MakeDivider(Transform parent, Vector2 pos)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Div", new Type[2]
		{
			typeof(RectTransform),
			typeof(Image)
		});
		val.transform.SetParent(parent, false);
		((Graphic)val.GetComponent<Image>()).color = C_ACCENT * 0.3f;
		RectTransform component = val.GetComponent<RectTransform>();
		component.sizeDelta = new Vector2(400f, 1f);
		component.anchoredPosition = pos;
	}

	private static TextMeshProUGUI MakeTMPChild(Transform parent, string name, int size, Color color)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(name, new Type[2]
		{
			typeof(RectTransform),
			typeof(TextMeshProUGUI)
		});
		val.transform.SetParent(parent, false);
		TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
		((TMP_Text)component).fontSize = size;
		((Graphic)component).color = color;
		((TMP_Text)component).alignment = (TextAlignmentOptions)513;
		return component;
	}

	private static void FillParent(RectTransform rt, float hPad = 0f, float vPad = 0f)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		rt.anchorMin = Vector2.zero;
		rt.anchorMax = Vector2.one;
		rt.offsetMin = new Vector2(hPad, vPad);
		rt.offsetMax = new Vector2(0f - hPad, 0f - vPad);
	}
}
[HarmonyPatch(typeof(PassportManager), "Awake")]
internal static class ReportCardInjector
{
	[HarmonyPostfix]
	private static void Postfix()
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Expected O, but got Unknown
		if ((Object)(object)ReportCardManager.Instance != (Object)null)
		{
			return;
		}
		if (!PhotonNetwork.IsConnected)
		{
			ManualLogSource log = Plugin.Log;
			if (log != null)
			{
				log.LogInfo((object)"[ReportCard] Non connecté — injection ignorée.");
			}
			return;
		}
		GameObject val = new GameObject("ReportCardManager");
		Object.DontDestroyOnLoad((Object)(object)val);
		val.AddComponent<ReportCardManager>();
		ManualLogSource log2 = Plugin.Log;
		if (log2 != null)
		{
			log2.LogInfo((object)"[ReportCard] ReportCardManager injecté dans la scène.");
		}
	}
}
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resource1
{
	private static ResourceManager resourceMan;

	private static CultureInfo resourceCulture;

	[EditorBrowsable(EditorBrowsableState.Advanced)]
	internal static ResourceManager ResourceManager
	{
		get
		{
			if (resourceMan == null)
			{
				ResourceManager resourceManager = new ResourceManager("passportcustom.Resource1", typeof(Resource1).Assembly);
				resourceMan = resourceManager;
			}
			return resourceMan;
		}
	}

	[EditorBrowsable(EditorBrowsableState.Advanced)]
	internal static CultureInfo Culture
	{
		get
		{
			return resourceCulture;
		}
		set
		{
			resourceCulture = value;
		}
	}

	internal static byte[] arrow
	{
		get
		{
			object @object = ResourceManager.GetObject("arrow", resourceCulture);
			return (byte[])@object;
		}
	}

	internal Resource1()
	{
	}
}