using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Video;
[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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+950e6cf3a76cad758556ea6190b5bc78c8dee6be")]
[assembly: AssemblyProduct("RepoMessenger")]
[assembly: AssemblyTitle("RepoMessenger")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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]
[Microsoft.CodeAnalysis.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]
[Microsoft.CodeAnalysis.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 RepoMessenger
{
[BepInPlugin("Omniscye.RepoMessenger", "RepoMessenger", "1.1")]
public class RepoMessenger : BaseUnityPlugin
{
internal static ManualLogSource Log;
internal static string PluginDir;
internal static ConfigEntry<KeyCode> OpenKey;
private Harmony _harmony;
private const string AsciiArt = "\r\n____ ____ ___ ____ \r\n|__/ |___ |__] | | \r\n| \\ |___ | |__| \r\n \r\n_ _ ____ ____ ____ ____ _ _ ____ ____ ____ \r\n|\\/| |___ [__ [__ |___ |\\ | | __ |___ |__/ \r\n| | |___ ___] ___] |___ | \\| |__] |___ | \\ ";
private void Awake()
{
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Expected O, but got Unknown
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
try
{
PluginInfo info = ((BaseUnityPlugin)this).Info;
PluginDir = Path.GetDirectoryName((info != null) ? info.Location : null);
if (string.IsNullOrEmpty(PluginDir))
{
string location = Assembly.GetExecutingAssembly().Location;
if (!string.IsNullOrEmpty(location))
{
PluginDir = Path.GetDirectoryName(location);
}
}
}
catch
{
}
if (string.IsNullOrEmpty(PluginDir))
{
try
{
PluginDir = Paths.PluginPath;
}
catch
{
}
}
OpenKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Input", "OpenKey", (KeyCode)308, "Key used to toggle RepoMessenger.");
((BaseUnityPlugin)this).Logger.LogInfo((object)"\r\n____ ____ ___ ____ \r\n|__/ |___ |__] | | \r\n| \\ |___ | |__| \r\n \r\n_ _ ____ ____ ____ ____ _ _ ____ ____ ____ \r\n|\\/| |___ [__ [__ |___ |\\ | | __ |___ |__/ \r\n| | |___ ___] ___] |___ | \\| |__] |___ | \\ ");
((BaseUnityPlugin)this).Logger.LogInfo((object)"RepoMessenger loading...");
_harmony = new Harmony("Omniscye.RepoMessenger");
_harmony.PatchAll(Assembly.GetExecutingAssembly());
if ((Object)(object)RepoMessengerUI.Instance == (Object)null)
{
SpawnUI();
}
GameObject val = new GameObject("RepoMessenger_NetHost");
((Object)val).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)val);
val.AddComponent<RepoMessengerNetHandler>();
((BaseUnityPlugin)this).Logger.LogInfo((object)"RepoMessenger boot complete.");
}
private void OnDestroy()
{
try
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
catch
{
}
}
private void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(OpenKey.Value))
{
if ((Object)(object)RepoMessengerUI.Instance == (Object)null)
{
SpawnUI();
}
RepoMessengerUI.Instance.Toggle();
}
if (Input.GetKeyDown((KeyCode)289))
{
if ((Object)(object)RepoMessengerUI.Instance != (Object)null)
{
Object.Destroy((Object)(object)((Component)RepoMessengerUI.Instance).gameObject);
}
SpawnUI();
RepoMessengerUI.Instance.Show();
}
}
private void SpawnUI()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
GameObject val = new GameObject("RepoMessenger_Host");
((Object)val).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)val);
val.AddComponent<RepoMessengerUI>();
}
}
internal class RepoMessengerNetHandler : MonoBehaviourPunCallbacks, IOnEventCallback
{
private const byte ChatEventCode = 197;
private bool _callbackHooked;
private void OnEnable()
{
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnDisable()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
if (_callbackHooked)
{
PhotonNetwork.RemoveCallbackTarget((object)this);
}
_callbackHooked = false;
}
public override void OnJoinedRoom()
{
EnsureCallbackHooked();
}
public override void OnLeftRoom()
{
if (_callbackHooked)
{
PhotonNetwork.RemoveCallbackTarget((object)this);
_callbackHooked = false;
}
}
private void EnsureCallbackHooked()
{
if (!_callbackHooked)
{
PhotonNetwork.AddCallbackTarget((object)this);
_callbackHooked = true;
}
}
private void OnSceneLoaded(Scene s, LoadSceneMode m)
{
string text = ((Scene)(ref s)).name ?? "";
if (text.IndexOf("Lobby", StringComparison.OrdinalIgnoreCase) < 0 && (PhotonNetwork.InRoom || !PhotonNetwork.IsConnected))
{
EnsureCallbackHooked();
}
}
private static string GetLocalSteamId()
{
try
{
PlayerController instance = PlayerController.instance;
if ((Object)(object)instance?.playerAvatar != (Object)null)
{
return instance.playerAvatar.GetComponent<PlayerAvatar>()?.steamID ?? "";
}
}
catch
{
}
return "";
}
private static string ResolveStickerPath(string baseNameNoExt)
{
string baseNameNoExt2 = baseNameNoExt;
string pluginDir = RepoMessenger.PluginDir;
string dir2 = null;
try
{
dir2 = Paths.PluginPath;
}
catch
{
}
string[] exts = new string[5] { ".mp4", ".gif", ".png", ".jpg", ".jpeg" };
return Probe(pluginDir) ?? Probe(dir2);
string Probe(string dir)
{
if (string.IsNullOrEmpty(dir))
{
return null;
}
string[] array = exts;
foreach (string text in array)
{
string text2 = Path.Combine(dir, baseNameNoExt2 + text);
if (File.Exists(text2))
{
return text2;
}
}
return null;
}
}
public void OnEvent(EventData photonEvent)
{
if (photonEvent.Code != 197)
{
return;
}
try
{
if (!(photonEvent.CustomData is object[] array) || array.Length < 4)
{
return;
}
string text = (array[0] as string) ?? "?";
string text2 = (array[1] as string) ?? "";
string text3 = (array[2] as string) ?? "";
string text4 = (array[3] as string) ?? "";
if (!(text2 == GetLocalSteamId()))
{
ChatEntry e;
if (!string.IsNullOrEmpty(text4))
{
string text5 = ResolveStickerPath(text4);
e = ((!string.IsNullOrEmpty(text5)) ? ChatEntry.MakeSticker(text, text2, text5, local: false, text3) : new ChatEntry(text, text2, "[Sticker '" + text4 + "' not found] " + text3, local: false));
}
else
{
e = new ChatEntry(text, text2, text3, local: false);
}
ChatLog.Add(e);
RepoMessengerUI.Instance?.PlayReceiveSound();
RepoMessengerUI.Instance?.NotifyIncoming(text);
}
}
catch
{
}
}
public static void SendChat(string senderName, string senderSteamId, string message, string stickerBase)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_0049: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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)
object[] array = new object[4]
{
senderName ?? "?",
senderSteamId ?? "",
message ?? "",
stickerBase ?? ""
};
RaiseEventOptions val = new RaiseEventOptions
{
Receivers = (ReceiverGroup)1
};
SendOptions val2 = default(SendOptions);
((SendOptions)(ref val2)).Reliability = true;
SendOptions val3 = val2;
try
{
PhotonNetwork.RaiseEvent((byte)197, (object)array, val, val3);
}
catch
{
}
}
}
public class ChatEntry
{
public string SenderName;
public string SenderSteamId;
public string Message;
public DateTime Time;
public bool Local;
public bool IsSticker;
public string StickerPath;
public ChatEntry(string name, string steamId, string message, bool local)
{
SenderName = (string.IsNullOrEmpty(name) ? "?" : name);
SenderSteamId = steamId ?? string.Empty;
Message = message ?? string.Empty;
Local = local;
Time = DateTime.Now;
IsSticker = false;
StickerPath = null;
}
public static ChatEntry MakeSticker(string name, string steamId, string absolutePath, bool local, string caption = "")
{
return new ChatEntry(name, steamId, caption ?? string.Empty, local)
{
IsSticker = true,
StickerPath = absolutePath
};
}
}
public static class ChatLog
{
private static readonly List<ChatEntry> _entries = new List<ChatEntry>();
public const int MaxEntries = 200;
public static IReadOnlyList<ChatEntry> Entries => _entries;
public static void Add(ChatEntry e)
{
if (e != null && (e.IsSticker || !string.IsNullOrWhiteSpace(e.Message)))
{
_entries.Add(e);
while (_entries.Count > 200)
{
_entries.RemoveAt(0);
}
RepoMessengerUI.Instance?.RefreshList();
}
}
public static void Clear()
{
_entries.Clear();
RepoMessengerUI.Instance?.RefreshList();
}
}
public class RepoMessengerUI : MonoBehaviour
{
private struct Theme
{
public Color PanelBg;
public Color HeaderBg;
public Color HeaderText;
public Color MessageText;
public Color NameText;
public Color InputBg;
public Color InputText;
public Color PlaceholderText;
public Color Accent;
public Color NotifyBar;
}
private sealed class RtReleaser : MonoBehaviour
{
public RenderTexture Rt;
private void OnDestroy()
{
try
{
if ((Object)(object)Rt != (Object)null)
{
Rt.Release();
Object.Destroy((Object)(object)Rt);
}
}
catch
{
}
}
}
[CompilerGenerated]
private sealed class <CoScrollToBottom>d__63 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RepoMessengerUI <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CoScrollToBottom>d__63(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Canvas.ForceUpdateCanvases();
if ((Object)(object)<>4__this._scroll != (Object)null)
{
<>4__this._scroll.verticalNormalizedPosition = 0f;
}
<>2__current = null;
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
Canvas.ForceUpdateCanvases();
if ((Object)(object)<>4__this._scroll != (Object)null)
{
<>4__this._scroll.verticalNormalizedPosition = 0f;
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <ScrollToBottomEndOfFrame>d__61 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RepoMessengerUI <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ScrollToBottomEndOfFrame>d__61(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
try
{
<>4__this._scroll.verticalNormalizedPosition = 0f;
}
catch
{
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private Theme _currentTheme;
private Canvas _canvas;
private RectTransform _root;
private GameObject _panel;
private ScrollRect _scroll;
private RectTransform _content;
private TMP_InputField _input;
private readonly List<GameObject> _spawnedItems = new List<GameObject>();
private Image _panelImg;
private Image _headerBgImg;
private TextMeshProUGUI _headerTextTMP;
private Image _inputBgImg;
private Image _inputFieldBgImg;
private TextMeshProUGUI _inputTextTMP;
private TextMeshProUGUI _placeholderTMP;
private GameObject _notifyBar;
private TextMeshProUGUI _notifyText;
private Image _notifyImg;
private float _notifyTimer;
private bool _notifyVisible;
private AudioSource _audio;
private AudioClip _sndSend;
private AudioClip _sndRecv;
private bool _open;
private float _pulseT;
private readonly List<Behaviour> _disabledChatBehaviours = new List<Behaviour>();
private readonly Dictionary<string, Texture2D> _stickerCache = new Dictionary<string, Texture2D>(StringComparer.OrdinalIgnoreCase);
public static RepoMessengerUI Instance { get; private set; }
private static Theme ThemeBlue => MakeTheme(new Color(0.08f, 0.09f, 0.12f, 0.92f), new Color(0.1f, 0.14f, 0.22f, 1f), new Color(0.85f, 0.9f, 1f, 1f), new Color(0.92f, 0.95f, 1f, 1f), new Color(0.9f, 0.95f, 1f, 1f), new Color(0.07f, 0.09f, 0.14f, 1f), new Color(0.9f, 0.95f, 1f, 1f), new Color(1f, 1f, 1f, 0.4f), new Color(0.2f, 0.5f, 1f, 1f), new Color(0.15f, 0.45f, 1f, 0.95f));
private static Theme ThemeRed => MakeTheme(new Color(0.12f, 0.06f, 0.06f, 0.92f), new Color(0.22f, 0.1f, 0.1f, 1f), new Color(1f, 0.9f, 0.9f, 1f), new Color(1f, 0.92f, 0.92f, 1f), new Color(1f, 0.95f, 0.95f, 1f), new Color(0.14f, 0.07f, 0.07f, 1f), new Color(1f, 0.95f, 0.95f, 1f), new Color(1f, 1f, 1f, 0.4f), new Color(1f, 0.25f, 0.25f, 1f), new Color(1f, 0.2f, 0.2f, 0.95f));
private static Theme ThemePink => MakeTheme(new Color(0.12f, 0.07f, 0.12f, 0.92f), new Color(0.2f, 0.1f, 0.2f, 1f), new Color(1f, 0.92f, 1f, 1f), new Color(1f, 0.94f, 1f, 1f), new Color(1f, 0.96f, 1f, 1f), new Color(0.13f, 0.08f, 0.13f, 1f), new Color(1f, 0.96f, 1f, 1f), new Color(1f, 1f, 1f, 0.45f), new Color(1f, 0.35f, 0.75f, 1f), new Color(1f, 0.3f, 0.7f, 0.95f));
private static Theme ThemeOrange => MakeTheme(new Color(0.12f, 0.09f, 0.06f, 0.92f), new Color(0.22f, 0.15f, 0.08f, 1f), new Color(1f, 0.95f, 0.85f, 1f), new Color(1f, 0.96f, 0.9f, 1f), new Color(1f, 0.97f, 0.92f, 1f), new Color(0.14f, 0.1f, 0.07f, 1f), new Color(1f, 0.97f, 0.92f, 1f), new Color(1f, 1f, 1f, 0.4f), new Color(1f, 0.55f, 0.2f, 1f), new Color(1f, 0.5f, 0.2f, 0.95f));
private static Theme MakeTheme(Color panel, Color header, Color headerText, Color msg, Color name, Color inputBg, Color inputText, Color placeholder, Color accent, Color notify)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
Theme result = default(Theme);
result.PanelBg = panel;
result.HeaderBg = header;
result.HeaderText = headerText;
result.MessageText = msg;
result.NameText = name;
result.InputBg = inputBg;
result.InputText = inputText;
result.PlaceholderText = placeholder;
result.Accent = accent;
result.NotifyBar = notify;
return result;
}
private void Awake()
{
if ((Object)(object)Instance != (Object)null)
{
Object.Destroy((Object)(object)this);
return;
}
Instance = this;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
BuildCanvasHardTop();
BuildMessengerUI();
BuildAudio();
ApplyTheme(ThemeBlue);
Hide();
}
private void Update()
{
//IL_0006: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(RepoMessenger.OpenKey.Value))
{
Toggle();
}
if ((Object)(object)_notifyBar != (Object)null && _notifyVisible)
{
_pulseT += Time.unscaledDeltaTime * 2f;
if ((Object)(object)_notifyImg != (Object)null)
{
float a = _currentTheme.NotifyBar.a * (0.9f + 0.1f * (0.5f + 0.5f * Mathf.Sin(_pulseT)));
Color notifyBar = _currentTheme.NotifyBar;
notifyBar.a = a;
((Graphic)_notifyImg).color = notifyBar;
}
}
if (_notifyVisible)
{
_notifyTimer -= Time.unscaledDeltaTime;
if (_notifyTimer <= 0f)
{
HideNotifyBar();
}
}
if (!_open)
{
return;
}
try
{
MenuManager instance = MenuManager.instance;
if (instance != null)
{
instance.TextInputActive();
}
}
catch
{
}
try
{
SemiFunc.InputDisableMovement();
}
catch
{
}
if ((Object)(object)_input != (Object)null && _input.isFocused && (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271)))
{
SendFromInput();
return;
}
if ((Object)(object)_scroll != (Object)null)
{
float y = Input.mouseScrollDelta.y;
if (Mathf.Abs(y) > 0.01f)
{
float num = y * 0.08f;
_scroll.verticalNormalizedPosition = Mathf.Clamp01(_scroll.verticalNormalizedPosition + num);
}
}
if (Input.GetKeyDown((KeyCode)27))
{
Hide();
}
}
public void Toggle()
{
if (_open)
{
Hide();
}
else
{
Show();
}
}
public void Show()
{
_open = true;
if ((Object)(object)_panel != (Object)null)
{
_panel.SetActive(true);
}
try
{
MenuManager instance = MenuManager.instance;
if (instance != null)
{
instance.TextInputActive();
}
}
catch
{
}
SetVanillaChatEnabled(enable: false);
if ((Object)(object)_input != (Object)null)
{
EventSystem current = EventSystem.current;
if (current != null)
{
current.SetSelectedGameObject(((Component)_input).gameObject);
}
_input.ActivateInputField();
_input.caretPosition = _input.text?.Length ?? 0;
}
RefreshList();
}
public void Hide()
{
_open = false;
if ((Object)(object)_panel != (Object)null)
{
_panel.SetActive(false);
}
SetVanillaChatEnabled(enable: true);
}
public bool IsOpen()
{
return _open;
}
public void PlaySendSound()
{
if ((Object)(object)_audio != (Object)null && (Object)(object)_sndSend != (Object)null)
{
_audio.PlayOneShot(_sndSend, 0.85f);
}
}
public void PlayReceiveSound()
{
if ((Object)(object)_audio != (Object)null && (Object)(object)_sndRecv != (Object)null)
{
_audio.PlayOneShot(_sndRecv, 0.9f);
}
}
public void NotifyIncoming(string fromName)
{
string text = (string.IsNullOrWhiteSpace(fromName) ? "Someone" : fromName);
ShowNotifyBar("New message from " + text);
}
private void ShowNotifyBar(string msg)
{
if (!((Object)(object)_notifyBar == (Object)null))
{
if ((Object)(object)_notifyText != (Object)null)
{
((TMP_Text)_notifyText).text = msg;
}
_notifyBar.SetActive(true);
_notifyVisible = true;
_notifyTimer = 5f;
_pulseT = 0f;
}
}
private void HideNotifyBar()
{
if (!((Object)(object)_notifyBar == (Object)null))
{
_notifyBar.SetActive(false);
_notifyVisible = false;
}
}
private void BuildAudio()
{
_audio = ((Component)_canvas).gameObject.AddComponent<AudioSource>();
_audio.playOnAwake = false;
_audio.dopplerLevel = 0f;
_audio.spatialBlend = 0f;
_sndSend = MakeBeepClip(1400f, 80, 0.5f, 30);
_sndRecv = MakeBeepClip(900f, 110, 0.6f, 40);
}
private AudioClip MakeBeepClip(float freqHz, int ms, float vol, int easeOutMs)
{
int num = 44100;
int num2 = Mathf.CeilToInt((float)num * ((float)ms / 1000f));
int num3 = Mathf.CeilToInt((float)num * ((float)easeOutMs / 1000f));
float[] array = new float[num2];
double num4 = 0.0;
double num5 = Math.PI * 2.0 * (double)freqHz / (double)num;
for (int i = 0; i < num2; i++)
{
float num6 = (float)Math.Sin(num4) * vol;
if (i > num2 - num3)
{
float num7 = (float)(num2 - i) / (float)num3;
num6 *= num7;
}
array[i] = num6;
num4 += num5;
}
AudioClip val = AudioClip.Create("RM_Beep_" + freqHz, num2, 1, num, false);
val.SetData(array, 0);
return val;
}
private void ApplyTheme(Theme t)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: 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)
_currentTheme = t;
if ((Object)(object)_panelImg != (Object)null)
{
((Graphic)_panelImg).color = t.PanelBg;
}
if ((Object)(object)_headerBgImg != (Object)null)
{
((Graphic)_headerBgImg).color = t.HeaderBg;
}
if ((Object)(object)_headerTextTMP != (Object)null)
{
((Graphic)_headerTextTMP).color = t.HeaderText;
}
if ((Object)(object)_inputBgImg != (Object)null)
{
((Graphic)_inputBgImg).color = t.InputBg;
}
if ((Object)(object)_inputFieldBgImg != (Object)null)
{
((Graphic)_inputFieldBgImg).color = t.InputBg * new Color(1f, 1f, 1f, 1f);
}
if ((Object)(object)_inputTextTMP != (Object)null)
{
((Graphic)_inputTextTMP).color = t.InputText;
}
if ((Object)(object)_placeholderTMP != (Object)null)
{
((Graphic)_placeholderTMP).color = t.PlaceholderText;
}
if ((Object)(object)_notifyImg != (Object)null)
{
((Graphic)_notifyImg).color = t.NotifyBar;
}
RefreshList();
}
private void SetVanillaChatEnabled(bool enable)
{
try
{
if (enable)
{
for (int i = 0; i < _disabledChatBehaviours.Count; i++)
{
Behaviour val = _disabledChatBehaviours[i];
if ((Object)(object)val != (Object)null)
{
val.enabled = true;
}
}
_disabledChatBehaviours.Clear();
ChatUI[] array = Resources.FindObjectsOfTypeAll<ChatUI>();
foreach (ChatUI val2 in array)
{
if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)null)
{
((Component)val2).gameObject.SetActive(true);
}
}
return;
}
ChatUI[] array2 = Resources.FindObjectsOfTypeAll<ChatUI>();
foreach (ChatUI val3 in array2)
{
if (!((Object)(object)val3 == (Object)null))
{
if (((Behaviour)val3).enabled)
{
((Behaviour)val3).enabled = false;
_disabledChatBehaviours.Add((Behaviour)(object)val3);
}
if ((Object)(object)((Component)val3).gameObject != (Object)null)
{
((Component)val3).gameObject.SetActive(false);
}
}
}
ChatManager[] array3 = Resources.FindObjectsOfTypeAll<ChatManager>();
foreach (ChatManager val4 in array3)
{
if (!((Object)(object)val4 == (Object)null) && ((Behaviour)val4).enabled)
{
((Behaviour)val4).enabled = false;
_disabledChatBehaviours.Add((Behaviour)(object)val4);
}
}
}
catch
{
}
}
private void BuildCanvasHardTop()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Expected O, but got Unknown
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: 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_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Expected O, but got Unknown
GameObject val = new GameObject("RepoMessenger_Canvas");
((Object)val).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)val);
_canvas = val.AddComponent<Canvas>();
_canvas.renderMode = (RenderMode)0;
_canvas.overrideSorting = true;
_canvas.sortingOrder = 999999;
CanvasScaler val2 = val.AddComponent<CanvasScaler>();
val2.uiScaleMode = (ScaleMode)1;
val2.referenceResolution = new Vector2(1920f, 1080f);
val2.screenMatchMode = (ScreenMatchMode)0;
val2.matchWidthOrHeight = 0.5f;
val.AddComponent<GraphicRaycaster>();
_root = new GameObject("RepoMessenger_Root").AddComponent<RectTransform>();
((Object)((Component)_root).gameObject).hideFlags = (HideFlags)61;
((Transform)_root).SetParent(((Component)_canvas).transform, false);
_root.anchorMin = new Vector2(0.5f, 0f);
_root.anchorMax = new Vector2(0.5f, 0f);
_root.pivot = new Vector2(0.5f, 0f);
_root.anchoredPosition = Vector2.zero;
if ((Object)(object)Object.FindObjectOfType<EventSystem>() == (Object)null)
{
GameObject val3 = new GameObject("EventSystem", new Type[2]
{
typeof(EventSystem),
typeof(StandaloneInputModule)
});
((Object)val3).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)val3);
}
_notifyBar = new GameObject("NotifyBar");
((Object)_notifyBar).hideFlags = (HideFlags)61;
RectTransform val4 = _notifyBar.AddComponent<RectTransform>();
((Transform)val4).SetParent(((Component)_canvas).transform, false);
val4.anchorMin = new Vector2(0f, 1f);
val4.anchorMax = new Vector2(1f, 1f);
val4.pivot = new Vector2(0.5f, 1f);
val4.sizeDelta = new Vector2(0f, 28f);
_notifyImg = _notifyBar.AddComponent<Image>();
((Graphic)_notifyImg).color = new Color(1f, 0f, 0f, 0.9f);
_notifyText = new GameObject("Label").AddComponent<TextMeshProUGUI>();
RectTransform component = ((Component)_notifyText).GetComponent<RectTransform>();
((Transform)component).SetParent(_notifyBar.transform, false);
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.offsetMin = new Vector2(6f, 0f);
component.offsetMax = new Vector2(-6f, 0f);
((TMP_Text)_notifyText).text = "New message!";
((TMP_Text)_notifyText).fontSize = 18f;
((TMP_Text)_notifyText).alignment = (TextAlignmentOptions)4097;
((Graphic)_notifyText).color = Color.white;
_notifyBar.SetActive(false);
}
private void BuildMessengerUI()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Expected O, but got Unknown
//IL_010c: 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_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Expected O, but got Unknown
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: 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_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0333: Expected O, but got Unknown
//IL_035d: Unknown result type (might be due to invalid IL or missing references)
//IL_0374: Unknown result type (might be due to invalid IL or missing references)
//IL_0381: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03de: Unknown result type (might be due to invalid IL or missing references)
//IL_03e5: Expected O, but got Unknown
//IL_041b: Unknown result type (might be due to invalid IL or missing references)
//IL_0436: Unknown result type (might be due to invalid IL or missing references)
//IL_0451: Unknown result type (might be due to invalid IL or missing references)
//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
//IL_04dd: Expected O, but got Unknown
//IL_0506: Unknown result type (might be due to invalid IL or missing references)
//IL_051d: Unknown result type (might be due to invalid IL or missing references)
//IL_0534: Unknown result type (might be due to invalid IL or missing references)
//IL_054b: Unknown result type (might be due to invalid IL or missing references)
//IL_0562: Unknown result type (might be due to invalid IL or missing references)
//IL_0594: Unknown result type (might be due to invalid IL or missing references)
//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
//IL_05ab: Expected O, but got Unknown
//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0603: Unknown result type (might be due to invalid IL or missing references)
//IL_061a: Unknown result type (might be due to invalid IL or missing references)
//IL_064c: Unknown result type (might be due to invalid IL or missing references)
//IL_066a: Unknown result type (might be due to invalid IL or missing references)
//IL_069d: Unknown result type (might be due to invalid IL or missing references)
//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0747: Unknown result type (might be due to invalid IL or missing references)
//IL_076a: Unknown result type (might be due to invalid IL or missing references)
//IL_079d: Unknown result type (might be due to invalid IL or missing references)
//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
//IL_07cb: Unknown result type (might be due to invalid IL or missing references)
//IL_07e2: Unknown result type (might be due to invalid IL or missing references)
//IL_083a: Unknown result type (might be due to invalid IL or missing references)
_panel = new GameObject("Panel");
((Object)_panel).hideFlags = (HideFlags)61;
RectTransform val = _panel.AddComponent<RectTransform>();
((Transform)val).SetParent((Transform)(object)_root, false);
val.anchorMin = new Vector2(0.5f, 0f);
val.anchorMax = new Vector2(0.5f, 0f);
val.pivot = new Vector2(0.5f, 0f);
val.sizeDelta = new Vector2(640f, 380f);
val.anchoredPosition = new Vector2(0f, 20f);
_panelImg = _panel.AddComponent<Image>();
((Graphic)_panelImg).color = new Color(0.08f, 0.08f, 0.1f, 0.92f);
GameObject val2 = new GameObject("Header");
((Object)val2).hideFlags = (HideFlags)61;
RectTransform val3 = val2.AddComponent<RectTransform>();
((Transform)val3).SetParent((Transform)(object)val, false);
val3.anchorMin = new Vector2(0f, 1f);
val3.anchorMax = new Vector2(1f, 1f);
val3.pivot = new Vector2(0.5f, 1f);
val3.sizeDelta = new Vector2(0f, 36f);
_headerBgImg = val2.AddComponent<Image>();
((Graphic)_headerBgImg).color = new Color(0.15f, 0.16f, 0.22f, 1f);
_headerTextTMP = new GameObject("Title").AddComponent<TextMeshProUGUI>();
RectTransform component = ((Component)_headerTextTMP).GetComponent<RectTransform>();
((Transform)component).SetParent((Transform)(object)val3, false);
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.offsetMin = new Vector2(12f, 0f);
component.offsetMax = new Vector2(-12f, 0f);
((TMP_Text)_headerTextTMP).text = "REPO Messenger";
((TMP_Text)_headerTextTMP).fontSize = 20f;
((TMP_Text)_headerTextTMP).alignment = (TextAlignmentOptions)4097;
((Graphic)_headerTextTMP).color = new Color(0.9f, 0.92f, 0.94f, 1f);
GameObject val4 = new GameObject("Scroll");
((Object)val4).hideFlags = (HideFlags)61;
RectTransform val5 = val4.AddComponent<RectTransform>();
((Transform)val5).SetParent((Transform)(object)val, false);
val5.anchorMin = new Vector2(0f, 0f);
val5.anchorMax = new Vector2(1f, 1f);
val5.offsetMin = new Vector2(8f, 54f);
val5.offsetMax = new Vector2(-8f, -50f);
_scroll = val4.AddComponent<ScrollRect>();
_scroll.horizontal = false;
_scroll.vertical = true;
_scroll.movementType = (MovementType)2;
_scroll.scrollSensitivity = 20f;
_scroll.inertia = true;
GameObject val6 = new GameObject("Viewport");
((Object)val6).hideFlags = (HideFlags)61;
RectTransform val7 = val6.AddComponent<RectTransform>();
((Transform)val7).SetParent((Transform)(object)val5, false);
val7.anchorMin = new Vector2(0f, 0f);
val7.anchorMax = new Vector2(1f, 1f);
val7.offsetMin = Vector2.zero;
val7.offsetMax = Vector2.zero;
Image val8 = val6.AddComponent<Image>();
((Graphic)val8).color = new Color(0f, 0f, 0f, 0f);
RectMask2D val9 = val6.AddComponent<RectMask2D>();
val9.padding = Vector4.zero;
GameObject val10 = new GameObject("Content");
((Object)val10).hideFlags = (HideFlags)61;
_content = val10.AddComponent<RectTransform>();
((Transform)_content).SetParent((Transform)(object)val7, false);
_content.anchorMin = new Vector2(0f, 1f);
_content.anchorMax = new Vector2(1f, 1f);
_content.pivot = new Vector2(0.5f, 1f);
VerticalLayoutGroup val11 = val10.AddComponent<VerticalLayoutGroup>();
((LayoutGroup)val11).childAlignment = (TextAnchor)0;
((HorizontalOrVerticalLayoutGroup)val11).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)val11).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val11).childForceExpandHeight = false;
((HorizontalOrVerticalLayoutGroup)val11).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val11).spacing = 6f;
ContentSizeFitter val12 = val10.AddComponent<ContentSizeFitter>();
val12.verticalFit = (FitMode)2;
_scroll.viewport = val7;
_scroll.content = _content;
GameObject val13 = new GameObject("InputBg");
((Object)val13).hideFlags = (HideFlags)61;
RectTransform val14 = val13.AddComponent<RectTransform>();
((Transform)val14).SetParent((Transform)(object)val, false);
val14.anchorMin = new Vector2(0f, 0f);
val14.anchorMax = new Vector2(1f, 0f);
val14.pivot = new Vector2(0.5f, 0f);
val14.sizeDelta = new Vector2(0f, 40f);
val14.anchoredPosition = new Vector2(0f, 6f);
_inputBgImg = val13.AddComponent<Image>();
((Graphic)_inputBgImg).color = new Color(0.12f, 0.12f, 0.16f, 1f);
GameObject val15 = new GameObject("Input");
((Object)val15).hideFlags = (HideFlags)61;
RectTransform val16 = val15.AddComponent<RectTransform>();
((Transform)val16).SetParent((Transform)(object)val14, false);
val16.anchorMin = new Vector2(0f, 0f);
val16.anchorMax = new Vector2(1f, 1f);
val16.offsetMin = new Vector2(8f, 4f);
val16.offsetMax = new Vector2(-8f, -4f);
_inputFieldBgImg = val15.AddComponent<Image>();
((Graphic)_inputFieldBgImg).color = new Color(0.08f, 0.08f, 0.12f, 1f);
_input = val15.AddComponent<TMP_InputField>();
_inputTextTMP = new GameObject("Text").AddComponent<TextMeshProUGUI>();
RectTransform component2 = ((Component)_inputTextTMP).GetComponent<RectTransform>();
((Transform)component2).SetParent((Transform)(object)val16, false);
component2.anchorMin = new Vector2(0f, 0f);
component2.anchorMax = new Vector2(1f, 1f);
component2.offsetMin = new Vector2(8f, 4f);
component2.offsetMax = new Vector2(-8f, -4f);
((TMP_Text)_inputTextTMP).text = "";
((TMP_Text)_inputTextTMP).fontSize = 18f;
((TMP_Text)_inputTextTMP).enableWordWrapping = true;
((TMP_Text)_inputTextTMP).alignment = (TextAlignmentOptions)4097;
((Graphic)_inputTextTMP).color = new Color(0.9f, 0.92f, 0.94f, 1f);
_input.textComponent = (TMP_Text)(object)_inputTextTMP;
_placeholderTMP = new GameObject("Placeholder").AddComponent<TextMeshProUGUI>();
RectTransform component3 = ((Component)_placeholderTMP).GetComponent<RectTransform>();
((Transform)component3).SetParent((Transform)(object)val16, false);
component3.anchorMin = new Vector2(0f, 0f);
component3.anchorMax = new Vector2(1f, 1f);
component3.offsetMin = new Vector2(8f, 4f);
component3.offsetMax = new Vector2(-8f, -4f);
((TMP_Text)_placeholderTMP).text = "Type a message… (themes: /themeblue /themered /themepink /themeorange - stickers: /cat /omni)";
((TMP_Text)_placeholderTMP).fontSize = 18f;
((TMP_Text)_placeholderTMP).alignment = (TextAlignmentOptions)4097;
((Graphic)_placeholderTMP).color = new Color(1f, 1f, 1f, 0.35f);
_input.placeholder = (Graphic)(object)_placeholderTMP;
_input.lineType = (LineType)0;
((UnityEventBase)_input.onSubmit).RemoveAllListeners();
((UnityEvent<string>)(object)_input.onSubmit).AddListener((UnityAction<string>)delegate
{
SendFromInput();
});
((UnityEventBase)_input.onEndEdit).RemoveAllListeners();
}
private bool TryHandleSlashCommand(string raw)
{
if (string.IsNullOrWhiteSpace(raw) || raw[0] != '/')
{
return false;
}
string text = raw.Trim();
string text2 = text.ToLowerInvariant();
if (text2 == "/themered" || text2 == "/theme red")
{
ApplyTheme(ThemeRed);
ShowNotifyBar("Theme set: Red");
return true;
}
if (text2 == "/themeblue" || text2 == "/theme blue")
{
ApplyTheme(ThemeBlue);
ShowNotifyBar("Theme set: Blue");
return true;
}
if (text2 == "/themepink" || text2 == "/theme pink")
{
ApplyTheme(ThemePink);
ShowNotifyBar("Theme set: Pink");
return true;
}
if (text2 == "/themeorange" || text2 == "/theme orange")
{
ApplyTheme(ThemeOrange);
ShowNotifyBar("Theme set: Orange");
return true;
}
if (text2.StartsWith("/cat") || text2.StartsWith("/omni"))
{
bool flag = text2.StartsWith("/cat");
string text3 = (flag ? "cat" : "omni");
string text4 = (flag ? "/cat" : "/omni");
string text5 = "";
if (text.Length > text4.Length && char.IsWhiteSpace(text[text4.Length]))
{
text5 = text.Substring(text4.Length).TrimStart();
}
string text6 = FindStickerFile(text3);
if (string.IsNullOrEmpty(text6))
{
ShowNotifyBar(text3 + " media not found next to the DLL.");
return true;
}
string text7 = "?";
string text8 = "";
try
{
PlayerController instance = PlayerController.instance;
if ((Object)(object)instance != (Object)null && (Object)(object)instance.playerAvatar != (Object)null)
{
PlayerAvatar component = instance.playerAvatar.GetComponent<PlayerAvatar>();
if ((Object)(object)component != (Object)null)
{
text7 = component.playerName ?? "?";
text8 = component.steamID ?? "";
}
}
}
catch
{
}
ChatLog.Add(ChatEntry.MakeSticker(text7, text8, text6, local: true, text5));
PlaySendSound();
RepoMessengerNetHandler.SendChat(text7, text8, text5, text3);
if ((Object)(object)_input != (Object)null)
{
_input.text = string.Empty;
_input.ActivateInputField();
_input.caretPosition = 0;
}
return true;
}
ShowNotifyBar("Unknown command.");
return true;
}
private void SendFromInput()
{
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
string text = (((Object)(object)_input != (Object)null) ? _input.text : "");
if (string.IsNullOrWhiteSpace(text) || TryHandleSlashCommand(text))
{
return;
}
string text2 = "?";
string text3 = "";
try
{
PlayerController instance = PlayerController.instance;
if ((Object)(object)instance != (Object)null && (Object)(object)instance.playerAvatar != (Object)null)
{
PlayerAvatar component = instance.playerAvatar.GetComponent<PlayerAvatar>();
if ((Object)(object)component != (Object)null)
{
text2 = component.playerName ?? "?";
text3 = component.steamID ?? "";
}
}
}
catch
{
}
ChatLog.Add(new ChatEntry(text2, text3, text, local: true));
try
{
PlayerController instance2 = PlayerController.instance;
if ((Object)(object)instance2 != (Object)null && (Object)(object)instance2.playerAvatar != (Object)null)
{
PlayerAvatar component2 = instance2.playerAvatar.GetComponent<PlayerAvatar>();
if (component2 != null)
{
component2.ChatMessageSendRPC(text, false, default(PhotonMessageInfo));
}
}
}
catch
{
}
RepoMessengerNetHandler.SendChat(text2, text3, text, "");
PlaySendSound();
if ((Object)(object)_input != (Object)null)
{
_input.text = string.Empty;
_input.ActivateInputField();
_input.caretPosition = 0;
}
}
public void RefreshList()
{
if ((Object)(object)_content == (Object)null)
{
return;
}
for (int num = _spawnedItems.Count - 1; num >= 0; num--)
{
GameObject val = _spawnedItems[num];
_spawnedItems.RemoveAt(num);
if ((Object)(object)val != (Object)null)
{
Object.Destroy((Object)(object)val);
}
}
foreach (ChatEntry entry in ChatLog.Entries)
{
_spawnedItems.Add(CreateEntryItem(entry));
}
Canvas.ForceUpdateCanvases();
((MonoBehaviour)this).StartCoroutine(ScrollToBottomEndOfFrame());
ScrollToBottomSoon();
}
[IteratorStateMachine(typeof(<ScrollToBottomEndOfFrame>d__61))]
private IEnumerator ScrollToBottomEndOfFrame()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ScrollToBottomEndOfFrame>d__61(0)
{
<>4__this = this
};
}
private void ScrollToBottomSoon()
{
((MonoBehaviour)this).StartCoroutine(CoScrollToBottom());
}
[IteratorStateMachine(typeof(<CoScrollToBottom>d__63))]
private IEnumerator CoScrollToBottom()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CoScrollToBottom>d__63(0)
{
<>4__this = this
};
}
private GameObject CreateEntryItem(ChatEntry e)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_0058: 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)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Expected O, but got Unknown
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: 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_01ee: 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_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Expected O, but got Unknown
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_033c: Unknown result type (might be due to invalid IL or missing references)
//IL_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_0383: Unknown result type (might be due to invalid IL or missing references)
//IL_039a: Unknown result type (might be due to invalid IL or missing references)
//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Unknown result type (might be due to invalid IL or missing references)
//IL_0ad3: Unknown result type (might be due to invalid IL or missing references)
//IL_0b03: Unknown result type (might be due to invalid IL or missing references)
//IL_0b1a: Unknown result type (might be due to invalid IL or missing references)
//IL_0b31: Unknown result type (might be due to invalid IL or missing references)
//IL_0b48: Unknown result type (might be due to invalid IL or missing references)
//IL_0b9a: Unknown result type (might be due to invalid IL or missing references)
//IL_0bb8: Unknown result type (might be due to invalid IL or missing references)
//IL_0bbd: Unknown result type (might be due to invalid IL or missing references)
//IL_0bc4: Unknown result type (might be due to invalid IL or missing references)
//IL_0bef: Unknown result type (might be due to invalid IL or missing references)
//IL_0c0e: Unknown result type (might be due to invalid IL or missing references)
//IL_0c29: Unknown result type (might be due to invalid IL or missing references)
//IL_0c6a: Unknown result type (might be due to invalid IL or missing references)
//IL_0697: Unknown result type (might be due to invalid IL or missing references)
//IL_069e: Expected O, but got Unknown
//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
//IL_06f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0710: Unknown result type (might be due to invalid IL or missing references)
//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
//IL_04b0: Expected O, but got Unknown
//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0513: Unknown result type (might be due to invalid IL or missing references)
//IL_052f: Unknown result type (might be due to invalid IL or missing references)
//IL_054b: Unknown result type (might be due to invalid IL or missing references)
//IL_055b: Unknown result type (might be due to invalid IL or missing references)
//IL_0562: Expected O, but got Unknown
//IL_07ec: Unknown result type (might be due to invalid IL or missing references)
//IL_081c: Unknown result type (might be due to invalid IL or missing references)
//IL_0833: Unknown result type (might be due to invalid IL or missing references)
//IL_084a: Unknown result type (might be due to invalid IL or missing references)
//IL_0861: Unknown result type (might be due to invalid IL or missing references)
//IL_088e: Unknown result type (might be due to invalid IL or missing references)
//IL_08a7: Unknown result type (might be due to invalid IL or missing references)
//IL_08ac: Unknown result type (might be due to invalid IL or missing references)
//IL_07a5: Unknown result type (might be due to invalid IL or missing references)
//IL_066a: Unknown result type (might be due to invalid IL or missing references)
//IL_0674: Expected O, but got Unknown
//IL_0a56: Unknown result type (might be due to invalid IL or missing references)
//IL_0a71: Unknown result type (might be due to invalid IL or missing references)
//IL_0ab2: Unknown result type (might be due to invalid IL or missing references)
//IL_08e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0918: Unknown result type (might be due to invalid IL or missing references)
//IL_092f: Unknown result type (might be due to invalid IL or missing references)
//IL_0946: Unknown result type (might be due to invalid IL or missing references)
//IL_098f: Unknown result type (might be due to invalid IL or missing references)
//IL_09ad: Unknown result type (might be due to invalid IL or missing references)
//IL_09b2: Unknown result type (might be due to invalid IL or missing references)
//IL_09b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0a08: Unknown result type (might be due to invalid IL or missing references)
//IL_0a1c: Unknown result type (might be due to invalid IL or missing references)
//IL_09e7: Unknown result type (might be due to invalid IL or missing references)
ChatEntry e2 = e;
GameObject val = new GameObject("Row");
((Object)val).hideFlags = (HideFlags)61;
RectTransform rt = val.AddComponent<RectTransform>();
((Transform)rt).SetParent((Transform)(object)_content, false);
rt.anchorMin = new Vector2(0f, 1f);
rt.anchorMax = new Vector2(1f, 1f);
rt.pivot = new Vector2(0.5f, 1f);
Image val2 = val.AddComponent<Image>();
((Graphic)val2).color = new Color(1f, 1f, 1f, 0f);
GameObject val3 = new GameObject("IconWrap");
((Object)val3).hideFlags = (HideFlags)61;
RectTransform val4 = val3.AddComponent<RectTransform>();
((Transform)val4).SetParent((Transform)(object)rt, false);
val4.anchorMin = new Vector2(0f, 1f);
val4.anchorMax = new Vector2(0f, 1f);
val4.pivot = new Vector2(0f, 1f);
val4.sizeDelta = new Vector2(40f, 40f);
val4.anchoredPosition = new Vector2(8f, -6f);
Image val5 = val3.AddComponent<Image>();
((Graphic)val5).color = UserColor(e2.SenderSteamId);
((Graphic)val5).raycastTarget = false;
Outline val6 = val3.AddComponent<Outline>();
((Shadow)val6).effectDistance = new Vector2(0.5f, -0.5f);
((Shadow)val6).effectColor = _currentTheme.Accent;
TextMeshProUGUI val7 = new GameObject("Initial").AddComponent<TextMeshProUGUI>();
RectTransform component = ((Component)val7).GetComponent<RectTransform>();
((Transform)component).SetParent((Transform)(object)val4, false);
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.offsetMin = Vector2.zero;
component.offsetMax = Vector2.zero;
((TMP_Text)val7).text = (string.IsNullOrEmpty(e2.SenderName) ? "?" : char.ToUpperInvariant(e2.SenderName[0]).ToString());
((TMP_Text)val7).fontSize = 20f;
((TMP_Text)val7).alignment = (TextAlignmentOptions)514;
((Graphic)val7).color = Color.white;
GameObject val8 = new GameObject("TextWrap");
((Object)val8).hideFlags = (HideFlags)61;
RectTransform textRT = val8.AddComponent<RectTransform>();
((Transform)textRT).SetParent((Transform)(object)rt, false);
textRT.anchorMin = new Vector2(0f, 1f);
textRT.anchorMax = new Vector2(1f, 1f);
textRT.pivot = new Vector2(0f, 1f);
textRT.offsetMin = new Vector2(56f, 0f);
textRT.offsetMax = new Vector2(-12f, 0f);
TextMeshProUGUI val9 = new GameObject("NameTime").AddComponent<TextMeshProUGUI>();
RectTransform component2 = ((Component)val9).GetComponent<RectTransform>();
((Transform)component2).SetParent((Transform)(object)textRT, false);
component2.anchorMin = new Vector2(0f, 1f);
component2.anchorMax = new Vector2(1f, 1f);
component2.pivot = new Vector2(0f, 1f);
component2.offsetMin = new Vector2(0f, -20f);
component2.offsetMax = new Vector2(0f, 0f);
((TMP_Text)val9).text = $"{e2.SenderName} <color=#8AA>{e2.Time:HH:mm}</color>";
((TMP_Text)val9).fontSize = 16f;
((TMP_Text)val9).fontStyle = (FontStyles)1;
((TMP_Text)val9).alignment = (TextAlignmentOptions)4097;
((Graphic)val9).color = _currentTheme.NameText;
float availableWidth = 556f;
float num = 52f;
if (e2.IsSticker && !string.IsNullOrEmpty(e2.StickerPath))
{
if (e2.StickerPath.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase))
{
GameObject val10 = new GameObject("Video");
RawImage raw = val10.AddComponent<RawImage>();
RectTransform rawRT = val10.GetComponent<RectTransform>();
((Transform)rawRT).SetParent((Transform)(object)textRT, false);
rawRT.anchorMin = new Vector2(0f, 1f);
rawRT.anchorMax = new Vector2(0f, 1f);
rawRT.pivot = new Vector2(0f, 1f);
rawRT.anchoredPosition = new Vector2(0f, -24f);
GameObject val11 = new GameObject("VideoPlayerHost");
RectTransform val12 = val11.AddComponent<RectTransform>();
((Transform)val12).SetParent((Transform)(object)rawRT, false);
VideoPlayer vp = val11.AddComponent<VideoPlayer>();
vp.playOnAwake = false;
vp.isLooping = true;
vp.source = (VideoSource)1;
string text = e2.StickerPath;
if (!text.StartsWith("file://", StringComparison.OrdinalIgnoreCase))
{
text = "file:///" + text.Replace('\\', '/');
}
vp.url = text;
vp.renderMode = (VideoRenderMode)2;
vp.audioOutputMode = (VideoAudioOutputMode)0;
LayoutElement leS = val.AddComponent<LayoutElement>();
leS.minHeight = num;
leS.preferredHeight = num;
leS.flexibleHeight = 0f;
vp.prepareCompleted += (EventHandler)delegate
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
try
{
uint num11 = vp.width;
uint num12 = vp.height;
if (num11 == 0 || num12 == 0)
{
num11 = 320u;
num12 = 180u;
}
float num13 = availableWidth;
float num14 = 220f;
float num15 = Mathf.Min(num13 / (float)num11, num14 / (float)num12);
int num16 = Mathf.Max(1, Mathf.RoundToInt((float)num11 * num15));
int num17 = Mathf.Max(1, Mathf.RoundToInt((float)num12 * num15));
RenderTexture val21 = new RenderTexture(num16, num17, 0);
RtReleaser rtReleaser = ((Component)raw).gameObject.AddComponent<RtReleaser>();
rtReleaser.Rt = val21;
vp.targetTexture = val21;
raw.texture = (Texture)(object)val21;
rawRT.sizeDelta = new Vector2((float)num16, (float)num17);
float num18 = 0f;
if (!string.IsNullOrEmpty(e2.Message))
{
TextMeshProUGUI val22 = new GameObject("Caption").AddComponent<TextMeshProUGUI>();
RectTransform component8 = ((Component)val22).GetComponent<RectTransform>();
((Transform)component8).SetParent((Transform)(object)textRT, false);
component8.anchorMin = new Vector2(0f, 1f);
component8.anchorMax = new Vector2(1f, 1f);
component8.pivot = new Vector2(0f, 1f);
((TMP_Text)val22).text = e2.Message;
((TMP_Text)val22).fontSize = 18f;
((TMP_Text)val22).enableWordWrapping = true;
((TMP_Text)val22).alignment = (TextAlignmentOptions)257;
((Graphic)val22).color = _currentTheme.MessageText;
Vector2 preferredValues3 = ((TMP_Text)val22).GetPreferredValues(((TMP_Text)val22).text, availableWidth, float.PositiveInfinity);
float num19 = Mathf.Max(18f, preferredValues3.y);
component8.anchoredPosition = new Vector2(0f, (float)(-24 - num17 - 6));
component8.sizeDelta = new Vector2(0f, num19);
num18 = 6f + num19;
}
float num20 = Mathf.Max(52f, 24f + (float)num17 + num18);
textRT.offsetMin = new Vector2(56f, 0f - num20 + 6f);
textRT.offsetMax = new Vector2(-12f, 0f);
leS.minHeight = num20;
leS.preferredHeight = num20;
rt.sizeDelta = new Vector2(0f, num20);
Canvas.ForceUpdateCanvases();
LayoutRebuilder.ForceRebuildLayoutImmediate(_content);
vp.Play();
ScrollToBottomSoon();
}
catch
{
}
};
try
{
vp.Prepare();
}
catch
{
}
}
else
{
GameObject val13 = new GameObject("Sticker");
RawImage val14 = val13.AddComponent<RawImage>();
RectTransform component3 = val13.GetComponent<RectTransform>();
((Transform)component3).SetParent((Transform)(object)textRT, false);
component3.anchorMin = new Vector2(0f, 1f);
component3.anchorMax = new Vector2(0f, 1f);
component3.pivot = new Vector2(0f, 1f);
component3.anchoredPosition = new Vector2(0f, -24f);
Texture2D val15 = LoadStickerTexture(e2.StickerPath);
if ((Object)(object)val15 != (Object)null)
{
val14.texture = (Texture)(object)val15;
float num2 = 556f;
float num3 = 220f;
float num4 = ((Texture)val15).width;
float num5 = ((Texture)val15).height;
float num6 = Mathf.Min(num2 / Mathf.Max(1f, num4), num3 / Mathf.Max(1f, num5));
num4 *= num6;
num5 *= num6;
component3.sizeDelta = new Vector2(num4, num5);
num = Mathf.Max(num, 24f + num5 + (string.IsNullOrEmpty(e2.Message) ? 6f : 0f));
}
else
{
TextMeshProUGUI val16 = new GameObject("StickerFail").AddComponent<TextMeshProUGUI>();
RectTransform component4 = ((Component)val16).GetComponent<RectTransform>();
((Transform)component4).SetParent((Transform)(object)textRT, false);
component4.anchorMin = new Vector2(0f, 1f);
component4.anchorMax = new Vector2(1f, 1f);
component4.pivot = new Vector2(0f, 1f);
component4.anchoredPosition = new Vector2(0f, -24f);
((TMP_Text)val16).text = "<i>[sticker not found]</i>";
((TMP_Text)val16).fontSize = 16f;
((Graphic)val16).color = _currentTheme.MessageText * new Color(1f, 1f, 1f, 0.8f);
num = Mathf.Max(num, 42f);
}
if (!string.IsNullOrEmpty(e2.Message))
{
TextMeshProUGUI val17 = new GameObject("Caption").AddComponent<TextMeshProUGUI>();
RectTransform component5 = ((Component)val17).GetComponent<RectTransform>();
((Transform)component5).SetParent((Transform)(object)textRT, false);
component5.anchorMin = new Vector2(0f, 1f);
component5.anchorMax = new Vector2(1f, 1f);
component5.pivot = new Vector2(0f, 1f);
((TMP_Text)val17).text = e2.Message;
((TMP_Text)val17).fontSize = 18f;
((TMP_Text)val17).enableWordWrapping = true;
((TMP_Text)val17).alignment = (TextAlignmentOptions)257;
((Graphic)val17).color = _currentTheme.MessageText;
Vector2 preferredValues = ((TMP_Text)val17).GetPreferredValues(((TMP_Text)val17).text, 556f, float.PositiveInfinity);
float num7 = Mathf.Max(18f, preferredValues.y);
float num8 = 0f;
RectTransform component6 = val13.GetComponent<RectTransform>();
if ((Object)(object)component6 != (Object)null)
{
num8 = component6.sizeDelta.y;
}
component5.anchoredPosition = new Vector2(0f, -24f - num8 - 6f);
component5.sizeDelta = new Vector2(0f, num7);
num = Mathf.Max(num, 24f + num8 + 6f + num7);
}
textRT.offsetMin = new Vector2(56f, 0f - num + 6f);
textRT.offsetMax = new Vector2(-12f, 0f);
LayoutElement val18 = val.AddComponent<LayoutElement>();
val18.minHeight = num;
val18.preferredHeight = num;
val18.flexibleHeight = 0f;
rt.sizeDelta = new Vector2(0f, num);
ScrollToBottomSoon();
}
return val;
}
TextMeshProUGUI val19 = new GameObject("Message").AddComponent<TextMeshProUGUI>();
RectTransform component7 = ((Component)val19).GetComponent<RectTransform>();
((Transform)component7).SetParent((Transform)(object)textRT, false);
component7.anchorMin = new Vector2(0f, 1f);
component7.anchorMax = new Vector2(1f, 1f);
component7.pivot = new Vector2(0f, 1f);
component7.anchoredPosition = new Vector2(0f, -24f);
((TMP_Text)val19).text = e2.Message ?? string.Empty;
((TMP_Text)val19).fontSize = 18f;
((TMP_Text)val19).enableWordWrapping = true;
((TMP_Text)val19).alignment = (TextAlignmentOptions)257;
((Graphic)val19).color = _currentTheme.MessageText;
Vector2 preferredValues2 = ((TMP_Text)val19).GetPreferredValues(((TMP_Text)val19).text, 556f, float.PositiveInfinity);
float num9 = Mathf.Max(18f, preferredValues2.y);
float num10 = Mathf.Max(52f, 24f + num9);
component7.sizeDelta = new Vector2(0f, num9);
textRT.offsetMin = new Vector2(56f, 0f - num10 + 6f);
textRT.offsetMax = new Vector2(-12f, 0f);
LayoutElement val20 = val.AddComponent<LayoutElement>();
val20.minHeight = num10;
val20.preferredHeight = num10;
val20.flexibleHeight = 0f;
rt.sizeDelta = new Vector2(0f, num10);
return val;
}
private Texture2D LoadStickerTexture(string absolutePath)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
try
{
if (string.IsNullOrEmpty(absolutePath))
{
return null;
}
if (_stickerCache.TryGetValue(absolutePath, out Texture2D value) && (Object)(object)value != (Object)null)
{
return value;
}
if (!File.Exists(absolutePath))
{
return null;
}
if (absolutePath.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase))
{
return null;
}
byte[] array = File.ReadAllBytes(absolutePath);
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
if (ImageConversion.LoadImage(val, array, false))
{
_stickerCache[absolutePath] = val;
return val;
}
return null;
}
catch
{
return null;
}
}
private string FindStickerFile(string baseNameNoExt)
{
string baseNameNoExt2 = baseNameNoExt;
string pluginDir = RepoMessenger.PluginDir;
string dir2 = null;
try
{
dir2 = Paths.PluginPath;
}
catch
{
}
string[] exts = new string[5] { ".mp4", ".gif", ".png", ".jpg", ".jpeg" };
return Probe(pluginDir) ?? Probe(dir2);
string Probe(string dir)
{
if (string.IsNullOrEmpty(dir))
{
return null;
}
string[] array = exts;
foreach (string text in array)
{
string text2 = Path.Combine(dir, baseNameNoExt2 + text);
if (File.Exists(text2))
{
return text2;
}
}
return null;
}
}
private Color UserColor(string steamId)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_0068: 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)
int num = 23;
if (!string.IsNullOrEmpty(steamId))
{
for (int i = 0; i < steamId.Length; i++)
{
num = num * 31 + steamId[i];
}
}
float num2 = (float)(num & 0xFFFFFF) / 16777215f;
Color result = Color.HSVToRGB(num2, 0.55f, 0.9f);
result.a = 1f;
return result;
}
}
[HarmonyPatch]
public static class ChatActivationInterceptor
{
private static MethodBase TargetMethod()
{
Type typeFromHandle = typeof(ChatManager);
return AccessTools.Method(typeFromHandle, "StateSet", new Type[1] { AccessTools.Inner(typeFromHandle, "ChatState") }, (Type[])null);
}
private static bool Prefix(object __instance, object state)
{
string text = state?.ToString();
bool flag = (Object)(object)RepoMessengerUI.Instance != (Object)null && RepoMessengerUI.Instance.IsOpen();
if (text == "Active")
{
if ((Object)(object)RepoMessengerUI.Instance != (Object)null)
{
RepoMessengerUI.Instance.Show();
}
return false;
}
if (text == "Send" && flag)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(InputManager), "KeyDown")]
public static class BlockKeysWhenMessengerOpen
{
private static bool Prefix(InputKey key, ref bool __result)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Invalid comparison between Unknown and I4
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Invalid comparison between Unknown and I4
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Invalid comparison between Unknown and I4
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Invalid comparison between Unknown and I4
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Invalid comparison between Unknown and I4
if ((Object)(object)RepoMessengerUI.Instance != (Object)null && RepoMessengerUI.Instance.IsOpen() && ((int)key == 7 || (int)key == 9 || (int)key == 13 || (int)key == 18 || (int)key == 6))
{
__result = false;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(SemiFunc), "InputDown")]
public static class BlockSemiInputDownWhenMessengerOpen
{
private static bool Prefix(InputKey key, ref bool __result)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Invalid comparison between Unknown and I4
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Invalid comparison between Unknown and I4
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Invalid comparison between Unknown and I4
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Invalid comparison between Unknown and I4
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Invalid comparison between Unknown and I4
if ((Object)(object)RepoMessengerUI.Instance != (Object)null && RepoMessengerUI.Instance.IsOpen() && ((int)key == 7 || (int)key == 13 || (int)key == 9 || (int)key == 18 || (int)key == 6))
{
__result = false;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(RunManager), "Update")]
public static class BlockRunManagerBackspaceWhenMessengerOpen
{
private static bool Prefix()
{
if ((Object)(object)RepoMessengerUI.Instance != (Object)null && RepoMessengerUI.Instance.IsOpen() && Input.GetKeyDown((KeyCode)8))
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(ChatManager), "Update")]
public static class BlockChatManagerUpdateWhenMessengerOpen
{
private static bool Prefix()
{
if ((Object)(object)RepoMessengerUI.Instance != (Object)null && RepoMessengerUI.Instance.IsOpen())
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(PlayerAvatar))]
public static class PlayerAvatarChatHooks
{
[HarmonyPostfix]
[HarmonyPatch("ChatMessageSendRPC")]
public static void Post_ChatMessageSendRPC(PlayerAvatar __instance, string _message, bool crouching, PhotonMessageInfo _info)
{
try
{
string text = (((Object)(object)__instance != (Object)null) ? __instance.playerName : "?");
string steamId = (((Object)(object)__instance != (Object)null) ? __instance.steamID : string.Empty);
if (!((Object)(object)__instance != (Object)null) || !((Object)(object)__instance.photonView != (Object)null) || !__instance.photonView.IsMine)
{
ChatLog.Add(new ChatEntry(text, steamId, _message, local: false));
RepoMessengerUI.Instance?.PlayReceiveSound();
RepoMessengerUI.Instance?.NotifyIncoming(text);
}
}
catch
{
}
}
[HarmonyPrefix]
[HarmonyPatch("ChatMessageSpeak")]
public static bool Pre_ChatMessageSpeak(PlayerAvatar __instance, string _message, bool crouching)
{
try
{
if ((Object)(object)RepoMessengerUI.Instance != (Object)null && RepoMessengerUI.Instance.IsOpen())
{
return false;
}
}
catch
{
}
return true;
}
}
[HarmonyPatch(typeof(ChatUI))]
public static class ChatUIHideWhenMessengerOpen
{
[HarmonyPostfix]
[HarmonyPatch("Update")]
public static void Post_ChatUI_Update(ChatUI __instance)
{
try
{
if ((Object)(object)RepoMessengerUI.Instance != (Object)null && RepoMessengerUI.Instance.IsOpen())
{
((SemiUI)__instance).Hide();
}
}
catch
{
}
}
}
}