using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Microsoft.CodeAnalysis;
using SNetwork;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("LobbyNotes")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LobbyNotes")]
[assembly: AssemblyTitle("LobbyNotes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace LobbyNotes
{
public class NoteOverlay : MonoBehaviour
{
public NoteOverlay(IntPtr ptr)
: base(ptr)
{
}
private void OnGUI()
{
LobbyNoteUI.Draw();
}
private void Update()
{
LobbyNoteUI.Update();
}
private void LateUpdate()
{
LobbyNoteUI.LateUpdate();
}
}
internal static class LobbyNoteUI
{
private struct IconHit
{
public Rect Rect;
public ulong Id;
public string Name;
}
private static readonly Color Orange = new Color(1f, 0.55f, 0.1f, 1f);
private const float IconSize = 26f;
private static Texture2D? _icon;
private static Texture2D? _panelBg;
private static Camera? _cam;
private static ulong _editId;
private static string _editName = "";
private static string _editText = "";
private static readonly List<IconHit> _icons = new List<IconHit>();
private static int _clickLogs;
private static Vector2? _gameCursorGui;
private static readonly List<Renderer> _hiddenCursorRenderers = new List<Renderer>();
private static bool _noRendererLogged;
private static bool _cursorOverridden;
private static CursorLockMode _prevLock;
private static bool _prevVisible;
private static Transform? _cursorTf;
private static float _lastCursorScan = -10f;
private static bool _cursorListLogged;
private static string _lastDiag = "";
private static readonly StringBuilder _diag = new StringBuilder();
private static readonly Rect[] _lastRect = (Rect[])(object)new Rect[8];
private static readonly float[] _lastTime = new float[8];
private static int _camListLogCount;
private static float _lastScanTime = -10f;
public static void Update()
{
//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
//IL_03bc: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: 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_00ef: 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_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: 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_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Expected O, but got Unknown
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_036e: Unknown result type (might be due to invalid IL or missing references)
bool flag = default(bool);
try
{
if (_editId != 0L)
{
ForceOsCursor(on: true);
HideGameCursor(hide: true);
if (Input.GetKeyDown((KeyCode)27))
{
CloseEditor();
}
else if ((Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305)) && (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271)))
{
SaveAndClose();
}
return;
}
ForceOsCursor(on: false);
HideGameCursor(hide: false);
_gameCursorGui = GetGameCursorGui();
if (!Input.GetMouseButtonDown(0) || _icons.Count == 0)
{
return;
}
Vector2? val = null;
if (Cursor.visible && (int)Cursor.lockState == 0)
{
Vector3 mousePosition = Input.mousePosition;
val = new Vector2(mousePosition.x, (float)Screen.height - mousePosition.y);
}
Vector2? gameCursorGui = _gameCursorGui;
Rect val2 = default(Rect);
foreach (IconHit icon in _icons)
{
Rect rect = icon.Rect;
float num = ((Rect)(ref rect)).x - 6f;
rect = icon.Rect;
float num2 = ((Rect)(ref rect)).y - 6f;
rect = icon.Rect;
float num3 = ((Rect)(ref rect)).width + 12f;
rect = icon.Rect;
((Rect)(ref val2))..ctor(num, num2, num3, ((Rect)(ref rect)).height + 12f);
if ((val.HasValue && ((Rect)(ref val2)).Contains(val.Value)) || (gameCursorGui.HasValue && ((Rect)(ref val2)).Contains(gameCursorGui.Value)))
{
OpenEditor(icon.Id, icon.Name);
return;
}
}
if (Plugin.DebugLog.Value && _clickLogs < 10)
{
_clickLogs++;
Rect rect2 = _icons[0].Rect;
ManualLogSource l = Plugin.L;
BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(57, 6, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Click] miss: mouse=");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(val.HasValue ? $"({val.Value.x:0},{val.Value.y:0})" : "locked");
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("gameCursor=");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(gameCursorGui.HasValue ? $"({gameCursorGui.Value.x:0},{gameCursorGui.Value.y:0})" : "none");
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("icon0=(");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(((Rect)(ref rect2)).x, "0");
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(",");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(((Rect)(ref rect2)).y, "0");
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(") lock=");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<CursorLockMode>(Cursor.lockState);
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" visible=");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<bool>(Cursor.visible);
}
l.LogInfo(val3);
}
}
catch (Exception ex)
{
if (_clickLogs++ < 10)
{
ManualLogSource l2 = Plugin.L;
BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(8, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[Click] ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<Exception>(ex);
}
l2.LogError(val4);
}
}
}
public static void LateUpdate()
{
if (_editId != 0L)
{
ForceOsCursor(on: true);
HideGameCursor(hide: true);
}
}
private static void SaveAndClose()
{
NoteStore.Set(_editId, _editName, _editText);
CloseEditor();
}
private static void DeleteAndClose()
{
NoteStore.Set(_editId, _editName, "");
CloseEditor();
}
private static void HideGameCursor(bool hide)
{
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
bool flag = default(bool);
try
{
if (hide)
{
if ((Object)(object)_cursorTf == (Object)null)
{
GetGameCursorGui();
}
if ((Object)(object)_cursorTf == (Object)null)
{
return;
}
if (_hiddenCursorRenderers.Count == 0)
{
foreach (Component item in (Il2CppArrayBase<Component>)(object)((Component)_cursorTf).GetComponentsInChildren(Il2CppType.Of<Renderer>(), true))
{
Renderer val = ((item != null) ? ((Il2CppObjectBase)item).TryCast<Renderer>() : null);
if ((Object)(object)val != (Object)null && val.enabled)
{
_hiddenCursorRenderers.Add(val);
}
}
if (_hiddenCursorRenderers.Count == 0 && !_noRendererLogged)
{
_noRendererLogged = true;
ManualLogSource l = Plugin.L;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(32, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Cursor] '");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(GetPath(_cursorTf));
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'에서 숨길 Renderer를 찾지 못함");
}
l.LogWarning(val2);
}
}
{
foreach (Renderer hiddenCursorRenderer in _hiddenCursorRenderers)
{
if ((Object)(object)hiddenCursorRenderer != (Object)null)
{
hiddenCursorRenderer.enabled = false;
}
}
return;
}
}
if (_hiddenCursorRenderers.Count <= 0)
{
return;
}
foreach (Renderer hiddenCursorRenderer2 in _hiddenCursorRenderers)
{
if ((Object)(object)hiddenCursorRenderer2 != (Object)null)
{
hiddenCursorRenderer2.enabled = true;
}
}
_hiddenCursorRenderers.Clear();
}
catch (Exception ex)
{
if (_clickLogs++ < 10)
{
ManualLogSource l2 = Plugin.L;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(9, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Cursor] ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex);
}
l2.LogError(val3);
}
}
}
private static void OpenEditor(ulong id, string name)
{
_editId = id;
_editName = name;
_editText = NoteStore.Get(id);
}
private static void CloseEditor()
{
_editId = 0uL;
}
private static void ForceOsCursor(bool on)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
if (on)
{
if (!_cursorOverridden)
{
_prevLock = Cursor.lockState;
_prevVisible = Cursor.visible;
_cursorOverridden = true;
}
Cursor.lockState = (CursorLockMode)0;
Cursor.visible = true;
}
else if (_cursorOverridden)
{
Cursor.lockState = _prevLock;
Cursor.visible = _prevVisible;
_cursorOverridden = false;
}
}
private static Vector2? GetGameCursorGui()
{
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Expected O, but got Unknown
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Expected O, but got Unknown
if ((Object)(object)_cam == (Object)null)
{
return null;
}
if ((Object)(object)_cursorTf == (Object)null || !((Component)_cursorTf).gameObject.activeInHierarchy)
{
_cursorTf = null;
if (Time.unscaledTime - _lastCursorScan < 2f)
{
return null;
}
_lastCursorScan = Time.unscaledTime;
int cullingMask = _cam.cullingMask;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val2;
foreach (Object item in (Il2CppArrayBase<Object>)(object)Resources.FindObjectsOfTypeAll(Il2CppType.Of<Transform>()))
{
Transform val = ((item != null) ? ((Il2CppObjectBase)item).TryCast<Transform>() : null);
if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy || (cullingMask & (1 << ((Component)val).gameObject.layer)) == 0 || ((Object)val).name.IndexOf("cursor", StringComparison.OrdinalIgnoreCase) < 0)
{
continue;
}
if (!_cursorListLogged)
{
ManualLogSource l = Plugin.L;
val2 = new BepInExInfoLogInterpolatedStringHandler(21, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Cursor] candidate '");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(GetPath(val));
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'");
}
l.LogInfo(val2);
}
if ((Object)(object)_cursorTf == (Object)null || GetDepth(val) < GetDepth(_cursorTf))
{
_cursorTf = val;
}
}
_cursorListLogged = true;
if ((Object)(object)_cursorTf == (Object)null)
{
return null;
}
ManualLogSource l2 = Plugin.L;
val2 = new BepInExInfoLogInterpolatedStringHandler(17, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Cursor] using '");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(GetPath(_cursorTf));
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'");
}
l2.LogInfo(val2);
}
Vector3 val3 = _cam.WorldToViewportPoint(_cursorTf.position);
return new Vector2(val3.x * (float)Screen.width, (1f - val3.y) * (float)Screen.height);
}
private static int GetDepth(Transform t)
{
int num = 0;
Transform parent = t.parent;
while ((Object)(object)parent != (Object)null)
{
num++;
parent = parent.parent;
}
return num;
}
private static string GetPath(Transform t)
{
string text = ((Object)t).name;
Transform parent = t.parent;
while ((Object)(object)parent != (Object)null)
{
text = ((Object)parent).name + "/" + text;
parent = parent.parent;
}
return text;
}
private static void Diag(string s)
{
_diag.Append(s).Append(" | ");
}
private static void FlushDiag()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Invalid comparison between Unknown and I4
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
if (Event.current == null || (int)Event.current.type != 7)
{
return;
}
string text = _diag.ToString();
_diag.Clear();
if (Plugin.DebugLog.Value && !(text == _lastDiag))
{
_lastDiag = text;
ManualLogSource l = Plugin.L;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(7, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Diag] ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
}
l.LogInfo(val);
}
}
public static void Draw()
{
_diag.Clear();
try
{
DrawInner();
}
catch (Exception ex)
{
Diag("EXCEPTION " + ex.GetType().Name + ": " + ex.Message);
}
FlushDiag();
}
private static void DrawInner()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Invalid comparison between Unknown and I4
if (Event.current != null && (int)Event.current.type == 7)
{
_icons.Clear();
}
if (!InReadyLobby())
{
_editId = 0uL;
return;
}
EnsureTextures();
if (_editId != 0L)
{
DrawEditor();
}
else
{
DrawIcons();
}
}
private static bool InReadyLobby()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
eGameStateName currentStateName = GameStateManager.CurrentStateName;
if ((int)currentStateName != 5)
{
Diag($"state={currentStateName}");
return false;
}
MainMenuGuiLayer current = MainMenuGuiLayer.Current;
if (current == null)
{
Diag("MainMenuGuiLayer null");
return false;
}
CM_PageLoadout pageLoadout = current.PageLoadout;
if ((Object)(object)pageLoadout == (Object)null)
{
Diag("PageLoadout null");
return false;
}
if (!((Component)pageLoadout).gameObject.activeInHierarchy)
{
Diag("PageLoadout inactive");
return false;
}
return true;
}
private static void DrawIcons()
{
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
//IL_02f4: Invalid comparison between Unknown and I4
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_0307: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_034c: Unknown result type (might be due to invalid IL or missing references)
//IL_0351: Unknown result type (might be due to invalid IL or missing references)
//IL_035b: Unknown result type (might be due to invalid IL or missing references)
//IL_037e: Unknown result type (might be due to invalid IL or missing references)
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
Il2CppReferenceArray<CM_PlayerLobbyBar> playerLobbyBars = MainMenuGuiLayer.Current.PageLoadout.m_playerLobbyBars;
if (playerLobbyBars == null)
{
Diag("bars null");
return;
}
int num = -1;
foreach (CM_PlayerLobbyBar item in (Il2CppArrayBase<CM_PlayerLobbyBar>)(object)playerLobbyBars)
{
num++;
if ((Object)(object)item == (Object)null)
{
Diag($"#{num} bar null");
continue;
}
SNet_Player player = item.m_player;
if ((Object)(object)player == (Object)null)
{
Diag($"#{num} empty");
continue;
}
if (player.IsBot)
{
Diag($"#{num} bot");
continue;
}
if (player.IsLocal && !Plugin.ShowOnSelf.Value)
{
Diag($"#{num} self(skip)");
continue;
}
TextMeshPro nickText = item.m_nickText;
if ((Object)(object)nickText == (Object)null)
{
Diag($"#{num} nickText null");
continue;
}
Rect rect = default(Rect);
string why = "";
if (((Component)nickText).gameObject.activeInHierarchy && TryGetIconRect(((Component)nickText).gameObject, out rect, out why))
{
if (num < _lastRect.Length)
{
_lastRect[num] = rect;
_lastTime[num] = Time.unscaledTime;
}
Diag($"#{num} OK {player.NickName}");
}
else
{
if (num >= _lastRect.Length || !(Time.unscaledTime - _lastTime[num] < 0.5f))
{
Diag($"#{num} {(((Component)nickText).gameObject.activeInHierarchy ? why : "nickText inactive")}");
continue;
}
rect = _lastRect[num];
}
ulong lookup = player.Lookup;
GUI.color = (NoteStore.HasNote(lookup) ? Orange : Color.white);
if ((int)Event.current.type == 7)
{
_icons.Add(new IconHit
{
Rect = rect,
Id = lookup,
Name = player.NickName
});
}
if (_gameCursorGui.HasValue && ((Rect)(ref rect)).Contains(_gameCursorGui.Value))
{
GUI.color = Color.Lerp(GUI.color, Color.yellow, 0.5f);
}
if ((Object)(object)_icon != (Object)null)
{
GUI.DrawTexture(rect, (Texture)(object)_icon);
}
GUI.color = Color.white;
}
}
private static bool TryGetIconRect(GameObject nickObj, out Rect rect, out string why)
{
//IL_0001: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: 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_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: 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_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
rect = default(Rect);
why = "";
bool flag = false;
Bounds val = default(Bounds);
foreach (Component item in (Il2CppArrayBase<Component>)(object)nickObj.GetComponentsInChildren(Il2CppType.Of<Renderer>(), false))
{
Renderer val2 = ((item != null) ? ((Il2CppObjectBase)item).TryCast<Renderer>() : null);
if ((Object)(object)val2 == (Object)null || !val2.enabled)
{
continue;
}
Bounds bounds = val2.bounds;
Vector3 size = ((Bounds)(ref bounds)).size;
if (!(((Vector3)(ref size)).sqrMagnitude < 1E-08f))
{
if (!flag)
{
val = bounds;
flag = true;
}
else
{
((Bounds)(ref val)).Encapsulate(bounds);
}
}
}
if (!flag)
{
why = "no Renderer";
return false;
}
Vector3 val3 = default(Vector3);
((Vector3)(ref val3))..ctor(((Bounds)(ref val)).max.x, ((Bounds)(ref val)).center.y, ((Bounds)(ref val)).center.z);
Camera val4 = FindCamera(nickObj.layer, val3, ((Object)nickObj).name);
if ((Object)(object)val4 == (Object)null)
{
why = $"no camera sees layer {nickObj.layer}";
return false;
}
Vector3 val5 = val4.WorldToViewportPoint(val3);
float num = val5.x * (float)Screen.width + 8f;
float num2 = (1f - val5.y) * (float)Screen.height - 13f;
rect = new Rect(num, num2, 26f, 26f);
return true;
}
private static bool InView(Camera c, Vector3 world, out Vector3 vp)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
vp = c.WorldToViewportPoint(world);
if (vp.z > 0f && vp.x >= -0.05f && vp.x <= 1.05f && vp.y >= -0.05f)
{
return vp.y <= 1.05f;
}
return false;
}
private static Camera? FindCamera(int layer, Vector3 world, string objName)
{
//IL_0027: 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_007e: Expected O, but got Unknown
//IL_0128: 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_03a6: Unknown result type (might be due to invalid IL or missing references)
//IL_03ad: Expected O, but got Unknown
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Expected O, but got Unknown
//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
int num = 1 << layer;
if ((Object)(object)_cam != (Object)null && (_cam.cullingMask & num) != 0 && InView(_cam, world, out var _))
{
return _cam;
}
if (Time.unscaledTime - _lastScanTime < 1f)
{
return null;
}
_lastScanTime = Time.unscaledTime;
bool flag = _camListLogCount < 3;
_camListLogCount++;
bool flag2 = default(bool);
if (flag)
{
ManualLogSource l = Plugin.L;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(33, 4, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Cam] scan for '");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(objName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' layer=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(layer);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" screen=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Screen.width);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("x");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Screen.height);
}
l.LogInfo(val);
}
Camera val2 = null;
float num2 = float.MinValue;
foreach (Object item in (Il2CppArrayBase<Object>)(object)Resources.FindObjectsOfTypeAll(Il2CppType.Of<Camera>()))
{
Camera val3 = ((item != null) ? ((Il2CppObjectBase)item).TryCast<Camera>() : null);
if ((Object)(object)val3 == (Object)null)
{
continue;
}
Scene scene = ((Component)val3).gameObject.scene;
if (!((Scene)(ref scene)).IsValid())
{
continue;
}
bool flag3 = (val3.cullingMask & num) != 0;
Vector3 vp2;
bool flag4 = InView(val3, world, out vp2);
if (flag)
{
ManualLogSource l2 = Plugin.L;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(71, 13, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Cam] '");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)val3).name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' layer=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(flag3);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" view=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(flag4);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" enabled=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(((Behaviour)val3).enabled);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("active=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(((Component)val3).gameObject.activeInHierarchy);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" rt=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>((Object)(object)val3.targetTexture != (Object)null);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("ortho=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(val3.orthographic);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" px=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(val3.pixelWidth);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("x");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(val3.pixelHeight);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" depth=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(val3.depth);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("vp=(");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(vp2.x, "0.00");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(",");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(vp2.y, "0.00");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(",");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(vp2.z, "0.0");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
}
l2.LogInfo(val);
}
if (flag3 && flag4)
{
float num3 = (((Component)val3).gameObject.activeInHierarchy ? 100f : 0f) + (((Object)(object)val3.targetTexture == (Object)null) ? 10f : 0f) + val3.depth * 0.01f;
if (num3 > num2)
{
num2 = num3;
val2 = val3;
}
}
}
if ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)_cam)
{
_cam = val2;
ManualLogSource l3 = Plugin.L;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Cam] using '");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)val2).name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
}
l3.LogInfo(val);
}
return val2;
}
private static void DrawEditor()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Invalid comparison between Unknown and I4
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Invalid comparison between Unknown and I4
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Invalid comparison between Unknown and I4
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Invalid comparison between Unknown and I4
float num = Mathf.Min(520f, (float)Screen.width - 40f);
float num2 = 300f;
Rect val = default(Rect);
((Rect)(ref val))..ctor(((float)Screen.width - num) / 2f, ((float)Screen.height - num2) / 2f, num, num2);
GUIStyle val2 = new GUIStyle(GUI.skin.box);
val2.normal.background = _panelBg;
GUI.color = Color.white;
GUI.Box(val, "", val2);
GUI.Label(new Rect(((Rect)(ref val)).x + 14f, ((Rect)(ref val)).y + 10f, num - 28f, 22f), "Player Note · " + _editName);
GUI.Label(new Rect(((Rect)(ref val)).x + 14f, ((Rect)(ref val)).y + 30f, num - 28f, 20f), $"Steam ID: {_editId} (only visible to you) Ctrl+Enter: Save · Esc: Close");
Event current = Event.current;
if (current != null && (int)current.type == 4)
{
if ((int)current.keyCode == 27)
{
current.Use();
CloseEditor();
return;
}
if (((int)current.keyCode == 13 || (int)current.keyCode == 271) && (current.control || current.command))
{
current.Use();
SaveAndClose();
return;
}
if (current.character == '\n' && (current.control || current.command))
{
current.Use();
}
}
GUI.SetNextControlName("LobbyNotesText");
_editText = GUI.TextArea(new Rect(((Rect)(ref val)).x + 14f, ((Rect)(ref val)).y + 56f, num - 28f, num2 - 112f), _editText, 500);
GUI.FocusControl("LobbyNotesText");
float num3 = ((Rect)(ref val)).y + num2 - 44f;
float num4 = 100f;
if (GUI.Button(new Rect(((Rect)(ref val)).x + 14f, num3, num4, 30f), "Save"))
{
SaveAndClose();
}
else if (GUI.Button(new Rect(((Rect)(ref val)).x + 24f + num4, num3, num4, 30f), "Delete"))
{
DeleteAndClose();
}
else if (GUI.Button(new Rect(((Rect)(ref val)).xMax - 14f - num4, num3, num4, 30f), "Close"))
{
CloseEditor();
}
}
private static void EnsureTextures()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_icon == (Object)null)
{
_icon = MakeNotepadIcon();
}
if ((Object)(object)_panelBg == (Object)null)
{
_panelBg = new Texture2D(1, 1)
{
hideFlags = (HideFlags)61
};
_panelBg.SetPixel(0, 0, new Color(0.08f, 0.08f, 0.09f, 0.95f));
_panelBg.Apply();
}
}
private static Texture2D MakeNotepadIcon()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false)
{
hideFlags = (HideFlags)61,
filterMode = (FilterMode)1
};
Color val2 = default(Color);
((Color)(ref val2))..ctor(1f, 1f, 1f, 0f);
Color white = Color.white;
for (int i = 0; i < 32; i++)
{
for (int j = 0; j < 32; j++)
{
bool flag = j >= 6 && j <= 25 && i >= 3 && i <= 28;
bool flag2 = j + (31 - i) > 33 && j > 19 && i > 22;
bool flag3 = i >= 26 && i <= 28 && j >= 6 && j <= 25 && j % 4 == 1;
bool flag4 = (i == 8 || i == 13 || i == 18) && j >= 10 && j <= 21;
bool flag5 = i == 23 && j >= 10 && j <= 17;
val.SetPixel(j, i, (flag && !flag2 && !flag3 && !flag4 && !flag5) ? white : val2);
}
}
val.Apply();
return val;
}
}
public class NoteEntry
{
public string LastName { get; set; } = "";
public string Note { get; set; } = "";
public DateTime Updated { get; set; }
}
public static class NoteStore
{
private static readonly Dictionary<ulong, NoteEntry> _notes = new Dictionary<ulong, NoteEntry>();
private static string _path = "";
private static readonly JsonSerializerOptions _json = new JsonSerializerOptions
{
WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
};
public static void Load(string path)
{
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Expected O, but got Unknown
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
_path = path;
_notes.Clear();
bool flag = default(bool);
try
{
if (!File.Exists(path))
{
return;
}
Dictionary<string, NoteEntry> dictionary = JsonSerializer.Deserialize<Dictionary<string, NoteEntry>>(File.ReadAllText(path), _json);
if (dictionary == null)
{
return;
}
foreach (KeyValuePair<string, NoteEntry> item in dictionary)
{
if (ulong.TryParse(item.Key, out var result) && item.Value != null)
{
_notes[result] = item.Value;
}
}
ManualLogSource l = Plugin.L;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loaded ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_notes.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" notes");
}
l.LogInfo(val);
}
catch (Exception ex)
{
ManualLogSource l2 = Plugin.L;
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(17, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("메모 파일을 읽지 못했습니다: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
l2.LogError(val2);
}
}
public static bool HasNote(ulong steamId)
{
if (_notes.TryGetValue(steamId, out NoteEntry value))
{
return !string.IsNullOrWhiteSpace(value.Note);
}
return false;
}
public static string Get(ulong steamId)
{
if (!_notes.TryGetValue(steamId, out NoteEntry value))
{
return "";
}
return value.Note;
}
public static void Set(ulong steamId, string nickName, string note)
{
if (string.IsNullOrWhiteSpace(note))
{
_notes.Remove(steamId);
}
else
{
_notes[steamId] = new NoteEntry
{
LastName = nickName,
Note = note.Trim(),
Updated = DateTime.Now
};
}
Save();
}
private static void Save()
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
try
{
Dictionary<string, NoteEntry> value = _notes.ToDictionary<KeyValuePair<ulong, NoteEntry>, string, NoteEntry>((KeyValuePair<ulong, NoteEntry> kv) => kv.Key.ToString(), (KeyValuePair<ulong, NoteEntry> kv) => kv.Value);
string text = _path + ".tmp";
File.WriteAllText(text, JsonSerializer.Serialize(value, _json));
File.Move(text, _path, overwrite: true);
}
catch (Exception ex)
{
ManualLogSource l = Plugin.L;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(10, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("메모 저장 실패: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
l.LogError(val);
}
}
}
[BepInPlugin("LobbyNotes", "LobbyNotes", "1.0.0")]
public class Plugin : BasePlugin
{
public const string GUID = "LobbyNotes";
public const string NAME = "LobbyNotes";
public const string VERSION = "1.0.0";
internal static ManualLogSource L;
internal static ConfigEntry<bool> ShowOnSelf;
internal static ConfigEntry<bool> DebugLog;
public override void Load()
{
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Expected O, but got Unknown
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Expected O, but got Unknown
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Expected O, but got Unknown
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Expected O, but got Unknown
L = ((BasePlugin)this).Log;
ShowOnSelf = ((BasePlugin)this).Config.Bind<bool>("Debug", "ShowOnSelf", false, "Show the note icon on your own slot as well (for testing)");
DebugLog = ((BasePlugin)this).Config.Bind<bool>("Debug", "DebugLog", false, "Write troubleshooting info to the BepInEx log");
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string text = Path.Combine(folderPath, "GTFOModding-LobbyNotes");
Directory.CreateDirectory(text);
string text2 = Path.Combine(text, "LobbyNotes.json");
string[] array = new string[2]
{
Path.Combine(folderPath, "GTFO-Modding", "LobbyNotes", "LobbyNotes.json"),
Path.Combine(Paths.ConfigPath, "LobbyNotes.json")
};
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val;
if (!File.Exists(text2))
{
string[] array2 = array;
foreach (string text3 in array2)
{
if (!File.Exists(text3))
{
continue;
}
try
{
File.Copy(text3, text2);
ManualLogSource log = ((BasePlugin)this).Log;
val = new BepInExInfoLogInterpolatedStringHandler(24, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("기존 메모를 새 위치로 복사했습니다: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text3);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" → ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text2);
}
log.LogInfo(val);
}
catch (Exception ex)
{
ManualLogSource log2 = ((BasePlugin)this).Log;
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(13, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("기존 메모 복사 실패: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
log2.LogError(val2);
}
break;
}
}
NoteStore.Load(text2);
ManualLogSource log3 = ((BasePlugin)this).Log;
val = new BepInExInfoLogInterpolatedStringHandler(7, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("메모 파일: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text2);
}
log3.LogInfo(val);
ClassInjector.RegisterTypeInIl2Cpp<NoteOverlay>();
((BasePlugin)this).AddComponent<NoteOverlay>();
ManualLogSource log4 = ((BasePlugin)this).Log;
val = new BepInExInfoLogInterpolatedStringHandler(8, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("LobbyNotes");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded");
}
log4.LogInfo(val);
}
}
}