Decompiled source of ChatPlus v1.0.0

BepInEx\plugins\ChatPlus.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using ChatPlus.Behaviors;
using ChatPlus.Messaging;
using ChatPlus.Models;
using ChatPlus.Patches;
using ChatPlus.Services;
using ChatPlus.UI;
using Engine.Console;
using Engine.Console.PublicInterface;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Network;
using ProjectM.UI;
using TMPro;
using Unity.Collections;
using Unity.Entities;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ChatPlus")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+23b7d1ce19ea62bfd653356f7dae91597677342c")]
[assembly: AssemblyProduct("ChatPlus")]
[assembly: AssemblyTitle("ChatPlus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ChatPlus
{
	internal static class Core
	{
		private static World? _client;

		private static Entity _localCharacter = Entity.Null;

		private static Entity _localUser = Entity.Null;

		private static bool _initialized;

		private static bool _gameDataReady;

		private static bool _armed;

		private static bool _hasLocalPlayer;

		private static double _nextPlayerCheck;

		public static ManualLogSource Log => Plugin.LogInstance;

		public static bool HasInitialized => _initialized;

		public static bool GameDataReady => _gameDataReady;

		public static bool Armed => _armed;

		public static bool HasLocalPlayer
		{
			get
			{
				//IL_0024: 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_0035: 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)
				double realtimeSinceStartupAsDouble = Time.realtimeSinceStartupAsDouble;
				if (realtimeSinceStartupAsDouble < _nextPlayerCheck)
				{
					return _hasLocalPlayer;
				}
				_nextPlayerCheck = realtimeSinceStartupAsDouble + 0.5;
				try
				{
					_hasLocalPlayer = LocalUser != Entity.Null && LocalCharacter != Entity.Null;
				}
				catch
				{
					_hasLocalPlayer = false;
				}
				return _hasLocalPlayer;
			}
		}

		public static bool WorldIsAlive
		{
			get
			{
				if (_client == null)
				{
					return false;
				}
				try
				{
					return _client.IsCreated;
				}
				catch
				{
					return false;
				}
			}
		}

		public static EntityManager EntityManager => _client.EntityManager;

		public static UICanvasBase Canvas { get; private set; } = null;

		public static bool HasCanvas => (Object)(object)Canvas != (Object)null;

		public static Canvas UiCanvas { get; private set; } = null;

		public static int UiLayer { get; private set; }

		public static Entity LocalCharacter
		{
			get
			{
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: 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)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: 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_0019: 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_004a: 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_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: 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_0042: Unknown result type (might be due to invalid IL or missing references)
				if (!WorldIsAlive)
				{
					return Entity.Null;
				}
				if (_localCharacter.Exists())
				{
					return _localCharacter;
				}
				try
				{
					if (ConsoleShared.TryGetLocalCharacterInCurrentWorld(ref _localCharacter, _client) && _localCharacter.Exists())
					{
						return _localCharacter;
					}
					_localCharacter = Entity.Null;
					return Entity.Null;
				}
				catch
				{
					_localCharacter = Entity.Null;
					return Entity.Null;
				}
			}
		}

		public static Entity LocalUser
		{
			get
			{
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: 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)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: 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_0019: 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_004a: 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_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: 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_0042: Unknown result type (might be due to invalid IL or missing references)
				if (!WorldIsAlive)
				{
					return Entity.Null;
				}
				if (_localUser.Exists())
				{
					return _localUser;
				}
				try
				{
					if (ConsoleShared.TryGetLocalUserInCurrentWorld(ref _localUser, _client) && _localUser.Exists())
					{
						return _localUser;
					}
					_localUser = Entity.Null;
					return Entity.Null;
				}
				catch
				{
					_localUser = Entity.Null;
					return Entity.Null;
				}
			}
		}

		public static event Action? HudReady;

		public static void SetGameDataReady(bool ready)
		{
			_gameDataReady = ready;
		}

		public static void Initialize(GameDataManager gameDataManager)
		{
			if (_initialized)
			{
				return;
			}
			try
			{
				_client = ((ComponentSystemBase)gameDataManager).World;
				_initialized = true;
				Log.LogInfo((object)"[ChatPlus] Client world bound.");
			}
			catch
			{
				_client = null;
				throw;
			}
		}

		public static void SetCanvas(UICanvasBase canvas)
		{
			if ((Object)(object)canvas == (Object)null)
			{
				return;
			}
			UICanvasBase canvas2 = Canvas;
			Canvas = canvas;
			if ((Object)(object)canvas2 != (Object)(object)canvas)
			{
				try
				{
					NativeChatService.Reset();
				}
				catch
				{
				}
			}
			if (!((Object)(object)canvas.BottomBarParent == (Object)null))
			{
				UiCanvas = ((Component)canvas.BottomBarParent).gameObject.GetComponent<Canvas>();
				if (!((Object)(object)UiCanvas == (Object)null))
				{
					UiLayer = ((Component)UiCanvas).gameObject.layer;
					_armed = true;
					UpdateDriver.Setup();
					Log.LogInfo((object)"[ChatPlus] Game canvas captured, update driver running.");
				}
			}
		}

		internal static void RaiseHudReady()
		{
			Core.HudReady?.Invoke();
		}

		public static void Reset()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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)
			_client = null;
			_initialized = false;
			_localCharacter = Entity.Null;
			_localUser = Entity.Null;
			_gameDataReady = false;
			_armed = false;
			_hasLocalPlayer = false;
			_nextPlayerCheck = 0.0;
			Canvas = null;
			UiCanvas = null;
			UiLayer = 0;
		}
	}
	[BepInPlugin("io.vrising.ChatPlus", "ChatPlus", "1.0.0")]
	internal class Plugin : BasePlugin
	{
		private Harmony _harmony;

		internal static Plugin Instance { get; private set; }

		public static ManualLogSource LogInstance => ((BasePlugin)Instance).Log;

		public static bool IsClient { get; private set; }

		public override void Load()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			Instance = this;
			IsClient = Application.productName.Equals("VRising", StringComparison.OrdinalIgnoreCase);
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val;
			if (!IsClient)
			{
				ManualLogSource log = ((BasePlugin)this).Log;
				val = new BepInExInfoLogInterpolatedStringHandler(34, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ChatPlus");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" [");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] is a client mod, skipping on ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Application.productName);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
				}
				log.LogInfo(val);
				return;
			}
			_harmony = new Harmony("io.vrising.ChatPlus");
			_harmony.CreateClassProcessor(typeof(InitializationPatch)).Patch();
			_harmony.CreateClassProcessor(typeof(ClientChatSystemPatch)).Patch();
			_harmony.CreateClassProcessor(typeof(NativeChatPatch)).Patch();
			InputSuppressionPatch.Apply(_harmony);
			ManualLogSource log2 = ((BasePlugin)this).Log;
			val = new BepInExInfoLogInterpolatedStringHandler(11, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ChatPlus");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" [");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] loaded.");
			}
			log2.LogInfo(val);
		}

		public override bool Unload()
		{
			HistoryService.Flush();
			InputHistoryService.Flush();
			SettingsService.Flush();
			UpdateDriver.Shutdown();
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			return true;
		}
	}
	internal static class VExtensions
	{
		public static bool Has<T>(this Entity entity)
		{
			//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_001c: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!Core.HasInitialized)
				{
					return false;
				}
				if (entity == Entity.Null)
				{
					return false;
				}
				EntityManager entityManager = Core.EntityManager;
				World world = ((EntityManager)(ref entityManager)).World;
				if (world == null || !world.IsCreated)
				{
					return false;
				}
				entityManager = Core.EntityManager;
				if (!((EntityManager)(ref entityManager)).Exists(entity))
				{
					return false;
				}
				entityManager = Core.EntityManager;
				return ((EntityManager)(ref entityManager)).HasComponent<T>(entity);
			}
			catch
			{
				return false;
			}
		}

		public static bool Exists(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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)
			try
			{
				if (entity == Entity.Null)
				{
					return false;
				}
				if (!Core.HasInitialized)
				{
					return false;
				}
				EntityManager entityManager = Core.EntityManager;
				World world = ((EntityManager)(ref entityManager)).World;
				if (world == null || !world.IsCreated)
				{
					return false;
				}
				entityManager = Core.EntityManager;
				return ((EntityManager)(ref entityManager)).Exists(entity);
			}
			catch
			{
				return false;
			}
		}

		public static T Read<T>(this Entity entity) where T : struct
		{
			//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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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)
			try
			{
				if (!Core.HasInitialized)
				{
					return default(T);
				}
				if (entity == Entity.Null)
				{
					return default(T);
				}
				EntityManager entityManager = Core.EntityManager;
				World world = ((EntityManager)(ref entityManager)).World;
				if (world == null || !world.IsCreated)
				{
					return default(T);
				}
				entityManager = Core.EntityManager;
				T val = default(T);
				return ((EntityManager)(ref entityManager)).TryGetComponentData<T>(entity, ref val) ? val : default(T);
			}
			catch
			{
				return default(T);
			}
		}

		public static NetworkId GetNetworkId(this Entity entity)
		{
			//IL_0063: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_006b: 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_0029: 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_0021: 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_0042: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!Core.HasInitialized)
				{
					return NetworkId.Empty;
				}
				if (entity == Entity.Null)
				{
					return NetworkId.Empty;
				}
				EntityManager entityManager = Core.EntityManager;
				World world = ((EntityManager)(ref entityManager)).World;
				if (world == null || !world.IsCreated)
				{
					return NetworkId.Empty;
				}
				entityManager = Core.EntityManager;
				NetworkId val = default(NetworkId);
				return ((EntityManager)(ref entityManager)).TryGetComponentData<NetworkId>(entity, ref val) ? val : NetworkId.Empty;
			}
			catch
			{
				return NetworkId.Empty;
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "io.vrising.ChatPlus";

		public const string PLUGIN_NAME = "ChatPlus";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ChatPlus.UI
{
	internal static class ChatWindow
	{
		private struct SendTarget
		{
			public ChatChannel Channel;

			public NetworkId Target;

			public string Label;

			public SendTarget(ChatChannel channel, NetworkId target, string label)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				Channel = channel;
				Target = target;
				Label = label;
			}
		}

		private const float DefaultWidth = 460f;

		private const float DefaultHeight = 340f;

		private const float InputH = 34f;

		private const float RailW = 18f;

		private const float LabelH = 18f;

		private const float LabelFontSize = 13f;

		private const int MaxVisibleLines = 300;

		private const double IdleVisibleSeconds = 15.0;

		private const float FadeInRate = 4f;

		private const float FadeOutRate = 1.67f;

		private const float WheelScrollStep = 0.08f;

		private static bool _subscribed;

		private static bool _built;

		private static bool _open;

		private static bool _logDirty;

		private static GameObject? _root;

		private static RectTransform? _rootRect;

		private static CanvasGroup? _fade;

		private static float _alpha;

		private static double _lastActivityUtc = -1000.0;

		private static double _recalcAfterOpen = -1.0;

		private static bool _chatActive;

		private static bool _viewSettings;

		private static bool _viewHelp;

		private static GameObject? _chatView;

		private static GameObject? _settingsView;

		private static GameObject? _helpView;

		private static GameObject? _helpBtn;

		private static GameObject? _helpBackBtn;

		private static GameObject? _copyBtn;

		private static GameObject? _bottomBar;

		private static RectTransform? _hkContainer;

		private static RectTransform? _hkAddBtnRt;

		private static TextMeshProUGUI? _hkHint;

		private static ScrollRect? _settingsScroll;

		private static Scrollbar? _settingsScrollbar;

		private static RectTransform? _settingsScrollbarRect;

		private static GameObject? _settingsHandleGo;

		private static ScrollRect? _helpScroll;

		private static Scrollbar? _helpScrollbar;

		private static RectTransform? _helpScrollbarRect;

		private static GameObject? _helpHandleGo;

		private static bool _settingsScrollbarDragging;

		private static int _hkArmedIndex = -1;

		private static TextMeshProUGUI? _log;

		private static TMP_InputField? _compose;

		private static ScrollRect? _scroll;

		private static RectTransform? _scrollContent;

		private static Scrollbar? _scrollbar;

		private static RectTransform? _scrollbarRect;

		private static GameObject? _scrollbarHandleGo;

		private static bool _scrollbarDragging;

		private static float _displayScrollSize = 0.2f;

		private static RectTransform? _gripRect;

		private static Image? _gripBg;

		private static bool _dragging;

		private static Vector2 _dragStartMouse;

		private static Vector2 _dragStartPos;

		private static TextMeshProUGUI? _channelLabel;

		private static GameObject? _channelBg;

		private static RectTransform? _channelLabelRect;

		private static GameObject? _composeBar;

		private static GameObject? _hintBar;

		private static bool _wasTypingLastFrame;

		private static bool _focusPending;

		private static Slider? _opacitySlider;

		private static TextMeshProUGUI? _opacityValue;

		private static Slider? _inputOpacitySlider;

		private static TextMeshProUGUI? _inputOpacityValue;

		private static TMP_InputField? _geomX;

		private static TMP_InputField? _geomY;

		private static TMP_InputField? _geomW;

		private static TMP_InputField? _geomH;

		private static TMP_InputField? _geomClan;

		private static Slider? _geomWSlider;

		private static Slider? _geomHSlider;

		private static Slider? _geomClanSlider;

		private static bool _sliderSyncGuard;

		private static Image? _scrollBg;

		private static Image? _composeBarBg;

		private static Image? _inputBg;

		private static TextMeshProUGUI? _placeholderTmp;

		private static RectTransform? _composeBarRect;

		private static RectTransform? _logScrollRect;

		private static RectTransform? _textAreaRect;

		private static RectTransform? _settingsBtnRt;

		private static Image? _settingsBtnBg;

		private static RectTransform? _railRt;

		private static float _composeH = 34f;

		private static int _pendingHkIndex = -1;

		private static int _pendingCmdIndex = -1;

		private static readonly List<List<TMP_InputField?>> _hkCommandFields = new List<List<TMP_InputField>>();

		private static bool _forceHoverRecompute;

		private static int _periodicRefreshCounter;

		private static bool _scrollToBottomPending;

		private static int _winStart;

		private static int _winEnd;

		private static int _appliedTrim;

		private static bool _tailRequested;

		private static bool _followTail = true;

		private static bool _anchorTopPending;

		private static int _anchorAllLines = -1;

		private static float _anchorSubPixel;

		private static bool _windowMoved;

		private static int _pendingWinStart;

		private static int _pendingWinEnd;

		private static float _lastScrollNorm = -1f;

		private static int _ignoreScrollFrames;

		private static float _logOffsetTarget;

		private static float _logOffsetApplied;

		private static bool _seekPending;

		private static double _rebuildFailLogAt;

		private static double _rebuildBackoffUntil;

		private static int _rebuildFailCount;

		private static readonly List<GameObject> _colorSwatchRows = new List<GameObject>();

		private static readonly Color[] _colorPalette = (Color[])(object)new Color[9]
		{
			new Color(0.949f, 0.922f, 0.859f, 1f),
			new Color(1f, 1f, 1f, 1f),
			new Color(0.85f, 0.15f, 0.12f, 1f),
			new Color(0.725f, 0.788f, 0.827f, 1f),
			new Color(0.35f, 0.85f, 0.45f, 1f),
			new Color(1f, 0.6f, 0.2f, 1f),
			new Color(0.35f, 0.6f, 1f, 1f),
			new Color(0.682f, 0.486f, 0.922f, 1f),
			new Color(1f, 0.824f, 0.29f, 1f)
		};

		private static readonly string[] _colorRowNames = new string[14]
		{
			"Global label", "Global text", "Local label", "Local text", "Clan label", "Clan text", "Whisper label", "Whisper text", "System label", "System text",
			"Your name", "Your messages", "Admin name", "Admin messages"
		};

		private static readonly ChatChannel[] _colorRowChannels = new ChatChannel[10]
		{
			ChatChannel.Global,
			ChatChannel.Global,
			ChatChannel.Local,
			ChatChannel.Local,
			ChatChannel.Clan,
			ChatChannel.Clan,
			ChatChannel.Whisper,
			ChatChannel.Whisper,
			ChatChannel.System,
			ChatChannel.System
		};

		private const float MaxComposeH = 120f;

		private const int MaxRenderChars = 16000;

		private const int LoadChunk = 80;

		private const float LogScrollPixelsPerNotch = 60f;

		private const float LogScrollSmoothing = 25f;

		private static readonly List<SendTarget> _cycle = new List<SendTarget>();

		private static string _cycleSignature = string.Empty;

		private static int _cycleIndex;

		private static readonly List<string> _history = new List<string>();

		private static int _historyIndex = -1;

		private static readonly List<ChatLine> _renderedLines = new List<ChatLine>();

		private static readonly List<int> _lineOffsets = new List<int>();

		private static readonly List<int> _lineVisLens = new List<int>();

		private static readonly List<int> _lineRawStarts = new List<int>();

		private static bool _logClickArmed;

		private static Vector2 _logDownPos;

		private static TextMeshProUGUI? _copyLabel;

		private static double _copyFeedbackUntil;

		private static GameObject? _highlightObj;

		private static Image? _highlight;

		private static RectTransform? _highlightRect;

		private static int _hoverLineIdx = -1;

		private static double _highlightFlashUntil;

		private static double _channelLabelFeedbackUntil;

		private static bool _moddedActive = true;

		private const float HKHeaderH = 26f;

		private const float HkCmdH = 26f;

		private const float HKAddRowH = 24f;

		private const float HkGapH = 8f;

		private const float HKFixedTop = 767f;

		private static readonly HashSet<string> ClosableRichTags = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
		{
			"color", "size", "b", "i", "u", "s", "mark", "font", "style", "material",
			"link", "gradient", "align", "indent", "margin", "voffset", "cspace", "mspace", "nobr", "noparse",
			"sub", "sup", "uppercase", "lowercase", "allcaps", "smallcaps", "liga", "frac", "space", "width",
			"pos", "scale", "rotate", "page", "a", "action", "line-height", "line-indent", "font-weight"
		};

		private static float WinW => SettingsService.WindowWidth;

		private static float WinH => SettingsService.WindowHeight;

		private static bool Mirrored => SettingsService.MirrorLayout;

		private static float ContentWidth => WinW - 18f;

		public static bool IsOpen => _open;

		public static bool IsTyping => _chatActive;

		public static bool IsModdedActive => _moddedActive;

		public static bool IsPointerOverWindow
		{
			get
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: 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)
				if (!_open || (Object)(object)_rootRect == (Object)null)
				{
					return false;
				}
				Camera val = (((int)Core.UiCanvas.renderMode == 0) ? null : Core.UiCanvas.worldCamera);
				return RectTransformUtility.RectangleContainsScreenPoint(_rootRect, Vector2.op_Implicit(Input.mousePosition), val);
			}
		}

		public static bool IsSettingsOpen
		{
			get
			{
				if (_viewSettings && _open)
				{
					return _moddedActive;
				}
				return false;
			}
		}

		public static bool IsPointerOverSettings
		{
			get
			{
				if (IsSettingsOpen)
				{
					return IsPointerOverWindow;
				}
				return false;
			}
		}

		public static bool IsScrollbarEngaged
		{
			get
			{
				if (_open && _moddedActive && _chatActive && !_viewSettings && _alpha > 0.01f)
				{
					if (!IsPointerOverScrollbar())
					{
						return _scrollbarDragging;
					}
					return true;
				}
				return false;
			}
		}

		public static bool CapturesWheel
		{
			get
			{
				try
				{
					if (!Core.HasInitialized)
					{
						return false;
					}
					if (ConsoleGateService.IsConsoleOpen)
					{
						return false;
					}
					if (!_moddedActive || !_open || _alpha <= 0.01f)
					{
						return false;
					}
					if (!_chatActive && !IsSettingsOpen)
					{
						return false;
					}
					return IsPointerOverWindow;
				}
				catch
				{
					return false;
				}
			}
		}

		public static bool IsDragging
		{
			get
			{
				if (_dragging && _open)
				{
					return _moddedActive;
				}
				return false;
			}
		}

		public static void ToggleModded()
		{
			SetModdedActive(!_moddedActive);
		}

		public static void SetModdedActive(bool modded)
		{
			_moddedActive = modded;
			if (modded)
			{
				_chatActive = false;
				_viewSettings = false;
				_viewHelp = false;
				_hkArmedIndex = -1;
				SetOpen(open: true);
				MarkActivity();
			}
			else
			{
				SetOpen(open: false);
				NativeChatService.RestoreNative();
			}
		}

		public static void EnsureBuilt()
		{
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Expected O, but got Unknown
			if (_built || !Core.HasInitialized || !Core.HasCanvas)
			{
				return;
			}
			try
			{
				if (!_subscribed)
				{
					_subscribed = true;
					UpdateDriver.Actions.Add(Tick);
					UpdateDriver.Actions.Add(InputLockService.Tick);
					UpdateDriver.Actions.Add(NativeChatService.Tick);
					UpdateDriver.Actions.Add(HistoryService.Tick);
					UpdateDriver.Actions.Add(InputSuppressionPatch.Tick);
					UpdateDriver.Actions.Add(SettingsService.Tick);
					UpdateDriver.Actions.Add(ClanHudService.Tick);
					ChatDataService.LineCaptured += OnLineCaptured;
					HistoryService.Initialize();
					SettingsService.Initialize();
					InputHistoryService.Initialize();
					_history.AddRange(InputHistoryService.Entries);
				}
				Build();
				_built = true;
				Core.Log.LogInfo((object)"[ChatPlus] Chat window built.");
				ApplyLayout();
				if (_moddedActive)
				{
					_chatActive = false;
					_focusPending = false;
					SetOpen(open: true);
				}
				_logDirty = true;
				_tailRequested = true;
				_recalcAfterOpen = Time.realtimeSinceStartupAsDouble + 0.2;
			}
			catch (Exception ex)
			{
				ManualLogSource log = Core.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(37, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ChatPlus] Chat window build failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				log.LogError(val);
			}
		}

		public static void ResetSession()
		{
			TMP_InputField compose = _compose;
			if ((Object)(object)_root != (Object)null)
			{
				try
				{
					Object.Destroy((Object)(object)_root);
				}
				catch
				{
				}
			}
			_root = null;
			_rootRect = null;
			_fade = null;
			_chatView = null;
			_settingsView = null;
			_helpView = null;
			_helpBtn = null;
			_helpBackBtn = null;
			_copyBtn = null;
			_bottomBar = null;
			_hkContainer = null;
			_hkHint = null;
			_log = null;
			_compose = null;
			_scroll = null;
			_scrollContent = null;
			_scrollbar = null;
			_scrollbarRect = null;
			_channelLabel = null;
			_channelBg = null;
			_composeBar = null;
			_hintBar = null;
			_railRt = null;
			_settingsBtnRt = null;
			_settingsBtnBg = null;
			_opacitySlider = null;
			_opacityValue = null;
			_inputOpacitySlider = null;
			_inputOpacityValue = null;
			_geomX = null;
			_geomY = null;
			_geomW = null;
			_geomH = null;
			_geomClan = null;
			_geomWSlider = null;
			_geomHSlider = null;
			_geomClanSlider = null;
			_sliderSyncGuard = false;
			_renderedLines.Clear();
			_lineOffsets.Clear();
			_lineVisLens.Clear();
			_lineRawStarts.Clear();
			_logClickArmed = false;
			_copyLabel = null;
			_copyFeedbackUntil = 0.0;
			_highlightObj = null;
			_highlight = null;
			_highlightRect = null;
			_hoverLineIdx = -1;
			_forceHoverRecompute = false;
			_highlightFlashUntil = 0.0;
			_channelLabelFeedbackUntil = 0.0;
			_scrollBg = null;
			_composeBarBg = null;
			_inputBg = null;
			_placeholderTmp = null;
			_composeBarRect = null;
			_logScrollRect = null;
			_textAreaRect = null;
			_channelLabelRect = null;
			_composeH = 34f;
			_cycle.Clear();
			_cycleIndex = 0;
			_cycleSignature = string.Empty;
			_built = false;
			_open = false;
			_logDirty = false;
			_recalcAfterOpen = -1.0;
			_alpha = 0f;
			_lastActivityUtc = -1000.0;
			_chatActive = false;
			_viewSettings = false;
			_viewHelp = false;
			_wasTypingLastFrame = false;
			_hkArmedIndex = -1;
			_focusPending = false;
			_scrollbarDragging = false;
			_dragging = false;
			_gripRect = null;
			_gripBg = null;
			_hkContainer = null;
			_hkAddBtnRt = null;
			_hkHint = null;
			_settingsScroll = null;
			_settingsScrollbar = null;
			_settingsScrollbarRect = null;
			_settingsHandleGo = null;
			_helpScroll = null;
			_helpScrollbar = null;
			_helpScrollbarRect = null;
			_helpHandleGo = null;
			_settingsScrollbarDragging = false;
			_scrollbarHandleGo = null;
			_colorSwatchRows.Clear();
			_pendingHkIndex = -1;
			_pendingCmdIndex = -1;
			_hkCommandFields.Clear();
			_winStart = 0;
			_winEnd = 0;
			_appliedTrim = 0;
			_tailRequested = true;
			_followTail = true;
			_anchorTopPending = false;
			_anchorAllLines = -1;
			_anchorSubPixel = 0f;
			_windowMoved = false;
			_pendingWinStart = 0;
			_pendingWinEnd = 0;
			_displayScrollSize = 0.2f;
			_lastScrollNorm = -1f;
			_ignoreScrollFrames = 0;
			_logOffsetTarget = 0f;
			_logOffsetApplied = 0f;
			_seekPending = false;
			_scrollToBottomPending = false;
			_periodicRefreshCounter = 0;
			_rebuildFailLogAt = 0.0;
			_rebuildBackoffUntil = 0.0;
			_rebuildFailCount = 0;
			try
			{
				if ((Object)(object)compose != (Object)null)
				{
					compose.DeactivateInputField(false);
				}
			}
			catch
			{
			}
			try
			{
				EventSystem current = EventSystem.current;
				if ((Object)(object)current != (Object)null)
				{
					current.SetSelectedGameObject((GameObject)null);
				}
			}
			catch
			{
			}
		}

		private static void Build()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)Core.UiCanvas).transform;
			int uiLayer = Core.UiLayer;
			_root = UiFactory.Create("ChatPlusWindow", transform, uiLayer);
			UiFactory.AnchorPoint(_root, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(SettingsService.WindowX, SettingsService.WindowY), new Vector2(WinW, WinH));
			_chatView = UiFactory.Create("ChatView", _root.transform, uiLayer);
			UiFactory.FillParent(_chatView);
			BuildChatView(_chatView.transform, uiLayer);
			_settingsView = UiFactory.Create("SettingsView", _root.transform, uiLayer);
			UiFactory.FillParent(_settingsView);
			BuildSettingsView(_settingsView.transform, uiLayer);
			_settingsView.SetActive(false);
			_helpView = UiFactory.Create("HelpView", _root.transform, uiLayer);
			UiFactory.FillParent(_helpView);
			BuildHelpView(_helpView.transform, uiLayer);
			_helpView.SetActive(false);
			_bottomBar = UiFactory.Create("BottomBar", _root.transform, uiLayer);
			UiFactory.FillParent(_bottomBar);
			BuildBottomBar(_bottomBar.transform, uiLayer);
			_bottomBar.SetActive(false);
			_root.transform.SetAsLastSibling();
			Canvas obj = _root.AddComponent<Canvas>();
			obj.overrideSorting = true;
			obj.sortingOrder = 5000;
			_root.AddComponent<GraphicRaycaster>();
			_fade = _root.AddComponent<CanvasGroup>();
			_fade.alpha = 0f;
			_fade.interactable = false;
			_fade.blocksRaycasts = false;
			_rootRect = _root.GetComponent<RectTransform>();
			_root.SetActive(false);
		}

		private static void BuildChatView(Transform parent, int layer)
		{
			Scrollbar scrollbar = BuildLeftRail(parent, layer);
			BuildContentArea(parent, layer, scrollbar);
			BuildBottomStrip(parent, layer);
		}

		private static Scrollbar BuildLeftRail(Transform parent, int layer)
		{
			//IL_002e: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: 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_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: 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_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: 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_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = UiFactory.Create("LeftRail", parent, layer);
			RectTransform component = val.GetComponent<RectTransform>();
			float num = (Mirrored ? 1f : 0f);
			component.anchorMin = new Vector2(num, 0f);
			component.anchorMax = new Vector2(num, 1f);
			component.pivot = new Vector2(num, 0.5f);
			component.sizeDelta = new Vector2(18f, -18f);
			component.anchoredPosition = new Vector2(0f, 9f);
			GameObject go = UiFactory.Create("RailGradient", val.transform, layer);
			UiFactory.Stretch(go, 0f, 0f, 0f, 0f);
			UiFactory.BottomFadeBackground(go, new Color(0.039f, 0.039f, 0.051f, 0.85f));
			GameObject val2 = UiFactory.Create("SettingsBtn", val.transform, layer);
			RectTransform component2 = val2.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 0f);
			component2.anchorMax = new Vector2(1f, 0f);
			component2.pivot = new Vector2(0.5f, 0f);
			component2.anchoredPosition = Vector2.zero;
			component2.sizeDelta = new Vector2(0f, 34f);
			_settingsBtnBg = UiFactory.Background(val2, Theme.ButtonBg);
			UiFactory.Button(val2, ToggleSettingsView);
			_settingsBtnRt = component2;
			GameObject obj = UiFactory.Create("SettingsIcon", val2.transform, layer);
			Image obj2 = UiFactory.Background(obj, Theme.TextPrimary);
			obj2.sprite = UiFactory.WrenchSprite();
			obj2.type = (Type)0;
			((Graphic)obj2).raycastTarget = false;
			RectTransform component3 = obj.GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0.5f, 0.5f);
			component3.anchorMax = new Vector2(0.5f, 0.5f);
			component3.pivot = new Vector2(0.5f, 0.5f);
			component3.anchoredPosition = Vector2.zero;
			component3.sizeDelta = new Vector2(18f, 32f);
			GameObject val3 = UiFactory.Create("RailScrollbar", val.transform, layer);
			RectTransform component4 = val3.GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0f, 1f);
			component4.anchorMax = new Vector2(1f, 1f);
			component4.pivot = new Vector2(0.5f, 1f);
			component4.anchoredPosition = Vector2.zero;
			component4.sizeDelta = new Vector2(0f, WinH - 18f - 34f);
			_railRt = component;
			CanvasGroup obj3 = val3.AddComponent<CanvasGroup>();
			obj3.ignoreParentGroups = true;
			obj3.interactable = true;
			obj3.blocksRaycasts = true;
			((Graphic)UiFactory.Background(val3, new Color(0f, 0f, 0f, 0f))).raycastTarget = false;
			GameObject obj4 = UiFactory.Create("RailLine", val3.transform, layer);
			RectTransform component5 = obj4.GetComponent<RectTransform>();
			component5.anchorMin = new Vector2(0.5f, 0f);
			component5.anchorMax = new Vector2(0.5f, 1f);
			component5.pivot = new Vector2(0.5f, 0.5f);
			component5.sizeDelta = new Vector2(4f, 0f);
			((Graphic)UiFactory.Background(obj4, new Color(0.184f, 0.184f, 0.184f, 0.6f))).raycastTarget = false;
			GameObject obj5 = UiFactory.Create("Handle", val3.transform, layer);
			RectTransform component6 = obj5.GetComponent<RectTransform>();
			component6.anchorMin = Vector2.zero;
			component6.anchorMax = Vector2.one;
			component6.offsetMin = new Vector2(4f, 0f);
			component6.offsetMax = new Vector2(-4f, 0f);
			Image val4 = UiFactory.Background(obj5, new Color(0.45f, 0.45f, 0.45f, 0.55f));
			((Graphic)val4).raycastTarget = false;
			_scrollbarHandleGo = obj5;
			Scrollbar obj6 = val3.AddComponent<Scrollbar>();
			obj6.direction = (Direction)2;
			obj6.handleRect = component6;
			((Selectable)obj6).targetGraphic = (Graphic)(object)val4;
			obj6.value = 1f;
			((Selectable)obj6).interactable = false;
			((Selectable)obj6).transition = (Transition)0;
			val2.transform.SetAsLastSibling();
			_scrollbarRect = component4;
			return obj6;
		}

		private static void BuildContentArea(Transform parent, int layer, Scrollbar scrollbar)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = UiFactory.Create("ContentArea", parent, layer);
			RectTransform component = obj.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(0.5f, 0.5f);
			component.offsetMin = (Mirrored ? new Vector2(0f, 18f) : new Vector2(18f, 18f));
			component.offsetMax = (Mirrored ? new Vector2(-18f, 0f) : new Vector2(0f, 0f));
			BuildLog(obj.transform, layer, ContentWidth, scrollbar);
			BuildCompose(obj.transform, layer, ContentWidth);
		}

		private static void BuildBottomStrip(Transform parent, int layer)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = UiFactory.Create("BottomStrip", parent, layer);
			RectTransform component = obj.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(1f, 0f);
			component.pivot = new Vector2(0.5f, 0f);
			component.anchoredPosition = Vector2.zero;
			component.sizeDelta = new Vector2(0f, 18f);
			BuildGrip(obj.transform, layer);
			BuildChannelLabel(obj.transform, layer, WinW);
		}

		private static void BuildGrip(Transform parent, int layer)
		{
			//IL_002e: 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_0050: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_016a: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = UiFactory.Create("DragGrip", parent, layer);
			RectTransform component = val.GetComponent<RectTransform>();
			float num = (Mirrored ? 1f : 0f);
			component.anchorMin = new Vector2(num, 0f);
			component.anchorMax = new Vector2(num, 0f);
			component.pivot = new Vector2(num, 0f);
			component.anchoredPosition = Vector2.zero;
			component.sizeDelta = new Vector2(18f, 18f);
			_gripRect = component;
			GameObject val2 = UiFactory.Create("DragGripFace", val.transform, layer);
			RectTransform component2 = val2.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0.5f, 0.5f);
			component2.anchorMax = new Vector2(0.5f, 0.5f);
			component2.pivot = new Vector2(0.5f, 0.5f);
			component2.anchoredPosition = Vector2.zero;
			component2.sizeDelta = new Vector2(14f, 14f);
			_gripBg = UiFactory.Background(val2, new Color(1f, 1f, 1f, 0.08f));
			((Graphic)_gripBg).raycastTarget = false;
			for (int i = 0; i < 3; i++)
			{
				for (int j = 0; j < 2; j++)
				{
					GameObject obj = UiFactory.Create("Dot", val2.transform, layer);
					RectTransform component3 = obj.GetComponent<RectTransform>();
					component3.anchorMin = new Vector2(0.5f, 0.5f);
					component3.anchorMax = new Vector2(0.5f, 0.5f);
					component3.pivot = new Vector2(0.5f, 0.5f);
					component3.anchoredPosition = new Vector2(((float)j - 0.5f) * 5f, ((float)i - 1f) * 4f);
					component3.sizeDelta = new Vector2(3f, 3f);
					((Graphic)UiFactory.Background(obj, new Color(1f, 1f, 1f, 1f))).raycastTarget = false;
				}
			}
		}

		private static void BuildLog(Transform parent, int layer, float width, Scrollbar scrollbar)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0062: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: 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_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: 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_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = UiFactory.Create("Log", parent, layer);
			UiFactory.AnchorPoint(val, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), Vector2.zero, new Vector2(width, WinH - 34f - 18f));
			_scrollBg = UiFactory.Background(val, new Color(0.039f, 0.039f, 0.051f, SettingsService.LogBackgroundOpacity));
			((Graphic)_scrollBg).raycastTarget = false;
			GameObject val2 = UiFactory.Create("Viewport", val.transform, layer);
			UiFactory.FillParent(val2);
			((Graphic)UiFactory.Background(val2, new Color(0f, 0f, 0f, 0f))).raycastTarget = false;
			val2.AddComponent<RectMask2D>();
			_logScrollRect = val.GetComponent<RectTransform>();
			GameObject obj = UiFactory.Create("Content", val2.transform, layer);
			RectTransform component = obj.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(0.5f, 1f);
			component.offsetMin = (Mirrored ? new Vector2(6f, 0f) : new Vector2(8f, 0f));
			component.offsetMax = (Mirrored ? new Vector2(-8f, 0f) : new Vector2(-6f, 0f));
			component.anchoredPosition = Vector2.zero;
			_log = UiFactory.Label(obj, string.Empty, 14f, Theme.TextPrimary, (TextAlignmentOptions)513);
			((TMP_Text)_log).enableWordWrapping = true;
			((TMP_Text)_log).alignment = (TextAlignmentOptions)257;
			((TMP_Text)_log).margin = new Vector4(0f, 0f, 0f, 12f);
			obj.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			ScrollRect obj2 = val.AddComponent<ScrollRect>();
			obj2.content = component;
			obj2.viewport = val2.GetComponent<RectTransform>();
			obj2.horizontal = false;
			obj2.vertical = true;
			obj2.movementType = (MovementType)2;
			obj2.scrollSensitivity = 0f;
			obj2.verticalScrollbar = null;
			_scroll = obj2;
			_scrollContent = component;
			_scrollbar = scrollbar;
			_highlightObj = UiFactory.Create("HoverHighlight", ((Component)((TMP_Text)_log).rectTransform).transform, layer);
			RectTransform component2 = _highlightObj.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 1f);
			component2.anchorMax = new Vector2(1f, 1f);
			component2.pivot = new Vector2(0.5f, 1f);
			component2.anchoredPosition = Vector2.zero;
			component2.sizeDelta = Vector2.zero;
			_highlight = UiFactory.Background(_highlightObj, new Color(1f, 1f, 1f, 0.09f));
			((Graphic)_highlight).raycastTarget = false;
			_highlightRect = component2;
			_highlightObj.transform.SetAsFirstSibling();
			_highlightObj.SetActive(false);
		}

		private static void BuildCompose(Transform parent, int layer, float width)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: 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_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: 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_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			_composeBar = UiFactory.Create("Compose", parent, layer);
			UiFactory.AnchorPoint(_composeBar, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), Vector2.zero, new Vector2(width, 34f));
			_composeBarBg = UiFactory.Background(_composeBar, Theme.InputBg);
			((Graphic)_composeBarBg).raycastTarget = false;
			_composeBarRect = _composeBar.GetComponent<RectTransform>();
			GameObject val = UiFactory.Create("Input", _composeBar.transform, layer);
			UiFactory.Stretch(val, 6f, 4f, 4f, 4f);
			Image val2 = UiFactory.Background(val, Theme.InputBg);
			((Graphic)val2).raycastTarget = false;
			_inputBg = val2;
			GameObject val3 = UiFactory.Create("TextArea", val.transform, layer);
			UiFactory.Stretch(val3, 8f, 8f, 3f, 3f);
			_textAreaRect = val3.GetComponent<RectTransform>();
			GameObject go = UiFactory.Create("Placeholder", val3.transform, layer);
			UiFactory.FillParent(go);
			TextMeshProUGUI val4 = UiFactory.Label(go, "Type a message", 12f, Theme.TextMuted, (TextAlignmentOptions)513);
			((TMP_Text)val4).enableWordWrapping = true;
			_placeholderTmp = val4;
			GameObject go2 = UiFactory.Create("Text", val3.transform, layer);
			UiFactory.FillParent(go2);
			TextMeshProUGUI val5 = UiFactory.Label(go2, string.Empty, 12f, Theme.TextPrimary, (TextAlignmentOptions)513);
			((TMP_Text)val5).enableWordWrapping = true;
			_compose = UiFactory.InputField(val, val5, val4, val3.GetComponent<RectTransform>(), val2);
			_compose.lineType = (LineType)1;
			UiFactory.AddSubmitListener(_compose, SubmitCompose);
			_composeBar.SetActive(false);
			_hintBar = UiFactory.Create("HintBar", parent, layer);
			UiFactory.AnchorPoint(_hintBar, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), Vector2.zero, new Vector2(width, 34f));
			if (Mirrored)
			{
				UiFactory.RightFadeBackground(_hintBar, new Color(0.039f, 0.039f, 0.051f, 0.85f));
			}
			else
			{
				UiFactory.LeftFadeBackground(_hintBar, new Color(0.039f, 0.039f, 0.051f, 0.85f));
			}
			GameObject go3 = UiFactory.Create("HintText", _hintBar.transform, layer);
			TextMeshProUGUI val6;
			if (Mirrored)
			{
				UiFactory.AnchorPoint(go3, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-14f, 0f), new Vector2(width - 28f, 26f));
				val6 = UiFactory.Label(go3, "Press Enter to send a message", 12f, Theme.TextMuted, (TextAlignmentOptions)516);
			}
			else
			{
				UiFactory.AnchorPoint(go3, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(14f, 0f), new Vector2(width - 28f, 26f));
				val6 = UiFactory.Label(go3, "Press Enter to send a message", 12f, Theme.TextMuted, (TextAlignmentOptions)513);
			}
			((TMP_Text)val6).verticalAlignment = (VerticalAlignmentOptions)512;
			((Graphic)val6).raycastTarget = false;
			((TMP_Text)val6).enableWordWrapping = false;
			_hintBar.SetActive(false);
		}

		private static void BuildChannelLabel(Transform parent, int layer, float width)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = UiFactory.Create("SendChannelBg", parent, layer);
			UiFactory.AnchorPoint(val, new Vector2(0f, 0f), new Vector2(0f, 0f), Vector2.zero, new Vector2(width, 18f));
			if (Mirrored)
			{
				UiFactory.RightFadeBackground(val, new Color(0.039f, 0.039f, 0.051f, 0.85f));
			}
			else
			{
				UiFactory.LeftFadeBackground(val, new Color(0.039f, 0.039f, 0.051f, 0.85f), 1f);
			}
			_channelBg = val;
			GameObject val2 = UiFactory.Create("SendChannelLabel", parent, layer);
			if (Mirrored)
			{
				UiFactory.AnchorPoint(val2, new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(-26f, 0f), new Vector2(width - 18f - 24f, 18f));
				_channelLabel = UiFactory.Label(val2, string.Empty, 13f, Theme.TextAccent, (TextAlignmentOptions)516);
			}
			else
			{
				UiFactory.AnchorPoint(val2, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(26f, 0f), new Vector2(width - 18f - 24f, 18f));
				_channelLabel = UiFactory.Label(val2, string.Empty, 13f, Theme.TextAccent, (TextAlignmentOptions)513);
			}
			((TMP_Text)_channelLabel).verticalAlignment = (VerticalAlignmentOptions)512;
			_channelLabelRect = val2.GetComponent<RectTransform>();
			UpdateChannelLabel();
			val.SetActive(false);
			val2.SetActive(false);
		}

		private static void BuildSettingsView(Transform parent, int layer)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: 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_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: 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_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0502: Unknown result type (might be due to invalid IL or missing references)
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			//IL_0622: Unknown result type (might be due to invalid IL or missing references)
			//IL_0631: Unknown result type (might be due to invalid IL or missing references)
			//IL_0645: Unknown result type (might be due to invalid IL or missing references)
			//IL_0674: Unknown result type (might be due to invalid IL or missing references)
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0702: Unknown result type (might be due to invalid IL or missing references)
			//IL_0738: Unknown result type (might be due to invalid IL or missing references)
			//IL_074e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0764: Unknown result type (might be due to invalid IL or missing references)
			//IL_077a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0786: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0806: Unknown result type (might be due to invalid IL or missing references)
			//IL_0815: Unknown result type (might be due to invalid IL or missing references)
			//IL_0824: 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_084c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a66: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a75: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a93: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa7: 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_0ae2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b0a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c0b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c69: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c7b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c8a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c94: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d93: Unknown result type (might be due to invalid IL or missing references)
			//IL_0da8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dbd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e12: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e21: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e30: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e49: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e75: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e8a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e9f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eb4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ec9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0efd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f12: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f27: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f51: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f5d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fbc: Unknown result type (might be due to invalid IL or missing references)
			GameObject go = UiFactory.Create("SettingsBg", parent, layer);
			UiFactory.FillParent(go);
			((Graphic)UiFactory.Background(go, Theme.SettingsBgWarm)).raycastTarget = true;
			GameObject go2 = UiFactory.Create("SettingsTitle", parent, layer);
			UiFactory.AnchorPoint(go2, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(10f, -12f), new Vector2(200f, 22f));
			UiFactory.Label(go2, "Settings", 16f, Theme.TextPrimary, (TextAlignmentOptions)513);
			GameObject go3 = UiFactory.Create("SettingsRule", parent, layer);
			UiFactory.AnchorPoint(go3, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(10f, -40f), new Vector2(200f, 1f));
			UiFactory.Hairline(go3, Theme.DividerRed);
			GameObject val = UiFactory.Create("MirrorToggle", parent, layer);
			UiFactory.AnchorPoint(val, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-10f, -8f), new Vector2(120f, 20f));
			UiFactory.Background(val, Theme.ButtonBg);
			UiFactory.Button(val, ToggleMirrorLayout);
			GameObject go4 = UiFactory.Create("MirrorLabel", val.transform, layer);
			UiFactory.FillParent(go4);
			UiFactory.Label(go4, MirrorToggleText(), 12f, Theme.TextPrimary, (TextAlignmentOptions)514);
			GameObject val2 = UiFactory.Create("SettingsScroll", parent, layer);
			RectTransform component = val2.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(0.5f, 0.5f);
			component.offsetMin = new Vector2(0f, 40f);
			component.offsetMax = new Vector2(0f, -46f);
			GameObject val3 = UiFactory.Create("SettingsViewport", val2.transform, layer);
			UiFactory.FillParent(val3);
			((Graphic)UiFactory.Background(val3, new Color(0f, 0f, 0f, 0f))).raycastTarget = false;
			val3.AddComponent<RectMask2D>();
			GameObject val4 = UiFactory.Create("SettingsContent", val3.transform, layer);
			RectTransform component2 = val4.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 1f);
			component2.anchorMax = new Vector2(1f, 1f);
			component2.pivot = new Vector2(0f, 1f);
			component2.offsetMin = new Vector2(10f, 0f);
			component2.offsetMax = new Vector2(-10f, 0f);
			component2.anchoredPosition = Vector2.zero;
			component2.sizeDelta = new Vector2(0f, 1200f);
			ScrollRect val5 = val2.AddComponent<ScrollRect>();
			val5.content = component2;
			val5.viewport = val3.GetComponent<RectTransform>();
			val5.horizontal = false;
			val5.vertical = true;
			val5.movementType = (MovementType)2;
			val5.scrollSensitivity = 20f;
			_settingsScroll = val5;
			BuildScrollbarTrack(val2.transform, val3.transform, val5, layer, out _settingsHandleGo, out _settingsScrollbarRect, out _settingsScrollbar);
			GameObject go5 = UiFactory.Create("OpacityLabel", val4.transform, layer);
			UiFactory.AnchorPoint(go5, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(8f, -14f), new Vector2(100f, 18f));
			UiFactory.Label(go5, "Log opacity", 12f, Theme.TextMuted, (TextAlignmentOptions)513);
			GameObject val6 = UiFactory.Create("OpacitySlider", val4.transform, layer);
			UiFactory.AnchorPoint(val6, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(110f, -14f), new Vector2(160f, 14f));
			UiFactory.Background(val6, Theme.FieldBg);
			GameObject obj = UiFactory.Create("Fill", val6.transform, layer);
			RectTransform component3 = obj.GetComponent<RectTransform>();
			component3.anchorMin = Vector2.zero;
			component3.anchorMax = Vector2.one;
			component3.offsetMin = Vector2.zero;
			component3.offsetMax = Vector2.zero;
			((Graphic)UiFactory.Background(obj, Theme.Steel)).raycastTarget = false;
			GameObject obj2 = UiFactory.Create("Handle", val6.transform, layer);
			RectTransform component4 = obj2.GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0f, 0.5f);
			component4.anchorMax = new Vector2(0f, 0.5f);
			component4.pivot = new Vector2(0.5f, 0.5f);
			component4.sizeDelta = new Vector2(6f, 8f);
			component4.anchoredPosition = Vector2.zero;
			Image val7 = UiFactory.Background(obj2, new Color(0.725f, 0.788f, 0.827f, 1f));
			((Graphic)val7).raycastTarget = true;
			_opacitySlider = UiFactory.AddHorizontalSlider(val6, component4, component3, val7, SettingsService.LogBackgroundOpacity, OnOpacityChanged);
			GameObject go6 = UiFactory.Create("OpacityPct", val4.transform, layer);
			UiFactory.AnchorPoint(go6, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(276f, -14f), new Vector2(44f, 18f));
			_opacityValue = UiFactory.Label(go6, FormatPercent(SettingsService.LogBackgroundOpacity), 12f, Theme.TextPrimary, (TextAlignmentOptions)513);
			GameObject go7 = UiFactory.Create("InputOpacityLabel", val4.transform, layer);
			UiFactory.AnchorPoint(go7, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(8f, -40f), new Vector2(100f, 18f));
			UiFactory.Label(go7, "Input opacity", 12f, Theme.TextMuted, (TextAlignmentOptions)513);
			GameObject val8 = UiFactory.Create("InputOpacitySlider", val4.transform, layer);
			UiFactory.AnchorPoint(val8, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(110f, -40f), new Vector2(160f, 14f));
			UiFactory.Background(val8, Theme.FieldBg);
			GameObject obj3 = UiFactory.Create("InputFill", val8.transform, layer);
			RectTransform component5 = obj3.GetComponent<RectTransform>();
			component5.anchorMin = Vector2.zero;
			component5.anchorMax = Vector2.one;
			component5.offsetMin = Vector2.zero;
			component5.offsetMax = Vector2.zero;
			((Graphic)UiFactory.Background(obj3, Theme.Steel)).raycastTarget = false;
			GameObject obj4 = UiFactory.Create("InputHandle", val8.transform, layer);
			RectTransform component6 = obj4.GetComponent<RectTransform>();
			component6.anchorMin = new Vector2(0f, 0.5f);
			component6.anchorMax = new Vector2(0f, 0.5f);
			component6.pivot = new Vector2(0.5f, 0.5f);
			component6.sizeDelta = new Vector2(6f, 8f);
			component6.anchoredPosition = Vector2.zero;
			Image val9 = UiFactory.Background(obj4, new Color(0.725f, 0.788f, 0.827f, 1f));
			((Graphic)val9).raycastTarget = true;
			_inputOpacitySlider = UiFactory.AddHorizontalSlider(val8, component6, component5, val9, SettingsService.InputBackgroundOpacity, OnInputOpacityChanged);
			GameObject go8 = UiFactory.Create("InputOpacityPct", val4.transform, layer);
			UiFactory.AnchorPoint(go8, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(276f, -40f), new Vector2(44f, 18f));
			_inputOpacityValue = UiFactory.Label(go8, FormatPercent(SettingsService.InputBackgroundOpacity), 12f, Theme.TextPrimary, (TextAlignmentOptions)513);
			_geomX = BuildGeometryRow(val4.transform, layer, "Pos X", -72f, () => SettingsService.WindowX, delegate(float v)
			{
				SettingsService.WindowX = v;
				ApplyLayout();
			});
			_geomY = BuildGeometryRow(val4.transform, layer, "Pos Y", -98f, () => SettingsService.WindowY, delegate(float v)
			{
				SettingsService.WindowY = v;
				ApplyLayout();
			});
			_geomW = BuildGeometrySliderRow(val4.transform, layer, "Width", -124f, () => SettingsService.WindowWidth, delegate(float v)
			{
				SettingsService.WindowWidth = v;
				ApplyLayout();
			}, 300f, 2000f, ref _geomWSlider);
			_geomH = BuildGeometrySliderRow(val4.transform, layer, "Height", -150f, () => SettingsService.WindowHeight, delegate(float v)
			{
				SettingsService.WindowHeight = v;
				ApplyLayout();
			}, 200f, 1200f, ref _geomHSlider);
			_geomClan = BuildGeometrySliderRow(val4.transform, layer, "Clan up", -176f, () => SettingsService.ClanListYOffset, delegate(float v)
			{
				SettingsService.ClanListYOffset = v;
			}, -500f, 500f, ref _geomClanSlider);
			GameObject go9 = UiFactory.Create("ColorsHint", val4.transform, layer);
			UiFactory.AnchorPoint(go9, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(8f, -202f), new Vector2(200f, 18f));
			UiFactory.Label(go9, "Colors", 13f, Theme.TextPrimary, (TextAlignmentOptions)513);
			GameObject go10 = UiFactory.Create("ColorsRule", val4.transform, layer);
			UiFactory.AnchorPoint(go10, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(8f, -216f), new Vector2(200f, 1f));
			UiFactory.Hairline(go10, Theme.DividerRed);
			_colorSwatchRows.Clear();
			float num = -230f;
			float num2 = num;
			for (int num3 = 0; num3 < _colorRowNames.Length; num3++)
			{
				ChatColorGroup? chatColorGroup = ColorGroupForRow(num3);
				if (chatColorGroup.HasValue)
				{
					ChatColorGroup valueOrDefault = chatColorGroup.GetValueOrDefault();
					float num4 = num - 21f;
					BuildColorGroupBackground(val4.transform, layer, num, num4);
					BuildColorSwatchRow(val4.transform, layer, num3, num);
					num2 = num4;
					BuildColorChannelStrip(val4.transform, layer, valueOrDefault, num4);
					num -= 52f;
				}
				else
				{
					BuildColorSwatchRow(val4.transform, layer, num3, num);
					num -= 24f;
				}
			}
			RefreshColorSelection();
			float num5 = num2 - 22f;
			GameObject go11 = UiFactory.Create("DisplayHint", val4.transform, layer);
			UiFactory.AnchorPoint(go11, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(8f, num5), new Vector2(200f, 18f));
			UiFactory.Label(go11, "Display", 13f, Theme.TextPrimary, (TextAlignmentOptions)513);
			GameObject go12 = UiFactory.Create("DisplayRule", val4.transform, layer);
			UiFactory.AnchorPoint(go12, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(8f, num5 - 14f), new Vector2(200f, 1f));
			UiFactory.Hairline(go12, Theme.DividerRed);
			BuildToggleRow(val4.transform, layer, "Timestamp", num5 - 28f, () => SettingsService.ShowTimestamp, delegate(bool v)
			{
				SettingsService.ShowTimestamp = v;
				SettingsService.MarkDirty();
				RebuildLog();
			});
			BuildToggleRow(val4.transform, layer, "Channel tag", num5 - 52f, () => SettingsService.ShowChannelIndicator, delegate(bool v)
			{
				SettingsService.ShowChannelIndicator = v;
				SettingsService.MarkDirty();
				RebuildLog();
			});
			_hkHint = UiFactory.Label(UiFactory.Create("HotkeysHint", val4.transform, layer), "Hotkeys", 13f, Theme.TextPrimary, (TextAlignmentOptions)513);
			RectTransform component7 = ((Component)_hkHint).GetComponent<RectTransform>();
			component7.anchorMin = new Vector2(0f, 1f);
			component7.anchorMax = new Vector2(1f, 1f);
			component7.pivot = new Vector2(0f, 0.5f);
			component7.anchoredPosition = new Vector2(8f, -745f);
			component7.sizeDelta = new Vector2(WinW - 36f, 18f);
			GameObject go13 = UiFactory.Create("HotkeysRule", val4.transform, layer);
			UiFactory.AnchorPoint(go13, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(8f, -759f), new Vector2(200f, 1f));
			UiFactory.Hairline(go13, Theme.DividerRed);
			RectTransform component8 = UiFactory.Create("HotkeysRows", val4.transform, layer).GetComponent<RectTransform>();
			component8.anchorMin = new Vector2(0f, 1f);
			component8.anchorMax = new Vector2(1f, 1f);
			component8.pivot = new Vector2(0f, 1f);
			component8.anchoredPosition = new Vector2(8f, -767f);
			component8.sizeDelta = new Vector2(-16f, 0f);
			_hkContainer = component8;
			GameObject val10 = UiFactory.Create("AddHotkey", val4.transform, layer);
			RectTransform component9 = val10.GetComponent<RectTransform>();
			component9.anchorMin = new Vector2(0f, 1f);
			component9.anchorMax = new Vector2(0f, 1f);
			component9.pivot = new Vector2(0f, 1f);
			component9.anchoredPosition = new Vector2(8f, 0f);
			component9.sizeDelta = new Vector2(110f, 24f);
			UiFactory.Background(val10, Theme.ButtonBg);
			UiFactory.Button(val10, AddHotkey);
			_hkAddBtnRt = component9;
			GameObject go14 = UiFactory.Create("AddHotkeyLabel", val10.transform, layer);
			UiFactory.FillParent(go14);
			UiFactory.Label(go14, "+ Add Hotkey", 12f, Theme.TextPrimary, (TextAlignmentOptions)514);
			RebuildHotkeyRows();
		}

		private static void BuildBottomBar(Transform parent, int layer)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00fa: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: 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_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			_helpBtn = UiFactory.Create("HelpBtn", parent, layer);
			UiFactory.AnchorPoint(_helpBtn, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(10f, 8f), new Vector2(76f, 24f));
			UiFactory.Background(_helpBtn, Theme.ButtonBg);
			UiFactory.Button(_helpBtn, ShowHelpPage);
			GameObject go = UiFactory.Create("HelpBtnLabel", _helpBtn.transform, layer);
			UiFactory.FillParent(go);
			UiFactory.Label(go, "Help", 12f, Theme.TextPrimary, (TextAlignmentOptions)514);
			_helpBackBtn = UiFactory.Create("HelpBackBtn", parent, layer);
			UiFactory.AnchorPoint(_helpBackBtn, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(10f, 8f), new Vector2(76f, 24f));
			UiFactory.Background(_helpBackBtn, Theme.ButtonBg);
			UiFactory.Button(_helpBackBtn, ShowSettingsPage);
			GameObject go2 = UiFactory.Create("HelpBackLabel", _helpBackBtn.transform, layer);
			UiFactory.FillParent(go2);
			UiFactory.Label(go2, "Back", 12f, Theme.TextPrimary, (TextAlignmentOptions)514);
			_helpBackBtn.SetActive(false);
			_copyBtn = UiFactory.Create("CopyChat", parent, layer);
			UiFactory.AnchorPoint(_copyBtn, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(94f, 8f), new Vector2(110f, 24f));
			UiFactory.Background(_copyBtn, Theme.ButtonBg);
			UiFactory.Button(_copyBtn, CopyAllToClipboard);
			GameObject go3 = UiFactory.Create("CopyChatLabel", _copyBtn.transform, layer);
			UiFactory.FillParent(go3);
			_copyLabel = UiFactory.Label(go3, "Copy chat", 12f, Theme.TextPrimary, (TextAlignmentOptions)514);
			GameObject val = UiFactory.Create("Done", parent, layer);
			UiFactory.AnchorPoint(val, new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(-10f, 8f), new Vector2(56f, 24f));
			UiFactory.Background(val, Theme.ButtonBg);
			UiFactory.Button(val, ToggleSettingsView);
			GameObject go4 = UiFactory.Create("DoneLabel", val.transform, layer);
			UiFactory.FillParent(go4);
			UiFactory.Label(go4, "Done", 12f, Theme.TextPrimary, (TextAlignmentOptions)514);
		}

		private static void BuildHelpView(Transform parent, int layer)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			GameObject go = UiFactory.Create("HelpBg", parent, layer);
			UiFactory.FillParent(go);
			((Graphic)UiFactory.Background(go, Theme.SettingsBgWarm)).raycastTarget = true;
			GameObject go2 = UiFactory.Create("HelpTitle", parent, layer);
			UiFactory.AnchorPoint(go2, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(10f, -12f), new Vector2(200f, 22f));
			UiFactory.Label(go2, "Help", 16f, Theme.TextPrimary, (TextAlignmentOptions)513);
			GameObject go3 = UiFactory.Create("HelpRule", parent, layer);
			UiFactory.AnchorPoint(go3, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(10f, -40f), new Vector2(200f, 1f));
			UiFactory.Hairline(go3, Theme.DividerRed);
			GameObject val = UiFactory.Create("HelpScroll", parent, layer);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(0.5f, 0.5f);
			component.offsetMin = new Vector2(0f, 40f);
			component.offsetMax = new Vector2(0f, -46f);
			GameObject val2 = UiFactory.Create("HelpViewport", val.transform, layer);
			UiFactory.FillParent(val2);
			((Graphic)UiFactory.Background(val2, new Color(0f, 0f, 0f, 0f))).raycastTarget = false;
			val2.AddComponent<RectMask2D>();
			GameObject obj = UiFactory.Create("HelpContent", val2.transform, layer);
			RectTransform component2 = obj.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 1f);
			component2.anchorMax = new Vector2(1f, 1f);
			component2.pivot = new Vector2(0f, 1f);
			component2.offsetMin = new Vector2(10f, 0f);
			component2.offsetMax = new Vector2(-10f, 0f);
			component2.anchoredPosition = Vector2.zero;
			ScrollRect val3 = val.AddComponent<ScrollRect>();
			val3.content = component2;
			val3.viewport = val2.GetComponent<RectTransform>();
			val3.horizontal = false;
			val3.vertical = true;
			val3.movementType = (MovementType)2;
			val3.scrollSensitivity = 20f;
			_helpScroll = val3;
			BuildScrollbarTrack(val.transform, val2.transform, val3, layer, out _helpHandleGo, out _helpScrollbarRect, out _helpScrollbar);
			float y = -8f;
			AddHelpHeader(obj.transform, layer, "Chat", ref y);
			AddHelpBody(obj.transform, layer, "Enter focuses the box and sends. Empty Enter or Escape defocuses without closing. F6 swaps between ChatPlus and the vanilla chat.", ref y);
			AddHelpHeader(obj.transform, layer, "Channels", ref y);
			AddHelpBody(obj.transform, layer, "TAB cycles the send channel. The label below the input always shows the active one. Some servers restrict Global chat. Messages are capped at 490 bytes, roughly 480 normal characters; accented letters, emoji, and other symbols count as more.", ref y);
			AddHelpHeader(obj.transform, layer, "Recall", ref y);
			AddHelpBody(obj.transform, layer, "Up and Down cycle your sent lines, newest first. Recall persists across sessions up to 1000 lines.", ref y);
			AddHelpHeader(obj.transform, layer, "Hotkeys", ref y);
			AddHelpBody(obj.transform, layer, "Add entries in Settings. Click the key box and press a key or Ctrl, Alt, Shift combo. Each entry can hold a list of commands or messages; they fire to the current channel, one after another, while the chat box is not focused. The checkbox right of the key box toggles the entry on and off (on by default). Use \"+ Add command\" for more lines and the small X to remove one. The right-side X deletes the whole entry.", ref y);
			AddHelpHeader(obj.transform, layer, "Copy", ref y);
			AddHelpBody(obj.transform, layer, "While the chat box is focused, click a chat line to copy it with its timestamp. Click \"Copy chat\" to copy the lines currently shown. Timestamps appear only when the Timestamp toggle is on.", ref y);
			AddHelpHeader(obj.transform, layer, "Admins", ref y);
			AddHelpBody(obj.transform, layer, "A player who is an admin shows an [ADMIN] tag after their name. The admin name and admin message colors are set with the \"Admin name\" and \"Admin messages\" swatches in Settings. The admin colors also apply to your own lines when you are an admin. Each special color row has an \"Applies to\" switch row for Global, Local, Clan, and Whisper. A channel with a switch off falls back to the next color, then to the channel color.", ref y);
			AddHelpHeader(obj.transform, layer, "Look and layout", ref y);
			AddHelpBody(obj.transform, layer, "Sliders set log and input transparency. The position fields move and size the window. Grab the dotted grip in the bottom corner to drag. The \"Right side\" button mirrors the layout. Grab the chat history and drag to scroll it; the wheel also scrolls. Timestamps and channel tags (like [L], [G]) can be toggled in Settings.", ref y);
			AddHelpHeader(obj.transform, layer, "Miscellaneous", ref y);
			AddHelpBody(obj.transform, layer, "The window fades after 15 seconds idle.", ref y);
			component2.sizeDelta = new Vector2(0f, 0f - y + 16f);
		}

		private static void AddHelpHeader(Transform content, int layer, string text, ref float y)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			y -= 10f;
			GameObject obj = UiFactory.Create("HelpHeader", content, layer);
			RectTransform component = obj.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(0f, 1f);
			component.anchoredPosition = new Vector2(8f, y);
			component.sizeDelta = new Vector2(-16f, 20f);
			UiFactory.Label(obj, text, 13f, Theme.TextPrimary, (TextAlignmentOptions)513);
			y -= 22f;
		}

		private static void AddHelpBody(Transform content, int layer, string text, ref float y)
		{
			//IL_001e: 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)
			//IL_0048: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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)
			GameObject obj = UiFactory.Create("HelpBody", content, layer);
			RectTransform component = obj.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(0f, 1f);
			component.anchoredPosition = new Vector2(8f, y);
			TextMeshProUGUI obj2 = UiFactory.Label(obj, text, 12f, Theme.TextMuted, (TextAlignmentOptions)513);
			((TMP_Text)obj2).enableWordWrapping = true;
			float num = ((TMP_Text)obj2).GetPreferredValues(text, WinW - 36f, 0f).y + 4f;
			component.sizeDelta = new Vector2(-16f, num);
			y -= num + 4f;
		}

		private static void OnOpacityChanged(float value)
		{
			SettingsService.LogBackgroundOpacity = value;
			if ((Object)(object)_opacityValue != (Object)null)
			{
				((TMP_Text)_opacityValue).text = FormatPercent(value);
			}
		}

		private static void OnInputOpacityChanged(float value)
		{
			SettingsService.InputBackgroundOpacity = value;
			if ((Object)(object)_inputOpacityValue != (Object)null)
			{
				((TMP_Text)_inputOpacityValue).text = FormatPercent(value);
			}
		}

		private static void BuildScrollbarTrack(Transform parent, Transform viewport, ScrollRect scroll, int layer, out GameObject? handleGo, out RectTransform? barRect, out Scrollbar? scrollbarOut)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0096: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			handleGo = null;
			barRect = null;
			scrollbarOut = null;
			float num = (Mirrored ? 0f : 1f);
			GameObject val = UiFactory.Create("SettingsTrack", parent, layer);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(num, 0f);
			component.anchorMax = new Vector2(num, 1f);
			component.pivot = new Vector2(num, 0.5f);
			component.anchoredPosition = new Vector2((num == 0f) ? 2f : (-2f), 0f);
			component.sizeDelta = new Vector2(6f, 0f);
			((Graphic)UiFactory.Background(val, new Color(0.184f, 0.184f, 0.184f, 0.4f))).raycastTarget = false;
			barRect = component;
			GameObject val2 = UiFactory.Create("SettingsHandle", val.transform, layer);
			RectTransform component2 = val2.GetComponent<RectTransform>();
			component2.anchorMin = Vector2.zero;
			component2.anchorMax = Vector2.one;
			component2.offsetMin = Vector2.zero;
			component2.offsetMax = Vector2.zero;
			Image val3 = UiFactory.Background(val2, new Color(0.45f, 0.45f, 0.45f, 0.55f));
			((Graphic)val3).raycastTarget = false;
			Scrollbar val4 = val.AddComponent<Scrollbar>();
			val4.direction = (Direction)2;
			val4.handleRect = component2;
			((Selectable)val4).targetGraphic = (Graphic)(object)val3;
			((Selectable)val4).interactable = true;
			scroll.verticalScrollbar = val4;
			scroll.verticalScrollbarVisibility = (ScrollbarVisibility)0;
			handleGo = val2;
			scrollbarOut = val4;
		}

		private static string FormatPercent(float value)
		{
			return $"{Mathf.RoundToInt(value * 100f)}%";
		}

		private static void AddHotkey()
		{
			SettingsService.Hotkeys.Add(new SettingsService.HotkeyEntry());
			SettingsService.MarkDirty();
			RebuildHotkeyRows();
		}

		private static void RemoveHotkey(int index)
		{
			if (index >= 0 && index < SettingsService.Hotkeys.Count)
			{
				if (_hkArmedIndex == index)
				{
					_hkArmedIndex = -1;
				}
				else if (_hkArmedIndex > index)
				{
					_hkArmedIndex--;
				}
				SettingsService.Hotkeys.RemoveAt(index);
				SettingsService.MarkDirty();
				RebuildHotkeyRows();
			}
		}

		private static float HkEntryHeight(SettingsService.HotkeyEntry entry)
		{
			int num = ((entry.Commands != null) ? entry.Commands.Count : 0);
			return 26f + (float)num * 26f + 24f + 8f;
		}

		private static float HkContentHeight()
		{
			float num = 767f;
			foreach (SettingsService.HotkeyEntry hotkey in SettingsService.Hotkeys)
			{
				num += HkEntryHeight(hotkey);
			}
			return num + 34f + 24f;
		}

		private static void CommitHotkeyFields()
		{
			for (int i = 0; i < _hkCommandFields.Count && i < SettingsService.Hotkeys.Count; i++)
			{
				SettingsService.HotkeyEntry hotkeyEntry = SettingsService.Hotkeys[i];
				List<TMP_InputField> list = _hkCommandFields[i];
				for (int j = 0; j < list.Count; j++)
				{
					TMP_InputField val = list[j];