Decompiled source of Peak Global Chat v1.1.5
PeakTextMod.dll
Decompiled 4 hours agousing System; using System.Collections.Generic; using System.Diagnostics; 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 Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PeakTextMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Mod de texto sincronizado para PEAK")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("PeakTextMod")] [assembly: AssemblyTitle("PeakTextMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PeakTextMod { [BepInPlugin("com.usuario.peaktextmod", "Peak Text Mod", "1.1.3")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.usuario.peaktextmod"; public const string PluginName = "Peak Text Mod"; public const string PluginVersion = "1.1.3"; internal static ManualLogSource Logger; public static Plugin Instance; public static ConfigEntry<KeyCode> ToggleKey; public static ConfigEntry<int> FontSize; public static ConfigEntry<float> FadeDelay; public static ConfigEntry<float> FadeDuration; public static ConfigEntry<int> MaxCharacters; public static ConfigEntry<bool> ShowHistory; public static ConfigEntry<bool> PlaySound; public static ConfigEntry<float> SoundVolume; public static ConfigEntry<string> QC1; public static ConfigEntry<string> QC2; public static ConfigEntry<string> QC3; public static ConfigEntry<string> QC4; public static ConfigEntry<string> QC5; private void Awake() { Instance = this; Logger = ((BaseUnityPlugin)this).Logger; ToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ToggleKey", (KeyCode)116, "Tecla para abrir/cerrar el editor"); FontSize = ((BaseUnityPlugin)this).Config.Bind<int>("General", "FontSize", 26, "Tamaño de fuente del texto global"); MaxCharacters = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxCharacters", 120, "Máximo de caracteres por mensaje"); FadeDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "FadeDelay", 10f, "Segundos antes de empezar a desvanecer (0 = nunca)"); FadeDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "FadeDuration", 3f, "Duración del desvanecimiento en segundos"); ShowHistory = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "ShowHistory", true, "Mostrar mensajes anteriores"); PlaySound = ((BaseUnityPlugin)this).Config.Bind<bool>("Sound", "PlayNotification", true, "Sonido al recibir mensaje"); SoundVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Sound", "Volume", 0.4f, "Volumen de notificación (0.0 - 1.0)"); QC1 = ((BaseUnityPlugin)this).Config.Bind<string>("QuickChat", "Slot1", "¡Sígueme!", "Ctrl+1"); QC2 = ((BaseUnityPlugin)this).Config.Bind<string>("QuickChat", "Slot2", "Esperadme", "Ctrl+2"); QC3 = ((BaseUnityPlugin)this).Config.Bind<string>("QuickChat", "Slot3", "GG", "Ctrl+3"); QC4 = ((BaseUnityPlugin)this).Config.Bind<string>("QuickChat", "Slot4", "Vamos arriba", "Ctrl+4"); QC5 = ((BaseUnityPlugin)this).Config.Bind<string>("QuickChat", "Slot5", "Cuidado", "Ctrl+5"); Logger.LogInfo((object)"Peak Text Mod v1.1.3 cargado."); ((Component)this).gameObject.AddComponent<TextUIController>(); } } public class TextUIController : MonoBehaviour, IOnEventCallback { private struct ChatMessage { public string Sender; public string Text; public float Time; } private readonly List<ChatMessage> _history = new List<ChatMessage>(); private const int MAX_HISTORY = 8; private const byte TEXT_SYNC_EVENT_CODE = 199; private bool _isEditing = false; private string _inputText = ""; private bool _needsFocus = false; private float _lastMessageTime = -999f; private CursorLockMode _savedCursorLock; private bool _savedCursorVisible; private AudioClip _notifClip; private AudioSource _audio; private bool _stylesInit = false; private GUIStyle _mainText; private GUIStyle _shadowText; private GUIStyle _histText; private GUIStyle _inputField; private GUIStyle _button; private GUIStyle _hint; private GUIStyle _status; private GUIStyle _titleBar; private GUIStyle _hintRight; private GUIStyle _counterStyle; private Texture2D _panelTex; private Texture2D _inputTex; private Texture2D _btnTex; private Texture2D _btnHoverTex; private Texture2D _bannerTex; private static readonly Color Accent = new Color(0.35f, 0.55f, 1f); private static readonly Color Green = new Color(0.3f, 0.9f, 0.5f); private static readonly Color Panel = new Color(0.06f, 0.06f, 0.1f, 0.93f); private static readonly Color InputBg = new Color(0.1f, 0.1f, 0.16f, 0.95f); private static readonly Color Banner = new Color(0f, 0f, 0f, 0.5f); private void Awake() { _notifClip = CreateBeep(880f, 0.15f); _audio = ((Component)this).gameObject.AddComponent<AudioSource>(); _audio.playOnAwake = false; Plugin.Logger.LogInfo((object)"TextUIController Awake - Iniciando..."); } private void Start() { AddMessage("SISTEMA", "Chat Mod v1.1.0 - Pulsa 'T' para escribir"); } private void OnDestroy() { if ((Object)(object)_panelTex != (Object)null) { Object.Destroy((Object)(object)_panelTex); } if ((Object)(object)_inputTex != (Object)null) { Object.Destroy((Object)(object)_inputTex); } if ((Object)(object)_btnTex != (Object)null) { Object.Destroy((Object)(object)_btnTex); } if ((Object)(object)_btnHoverTex != (Object)null) { Object.Destroy((Object)(object)_btnHoverTex); } if ((Object)(object)_bannerTex != (Object)null) { Object.Destroy((Object)(object)_bannerTex); } if ((Object)(object)_notifClip != (Object)null) { Object.Destroy((Object)(object)_notifClip); } } private void OnEnable() { PhotonNetwork.AddCallbackTarget((object)this); } private void OnDisable() { PhotonNetwork.RemoveCallbackTarget((object)this); } public void OnEvent(EventData evt) { try { if (evt.Code != 199 || !(evt.CustomData is object[] array) || array.Length < 2) { return; } string sender = (array[0] as string) ?? "???"; string text = (array[1] as string) ?? ""; if (!string.IsNullOrEmpty(text)) { int value = Plugin.MaxCharacters.Value; if (text.Length > value) { text = text.Substring(0, value); } AddMessage(sender, text); if (Plugin.PlaySound.Value) { PlayNotif(); } } } catch (Exception ex) { Plugin.Logger.LogError((object)("Error en OnEvent: " + ex.Message)); } } private bool SendText(string text) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(text)) { return false; } int value = Plugin.MaxCharacters.Value; if (text.Length > value) { text = text.Substring(0, value); } bool flag; bool flag2; string text2; try { flag = PhotonNetwork.IsConnected; flag2 = flag && PhotonNetwork.InRoom; text2 = (flag ? PhotonNetwork.NickName : null); } catch { flag = false; flag2 = false; text2 = null; } string text3 = "Local"; if (flag && !string.IsNullOrWhiteSpace(text2)) { text3 = text2; } else if (flag) { text3 = "Jugador"; } AddMessage(text3, text); if (flag2) { try { object[] array = new object[2] { text3, text }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; SendOptions val2 = default(SendOptions); ((SendOptions)(ref val2)).Reliability = true; SendOptions val3 = val2; PhotonNetwork.RaiseEvent((byte)199, (object)array, val, val3); } catch (Exception ex) { Plugin.Logger.LogWarning((object)("Error enviando por red: " + ex.Message)); } } return true; } private void AddMessage(string sender, string text) { _history.Insert(0, new ChatMessage { Sender = sender, Text = text, Time = Time.time }); if (_history.Count > 8) { _history.RemoveAt(_history.Count - 1); } _lastMessageTime = Time.time; } private void Update() { //IL_0006: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Invalid comparison between Unknown and I4 if (Input.GetKeyDown(Plugin.ToggleKey.Value)) { Plugin.Logger.LogInfo((object)$"Tecla Toggle ({Plugin.ToggleKey.Value}) detectada."); ToggleEditor(); return; } if (_isEditing && Input.GetKeyDown((KeyCode)27) && (int)Plugin.ToggleKey.Value != 27) { CloseEditor(); } if (!_isEditing && (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305))) { CheckQuickChat((KeyCode)49, Plugin.QC1); CheckQuickChat((KeyCode)50, Plugin.QC2); CheckQuickChat((KeyCode)51, Plugin.QC3); CheckQuickChat((KeyCode)52, Plugin.QC4); CheckQuickChat((KeyCode)53, Plugin.QC5); } } private void CheckQuickChat(KeyCode key, ConfigEntry<string> cfg) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(key) && !string.IsNullOrWhiteSpace(cfg.Value)) { SendText(cfg.Value); } } private void ToggleEditor() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) _isEditing = !_isEditing; if (_isEditing) { _inputText = ""; _needsFocus = true; _savedCursorLock = Cursor.lockState; _savedCursorVisible = Cursor.visible; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else { RestoreCursor(); } } private void CloseEditor() { _isEditing = false; RestoreCursor(); } private void RestoreCursor() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Cursor.lockState = _savedCursorLock; Cursor.visible = _savedCursorVisible; } private AudioClip CreateBeep(float freq, float duration) { int num = 44100; int num2 = (int)((float)num * duration); float[] array = new float[num2]; for (int i = 0; i < num2; i++) { float num3 = (float)i / (float)num; float num4 = 1f - (float)i / (float)num2; array[i] = Mathf.Sin(MathF.PI * 2f * freq * num3) * 0.25f * num4 * num4; } AudioClip val = AudioClip.Create("ModBeep", num2, 1, num, false); val.SetData(array, 0); return val; } private void PlayNotif() { if ((Object)(object)_notifClip != (Object)null && (Object)(object)_audio != (Object)null) { _audio.volume = Mathf.Clamp01(Plugin.SoundVolume.Value); _audio.PlayOneShot(_notifClip); } } private void OnGUI() { try { GUI.depth = -100; InitStyles(); float alpha = CalcFadeAlpha(); DrawMessages(alpha); DrawStatus(); if (_isEditing) { DrawEditor(); } } catch (Exception ex) { Plugin.Logger.LogError((object)("Error en OnGUI: " + ex.Message + "\n" + ex.StackTrace)); } } private float CalcFadeAlpha() { if (_history.Count == 0) { return 0f; } float value = Plugin.FadeDelay.Value; if (value <= 0f) { return 1f; } float num = Time.time - _lastMessageTime; if (num < value) { return 1f; } float num2 = Mathf.Max(0.1f, Plugin.FadeDuration.Value); return 1f - Mathf.Clamp01((num - value) / num2); } private void DrawMessages(float alpha) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) if (alpha <= 0f || _history.Count == 0) { return; } int value = Plugin.FontSize.Value; float num = 20f; float num2 = (float)Screen.width * 0.85f; float num3 = ((float)Screen.width - num2) / 2f; int num4 = ((_history.Count > 1 && Plugin.ShowHistory.Value) ? Mathf.Min(_history.Count - 1, 4) : 0); int num5 = 40 + num4 * 20; Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, alpha); GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)(num5 + 15)), (Texture)(object)_bannerTex); GUI.color = color; ChatMessage chatMessage = _history[0]; string text = "[" + chatMessage.Sender + "] " + chatMessage.Text; _shadowText.fontSize = value; _mainText.fontSize = value; Rect val = default(Rect); ((Rect)(ref val))..ctor(num3, num, num2, 40f); Color contentColor = GUI.contentColor; GUI.contentColor = new Color(0f, 0f, 0f, alpha * 0.8f); GUI.Label(new Rect(((Rect)(ref val)).x + 1f, ((Rect)(ref val)).y + 1f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, _shadowText); GUI.contentColor = new Color(1f, 1f, 1f, alpha); GUI.Label(val, text, _mainText); GUI.contentColor = contentColor; if (Plugin.ShowHistory.Value && _history.Count > 1) { num += 36f; int num6 = Mathf.Min(_history.Count - 1, 4); for (int i = 1; i <= num6; i++) { ChatMessage chatMessage2 = _history[i]; float num7 = alpha * (1f - (float)i / (float)(num6 + 1)) * 0.6f; GUI.contentColor = new Color(0.75f, 0.75f, 0.85f, num7); GUI.Label(new Rect(num3 + 10f, num, num2 - 20f, 22f), "[" + chatMessage2.Sender + "] " + chatMessage2.Text, _histText); num += 20f; } GUI.contentColor = contentColor; } } private void DrawStatus() { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0081: 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_0062: 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) string text; Color textColor = default(Color); try { if (PhotonNetwork.IsConnected && PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null) { text = $"● En sala ({PhotonNetwork.CurrentRoom.PlayerCount}P)"; textColor = Green; } else if (PhotonNetwork.IsConnected) { text = "● Conectado"; textColor = new Color(1f, 0.8f, 0.2f); } else { text = "● Offline"; textColor = new Color(1f, 0.35f, 0.35f); } } catch { text = "● ..."; ((Color)(ref textColor))..ctor(1f, 0.8f, 0.2f); } _status.normal.textColor = textColor; GUI.Label(new Rect((float)(Screen.width - 220), 5f, 210f, 20f), text, _status); if (_hintRight != null) { _hintRight.normal.textColor = new Color(1f, 1f, 1f, 0.3f); KeyCode value = Plugin.ToggleKey.Value; string text2 = ((object)(KeyCode)(ref value)).ToString(); GUI.Label(new Rect((float)(Screen.width - 300), 22f, 290f, 16f), text2 + " = chat | Ctrl+1..5 = rápido", _hintRight); } } private void DrawEditor() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Invalid comparison between Unknown and I4 //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Invalid comparison between Unknown and I4 //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Invalid comparison between Unknown and I4 //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Invalid comparison between Unknown and I4 //IL_0232: Unknown result type (might be due to invalid IL or missing references) int value = Plugin.MaxCharacters.Value; float num = Mathf.Min(480, Screen.width - 40); float num2 = 140f; float num3 = ((float)Screen.width - num) / 2f; float num4 = (float)Screen.height / 2f - num2 / 2f; GUI.DrawTexture(new Rect(num3, num4, num, num2), (Texture)(object)_panelTex); GUI.DrawTexture(new Rect(num3, num4, num, 2f), (Texture)(object)_btnTex); GUI.Label(new Rect(num3 + 15f, num4 + 6f, num - 30f, 24f), "ENVIAR TEXTO | ENTER enviar | ESC cerrar", _titleBar); if ((int)Event.current.type == 4 && ((int)Event.current.keyCode == 13 || (int)Event.current.keyCode == 271)) { SendText(_inputText); CloseEditor(); Event.current.Use(); } GUI.DrawTexture(new Rect(num3 + 15f, num4 + 34f, num - 30f, 34f), (Texture)(object)_inputTex); GUI.SetNextControlName("ModTF"); _inputText = GUI.TextField(new Rect(num3 + 20f, num4 + 37f, num - 40f, 28f), _inputText ?? "", value, _inputField); if (_inputText == null) { _inputText = ""; } string text = $"{_inputText.Length}/{value}"; if (_counterStyle != null) { _counterStyle.normal.textColor = ((_inputText.Length >= value) ? new Color(1f, 0.4f, 0.4f) : new Color(1f, 1f, 1f, 0.4f)); GUI.Label(new Rect(num3 + num - 100f, num4 + 70f, 80f, 18f), text, _counterStyle); } if (GUI.Button(new Rect(num3 + 15f, num4 + 95f, num - 30f, 32f), "ENVIAR A TODOS", _button)) { SendText(_inputText); CloseEditor(); } if (_needsFocus || ((int)Event.current.type == 8 && string.IsNullOrEmpty(GUI.GetNameOfFocusedControl()))) { GUI.FocusControl("ModTF"); _needsFocus = false; } } private Texture2D MakeTex(Color color) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0011: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(2, 2); Color[] pixels = (Color[])(object)new Color[4] { color, color, color, color }; val.SetPixels(pixels); val.Apply(); return val; } private void InitStyles() { //IL_0012: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_011b: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0193: 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_01f2: 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: Expected O, but got Unknown //IL_022a: 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_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: 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_029f: Expected O, but got Unknown //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: 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_02f7: Expected O, but got Unknown //IL_0302: 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_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Expected O, but got Unknown //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0356: 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_0368: Expected O, but got Unknown //IL_036f: 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: Expected O, but got Unknown if (!_stylesInit) { _panelTex = MakeTex(Panel); _inputTex = MakeTex(InputBg); _bannerTex = MakeTex(Banner); _btnTex = MakeTex(Accent); _btnHoverTex = MakeTex(new Color(Accent.r + 0.1f, Accent.g + 0.1f, Accent.b + 0.1f)); int value = Plugin.FontSize.Value; _mainText = new GUIStyle(GUI.skin.label) { fontSize = value, fontStyle = (FontStyle)1, alignment = (TextAnchor)1, wordWrap = false }; _mainText.normal.textColor = Color.white; _shadowText = new GUIStyle(_mainText); _shadowText.normal.textColor = new Color(0f, 0f, 0f, 0.8f); _histText = new GUIStyle(GUI.skin.label) { fontSize = 14, alignment = (TextAnchor)1 }; _histText.normal.textColor = Color.white; _inputField = new GUIStyle(GUI.skin.textField) { fontSize = 17, alignment = (TextAnchor)3 }; _inputField.normal.textColor = Color.white; _inputField.normal.background = _inputTex; _inputField.focused.background = _inputTex; _inputField.focused.textColor = Color.white; _button = new GUIStyle(GUI.skin.button) { fontSize = 14, fontStyle = (FontStyle)1 }; _button.normal.background = _btnTex; _button.normal.textColor = Color.white; _button.hover.background = _btnHoverTex; _button.hover.textColor = Color.white; _button.active.background = _btnHoverTex; _hint = new GUIStyle(GUI.skin.label) { fontSize = 11, alignment = (TextAnchor)5 }; _hint.normal.textColor = new Color(1f, 1f, 1f, 0.4f); _status = new GUIStyle(GUI.skin.label) { fontSize = 12, fontStyle = (FontStyle)1, alignment = (TextAnchor)2 }; _titleBar = new GUIStyle(GUI.skin.label) { fontSize = 11, fontStyle = (FontStyle)1, alignment = (TextAnchor)3 }; _titleBar.normal.textColor = new Color(1f, 1f, 1f, 0.6f); _hintRight = new GUIStyle(_hint) { alignment = (TextAnchor)2 }; _counterStyle = new GUIStyle(_hint) { alignment = (TextAnchor)5 }; _stylesInit = true; } } } }
PeakGlobalChat.dll
Decompiled 4 hours agousing System; using System.Collections.Generic; using System.Diagnostics; 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 Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PeakTextMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Mod de texto sincronizado para PEAK")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("PeakTextMod")] [assembly: AssemblyTitle("PeakTextMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PeakTextMod { [BepInPlugin("com.usuario.peak_global_chat", "Peak Global Chat", "1.1.5")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.usuario.peak_global_chat"; public const string PluginName = "Peak Global Chat"; public const string PluginVersion = "1.1.5"; internal static ManualLogSource Logger; public static Plugin Instance; public static ConfigEntry<KeyCode> ToggleKey; public static ConfigEntry<int> FontSize; public static ConfigEntry<float> FadeDelay; public static ConfigEntry<float> FadeDuration; public static ConfigEntry<int> MaxCharacters; public static ConfigEntry<bool> ShowHistory; public static ConfigEntry<bool> PlaySound; public static ConfigEntry<float> SoundVolume; public static ConfigEntry<string> QC1; public static ConfigEntry<string> QC2; public static ConfigEntry<string> QC3; public static ConfigEntry<string> QC4; public static ConfigEntry<string> QC5; private void Awake() { Instance = this; Logger = ((BaseUnityPlugin)this).Logger; ToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ToggleKey", (KeyCode)116, "Tecla para abrir/cerrar el editor"); FontSize = ((BaseUnityPlugin)this).Config.Bind<int>("General", "FontSize", 26, "Tamaño de fuente del texto global"); MaxCharacters = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxCharacters", 120, "Máximo de caracteres por mensaje"); FadeDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "FadeDelay", 10f, "Segundos antes de empezar a desvanecer (0 = nunca)"); FadeDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "FadeDuration", 3f, "Duración del desvanecimiento en segundos"); ShowHistory = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "ShowHistory", true, "Mostrar mensajes anteriores"); PlaySound = ((BaseUnityPlugin)this).Config.Bind<bool>("Sound", "PlayNotification", true, "Sonido al recibir mensaje"); SoundVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Sound", "Volume", 0.4f, "Volumen de notificación (0.0 - 1.0)"); QC1 = ((BaseUnityPlugin)this).Config.Bind<string>("QuickChat", "Slot1", "¡Sígueme!", "Ctrl+1"); QC2 = ((BaseUnityPlugin)this).Config.Bind<string>("QuickChat", "Slot2", "Esperadme", "Ctrl+2"); QC3 = ((BaseUnityPlugin)this).Config.Bind<string>("QuickChat", "Slot3", "GG", "Ctrl+3"); QC4 = ((BaseUnityPlugin)this).Config.Bind<string>("QuickChat", "Slot4", "Vamos arriba", "Ctrl+4"); QC5 = ((BaseUnityPlugin)this).Config.Bind<string>("QuickChat", "Slot5", "Cuidado", "Ctrl+5"); Logger.LogInfo((object)"Peak Global Chat v1.1.5 cargado."); ((Component)this).gameObject.AddComponent<TextUIController>(); } } public class TextUIController : MonoBehaviour, IOnEventCallback { private struct ChatMessage { public string Sender; public string Text; public float Time; } private readonly List<ChatMessage> _history = new List<ChatMessage>(); private const int MAX_HISTORY = 8; private const byte TEXT_SYNC_EVENT_CODE = 199; private bool _isEditing = false; private string _inputText = ""; private bool _needsFocus = false; private float _lastMessageTime = -999f; private CursorLockMode _savedCursorLock; private bool _savedCursorVisible; private AudioClip _notifClip; private AudioSource _audio; private bool _stylesInit = false; private GUIStyle _mainText; private GUIStyle _shadowText; private GUIStyle _histText; private GUIStyle _inputField; private GUIStyle _button; private GUIStyle _hint; private GUIStyle _status; private GUIStyle _titleBar; private GUIStyle _hintRight; private GUIStyle _counterStyle; private Texture2D _panelTex; private Texture2D _inputTex; private Texture2D _btnTex; private Texture2D _btnHoverTex; private Texture2D _bannerTex; private static readonly Color Accent = new Color(0.35f, 0.55f, 1f); private static readonly Color Green = new Color(0.3f, 0.9f, 0.5f); private static readonly Color Panel = new Color(0.06f, 0.06f, 0.1f, 0.93f); private static readonly Color InputBg = new Color(0.1f, 0.1f, 0.16f, 0.95f); private static readonly Color Banner = new Color(0f, 0f, 0f, 0.5f); private void Awake() { _notifClip = CreateBeep(880f, 0.15f); _audio = ((Component)this).gameObject.AddComponent<AudioSource>(); _audio.playOnAwake = false; Plugin.Logger.LogInfo((object)"TextUIController Awake - Iniciando..."); } private void Start() { AddMessage("SISTEMA", "Chat Mod v1.1.0 - Pulsa 'T' para escribir"); } private void OnDestroy() { if ((Object)(object)_panelTex != (Object)null) { Object.Destroy((Object)(object)_panelTex); } if ((Object)(object)_inputTex != (Object)null) { Object.Destroy((Object)(object)_inputTex); } if ((Object)(object)_btnTex != (Object)null) { Object.Destroy((Object)(object)_btnTex); } if ((Object)(object)_btnHoverTex != (Object)null) { Object.Destroy((Object)(object)_btnHoverTex); } if ((Object)(object)_bannerTex != (Object)null) { Object.Destroy((Object)(object)_bannerTex); } if ((Object)(object)_notifClip != (Object)null) { Object.Destroy((Object)(object)_notifClip); } } private void OnEnable() { PhotonNetwork.AddCallbackTarget((object)this); } private void OnDisable() { PhotonNetwork.RemoveCallbackTarget((object)this); } public void OnEvent(EventData evt) { try { if (evt.Code != 199 || !(evt.CustomData is object[] array) || array.Length < 2) { return; } string sender = (array[0] as string) ?? "???"; string text = (array[1] as string) ?? ""; if (!string.IsNullOrEmpty(text)) { int value = Plugin.MaxCharacters.Value; if (text.Length > value) { text = text.Substring(0, value); } AddMessage(sender, text); if (Plugin.PlaySound.Value) { PlayNotif(); } } } catch (Exception ex) { Plugin.Logger.LogError((object)("Error en OnEvent: " + ex.Message)); } } private bool SendText(string text) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(text)) { return false; } int value = Plugin.MaxCharacters.Value; if (text.Length > value) { text = text.Substring(0, value); } bool flag; bool flag2; string text2; try { flag = PhotonNetwork.IsConnected; flag2 = flag && PhotonNetwork.InRoom; text2 = (flag ? PhotonNetwork.NickName : null); } catch { flag = false; flag2 = false; text2 = null; } string text3 = "Local"; if (flag && !string.IsNullOrWhiteSpace(text2)) { text3 = text2; } else if (flag) { text3 = "Jugador"; } AddMessage(text3, text); if (flag2) { try { object[] array = new object[2] { text3, text }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; SendOptions val2 = default(SendOptions); ((SendOptions)(ref val2)).Reliability = true; SendOptions val3 = val2; PhotonNetwork.RaiseEvent((byte)199, (object)array, val, val3); } catch (Exception ex) { Plugin.Logger.LogWarning((object)("Error enviando por red: " + ex.Message)); } } return true; } private void AddMessage(string sender, string text) { _history.Insert(0, new ChatMessage { Sender = sender, Text = text, Time = Time.time }); if (_history.Count > 8) { _history.RemoveAt(_history.Count - 1); } _lastMessageTime = Time.time; } private void Update() { //IL_0006: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Invalid comparison between Unknown and I4 if (Input.GetKeyDown(Plugin.ToggleKey.Value)) { Plugin.Logger.LogInfo((object)$"Tecla Toggle ({Plugin.ToggleKey.Value}) detectada."); ToggleEditor(); return; } if (_isEditing && Input.GetKeyDown((KeyCode)27) && (int)Plugin.ToggleKey.Value != 27) { CloseEditor(); } if (!_isEditing && (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305))) { CheckQuickChat((KeyCode)49, Plugin.QC1); CheckQuickChat((KeyCode)50, Plugin.QC2); CheckQuickChat((KeyCode)51, Plugin.QC3); CheckQuickChat((KeyCode)52, Plugin.QC4); CheckQuickChat((KeyCode)53, Plugin.QC5); } } private void CheckQuickChat(KeyCode key, ConfigEntry<string> cfg) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(key) && !string.IsNullOrWhiteSpace(cfg.Value)) { SendText(cfg.Value); } } private void ToggleEditor() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) _isEditing = !_isEditing; if (_isEditing) { _inputText = ""; _needsFocus = true; _savedCursorLock = Cursor.lockState; _savedCursorVisible = Cursor.visible; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else { RestoreCursor(); } } private void CloseEditor() { _isEditing = false; RestoreCursor(); } private void RestoreCursor() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Cursor.lockState = _savedCursorLock; Cursor.visible = _savedCursorVisible; } private AudioClip CreateBeep(float freq, float duration) { int num = 44100; int num2 = (int)((float)num * duration); float[] array = new float[num2]; for (int i = 0; i < num2; i++) { float num3 = (float)i / (float)num; float num4 = 1f - (float)i / (float)num2; array[i] = Mathf.Sin(MathF.PI * 2f * freq * num3) * 0.25f * num4 * num4; } AudioClip val = AudioClip.Create("ModBeep", num2, 1, num, false); val.SetData(array, 0); return val; } private void PlayNotif() { if ((Object)(object)_notifClip != (Object)null && (Object)(object)_audio != (Object)null) { _audio.volume = Mathf.Clamp01(Plugin.SoundVolume.Value); _audio.PlayOneShot(_notifClip); } } private void OnGUI() { try { GUI.depth = -100; InitStyles(); float alpha = CalcFadeAlpha(); DrawMessages(alpha); DrawStatus(); if (_isEditing) { DrawEditor(); } } catch (Exception ex) { Plugin.Logger.LogError((object)("Error en OnGUI: " + ex.Message + "\n" + ex.StackTrace)); } } private float CalcFadeAlpha() { if (_history.Count == 0) { return 0f; } float value = Plugin.FadeDelay.Value; if (value <= 0f) { return 1f; } float num = Time.time - _lastMessageTime; if (num < value) { return 1f; } float num2 = Mathf.Max(0.1f, Plugin.FadeDuration.Value); return 1f - Mathf.Clamp01((num - value) / num2); } private void DrawMessages(float alpha) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) if (alpha <= 0f || _history.Count == 0) { return; } int value = Plugin.FontSize.Value; float num = 20f; float num2 = (float)Screen.width * 0.85f; float num3 = ((float)Screen.width - num2) / 2f; int num4 = ((_history.Count > 1 && Plugin.ShowHistory.Value) ? Mathf.Min(_history.Count - 1, 4) : 0); int num5 = 40 + num4 * 20; Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, alpha); GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)(num5 + 15)), (Texture)(object)_bannerTex); GUI.color = color; ChatMessage chatMessage = _history[0]; string text = "[" + chatMessage.Sender + "] " + chatMessage.Text; _shadowText.fontSize = value; _mainText.fontSize = value; Rect val = default(Rect); ((Rect)(ref val))..ctor(num3, num, num2, 40f); Color contentColor = GUI.contentColor; GUI.contentColor = new Color(0f, 0f, 0f, alpha * 0.8f); GUI.Label(new Rect(((Rect)(ref val)).x + 1f, ((Rect)(ref val)).y + 1f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, _shadowText); GUI.contentColor = new Color(1f, 1f, 1f, alpha); GUI.Label(val, text, _mainText); GUI.contentColor = contentColor; if (Plugin.ShowHistory.Value && _history.Count > 1) { num += 36f; int num6 = Mathf.Min(_history.Count - 1, 4); for (int i = 1; i <= num6; i++) { ChatMessage chatMessage2 = _history[i]; float num7 = alpha * (1f - (float)i / (float)(num6 + 1)) * 0.6f; GUI.contentColor = new Color(0.75f, 0.75f, 0.85f, num7); GUI.Label(new Rect(num3 + 10f, num, num2 - 20f, 22f), "[" + chatMessage2.Sender + "] " + chatMessage2.Text, _histText); num += 20f; } GUI.contentColor = contentColor; } } private void DrawStatus() { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0081: 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_0062: 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) string text; Color textColor = default(Color); try { if (PhotonNetwork.IsConnected && PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null) { text = $"● En sala ({PhotonNetwork.CurrentRoom.PlayerCount}P)"; textColor = Green; } else if (PhotonNetwork.IsConnected) { text = "● Conectado"; textColor = new Color(1f, 0.8f, 0.2f); } else { text = "● Offline"; textColor = new Color(1f, 0.35f, 0.35f); } } catch { text = "● ..."; ((Color)(ref textColor))..ctor(1f, 0.8f, 0.2f); } _status.normal.textColor = textColor; GUI.Label(new Rect((float)(Screen.width - 220), 5f, 210f, 20f), text, _status); if (_hintRight != null) { _hintRight.normal.textColor = new Color(1f, 1f, 1f, 0.3f); KeyCode value = Plugin.ToggleKey.Value; string text2 = ((object)(KeyCode)(ref value)).ToString(); GUI.Label(new Rect((float)(Screen.width - 300), 22f, 290f, 16f), text2 + " = chat | Ctrl+1..5 = rápido", _hintRight); } } private void DrawEditor() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Invalid comparison between Unknown and I4 //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Invalid comparison between Unknown and I4 //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Invalid comparison between Unknown and I4 //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Invalid comparison between Unknown and I4 //IL_0232: Unknown result type (might be due to invalid IL or missing references) int value = Plugin.MaxCharacters.Value; float num = Mathf.Min(480, Screen.width - 40); float num2 = 140f; float num3 = ((float)Screen.width - num) / 2f; float num4 = (float)Screen.height / 2f - num2 / 2f; GUI.DrawTexture(new Rect(num3, num4, num, num2), (Texture)(object)_panelTex); GUI.DrawTexture(new Rect(num3, num4, num, 2f), (Texture)(object)_btnTex); GUI.Label(new Rect(num3 + 15f, num4 + 6f, num - 30f, 24f), "ENVIAR TEXTO | ENTER enviar | ESC cerrar", _titleBar); if ((int)Event.current.type == 4 && ((int)Event.current.keyCode == 13 || (int)Event.current.keyCode == 271)) { SendText(_inputText); CloseEditor(); Event.current.Use(); } GUI.DrawTexture(new Rect(num3 + 15f, num4 + 34f, num - 30f, 34f), (Texture)(object)_inputTex); GUI.SetNextControlName("ModTF"); _inputText = GUI.TextField(new Rect(num3 + 20f, num4 + 37f, num - 40f, 28f), _inputText ?? "", value, _inputField); if (_inputText == null) { _inputText = ""; } string text = $"{_inputText.Length}/{value}"; if (_counterStyle != null) { _counterStyle.normal.textColor = ((_inputText.Length >= value) ? new Color(1f, 0.4f, 0.4f) : new Color(1f, 1f, 1f, 0.4f)); GUI.Label(new Rect(num3 + num - 100f, num4 + 70f, 80f, 18f), text, _counterStyle); } if (GUI.Button(new Rect(num3 + 15f, num4 + 95f, num - 30f, 32f), "ENVIAR A TODOS", _button)) { SendText(_inputText); CloseEditor(); } if (_needsFocus || ((int)Event.current.type == 8 && string.IsNullOrEmpty(GUI.GetNameOfFocusedControl()))) { GUI.FocusControl("ModTF"); _needsFocus = false; } } private Texture2D MakeTex(Color color) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0011: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(2, 2); Color[] pixels = (Color[])(object)new Color[4] { color, color, color, color }; val.SetPixels(pixels); val.Apply(); return val; } private void InitStyles() { //IL_0012: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_011b: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0193: 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_01f2: 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: Expected O, but got Unknown //IL_022a: 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_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: 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_029f: Expected O, but got Unknown //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: 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_02f7: Expected O, but got Unknown //IL_0302: 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_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Expected O, but got Unknown //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0356: 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_0368: Expected O, but got Unknown //IL_036f: 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: Expected O, but got Unknown if (!_stylesInit) { _panelTex = MakeTex(Panel); _inputTex = MakeTex(InputBg); _bannerTex = MakeTex(Banner); _btnTex = MakeTex(Accent); _btnHoverTex = MakeTex(new Color(Accent.r + 0.1f, Accent.g + 0.1f, Accent.b + 0.1f)); int value = Plugin.FontSize.Value; _mainText = new GUIStyle(GUI.skin.label) { fontSize = value, fontStyle = (FontStyle)1, alignment = (TextAnchor)1, wordWrap = false }; _mainText.normal.textColor = Color.white; _shadowText = new GUIStyle(_mainText); _shadowText.normal.textColor = new Color(0f, 0f, 0f, 0.8f); _histText = new GUIStyle(GUI.skin.label) { fontSize = 14, alignment = (TextAnchor)1 }; _histText.normal.textColor = Color.white; _inputField = new GUIStyle(GUI.skin.textField) { fontSize = 17, alignment = (TextAnchor)3 }; _inputField.normal.textColor = Color.white; _inputField.normal.background = _inputTex; _inputField.focused.background = _inputTex; _inputField.focused.textColor = Color.white; _button = new GUIStyle(GUI.skin.button) { fontSize = 14, fontStyle = (FontStyle)1 }; _button.normal.background = _btnTex; _button.normal.textColor = Color.white; _button.hover.background = _btnHoverTex; _button.hover.textColor = Color.white; _button.active.background = _btnHoverTex; _hint = new GUIStyle(GUI.skin.label) { fontSize = 11, alignment = (TextAnchor)5 }; _hint.normal.textColor = new Color(1f, 1f, 1f, 0.4f); _status = new GUIStyle(GUI.skin.label) { fontSize = 12, fontStyle = (FontStyle)1, alignment = (TextAnchor)2 }; _titleBar = new GUIStyle(GUI.skin.label) { fontSize = 11, fontStyle = (FontStyle)1, alignment = (TextAnchor)3 }; _titleBar.normal.textColor = new Color(1f, 1f, 1f, 0.6f); _hintRight = new GUIStyle(_hint) { alignment = (TextAnchor)2 }; _counterStyle = new GUIStyle(_hint) { alignment = (TextAnchor)5 }; _stylesInit = true; } } } }