using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LCBridgeOverlay")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.3.0.0")] [assembly: AssemblyInformationalVersion("1.3.0+e471728a4a7d97b5c72ce26f5d901ac7f673b150")] [assembly: AssemblyProduct("LCBridgeOverlay")] [assembly: AssemblyTitle("LCBridgeOverlay")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LCBridgeOverlay { public static class BcmerEvents { public struct EventInfo { public string Name; public string ColorHex; } private static Type _emType; private static FieldInfo _curEventsField; private static bool _searched; private static readonly Dictionary _nameCache = new Dictionary(); private static readonly Dictionary> _typeGetterCache = new Dictionary>(); private static string ColorFor(string typeName) { string text = (typeName ?? "").ToLowerInvariant(); if (text.Contains("verygood") || text.Contains("great")) { return "#00FF00"; } if (text.Contains("good")) { return "#008000"; } if (text.Contains("verybad")) { return "#8B0000"; } if (text.Contains("bad")) { return "#FF0000"; } if (text.Contains("black") || text.Contains("deadly") || text.Contains("impossible") || text.Contains("death")) { return "#000000"; } return "#FFFFFF"; } public static List GetEvents() { List list = new List(); try { EnsureSearched(); if (_curEventsField == null) { return list; } if (!(_curEventsField.GetValue(null) is IEnumerable enumerable)) { return list; } foreach (object item in enumerable) { if (item == null) { continue; } string text = GetName(item); if (!string.IsNullOrEmpty(text)) { if (ConfigSettings.RussianActive) { text = EventTranslate.ToRu(text); } list.Add(new EventInfo { Name = text, ColorHex = ColorFor(GetEventTypeName(item)) }); } } } catch { } return list; } public static bool BcmePresent() { try { foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { if (pluginInfo.Key.IndexOf("BrutalCompany", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } PluginInfo value = pluginInfo.Value; object obj; if (value == null) { obj = null; } else { BepInPlugin metadata = value.Metadata; obj = ((metadata != null) ? metadata.Name : null); } if (obj == null) { obj = ""; } if (((string)obj).IndexOf("BrutalCompany", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } catch { } return false; } private static void EnsureSearched() { if (_searched) { return; } _searched = true; if (!BcmePresent()) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"BCME не найден в Chainloader.PluginInfos — плашка ивентов возьмёт данные моста."); } return; } _emType = FindTypeByFullName("BrutalCompanyMinus.Minus.EventManager") ?? FindTypeFuzzy("BrutalCompany", "EventManager"); if (_emType != null) { _curEventsField = _emType.GetField("currentEvents", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)("[reflection] BCMER EventManager=" + _emType.FullName + ", currentEvents=" + ((_curEventsField != null) ? "OK" : "НЕ НАЙДЕНО"))); } } else { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogInfo((object)"[reflection] BCMER не найден (не установлен?) — плашка ивентов возьмёт данные моста."); } } } private static string GetName(object ev) { Type type = ev.GetType(); if (!_nameCache.TryGetValue(type, out var value)) { value = type.GetMethod("Name", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); _nameCache[type] = value; } if (value != null) { try { return value.Invoke(ev, null) as string; } catch { } } return ev.ToString(); } private static string GetEventTypeName(object ev) { Type type = ev.GetType(); if (!_typeGetterCache.TryGetValue(type, out var value)) { value = BuildTypeGetter(type); _typeGetterCache[type] = value; } try { return value?.Invoke(ev); } catch { return null; } } private static Func BuildTypeGetter(Type t) { string[] array = new string[6] { "Type", "EventType", "type", "eventType", "Rarity", "rarity" }; string[] array2 = array; foreach (string name in array2) { MethodInfo m = t.GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); if (m != null && (m.ReturnType.IsEnum || m.ReturnType == typeof(string))) { return (object o) => m.Invoke(o, null)?.ToString(); } } array2 = array; foreach (string name2 in array2) { PropertyInfo p = t.GetProperty(name2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (p != null && p.CanRead && (p.PropertyType.IsEnum || p.PropertyType == typeof(string))) { return (object o) => p.GetValue(o)?.ToString(); } } array2 = array; foreach (string name3 in array2) { FieldInfo f = t.GetField(name3, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (f != null && (f.FieldType.IsEnum || f.FieldType == typeof(string))) { return (object o) => f.GetValue(o)?.ToString(); } } return null; } private static Type FindTypeByFullName(string fullName) { try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type type = null; try { type = assembly.GetType(fullName, throwOnError: false); } catch { } if (type != null) { return type; } } } catch { } return null; } private static Type FindTypeFuzzy(string asmNameContains, string typeName) { try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if ((assembly.GetName().Name ?? "").IndexOf(asmNameContains, StringComparison.OrdinalIgnoreCase) < 0) { continue; } Type[] source; try { source = assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { source = ex.Types.Where((Type x) => x != null).ToArray(); } Type type = source.FirstOrDefault((Type x) => string.Equals(x.Name, typeName, StringComparison.OrdinalIgnoreCase)); if (type != null) { return type; } } } catch { } return null; } } public static class BridgeServer { private static TcpListener _listener; private static Thread _acceptThread; private static volatile bool _running; private static readonly List _clients = new List(); private static readonly object _lock = new object(); private static volatile string _lastPayload; public static void Start(int port) { if (!_running) { _running = true; _listener = new TcpListener(IPAddress.Loopback, port); _listener.Start(); _acceptThread = new Thread(AcceptLoop) { IsBackground = true, Name = "LCBridge-Accept" }; _acceptThread.Start(); } } public static void Stop() { _running = false; try { _listener?.Stop(); } catch { } lock (_lock) { foreach (TcpClient client in _clients) { try { client.Close(); } catch { } } _clients.Clear(); } } private static void AcceptLoop() { while (_running) { try { TcpClient tcpClient = _listener.AcceptTcpClient(); if (Handshake(tcpClient)) { string lastPayload = _lastPayload; if (lastPayload != null) { try { byte[] array = EncodeTextFrame(lastPayload); tcpClient.GetStream().Write(array, 0, array.Length); } catch { } } lock (_lock) { _clients.Add(tcpClient); } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"Оверлей подключился к мосту."); } } else { try { tcpClient.Close(); } catch { } } } catch { if (!_running) { break; } } } } private static bool Handshake(TcpClient client) { try { NetworkStream stream = client.GetStream(); byte[] array = new byte[4096]; int num = stream.Read(array, 0, array.Length); if (num <= 0) { return false; } string text = Encoding.UTF8.GetString(array, 0, num); string text2 = null; string[] array2 = text.Split(new string[1] { "\r\n" }, StringSplitOptions.None); foreach (string text3 in array2) { if (text3.StartsWith("Sec-WebSocket-Key:", StringComparison.OrdinalIgnoreCase)) { text2 = text3.Substring("Sec-WebSocket-Key:".Length).Trim(); break; } } if (text2 == null) { return false; } string text4; using (SHA1 sHA = SHA1.Create()) { text4 = Convert.ToBase64String(sHA.ComputeHash(Encoding.UTF8.GetBytes(text2 + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"))); } string s = "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: " + text4 + "\r\n\r\n"; byte[] bytes = Encoding.UTF8.GetBytes(s); stream.Write(bytes, 0, bytes.Length); return true; } catch { return false; } } public static void Broadcast(string text) { _lastPayload = text; byte[] array = EncodeTextFrame(text); List list = null; lock (_lock) { foreach (TcpClient client in _clients) { try { if (!client.Connected) { (list ?? (list = new List())).Add(client); } else { client.GetStream().Write(array, 0, array.Length); } } catch { (list ?? (list = new List())).Add(client); } } if (list == null) { return; } foreach (TcpClient item in list) { _clients.Remove(item); try { item.Close(); } catch { } } } } private static byte[] EncodeTextFrame(string text) { byte[] bytes = Encoding.UTF8.GetBytes(text); int num = bytes.Length; byte[] array; if (num <= 125) { array = new byte[2] { 0, (byte)num }; } else if (num <= 65535) { array = new byte[4] { 0, 126, (byte)((num >> 8) & 0xFF), (byte)(num & 0xFF) }; } else { array = new byte[10] { 0, 127, 0, 0, 0, 0, 0, 0, 0, 0 }; for (int i = 0; i < 8; i++) { array[9 - i] = (byte)((num >> 8 * i) & 0xFF); } } array[0] = 129; byte[] array2 = new byte[array.Length + bytes.Length]; Buffer.BlockCopy(array, 0, array2, 0, array.Length); Buffer.BlockCopy(bytes, 0, array2, array.Length, bytes.Length); return array2; } } public class BridgeTicker : MonoBehaviour { private float _timer; private const float Interval = 1f; private string _lastPayload; private int _lastMobCount = -1; private void Update() { _timer += Time.deltaTime; if (!(_timer < 1f)) { _timer = 0f; DataParser.Heartbeat = Time.unscaledTime; GameState.TickStats(); RunStats.Tick(); string text = BuildJson(); if (text != _lastPayload) { _lastPayload = text; BridgeServer.Broadcast(text); DataParser.PushLocal(text); } } } private string BuildJson() { (int alive, int total) crew = GameState.GetCrew(); int item = crew.alive; int item2 = crew.total; int deaths = GameState.GetDeaths(); int localHealth = GameState.GetLocalHealth(); string moonName = GameState.GetMoonName(); string weatherTweaksWeather = GameState.GetWeatherTweaksWeather(); string s = ((!string.IsNullOrEmpty(weatherTweaksWeather)) ? weatherTweaksWeather : GameState.GetVanillaWeather()); string brutalEvent = GameState.GetBrutalEvent(); (List outside, List inside) monsters = GameState.GetMonsters(); List item3 = monsters.outside; List item4 = monsters.inside; List traps = GameState.GetTraps(); bool onMoon = GameState.GetOnMoon(); bool loading = GameState.GetLoading(); bool inGame = GameState.GetInGame(); int resetToken = GameState.GetResetToken(); int levelScrap = GameState.GetLevelScrap(); (int quota, int fulfilled) quotaProgress = GameState.GetQuotaProgress(); int item5 = quotaProgress.quota; int item6 = quotaProgress.fulfilled; int shipScrapSafe = GameState.GetShipScrapSafe(); int quotaIndexSafe = GameState.GetQuotaIndexSafe(); int dayCount = GameState.GetDayCount(); int daysLeft = GameState.GetDaysLeft(); string interior = GameState.GetInterior(); (int hives, int inside, int outside) lootBreakdown = GameState.GetLootBreakdown(); int item7 = lootBreakdown.hives; int item8 = lootBreakdown.inside; int item9 = lootBreakdown.outside; bool oldBird = GameState.GetOldBird(); bool onShip = GameState.GetOnShip(); string topKiller = GameState.GetTopKiller(); string topMonster = GameState.GetTopMonster(); string deadliestEvent = GameState.GetDeadliestEvent(); int num = item3.Count + item4.Count; if (num != _lastMobCount) { _lastMobCount = num; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)string.Format("[monsters] улица={0} ({1}) | комплекс={2} ({3})", item3.Count, string.Join(",", item3), item4.Count, string.Join(",", item4))); } } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append('{'); stringBuilder.Append("\"type\":\"bridge\","); stringBuilder.Append("\"deaths\":").Append(deaths).Append(','); stringBuilder.Append("\"alive\":").Append(item).Append(','); stringBuilder.Append("\"total\":").Append(item2).Append(','); stringBuilder.Append("\"health\":").Append(localHealth).Append(','); stringBuilder.Append("\"moonName\":").Append(JsonStr(moonName)).Append(','); stringBuilder.Append("\"weatherFull\":").Append(JsonStr(s)).Append(','); stringBuilder.Append("\"brutalEvent\":").Append(JsonStr(brutalEvent ?? "")).Append(','); stringBuilder.Append("\"onMoon\":").Append(onMoon ? "true" : "false").Append(','); stringBuilder.Append("\"loading\":").Append(loading ? "true" : "false").Append(','); stringBuilder.Append("\"inGame\":").Append(inGame ? "true" : "false").Append(','); stringBuilder.Append("\"resetToken\":").Append(resetToken).Append(','); stringBuilder.Append("\"levelScrap\":").Append(levelScrap).Append(','); stringBuilder.Append("\"quotaValue\":").Append(item5).Append(','); stringBuilder.Append("\"quotaFulfilled\":").Append(item6).Append(','); stringBuilder.Append("\"shipLoot\":").Append(shipScrapSafe).Append(','); stringBuilder.Append("\"quotaIndex\":").Append(quotaIndexSafe).Append(','); stringBuilder.Append("\"dayCount\":").Append(dayCount).Append(','); stringBuilder.Append("\"daysLeft\":").Append(daysLeft).Append(','); stringBuilder.Append("\"interiorType\":").Append(JsonStr(interior ?? "")).Append(','); stringBuilder.Append("\"beehiveCount\":").Append(item7).Append(','); stringBuilder.Append("\"itemsInside\":").Append(item8).Append(','); stringBuilder.Append("\"itemsOutside\":").Append(item9).Append(','); stringBuilder.Append("\"hasOldBird\":").Append(oldBird ? "true" : "false").Append(','); stringBuilder.Append("\"onShip\":").Append(onShip ? "true" : "false").Append(','); stringBuilder.Append("\"topKiller\":").Append(JsonStr(topKiller ?? "")).Append(','); stringBuilder.Append("\"topMonster\":").Append(JsonStr(topMonster ?? "")).Append(','); stringBuilder.Append("\"deadliestEvent\":").Append(JsonStr(deadliestEvent ?? "")).Append(','); stringBuilder.Append("\"monstersOutside\":").Append(JsonArr(item3)).Append(','); stringBuilder.Append("\"monstersInside\":").Append(JsonArr(item4)).Append(','); stringBuilder.Append("\"traps\":").Append(JsonArr(traps)).Append(','); stringBuilder.Append("\"run\":").Append(RunStats.ToJson()); stringBuilder.Append('}'); return stringBuilder.ToString(); } private static string JsonArr(List items) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append('['); for (int i = 0; i < items.Count; i++) { if (i > 0) { stringBuilder.Append(','); } stringBuilder.Append(JsonStr(items[i])); } stringBuilder.Append(']'); return stringBuilder.ToString(); } private static string JsonStr(string s) { if (s == null) { return "\"\""; } StringBuilder stringBuilder = new StringBuilder(s.Length + 2); stringBuilder.Append('"'); foreach (char c in s) { switch (c) { case '"': stringBuilder.Append("\\\""); continue; case '\\': stringBuilder.Append("\\\\"); continue; case '\n': stringBuilder.Append("\\n"); continue; case '\r': stringBuilder.Append("\\r"); continue; case '\t': stringBuilder.Append("\\t"); continue; } if (c < ' ') { StringBuilder stringBuilder2 = stringBuilder.Append("\\u"); int num = c; stringBuilder2.Append(num.ToString("x4", CultureInfo.InvariantCulture)); } else { stringBuilder.Append(c); } } stringBuilder.Append('"'); return stringBuilder.ToString(); } } internal static class EnemyResolver { private static readonly string[] _turretMarkers = new string[3] { "ToilHeadController", "MantiToilController", "TurretHeadController" }; private static readonly string[] _slayerMarkers = new string[3] { "ToilSlayerController", "MantiSlayerController", "SlayerController" }; public static string Resolve(object enemyAiObj) { string baseName = GetBaseName(enemyAiObj); if (string.IsNullOrEmpty(baseName)) { return null; } try { switch (TurretKind(enemyAiObj)) { case 2: return baseName + "+Turret+Slayer"; case 1: return baseName + "+Turret"; } } catch { } return baseName; } private static string GetBaseName(object enemyAiObj) { try { EnemyAI val = (EnemyAI)((enemyAiObj is EnemyAI) ? enemyAiObj : null); if ((Object)(object)val != (Object)null && (Object)(object)val.enemyType != (Object)null && !string.IsNullOrEmpty(val.enemyType.enemyName)) { return val.enemyType.enemyName; } } catch { } return null; } private static int TurretKind(object enemyAiObj) { MonoBehaviour val = (MonoBehaviour)((enemyAiObj is MonoBehaviour) ? enemyAiObj : null); if ((Object)(object)val == (Object)null) { return 0; } Component[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); if (componentsInChildren == null) { return 0; } int num = 0; Component[] array = componentsInChildren; foreach (Component val2 in array) { if ((Object)(object)val2 == (Object)null) { continue; } string name = ((object)val2).GetType().Name; if (string.IsNullOrEmpty(name)) { continue; } string[] slayerMarkers = _slayerMarkers; foreach (string value in slayerMarkers) { if (name.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) { return 2; } } if (num != 0) { continue; } slayerMarkers = _turretMarkers; foreach (string value2 in slayerMarkers) { if (name.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0) { num = 1; break; } } } return num; } } public static class GameState { private static int _deaths = 0; private static readonly HashSet _deadThisRound = new HashSet(); private static int _resetToken = 0; private static readonly Dictionary _killerCounts = new Dictionary(); private static readonly Dictionary _eventDeaths = new Dictionary(); private static readonly Dictionary _monsterSeen = new Dictionary(); private static Type _mgSpawnerType; private static bool _mgSearched; private static FieldInfo _mgOwnedField; private static PropertyInfo _mgInstanceProp; private static FieldInfo _mgInstanceField; private static int _landedScrap; private static bool _wasLanded; private static bool _scrapLocked; private static Type _emType; private static FieldInfo _curEventsField; private static bool _bcSearched; private static readonly Dictionary _nameMethodCache = new Dictionary(); private static Type _wtVarsType; private static MethodInfo _wtGetCurrent; private static bool _wtSearched; private static float _lastLootLog; private static int _lastInside = -1; private static int _lastOutside = -1; public static int GetResetToken() { return _resetToken; } public static void RegisterDeath(PlayerControllerB p, string killer = null) { bool flag = false; try { int item = (int)p.playerClientId; if (_deadThisRound.Add(item)) { _deaths++; flag = true; } } catch { _deaths++; flag = true; } if (!flag) { return; } try { if (!string.IsNullOrEmpty(killer)) { _killerCounts.TryGetValue(killer, out var value); _killerCounts[killer] = value + 1; } string brutalEvent = GetBrutalEvent(); if (!string.IsNullOrEmpty(brutalEvent) && brutalEvent != "—") { _eventDeaths.TryGetValue(brutalEvent, out var value2); _eventDeaths[brutalEvent] = value2 + 1; } RunStats.OnDeath(killer); } catch { } } public static void OnNewRound() { _deadThisRound.Clear(); } public static void ResetDeaths() { _deaths = 0; _deadThisRound.Clear(); _resetToken++; _killerCounts.Clear(); _eventDeaths.Clear(); _monsterSeen.Clear(); RunStats.ResetRun(); } public static int GetDeaths() { return _deaths; } public static void TickStats() { try { HashSet hashSet = new HashSet(); foreach (EnemyAI allLiveEnemy in GetAllLiveEnemies()) { if (!((Object)(object)allLiveEnemy == (Object)null) && !allLiveEnemy.isEnemyDead) { string text = EnemyResolver.Resolve(allLiveEnemy); if (text != null) { hashSet.Add(text); } } } foreach (string item in hashSet) { _monsterSeen.TryGetValue(item, out var value); _monsterSeen[item] = value + 1; } } catch { } } private static string TopOf(Dictionary dict) { string result = null; int num = 0; foreach (KeyValuePair item in dict) { if (item.Value > num) { num = item.Value; result = item.Key; } } return result; } public static string GetTopKiller() { return TopOf(_killerCounts); } public static string GetTopMonster() { return TopOf(_monsterSeen); } public static string GetDeadliestEvent() { return TopOf(_eventDeaths); } public static (int alive, int total) GetCrew() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return (alive: 0, total: 0); } int num = 0; int num2 = 0; PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && (val.isPlayerControlled || val.isPlayerDead)) { num++; if (!val.isPlayerDead) { num2++; } } } if (num == 0) { num = 1; } return (alive: num2, total: num); } catch { return (alive: 0, total: 0); } } public static int GetLocalHealth() { try { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { return 0; } return val.health; } catch { return 0; } } private static void EnsureMonstersGordion() { if (_mgSearched) { return; } _mgSearched = true; _mgSpawnerType = FindTypeByFullName("MonstersGordion.CompanyMonsterSpawner") ?? FindTypeFuzzy("MonstersGordion", new string[1] { "CompanyMonsterSpawner" }); if (_mgSpawnerType != null) { _mgOwnedField = _mgSpawnerType.GetField("_ownedEnemies", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ?? _mgSpawnerType.GetField("ownedEnemies", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _mgInstanceProp = _mgSpawnerType.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public); _mgInstanceField = _mgSpawnerType.GetField("Instance", BindingFlags.Static | BindingFlags.Public); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[reflection] MonstersGordion=" + _mgSpawnerType.FullName + ", _ownedEnemies=" + ((_mgOwnedField != null) ? "OK" : "НЕ НАЙДЕНО"))); } } else { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)"[reflection] MonstersGordion не найден (не установлен?)"); } } } public static List GetGordionEnemies() { List list = new List(); try { EnsureMonstersGordion(); if (_mgSpawnerType == null || _mgOwnedField == null) { return list; } object obj = _mgInstanceProp?.GetValue(null) ?? _mgInstanceField?.GetValue(null) ?? GetSingletonInstance(_mgSpawnerType); if (obj == null) { return list; } if (!(_mgOwnedField.GetValue(obj) is IEnumerable enumerable)) { return list; } foreach (object item in enumerable) { EnemyAI val = (EnemyAI)((item is EnemyAI) ? item : null); if (val != null && (Object)(object)val != (Object)null && !val.isEnemyDead) { list.Add(val); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("GetGordionEnemies fail: " + ex.Message)); } } return list; } public static List GetAllLiveEnemies() { List list = new List(); HashSet hashSet = new HashSet(); try { RoundManager instance = RoundManager.Instance; if ((Object)(object)instance != (Object)null && instance.SpawnedEnemies != null) { foreach (EnemyAI spawnedEnemy in instance.SpawnedEnemies) { if ((Object)(object)spawnedEnemy != (Object)null && !spawnedEnemy.isEnemyDead && hashSet.Add(((Object)spawnedEnemy).GetInstanceID())) { list.Add(spawnedEnemy); } } } } catch { } foreach (EnemyAI gordionEnemy in GetGordionEnemies()) { if ((Object)(object)gordionEnemy != (Object)null && !gordionEnemy.isEnemyDead && hashSet.Add(((Object)gordionEnemy).GetInstanceID())) { list.Add(gordionEnemy); } } return list; } public static (List outside, List inside) GetMonsters() { List list = new List(); List list2 = new List(); try { Dictionary dictionary = new Dictionary(); Dictionary dictionary2 = new Dictionary(); foreach (EnemyAI allLiveEnemy in GetAllLiveEnemies()) { if ((Object)(object)allLiveEnemy == (Object)null || allLiveEnemy.isEnemyDead) { continue; } string key = "Unknown"; try { string text = EnemyResolver.Resolve(allLiveEnemy); if (!string.IsNullOrEmpty(text)) { key = text; } } catch { } Dictionary obj2 = (allLiveEnemy.isOutside ? dictionary : dictionary2); obj2.TryGetValue(key, out var value); obj2[key] = value + 1; } foreach (KeyValuePair item in dictionary) { list.Add((item.Value > 1) ? $"{item.Key} x{item.Value}" : item.Key); } foreach (KeyValuePair item2 in dictionary2) { list2.Add((item2.Value > 1) ? $"{item2.Key} x{item2.Value}" : item2.Key); } list.Sort(StringComparer.Ordinal); list2.Sort(StringComparer.Ordinal); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("GetMonsters fail: " + ex.Message)); } } return (outside: list, inside: list2); } public static List GetTraps() { List list = new List(); try { Dictionary counts = new Dictionary(); CountType("Turret"); CountType("Landmine"); CountType("Spike Trap"); foreach (KeyValuePair item in counts) { list.Add((item.Value > 1) ? $"{item.Key} x{item.Value}" : item.Key); } void CountType(string label) where T : Object { try { T[] array = Object.FindObjectsOfType(); if (array != null && array.Length != 0) { counts.TryGetValue(label, out var value); counts[label] = value + array.Length; } } catch { } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("GetTraps fail: " + ex.Message)); } } return list; } public static int GetLevelScrap() { try { RoundManager instance = RoundManager.Instance; if (GetOnMoon()) { if (!_wasLanded) { _wasLanded = true; _scrapLocked = false; _landedScrap = 0; } if (!_scrapLocked && (Object)(object)instance != (Object)null) { int num = (int)instance.totalScrapValueInLevel; if (num > 0) { _landedScrap = num; _scrapLocked = true; } } } else { _wasLanded = false; _scrapLocked = false; _landedScrap = 0; } return _landedScrap; } catch { return _landedScrap; } } private static string GetEventName(object ev) { Type type = ev.GetType(); if (!_nameMethodCache.TryGetValue(type, out var value)) { value = type.GetMethod("Name", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); _nameMethodCache[type] = value; } if (value != null) { try { return value.Invoke(ev, null) as string; } catch { } } return ExtractName(ev); } public static string GetBrutalEvent() { try { if (!_bcSearched) { _bcSearched = true; _emType = FindTypeByFullName("BrutalCompanyMinus.Minus.EventManager") ?? FindTypeFuzzy("BrutalCompany", new string[1] { "EventManager" }); if (_emType != null) { _curEventsField = _emType.GetField("currentEvents", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[reflection] BCMER EventManager=" + _emType.FullName + ", currentEvents field=" + ((_curEventsField != null) ? "OK" : "НЕ НАЙДЕНО"))); } } else { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)"[reflection] BCMER EventManager не найден (мод выключен?)"); } } } if (_curEventsField == null) { return null; } if (!(_curEventsField.GetValue(null) is IEnumerable enumerable)) { return null; } List list = new List(); foreach (object item in enumerable) { if (item != null) { string eventName = GetEventName(item); if (!string.IsNullOrEmpty(eventName)) { list.Add(eventName); } } } if (list.Count == 0) { return null; } return string.Join(", ", list); } catch (Exception ex) { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogDebug((object)("GetBrutalEvent fail: " + ex.Message)); } return null; } } public static string GetWeatherTweaksWeather() { try { if (!_wtSearched) { _wtSearched = true; _wtVarsType = FindTypeByFullName("WeatherTweaks.Variables") ?? FindTypeFuzzy("WeatherTweaks", new string[1] { "Variables" }); if (_wtVarsType != null) { _wtGetCurrent = _wtVarsType.GetMethod("GetCurrentWeather", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[reflection] WeatherTweaks Variables=" + _wtVarsType.FullName + ", GetCurrentWeather=" + ((_wtGetCurrent != null) ? "OK" : "НЕ НАЙДЕНО"))); } } else { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)"[reflection] WeatherTweaks Variables не найден (мод выключен?)"); } } } if (_wtGetCurrent == null) { return null; } object obj = _wtGetCurrent.Invoke(null, null); if (obj == null) { return null; } string text = ExtractName(obj); return string.IsNullOrEmpty(text) ? null : text; } catch (Exception ex) { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogDebug((object)("GetWeatherTweaks fail: " + ex.Message)); } return null; } } public static string GetVanillaWeather() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.currentLevel == (Object)null) { return "None"; } return ((object)Unsafe.As(ref instance.currentLevel.currentWeather)/*cast due to .constrained prefix*/).ToString(); } catch { return "None"; } } public static string GetMoonName() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.currentLevel == (Object)null) { return "—"; } return instance.currentLevel.PlanetName; } catch { return "—"; } } public static bool GetOnMoon() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.currentLevel == (Object)null) { return false; } return instance.shipHasLanded; } catch { return false; } } public static bool GetLoading() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return false; } return instance.travellingToNewLevel; } catch { return false; } } public static bool GetInGame() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return false; } return instance.shipHasLanded || instance.travellingToNewLevel; } catch { return false; } } public static int GetDayCount() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance != (Object)null && instance.gameStats != null) { return instance.gameStats.daysSpent + 1; } TimeOfDay instance2 = TimeOfDay.Instance; if ((Object)(object)instance2 == (Object)null) { return 1; } return (instance2.daysUntilDeadline < 0) ? 1 : (3 - instance2.daysUntilDeadline); } catch { return 1; } } public static int GetQuotaIndexSafe() { try { TimeOfDay instance = TimeOfDay.Instance; if ((Object)(object)instance == (Object)null) { return 1; } return instance.timesFulfilledQuota + 1; } catch { return 1; } } public static int GetShipScrapSafe() { try { int num = 0; GameObject[] array = GameObject.FindGameObjectsWithTag("PhysicsProp"); for (int i = 0; i < array.Length; i++) { GrabbableObject component = array[i].GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.itemProperties == (Object)null) && component.itemProperties.isScrap && (component.isInShipRoom || component.isInElevator)) { num += component.scrapValue; } } return num; } catch { return 0; } } public static List> GetShipScrapItems() { List> list = new List>(); try { GameObject[] array = GameObject.FindGameObjectsWithTag("PhysicsProp"); for (int i = 0; i < array.Length; i++) { GrabbableObject component = array[i].GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.itemProperties == (Object)null) && component.itemProperties.isScrap && (component.isInShipRoom || component.isInElevator)) { list.Add(new KeyValuePair(((Object)component).GetInstanceID(), component.scrapValue)); } } } catch { } return list; } public static List> GetMonsterInstances() { List> list = new List>(); try { foreach (EnemyAI allLiveEnemy in GetAllLiveEnemies()) { if (!((Object)(object)allLiveEnemy == (Object)null) && !allLiveEnemy.isEnemyDead) { string text = EnemyResolver.Resolve(allLiveEnemy); if (text != null) { list.Add(new KeyValuePair(((Object)allLiveEnemy).GetInstanceID(), text)); } } } } catch { } return list; } public static (List outside, List inside) GetMonstersRaw() { List list = new List(); List list2 = new List(); try { foreach (EnemyAI allLiveEnemy in GetAllLiveEnemies()) { if (!((Object)(object)allLiveEnemy == (Object)null) && !allLiveEnemy.isEnemyDead) { string text = EnemyResolver.Resolve(allLiveEnemy); if (text != null) { (allLiveEnemy.isOutside ? list : list2).Add(text); } } } } catch { } return (outside: list, inside: list2); } public static (int quota, int fulfilled) GetQuotaProgress() { try { TimeOfDay instance = TimeOfDay.Instance; if ((Object)(object)instance == (Object)null) { return (quota: 0, fulfilled: 0); } return (quota: instance.profitQuota, fulfilled: instance.quotaFulfilled); } catch { return (quota: 0, fulfilled: 0); } } public static int GetDaysLeft() { try { TimeOfDay instance = TimeOfDay.Instance; return ((Object)(object)instance != (Object)null) ? instance.daysUntilDeadline : (-1); } catch { return -1; } } public static string GetInterior() { try { if (!GetOnMoon()) { return null; } DungeonFlow val = RoundManager.Instance?.dungeonGenerator?.Generator?.DungeonFlow; if ((Object)(object)val == (Object)null) { return null; } string text = ((Object)val).name ?? ""; if (text.IndexOf("Level1", StringComparison.OrdinalIgnoreCase) >= 0) { return "Facility"; } if (text.IndexOf("Level2", StringComparison.OrdinalIgnoreCase) >= 0) { return "Mansion"; } if (text.IndexOf("Level3", StringComparison.OrdinalIgnoreCase) >= 0) { return "Mineshaft"; } text = text.Replace("DungeonFlow", "").Replace("Flow", "").Replace("flow", "") .Trim(); return string.IsNullOrEmpty(text) ? null : text; } catch { return null; } } public static (int hives, int inside, int outside) GetLootBreakdown() { int num = 0; int num2 = 0; int num3 = 0; try { if (!GetOnMoon()) { return (hives: 0, inside: 0, outside: 0); } GameObject[] array = GameObject.FindGameObjectsWithTag("PhysicsProp"); for (int i = 0; i < array.Length; i++) { GrabbableObject component = array[i].GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.itemProperties == (Object)null) && component.itemProperties.isScrap && !component.isInShipRoom && !component.isInElevator && !component.isHeld && !component.isHeldByEnemy) { if ((component.itemProperties.itemName ?? "").IndexOf("hive", StringComparison.OrdinalIgnoreCase) >= 0) { num++; } else if (component.isInFactory) { num2++; } else { num3++; } } } if (Time.time - _lastLootLog > 5f && (num2 != _lastInside || num3 != _lastOutside)) { _lastLootLog = Time.time; _lastInside = num2; _lastOutside = num3; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[loot] внутри={num2} снаружи={num3} ульи={num}"); } } } catch { } return (hives: num, inside: num2, outside: num3); } public static bool GetOldBird() { try { foreach (EnemyAI allLiveEnemy in GetAllLiveEnemies()) { if (!((Object)(object)allLiveEnemy == (Object)null) && !allLiveEnemy.isEnemyDead) { string text = (((Object)(object)allLiveEnemy.enemyType != (Object)null) ? (allLiveEnemy.enemyType.enemyName ?? "") : ""); if (text.IndexOf("RadMech", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Old Bird", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } } catch { } return false; } public static bool GetOnShip() { try { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; return (Object)(object)val != (Object)null && val.isInHangarShipRoom; } catch { return false; } } public static bool GetInsideFactorySafe() { try { PlayerControllerB val = StartOfRound.Instance?.localPlayerController; return (Object)(object)val != (Object)null && val.isInsideFactory; } catch { return false; } } private static Type FindTypeByFullName(string fullName) { try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type type = null; try { type = assembly.GetType(fullName, throwOnError: false); } catch { } if (type != null) { return type; } } } catch { } return null; } private static Type FindTypeFuzzy(string asmNameContains, string[] typeNameCandidates) { try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { string text = assembly.GetName().Name ?? ""; if (text.IndexOf(asmNameContains, StringComparison.OrdinalIgnoreCase) < 0) { continue; } Type[] source; try { source = assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { source = ex.Types.Where((Type t) => t != null).ToArray(); } foreach (string cand in typeNameCandidates) { Type type = source.FirstOrDefault((Type t) => string.Equals(t.Name, cand, StringComparison.OrdinalIgnoreCase)); if (type != null) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[reflection] нашёл тип " + type.FullName + " в " + text)); } return type; } } } } catch (Exception ex2) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogDebug((object)("FindTypeFuzzy fail: " + ex2.Message)); } } return null; } private static object ReadStaticMember(Type t, string name) { try { FieldInfo field = t.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { if (field.IsStatic) { return field.GetValue(null); } object singletonInstance = GetSingletonInstance(t); if (singletonInstance != null) { return field.GetValue(singletonInstance); } } PropertyInfo property = t.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { MethodInfo? getMethod = property.GetGetMethod(nonPublic: true); if ((object)getMethod != null && getMethod.IsStatic) { return property.GetValue(null); } object singletonInstance2 = GetSingletonInstance(t); if (singletonInstance2 != null) { return property.GetValue(singletonInstance2); } } } catch { } return null; } private static object GetSingletonInstance(Type t) { try { PropertyInfo propertyInfo = t.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public) ?? t.GetProperty("instance", BindingFlags.Static | BindingFlags.Public); if (propertyInfo != null) { return propertyInfo.GetValue(null); } FieldInfo fieldInfo = t.GetField("Instance", BindingFlags.Static | BindingFlags.Public) ?? t.GetField("instance", BindingFlags.Static | BindingFlags.Public); if (fieldInfo != null) { return fieldInfo.GetValue(null); } } catch { } return null; } private static string ExtractName(object val) { if (val == null) { return null; } try { if (val is string result) { return result; } if (val.GetType().IsEnum) { return val.ToString(); } Type type = val.GetType(); PropertyInfo propertyInfo = type.GetProperty("Name") ?? type.GetProperty("name"); if (propertyInfo != null) { string text = propertyInfo.GetValue(val) as string; if (!string.IsNullOrEmpty(text)) { return text; } } FieldInfo fieldInfo = type.GetField("Name") ?? type.GetField("name"); if (fieldInfo != null) { string text2 = fieldInfo.GetValue(val) as string; if (!string.IsNullOrEmpty(text2)) { return text2; } } string text3 = val.ToString(); if (!string.IsNullOrEmpty(text3) && text3 != type.FullName && text3 != type.Name) { return text3; } } catch { } return null; } } [HarmonyPatch(typeof(PlayerControllerB))] public static class PlayerControllerB_Patches { [HarmonyPatch("KillPlayer")] [HarmonyPostfix] public static void OnKillPlayer(PlayerControllerB __instance, CauseOfDeath causeOfDeath) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)null && __instance.isPlayerDead) { string killer = ResolveKiller(__instance, causeOfDeath); GameState.RegisterDeath(__instance, killer); } } private static string ResolveKiller(PlayerControllerB player, CauseOfDeath cause) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected I4, but got Unknown //IL_00a3: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) try { if ((int)cause != 2) { switch (cause - 5) { case 4: return "Drowning"; case 0: return "Suffocation"; case 8: return "Fire"; case 6: return "Shock"; case 3: return "Crushed"; default: { RoundManager instance = RoundManager.Instance; if ((Object)(object)instance == (Object)null || instance.SpawnedEnemies == null) { return "Unknown"; } Vector3 position = ((Component)player).transform.position; float num = 25f; string text = null; foreach (EnemyAI spawnedEnemy in instance.SpawnedEnemies) { if (!((Object)(object)spawnedEnemy == (Object)null) && !spawnedEnemy.isEnemyDead) { float num2 = Vector3.Distance(position, ((Component)spawnedEnemy).transform.position); if (num2 < num) { num = num2; text = EnemyResolver.Resolve(spawnedEnemy); } } } return string.IsNullOrEmpty(text) ? "Unknown" : text; } } } return "Fall"; } catch { return "Unknown"; } } } public static class RunStats { public class QuotaSlice { public int index; public int scrapStart; public int scrapEnd; public int seconds; public int deaths; } private class MoonStat { public int visits; public int profit; public int seconds; } private static readonly List _quotas = new List(); private static QuotaSlice _curQuota; private static int _lastQuotaIndex = -1; private static readonly Dictionary _moons = new Dictionary(); private static string _curMoon; private static int _moonScrapStart; private static readonly Dictionary _monsterTime = new Dictionary(); private static readonly Dictionary _monsterCount = new Dictionary(); private static readonly HashSet _seenMonsterIds = new HashSet(); private static int _peakMonsters; private static readonly Dictionary _collectedScrap = new Dictionary(); private static int _secInside; private static int _secOutside; private static readonly List _timeline = new List(); private static int _lastDayLogged = -1; private static string _lastEventLogged; private static int _runSeconds; public static void ResetRun() { _quotas.Clear(); _curQuota = null; _lastQuotaIndex = -1; _moons.Clear(); _curMoon = null; _moonScrapStart = 0; _monsterTime.Clear(); _peakMonsters = 0; _monsterCount.Clear(); _seenMonsterIds.Clear(); _collectedScrap.Clear(); _secInside = 0; _secOutside = 0; _timeline.Clear(); _lastDayLogged = -1; _lastEventLogged = null; _runSeconds = 0; } public static void OnDeath(string killer) { try { int dayCount = GameState.GetDayCount(); string moonName = GameState.GetMoonName(); string arg = (string.IsNullOrEmpty(killer) ? "?" : killer); _timeline.Add($"{dayCount}|death|{arg}@{moonName}"); if (_curQuota != null) { _curQuota.deaths++; } } catch { } } public static void Tick() { try { if (!GameState.GetInGame()) { return; } _runSeconds++; int dayCount = GameState.GetDayCount(); int quotaIndexSafe = GameState.GetQuotaIndexSafe(); bool onMoon = GameState.GetOnMoon(); string moonName = GameState.GetMoonName(); string brutalEvent = GameState.GetBrutalEvent(); foreach (KeyValuePair shipScrapItem in GameState.GetShipScrapItems()) { if (!_collectedScrap.ContainsKey(shipScrapItem.Key)) { _collectedScrap[shipScrapItem.Key] = shipScrapItem.Value; } } int num = 0; foreach (int value in _collectedScrap.Values) { num += value; } if (quotaIndexSafe != _lastQuotaIndex) { if (_curQuota != null) { _curQuota.scrapEnd = num; _quotas.Add(_curQuota); } _curQuota = new QuotaSlice { index = quotaIndexSafe, scrapStart = num, scrapEnd = num, seconds = 0, deaths = 0 }; _lastQuotaIndex = quotaIndexSafe; } if (_curQuota != null) { _curQuota.seconds++; _curQuota.scrapEnd = num; } if (onMoon && !string.IsNullOrEmpty(moonName)) { if (_curMoon != moonName) { _curMoon = moonName; _moonScrapStart = num; if (!_moons.ContainsKey(moonName)) { _moons[moonName] = new MoonStat(); } _moons[moonName].visits++; } MoonStat moonStat = _moons[moonName]; moonStat.seconds++; int num2 = num - _moonScrapStart; if (num2 > 0) { moonStat.profit += num2; _moonScrapStart = num; } } else { _curMoon = null; } List> monsterInstances = GameState.GetMonsterInstances(); foreach (KeyValuePair item in monsterInstances) { Add(_monsterTime, item.Value); if (_seenMonsterIds.Add(item.Key)) { Add(_monsterCount, item.Value); } } int count = monsterInstances.Count; if (count > _peakMonsters) { _peakMonsters = count; } if (onMoon) { if (GameState.GetInsideFactorySafe()) { _secInside++; } else { _secOutside++; } } if (onMoon && !string.IsNullOrEmpty(moonName) && moonName != "—" && dayCount > 0 && dayCount != _lastDayLogged) { _lastDayLogged = dayCount; _timeline.Add($"{dayCount}|day|{moonName}"); } if (!string.IsNullOrEmpty(brutalEvent) && brutalEvent != "—" && brutalEvent != _lastEventLogged) { _lastEventLogged = brutalEvent; _timeline.Add($"{dayCount}|event|{brutalEvent}"); } } catch { } } private static void Add(Dictionary d, string k) { if (!string.IsNullOrEmpty(k)) { d.TryGetValue(k, out var value); d[k] = value + 1; } } public static string ToJson() { try { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append('{'); stringBuilder.Append("\"quotas\":["); List list = new List(_quotas); if (_curQuota != null) { list.Add(_curQuota); } for (int i = 0; i < list.Count; i++) { QuotaSlice quotaSlice = list[i]; if (i > 0) { stringBuilder.Append(','); } int value = Math.Max(0, quotaSlice.scrapEnd - quotaSlice.scrapStart); stringBuilder.Append('{').Append("\"i\":").Append(quotaSlice.index) .Append(',') .Append("\"money\":") .Append(value) .Append(',') .Append("\"sec\":") .Append(quotaSlice.seconds) .Append(',') .Append("\"deaths\":") .Append(quotaSlice.deaths) .Append('}'); } stringBuilder.Append("],"); stringBuilder.Append("\"moons\":["); int num = 0; foreach (KeyValuePair item in _moons.OrderByDescending((KeyValuePair x) => x.Value.profit)) { if (num++ > 0) { stringBuilder.Append(','); } stringBuilder.Append('{').Append("\"name\":").Append(JsonStr(item.Key)) .Append(',') .Append("\"visits\":") .Append(item.Value.visits) .Append(',') .Append("\"profit\":") .Append(item.Value.profit) .Append(',') .Append("\"sec\":") .Append(item.Value.seconds) .Append('}'); } stringBuilder.Append("],"); stringBuilder.Append("\"monsters\":["); int num2 = 0; foreach (KeyValuePair item2 in _monsterCount.OrderByDescending((KeyValuePair x) => x.Value).Take(20)) { if (num2++ > 0) { stringBuilder.Append(','); } _monsterTime.TryGetValue(item2.Key, out var value2); stringBuilder.Append('{').Append("\"name\":").Append(JsonStr(item2.Key)) .Append(',') .Append("\"count\":") .Append(item2.Value) .Append(',') .Append("\"sec\":") .Append(value2) .Append('}'); } stringBuilder.Append("],"); stringBuilder.Append("\"peak\":").Append(_peakMonsters).Append(','); stringBuilder.Append("\"inside\":").Append(_secInside).Append(','); stringBuilder.Append("\"outside\":").Append(_secOutside).Append(','); stringBuilder.Append("\"runSec\":").Append(_runSeconds).Append(','); stringBuilder.Append("\"timeline\":["); for (int num3 = 0; num3 < _timeline.Count && num3 < 120; num3++) { if (num3 > 0) { stringBuilder.Append(','); } stringBuilder.Append(JsonStr(_timeline[num3])); } stringBuilder.Append(']'); stringBuilder.Append('}'); return stringBuilder.ToString(); } catch { return "{}"; } } private static string JsonStr(string s) { if (s == null) { return "\"\""; } StringBuilder stringBuilder = new StringBuilder("\""); foreach (char c in s) { switch (c) { case '"': case '\\': stringBuilder.Append('\\').Append(c); break; case '\n': case '\r': stringBuilder.Append(' '); break; default: stringBuilder.Append(c); break; } } stringBuilder.Append('"'); return stringBuilder.ToString(); } } [HarmonyPatch(typeof(StartOfRound))] public static class StartOfRound_Patches { [HarmonyPatch("ResetShip")] [HarmonyPostfix] public static void OnResetShip() { GameState.ResetDeaths(); } [HarmonyPatch("SetTimeAndPlanetToSavedSettings")] [HarmonyPostfix] public static void OnLoadSavedSettings() { try { StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)instance == (Object)null) && ((instance.gameStats != null && instance.gameStats.daysSpent <= 0) || ((Object)(object)TimeOfDay.Instance != (Object)null && TimeOfDay.Instance.timesFulfilledQuota <= 0 && TimeOfDay.Instance.daysUntilDeadline >= 3))) { GameState.ResetDeaths(); } } catch { } } [HarmonyPatch("StartGame")] [HarmonyPostfix] public static void OnStartGame() { GameState.OnNewRound(); } } public static class ConfigSettings { public static ConfigEntry Enabled; public static ConfigEntry Style; public static ConfigEntry AlwaysVisible; public static ConfigEntry ToggleKey; public static ConfigEntry Language; public static ConfigEntry Scale; public static ConfigEntry RightOffsetPx; public static ConfigEntry PerspectiveStrength; public static ConfigEntry FadeWhenIdle; public static ConfigEntry IdleFadeSeconds; public static ConfigEntry IdleMinOpacity; public static ConfigEntry ShowPanel; public static ConfigEntry ShowTimer; public static ConfigEntry ShowLocation; public static ConfigEntry ShowQuota; public static ConfigEntry ShowDayDeaths; public static ConfigEntry ShowMonsters; public static ConfigEntry ShowTraps; public static ConfigEntry ShowBrutalEvent; public static ConfigEntry ShowVictoryBanner; public static ConfigEntry ShowTicker; public static ConfigEntry AutoTimer; public static ConfigEntry ShowAllEvents; public static ConfigEntry TimerPauseKey; public static ConfigEntry TimerResetKey; public static ConfigEntry Scanlines; public static ConfigEntry ScaleMonstersByCount; public static ConfigEntry Port; public static Key ToggleKeyParsed { get; private set; } = (Key)23; public static Key TimerPauseKeyParsed { get; private set; } = (Key)29; public static Key TimerResetKeyParsed { get; private set; } = (Key)0; public static bool LegacyStyleActive => string.Equals(Style.Value?.Trim(), "Legacy", StringComparison.OrdinalIgnoreCase); public static bool RussianActive { get { string a = Language.Value?.Trim(); if (string.Equals(a, "ru", StringComparison.OrdinalIgnoreCase)) { return true; } if (string.Equals(a, "en", StringComparison.OrdinalIgnoreCase)) { return false; } return Rtlc.Present; } } public static void Bind(ConfigFile cfg) { Enabled = cfg.Bind("General", "Enabled", true, "Включить/выключить оверлей целиком."); Style = cfg.Bind("General", "Style", "Game", "Стиль оверлея: \"Legacy\" (старый пиксельный из HTML) или \"Game\" (как внутриигровой чат). Требует перезапуска игры."); AlwaysVisible = cfg.Bind("General", "AlwaysVisible", false, "true — оверлей виден всегда (даже вне корабля), клавиша показа/скрытия работает везде. false — оверлей виден только когда игрок на корабле."); ToggleKey = cfg.Bind("General", "ToggleKey", "I", "Клавиша для переключения видимости (имя из UnityEngine.InputSystem.Key, например I, F7, Numpad0)."); Language = cfg.Bind("General", "Language", "auto", "Язык надписей оверлея: \"auto\" (русский, если установлен русификатор RTLC, иначе английский), \"en\" или \"ru\"."); Scale = cfg.Bind("General", "Scale", 1f, "Масштаб оверлея (0.5–2.0)."); RightOffsetPx = cfg.Bind("General", "RightOffsetPx", 20, "Отступ оверлея от правого края экрана в пикселях."); PerspectiveStrength = cfg.Bind("General", "PerspectiveStrength", 0f, "ЭКСПЕРИМЕНТ: эффект перспективы (как чат «уходит вдаль») — ближняя к центру экрана сторона сужается. 0 — выключить (по умолчанию). Попробуй 0.16. Искажает и текст, и рамки. Требует перезапуска."); FadeWhenIdle = cfg.Bind("General", "FadeWhenIdle", true, "Приглушать оверлей, если долго не двигать камерой (возвращается при движении камеры)."); IdleFadeSeconds = cfg.Bind("General", "IdleFadeSeconds", 4f, "Сколько секунд без движения камеры до приглушения оверлея."); IdleMinOpacity = cfg.Bind("General", "IdleMinOpacity", 0.32f, "Насколько приглушать: итоговая непрозрачность в бездействии (0 — полностью прозрачный, 1 — без приглушения)."); ShowPanel = cfg.Bind("Widgets", "ShowPanel", true, "Общая панель: фон, рамка/уголки и логотип GDLP."); ShowTimer = cfg.Bind("Widgets", "ShowTimer", true, "Таймер (запуск/пауза/сброс — клавиши в секции Behavior; авто-режим — AutoTimer)."); ShowLocation = cfg.Bind("Widgets", "ShowLocation", true, "Блок локации: луна, погода, тип интерьера, ульи, предметы внутри/снаружи, Old Bird."); ShowQuota = cfg.Bind("Widgets", "ShowQuota", true, "Прогресс квоты: табы Q1–Q3, полоса выполнения, собранный лут."); ShowDayDeaths = cfg.Bind("Widgets", "ShowDayDeaths", true, "День и счётчик смертей."); ShowMonsters = cfg.Bind("Widgets", "ShowMonsters", true, "Монстры: слева — наружные (outside), справа — внутренние (inside)."); ShowTraps = cfg.Bind("Widgets", "ShowTraps", true, "Ловушки (турели, мины, шипы) в нижней части оверлея. При турельном ивенте — анимация стрельбы."); ShowBrutalEvent = cfg.Bind("Widgets", "ShowBrutalEvent", true, "Плашка с ивентом от BCME (BrutalCompanyMinusExtraReborn). Видна только на луне."); ShowVictoryBanner = cfg.Bind("Widgets", "ShowVictoryBanner", true, "Баннер победы после выполнения 3-й квоты (с аналитикой забега: квоты, луны, монстры, хроника)."); ShowTicker = cfg.Bind("Widgets", "ShowTicker", true, "Бегущая строка с краткой сводкой: экипаж, луна, погода, день, квота, смерти."); AutoTimer = cfg.Bind("Behavior", "AutoTimer", true, "true — таймер автоматически запускается при начале рейда и встаёт на паузу при загрузках/меню. false — только ручное управление."); ShowAllEvents = cfg.Bind("Behavior", "ShowAllEvents", false, "true — показывать ВСЕ ивенты BCME (через запятую). false — только первый из списка."); TimerPauseKey = cfg.Bind("Behavior", "TimerPauseKey", "O", "Клавиша паузы/запуска таймера. None — отключить."); TimerResetKey = cfg.Bind("Behavior", "TimerResetKey", "None", "Клавиша сброса таймера. None — отключить (сброс всё равно происходит при новом сейве)."); Scanlines = cfg.Bind("Behavior", "Scanlines", true, "Едва заметные горизонтальные полосы (CRT/LSD-эффект как в ванильных меню). Требует перезапуска игры."); ScaleMonstersByCount = cfg.Bind("Behavior", "ScaleMonstersByCount", false, "ЭКСПЕРИМЕНТ: убрать цифры количества у монстров И ловушек — вместо этого чем их больше, тем крупнее иконка и тем сильнее она трясётся."); Port = cfg.Bind("WebSocket", "Port", 8181, "Порт встроенного WebSocket-моста. По нему HTML-оверлей (OBS) получает те же данные. Если у тебя ещё стоит отдельный мод LCBridge — удали его, иначе порт будет занят."); ReparseKeys(); ToggleKey.SettingChanged += delegate { ReparseKeys(); }; TimerPauseKey.SettingChanged += delegate { ReparseKeys(); }; TimerResetKey.SettingChanged += delegate { ReparseKeys(); }; } private static void ReparseKeys() { //IL_000c: 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_0036: Unknown result type (might be due to invalid IL or missing references) ToggleKeyParsed = ParseKey(ToggleKey.Value, (Key)23); TimerPauseKeyParsed = ParseKey(TimerPauseKey.Value, (Key)0); TimerResetKeyParsed = ParseKey(TimerResetKey.Value, (Key)0); } private static Key ParseKey(string s, Key fallback) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(s)) { return (Key)0; } if (Enum.TryParse(s.Trim(), ignoreCase: true, out Key result)) { return result; } ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)$"Не удалось распознать клавишу '{s}', использую {fallback}."); } return fallback; } } [Serializable] public class BridgePayload { public string type; public int deaths; public int alive; public int total; public int health; public string moonName; public string weatherFull; public string brutalEvent; public bool onMoon; public bool loading; public bool inGame; public int resetToken; public int levelScrap; public string topKiller; public string topMonster; public string deadliestEvent; public string[] monstersOutside; public string[] monstersInside; public string[] traps; public RunInfo run; public int quotaValue; public int quotaFulfilled; public int shipLoot; public int quotaIndex = 1; public int dayCount = 1; public int daysLeft = -1; public string interiorType; public int beehiveCount; public int itemsInside; public int itemsOutside; public bool hasOldBird; public bool onShip; } [Serializable] public class RunInfo { public RunQuota[] quotas; public RunMoon[] moons; public RunMonster[] monsters; public int peak; public int inside; public int outside; public int runSec; public string[] timeline; } [Serializable] public class RunQuota { public int i; public int money; public int sec; public int deaths; } [Serializable] public class RunMoon { public string name; public int visits; public int profit; public int sec; } [Serializable] public class RunMonster { public string name; public int count; public int sec; } public static class DataParser { private static string _pendingLocal; private static readonly object _localLock = new object(); public static float Heartbeat = -999f; public static BridgePayload Current { get; private set; } public static void PushLocal(string json) { lock (_localLock) { _pendingLocal = json; } } public static string TakeLocal() { lock (_localLock) { string pendingLocal = _pendingLocal; _pendingLocal = null; return pendingLocal; } } public static bool TryParse(string json) { if (string.IsNullOrEmpty(json)) { return false; } BridgePayload bridgePayload; try { bridgePayload = JsonUtility.FromJson(json); } catch { return false; } if (bridgePayload == null || bridgePayload.type != "bridge") { return false; } Current = bridgePayload; return true; } public static void Clear() { Current = null; } } public static class EventTranslate { private static readonly HashSet _loggedMiss = new HashSet(); private static readonly Dictionary Map = new Dictionary { ["allweather"] = "Вся погода сразу", ["antibounty"] = "Награда снята", ["anticoilhead"] = "Анти-койлхед", ["arachnophobia"] = "Арахнофобия", ["baboonhorde"] = "Орда павианов", ["badproduce"] = "Гнилой урожай", ["bees"] = "Пчёлы", ["berserkturrets"] = "Турели в ярости", ["bigbonus"] = "Большой бонус", ["bigdelivery"] = "Большая доставка", ["birds"] = "Птицы", ["blackfriday"] = "Чёрная пятница", ["bonus"] = "Бонус", ["bounty"] = "Награда за голову", ["bracken"] = "Бракен", ["bughorde"] = "Орда жуков", ["butlers"] = "Дворецкие", ["cadaver"] = "Трупоцвет", ["catsanddogs"] = "Кошки и собаки", ["clock"] = "Часы", ["coilhead"] = "Койлхед", ["controlpad"] = "Пульт управления", ["cruiserfailure"] = "Поломка крейсера", ["dentures"] = "Вставная челюсть", ["dogs"] = "Слепые псы", ["doorcircuitfailure"] = "Сбой цепи дверей", ["doorfailure"] = "Поломка дверей", ["dooroverdriveev"] = "Двери вразнос", ["dustpans"] = "Совки", ["dweller"] = "Пещерный житель", ["earlyship"] = "Ранний отлёт", ["eastereggs"] = "Пасхалки", ["explodingitems"] = "Взрывающиеся предметы", ["facilityghost"] = "Призрак комплекса", ["flashlightsfailure"] = "Сбой фонарей", ["flowersnake"] = "Тюльпановая змейка", ["footballscrap"] = "Ценный мяч", ["forestgiant"] = "Лесной великан", ["fragileenemies"] = "Хрупкие враги", ["fullaccess"] = "Полный доступ", ["garbagelid"] = "Крышка мусорки", ["giantsoutside"] = "Великаны снаружи", ["gloomy"] = "Пасмурно", ["goldenbars"] = "Золотые слитки", ["goldenfacility"] = "Золотой комплекс", ["grabbablelandmines"] = "Переносные мины", ["grabbableturrets"] = "Переносные турели", ["heavyrain"] = "Ливень", ["hell"] = "Ад", ["higherscrapvalue"] = "Лут дороже", ["hoardingbugs"] = "Жуки-барахольщики", ["holidayseason"] = "Праздники", ["honk"] = "Гудок", ["insidebees"] = "Пчёлы внутри", ["ismetal"] = "Металлический день", ["itemchargerfailure"] = "Сбой зарядной станции", ["jester"] = "Шут", ["jetpackfailure"] = "Сбой джетпака", ["kamikaziebugs"] = "Жуки-камикадзе", ["kidnapperfox"] = "Лис-похититель", ["kiwibird"] = "Гигантский киви", ["landmines"] = "Мины", ["lateship"] = "Поздний отлёт", ["leaflessbrowntrees"] = "Голые бурые деревья", ["leaflesstrees"] = "Голые деревья", ["leverfailure"] = "Сбой рычага отлёта", ["littlegirl"] = "Девочка-призрак", ["lizard"] = "Спор-ящер", ["lockedentrance"] = "Запертый вход", ["locusts"] = "Саранча", ["manualcamerafailure"] = "Сбой камер", ["masked"] = "Маскед", ["maskitem"] = "Маска", ["metalswitch"] = "Металлический рубильник", ["meteors"] = "Метеоры", ["moreexits"] = "Больше выходов", ["morescrap"] = "Больше лута", ["nobaboons"] = "Без павианов", ["nobirds"] = "Без птиц", ["nobracken"] = "Без бракена", ["nobutlers"] = "Без дворецких", ["nocoilhead"] = "Без койлхедов", ["nodogs"] = "Без псов", ["noghosts"] = "Без призраков", ["nogiants"] = "Без великанов", ["nohoardingbugs"] = "Без жуков-барахольщиков", ["nojester"] = "Без шута", ["nolandmines"] = "Без мин", ["nolizards"] = "Без ящеров", ["nomasks"] = "Без масок", ["nonutcracker"] = "Без щелкунчиков", ["nooldbird"] = "Без старых птиц", ["noslimes"] = "Без слизней", ["nosnarefleas"] = "Без блох", ["nospiders"] = "Без пауков", ["nospiketraps"] = "Без шипов", ["nothing"] = "Ничего", ["nothumpers"] = "Без тамперов", ["notmetal"] = "Не металл", ["noturrets"] = "Без турелей", ["noworm"] = "Без червя", ["nutcracker"] = "Щелкунчик", ["nutslayer"] = "Щелкунчик-палач", ["nutslayersmore"] = "Щелкунчики-палачи", ["oldbirds"] = "Старые птицы (мехи)", ["outsidelandmines"] = "Мины снаружи", ["outsideturrets"] = "Турели снаружи", ["pickles"] = "Огурчики", ["plasticcup"] = "Пластиковый стаканчик", ["plentyoutsidescrap"] = "Много лута снаружи", ["puma"] = "Феиопар", ["raining"] = "Дождь", ["realityshift"] = "Сдвиг реальности", ["safeoutside"] = "Снаружи безопасно", ["scarceoutsidescrap"] = "Мало лута снаружи", ["scrapgalore"] = "Лут в изобилии", ["severedbits"] = "Расчленёнка", ["shipcorefailure"] = "Сбой ядра корабля", ["shiplightsfailure"] = "Сбой света корабля", ["shipmentfees"] = "Плата за доставку", ["sid"] = "SID", ["slimeinside"] = "Слизень внутри", ["slimes"] = "Слизни", ["smalldelivery"] = "Малая доставка", ["smallermap"] = "Карта поменьше", ["snarefleas"] = "Блохи-душители", ["spiders"] = "Пауки", ["spiketraps"] = "Шипы-ловушки", ["stingray"] = "Скат", ["strongenemies"] = "Сильные враги", ["sussypaintings"] = "Подозрительные картины", ["targetingfailureevent"] = "Сбой наведения", ["teleporterfailure"] = "Сбой телепорта", ["teleportertraps"] = "Ловушки-телепорты", ["teleportin"] = "Телепортация внутрь", ["terminalfailure"] = "Сбой терминала", ["thumpers"] = "Тамперы", ["timechaos"] = "Хаос времени", ["toiletpaper"] = "Туалетная бумага", ["train"] = "Поезд", ["transmutescrapbig"] = "Трансмутация лута (много)", ["transmutescrapsmall"] = "Трансмутация лута (мало)", ["trapsfailure"] = "Сбой ловушек", ["trees"] = "Деревья", ["turrets"] = "Турели", ["turretseverywhere"] = "Турели повсюду", ["veryearlyship"] = "Очень ранний отлёт", ["verylateship"] = "Очень поздний отлёт", ["walkiefailure"] = "Сбой рации", ["warzone"] = "Зона боевых действий", ["welcometothefactory"] = "Добро пожаловать на завод", ["worms"] = "Земляные левиафаны", ["zeddog"] = "Пёс-зомби", ["allslayers"] = "Все палачи", ["baddice"] = "Дурные кости", ["baldi"] = "Балди", ["barbers"] = "Барберы", ["bellcrab"] = "Краб-звоночек", ["bertha"] = "Берта", ["bloodmoon"] = "Кровавая луна", ["cityofgold"] = "Золотой город", ["cleaners"] = "Чистильщики", ["critters"] = "Мелкие твари", ["dice"] = "Кости", ["football"] = "Футбол", ["forsaken"] = "Забытый", ["foxy"] = "Фокси", ["giantshowdown"] = "Битва великанов", ["hallowed"] = "Хэллоуин", ["heatwave"] = "Аномальная жара", ["herobrine"] = "Херобрин", ["hotbarhassle"] = "Свистопляска инвентаря", ["hotbarmania"] = "Мания инвентаря", ["hurricane"] = "Ураган", ["immortalsnail"] = "Бессмертная улитка", ["itsplaytime"] = "Playtime", ["leafboys"] = "Листовые парни", ["lighteaterenemy"] = "Пожиратель света", ["lockers"] = "Локеры", ["majoramoon"] = "Луна Majora", ["manstalker"] = "Преследователь", ["mantitoil"] = "Мантикоил с турелью", ["mantitoilslayer"] = "Мантикоил-палач", ["meltdown"] = "Расплавление реактора", ["meteorshower"] = "Метеоритный дождь", ["moaienemy"] = "Моаи", ["mobileturrets"] = "Мобильные турели", ["needycats"] = "Назойливые коты", ["nemo"] = "Немо", ["nofiend"] = "Без Изверга", ["noimmortalsnails"] = "Без улиток", ["nolockers"] = "Без локеров", ["nomantitoil"] = "Без мантитоила", ["nomantitoilslayer"] = "Без мантитоила-палача", ["nopeepers"] = "Без Пиперов", ["noshyguy"] = "Без Шайгая", ["noslayers"] = "Без палачей", ["notoilslayer"] = "Без тойл-палача", ["peepers"] = "Пиперы", ["phonesout"] = "Телефоны наружу", ["playtimebig"] = "Playtime (большой)", ["rollinggiants"] = "Катящиеся великаны", ["roomba"] = "Робот-пылесос", ["scp682"] = "SCP-682", ["scp939"] = "SCP-939", ["seamine"] = "Морская мина", ["shiba"] = "Сиба-ину", ["shockwavedrones"] = "Дроны с ударной волной", ["shrimp"] = "Креветка", ["shyguy"] = "Шайгай", ["sirenhead"] = "Сиреноголовый", ["skullenemy"] = "Череп", ["slenderman"] = "Слендермен", ["solarflare"] = "Солнечная вспышка", ["souldev"] = "Souldev", ["takeygokubracken"] = "Бракен-Гоку", ["thefiend"] = "Изверг", ["toilhead"] = "Тойлхед (койл с турелью)", ["toilslayer"] = "Тойл-палач", ["walkers"] = "Ходоки", ["welcometoooblterra"] = "Добро пожаловать в Ooblterra", ["windy"] = "Ветрено", ["yeetbomb"] = "Бомба-йит" }; public static string ToRu(string raw) { if (string.IsNullOrEmpty(raw)) { return raw; } string text = Norm(raw); if (text.Length == 0) { return raw; } if (Map.TryGetValue(text, out var value)) { return value; } if (_loggedMiss.Add(text)) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[event-ru] нет перевода для ивента \"" + raw + "\" (ключ: " + text + ") — показываю как есть.")); } } return raw; } private static string Norm(string s) { StringBuilder stringBuilder = new StringBuilder(s.Length); string text = s.ToLowerInvariant(); foreach (char c in text) { if ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) { stringBuilder.Append(c); } } return stringBuilder.ToString(); } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] internal static class Patch_GameNetworkManager_Disconnect { private static void Postfix() { OverlayManager.Instance?.NotifyDisconnectedFromGame(); } } public static class Localization { private static readonly Dictionary En = new Dictionary { ["location"] = "LOCATION", ["deadline"] = "DEADLINE PROGRESS", ["lootQuota"] = "LOOT / QUOTA", ["onPlanet"] = "ON PLANET", ["day"] = "DAY", ["left"] = "LEFT", ["crew"] = "CREW", ["deaths"] = "DEATHS", ["outside"] = "OUTSIDE", ["inside"] = "INSIDE", ["traps"] = "TRAPS", ["brutalEvent"] = "!! BRUTAL EVENT", ["noData"] = "- no data -", ["offline"] = "OFFLINE", ["bridge"] = "BRIDGE", ["interior"] = "INTERIOR", ["items"] = "ITEMS", ["in"] = "IN", ["out"] = "OUT", ["hives"] = "HIVES", ["oldBird"] = "!! OLD BIRD !!", ["met"] = "MET", ["tMoon"] = "MOON", ["tWx"] = "WX", ["tQuota"] = "QUOTA", ["tEvent"] = "EVENT", ["tObjective"] = "OBJECTIVE: SURVIVE 3 QUOTAS", ["vicStamp"] = "CHALLENGE", ["vicTitle"] = "COMPLETE", ["vicSub"] = "3 QUOTAS DONE - YOU SURVIVED", ["vicTime"] = "TIME", ["vicLoot"] = "LOOT", ["vicDeaths"] = "DEATHS", ["vicQuotas"] = "BY QUOTA", ["vicMoons"] = "MOONS", ["vicMonsters"] = "MOST ENCOUNTERED", ["vicTimeline"] = "DAY BY DAY", ["vicVisits"] = "visits", ["vicNoLosses"] = "no losses", ["vicEvent"] = "event", ["vicDeath"] = "deaths" }; private static readonly Dictionary Ru = new Dictionary { ["location"] = "ЛОКАЦИЯ", ["deadline"] = "ПРОГРЕСС КВОТЫ", ["lootQuota"] = "ЛУТ / КВОТА", ["onPlanet"] = "НА ПЛАНЕТЕ", ["day"] = "ДЕНЬ", ["left"] = "ОСТ.", ["crew"] = "ЭКИПАЖ", ["deaths"] = "СМЕРТИ", ["outside"] = "УЛИЦА", ["inside"] = "КОМПЛЕКС", ["traps"] = "ЛОВУШКИ", ["brutalEvent"] = "!! BRUTAL ИВЕНТ", ["noData"] = "— нет данных —", ["offline"] = "НЕТ СВЯЗИ", ["bridge"] = "МОСТ", ["interior"] = "ИНТЕРЬЕР", ["items"] = "ПРЕДМЕТЫ", ["in"] = "ВНУТРИ", ["out"] = "СНАРУЖИ", ["hives"] = "УЛЬИ", ["oldBird"] = "!! OLD BIRD !!", ["met"] = "ЕСТЬ", ["tMoon"] = "ЛУНА", ["tWx"] = "ПОГОДА", ["tQuota"] = "КВОТА", ["tEvent"] = "ИВЕНТ", ["tObjective"] = "ЦЕЛЬ: ПЕРЕЖИТЬ 3 КВОТЫ", ["vicStamp"] = "ИСПЫТАНИЕ", ["vicTitle"] = "ПРОЙДЕНО", ["vicSub"] = "3 КВОТЫ ВЫПОЛНЕНЫ — ТЫ ВЫЖИЛ", ["vicTime"] = "ВРЕМЯ", ["vicLoot"] = "ЛУТ", ["vicDeaths"] = "СМЕРТИ", ["vicQuotas"] = "ПО КВОТАМ", ["vicMoons"] = "ЛУНЫ", ["vicMonsters"] = "КОГО ВСТРЕЧАЛИ ЧАЩЕ", ["vicTimeline"] = "ХРОНИКА ПО ДНЯМ", ["vicVisits"] = "визитов", ["vicNoLosses"] = "без потерь", ["vicEvent"] = "ивент", ["vicDeath"] = "смерти" }; public static string T(string key) { if ((ConfigSettings.RussianActive ? Ru : En).TryGetValue(key, out var value)) { return value; } if (En.TryGetValue(key, out var value2)) { return value2; } return key; } } public class OverlayManager : MonoBehaviour { private const float PanelWidth = 340f; private const float SlideTime = 0.3f; private const float RailReserve = 92f; private const float TiltDeg = 1f; private Canvas _canvas; private bool _dirty; private OverlayStyle S; private RectTransform _root; private CanvasGroup _group; private Image _bgImage; private readonly List _frameImages = new List(); private readonly List _pixbits = new List(); private readonly List _allTexts = new List(); private readonly List _bigTexts = new List(); private TMP_FontAsset _fontBody; private TMP_FontAsset _fontBig; private TMP_FontAsset _dynFont; private bool _fontsResolved; private float _fontRetryT; private static readonly Dictionary _osFontCache = new Dictionary(); private GameObject _headerGo; private GameObject _headerDivider; private GameObject _locationGo; private GameObject _quotaGo; private GameObject _dayDeathsGo; private GameObject _tickerGo; private TextMeshProUGUI _timerText; private EyeWidget _topEye; private TextMeshProUGUI _moonText; private TextMeshProUGUI _interiorText; private TextMeshProUGUI _itemsText; private TextMeshProUGUI _oldBirdText; private readonly Image[] _qtabBgs = (Image[])(object)new Image[3]; private readonly TextMeshProUGUI[] _qtabTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[3]; private TextMeshProUGUI _lootQuotaText; private TextMeshProUGUI _barText; private GameObject _onPlanetGo; private TextMeshProUGUI _onPlanetVal; private RectTransform _barFill; private Image _barFillImg; private TextMeshProUGUI _dayText; private TextMeshProUGUI _deathsText; private MobRailWidget _mobRail; private TrapFireEffect _trapFire; private EventPlateWidget _eventPlate; private RectTransform _eventPlateRt; private RectTransform _trapRailRt; private RectTransform _trapFxRt; private TextMeshProUGUI _eventText; private TickerWidget _ticker; private VictoryWidget _victory; private bool _userHidden; private float _vis; private Quaternion _lastCamRot = Quaternion.identity; private float _idleT; private float _idleAlpha = 1f; private const float IdleFadeTime = 0.8f; private float _timerSec; private bool _timerRunning; private bool? _prevLoading; private bool? _prevInGame; private int? _prevResetToken; private int? _lastQuotaIndex; private List _events = new List(); private bool _loggedFirstPacket; private bool _loggedParseFail; private bool? _loggedOnShip; private static readonly string[] TurretEventKeys = new string[11] { "turret", "турел", "berserk", "mobile", "everywhere", "toilhead", "toil", "hell", "quad", "artillery", "артилл" }; private const float PauseDimAlpha = 0.06f; private float _pauseFade; private static readonly (string key, string hex)[] WxColors = new(string, string)[6] { ("eclips", "#FF3A2E"), ("storm", "#FFCF3A"), ("rain", "#5FB6E6"), ("flood", "#3FA9C9"), ("fog", "#C8C2B0"), ("dust", "#D9A05A") }; private float _lastPanelH = -1f; private static Texture2D _scanTex; private static Sprite _grunge; public static OverlayManager Instance { get; private set; } internal OverlayStyle Style => S; private void Awake() { Instance = this; S = (ConfigSettings.LegacyStyleActive ? OverlayStyle.Legacy() : OverlayStyle.Game()); BuildUi(); if (DataParser.Current != null) { OnPayload(DataParser.Current); } } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void Update() { //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) string text = DataParser.TakeLocal(); if (text != null) { if (DataParser.TryParse(text)) { if (!_loggedFirstPacket) { _loggedFirstPacket = true; BridgePayload current = DataParser.Current; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"Первый пакет моста разобран: moon={current.moonName}, onShip={current.onShip}, inGame={current.inGame}, quota={current.shipLoot}/{current.quotaValue}"); } } OnPayload(DataParser.Current); } else if (!_loggedParseFail) { _loggedParseFail = true; ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("Не удалось разобрать пакет моста (начало): " + text.Substring(0, Math.Min(300, text.Length)))); } } } HandleInput(); if (_timerRunning) { _timerSec += Time.unscaledDeltaTime; } if (!_fontsResolved) { _fontRetryT += Time.unscaledDeltaTime; if (_fontRetryT >= 1f) { _fontRetryT = 0f; EnsureFonts(); if (_fontsResolved) { _dirty = true; } } } UpdateVisibility(Time.unscaledDeltaTime); PositionTrapRail(); if (((Component)_root).gameObject.activeSelf && ConfigSettings.ShowTimer.Value) { ((TMP_Text)_timerText).text = FmtTimeMs(_timerSec); ((Graphic)_timerText).color = (Color)(_timerRunning ? Color.white : new Color(1f, 1f, 1f, 0.6f)); } if (_dirty) { _dirty = false; EnsureFonts(); Refresh(); } RewarpOnResize(); } public void NotifyDisconnectedFromGame() { DataParser.Clear(); _timerRunning = false; _prevLoading = null; _prevInGame = null; _victory?.Hide(); _dirty = true; } private void OnPayload(BridgePayload p) { _dirty = true; if (_loggedOnShip != p.onShip) { _loggedOnShip = p.onShip; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)string.Format("onShip={0} → панель {1} (AlwaysVisible={2})", p.onShip, p.onShip ? "разрешена" : "будет скрыта", ConfigSettings.AlwaysVisible.Value)); } } if (_prevResetToken.HasValue && p.resetToken != _prevResetToken) { _timerSec = 0f; _timerRunning = false; _prevLoading = null; _prevInGame = null; _lastQuotaIndex = null; _victory?.Hide(); } _prevResetToken = p.resetToken; if (ConfigSettings.AutoTimer.Value && (p.loading != _prevLoading || p.inGame != _prevInGame)) { _timerRunning = p.inGame && !p.loading; _prevLoading = p.loading; _prevInGame = p.inGame; } _events = BcmerEvents.GetEvents(); if (_events.Count == 0 && !string.IsNullOrEmpty(p.brutalEvent)) { string[] array = p.brutalEvent.Split(','); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length != 0) { if (ConfigSettings.RussianActive) { text = EventTranslate.ToRu(text); } _events.Add(new BcmerEvents.EventInfo { Name = text, ColorHex = "#FFFFFF" }); } } } int num = Mathf.Max(1, p.quotaIndex); if (_lastQuotaIndex.HasValue && num > _lastQuotaIndex && num >= 4 && ConfigSettings.ShowVictoryBanner.Value) { _victory.Show(p, (int)_timerSec); } _lastQuotaIndex = num; } private void HandleInput() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) if (IsTypingChat()) { return; } if (KeyPressed(ConfigSettings.ToggleKeyParsed)) { bool flag = DataParser.Current?.onShip ?? false; if (ConfigSettings.AlwaysVisible.Value || flag) { _userHidden = !_userHidden; } } if (KeyPressed(ConfigSettings.TimerPauseKeyParsed)) { _timerRunning = !_timerRunning; } if (KeyPressed(ConfigSettings.TimerResetKeyParsed)) { _timerSec = 0f; } } private static bool IsTypingChat() { try { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; return (Object)(object)val != (Object)null && val.isTypingChat; } catch { return false; } } private static bool KeyPressed(Key k) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((int)k == 0) { return false; } Keyboard current = Keyboard.current; if (current == null) { return false; } try { return ((ButtonControl)current[k]).wasPressedThisFrame; } catch { return false; } } private void UpdateVisibility(float dt) { //IL_0184: Unknown result type (might be due to invalid IL or missing references) BridgePayload current = DataParser.Current; bool flag = DataParser.Current != null && Time.unscaledTime - DataParser.Heartbeat < 5f; bool flag2 = false; bool flag3 = false; try { GameNetworkManager instance = GameNetworkManager.Instance; PlayerControllerB val = (((Object)(object)instance != (Object)null) ? instance.localPlayerController : null); flag2 = (Object)(object)val != (Object)null; if ((Object)(object)val != (Object)null && (Object)(object)val.quickMenuManager != (Object)null) { flag3 = val.quickMenuManager.isMenuOpen; } } catch { } if ((Object)(object)_canvas != (Object)null) { _canvas.sortingOrder = (flag3 ? (-1000) : 500); } UpdateIdleFade(dt); bool flag4 = ConfigSettings.Enabled.Value && flag2 && (ConfigSettings.AlwaysVisible.Value || (flag && current != null && current.onShip)) && !_userHidden; _topEye?.SetOpen(flag4 ? 1f : 0f); _vis = Mathf.Clamp01(_vis + (flag4 ? 1f : (-1f)) * (dt / 0.3f)); float num = EaseOutCubic(_vis); float num2 = 340f * ConfigSettings.Scale.Value + 200f; float num3 = 0f - Mathf.Max((float)ConfigSettings.RightOffsetPx.Value, 92f); _root.anchoredPosition = new Vector2(Mathf.Lerp(num2, num3, num), 0f); _pauseFade = Mathf.MoveTowards(_pauseFade, flag3 ? 1f : 0f, dt / 0.2f); float num4 = Mathf.Lerp(1f, 0.06f, _pauseFade); _group.alpha = num * _idleAlpha * num4; bool flag5 = _vis > 0.001f; if (((Component)_root).gameObject.activeSelf != flag5) { ((Component)_root).gameObject.SetActive(flag5); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)(flag5 ? "Оверлей появляется." : "Оверлей скрыт.")); } if (flag5) { _dirty = true; } } } private static float EaseOutCubic(float t) { return 1f - Mathf.Pow(1f - t, 3f); } private void UpdateIdleFade(float dt) { //IL_006e: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (!ConfigSettings.FadeWhenIdle.Value) { _idleAlpha = 1f; return; } float num = 999f; try { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; Camera val2 = (((Object)(object)val != (Object)null) ? val.gameplayCamera : null); if ((Object)(object)val2 == (Object)null && (Object)(object)Camera.main != (Object)null) { val2 = Camera.main; } if ((Object)(object)val2 != (Object)null) { num = Quaternion.Angle(((Component)val2).transform.rotation, _lastCamRot); _lastCamRot = ((Component)val2).transform.rotation; } } catch { } if (num > 0.4f) { _idleT = 0f; } else { _idleT += dt; } float num2 = ((_idleT > ConfigSettings.IdleFadeSeconds.Value) ? Mathf.Clamp01(ConfigSettings.IdleMinOpacity.Value) : 1f); _idleAlpha = Mathf.MoveTowards(_idleAlpha, num2, dt / 0.8f); } private void Refresh() { //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_0205: 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_0289: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0566: 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) if (!((Component)_root).gameObject.activeSelf) { return; } BridgePayload current = DataParser.Current; bool flag = DataParser.Current != null && Time.unscaledTime - DataParser.Heartbeat < 5f; bool flag2 = current?.onMoon ?? false; bool value = ConfigSettings.ShowPanel.Value; ((Behaviour)_bgImage).enabled = value; foreach (Image frameImage in _frameImages) { if ((Object)(object)frameImage != (Object)null) { ((Behaviour)frameImage).enabled = value; } } foreach (PixbitFlicker pixbit in _pixbits) { if ((Object)(object)pixbit != (Object)null) { pixbit.Master = value; } } ((Component)_topEye).gameObject.SetActive(value); _headerGo.SetActive(value || ConfigSettings.ShowTimer.Value); _headerDivider.SetActive(value); ((Component)((TMP_Text)_timerText).transform.parent).gameObject.SetActive(ConfigSettings.ShowTimer.Value); _locationGo.SetActive(ConfigSettings.ShowLocation.Value); _quotaGo.SetActive(ConfigSettings.ShowQuota.Value); _dayDeathsGo.SetActive(ConfigSettings.ShowDayDeaths.Value); if (!ConfigSettings.ShowVictoryBanner.Value) { _victory.Hide(); } ((Graphic)_topEye.Img).color = (Color)(flag ? Color.white : new Color(0.5f, 0.5f, 0.5f, 1f)); ((TMP_Text)_timerText).text = FmtTime((int)_timerSec); ((Graphic)_timerText).color = (Color)(_timerRunning ? Color.white : new Color(1f, 1f, 1f, 0.6f)); string text = ((current == null || string.IsNullOrEmpty(current.moonName)) ? "- -" : current.moonName); string text2 = ((current != null) ? ColorizeWeather(current.weatherFull) : ""); ((TMP_Text)_moonText).text = ((text2.Length > 0) ? (Esc(text.ToUpperInvariant()) + " // " + text2) : Esc(text.ToUpperInvariant())); bool flag3 = flag2 && !string.IsNullOrEmpty(current.interiorType); ((Component)_interiorText).gameObject.SetActive(flag3); if (flag3) { ((TMP_Text)_interiorText).text = Localization.T("interior") + ": " + Esc(current.interiorType.ToUpperInvariant()) + ""; } ((Component)_itemsText).gameObject.SetActive(flag2); if (flag2) { ((TMP_Text)_itemsText).text = string.Format("{0}: {1} {2} / ", Localization.T("items"), Localization.T("in"), current.itemsInside) + string.Format("{0} {1} / ", Localization.T("out"), current.itemsOutside) + string.Format("{0} {1}", Localization.T("hives"), current.beehiveCount); } ((Component)_oldBirdText).gameObject.SetActive(flag2 && current.hasOldBird); int num = ((current == null) ? 1 : Mathf.Max(1, current.quotaIndex)); for (int i = 0; i < 3; i++) { bool flag4 = i < num - 1; bool flag5 = !flag4 && i == num - 1; ((Graphic)_qtabBgs[i]).color = (Color)(flag4 ? S.Frame : (flag5 ? OverlayStyle.WithA(S.Frame, S.LegacyCorners ? 0.1f : 0.22f) : new Color(1f, 1f, 1f, S.LegacyCorners ? 0f : 0.06f))); ((Graphic)_qtabTexts[i]).color = (flag4 ? (S.LegacyCorners ? Color.white : Color.black) : (flag5 ? S.Accent : S.TextDim)); } int num2 = ((current != null) ? Mathf.Max(0, current.quotaValue) : 0); int num3 = ((current != null) ? Mathf.Max(0, current.shipLoot) : 0); ((TMP_Text)_lootQuotaText).text = $"{num3}/{num2}"; float num4 = ((num2 > 0) ? ((float)num3 / (float)num2) : 0f); _barFill.anchorMax = new Vector2(Mathf.Clamp01(num4), 1f); ((Graphic)_barFillImg).color = ((num4 >= 1f) ? S.Accent : OverlayStyle.WithA(S.Accent, 0.7f)); ((Graphic)_barFillImg).SetVerticesDirty(); bool flag6 = flag2 && current.levelScrap > 0; _onPlanetGo.SetActive(flag6); if (flag6) { ((TMP_Text)_onPlanetVal).text = "$" + current.levelScrap; } int day = current?.dayCount ?? 1; int deaths = current?.deaths ?? 0; string text3 = ((current != null && current.daysLeft >= 0) ? string.Format(" ({1} {2})", OverlayStyle.Hex(S.TextDim), current.daysLeft, Localization.T("left")) : ""); ((TMP_Text)_dayText).text = day + text3; ((TMP_Text)_deathsText).text = deaths.ToString(); bool value2 = ConfigSettings.ShowMonsters.Value; _mobRail.SetMobs((!value2) ? null : current?.monstersOutside, (!value2) ? null : current?.monstersInside); string[] array = ((!ConfigSettings.ShowTraps.Value) ? null : current?.traps); _mobRail.SetTraps(array); _trapFire.Firing = ConfigSettings.ShowTraps.Value && array != null && array.Length != 0 && flag2 && HasTurretTrap(array) && TurretEventActive(); RefreshEventPlate(flag2); RefreshTicker(current, flag, text, num, day, deaths); } private void RefreshEventPlate(bool onMoon) { //IL_0061: 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) bool flag = ConfigSettings.ShowBrutalEvent.Value && onMoon && (_events.Count > 0 || BcmerEvents.BcmePresent()); _eventPlate.SetVisible(flag); if (!flag) { return; } if (_events.Count == 0) { ((TMP_Text)_eventText).text = "" + Localization.T("noData") + ""; return; } List list = _events; if (!ConfigSettings.ShowAllEvents.Value && list.Count > 1) { list = list.GetRange(0, 1); } StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < list.Count; i++) { if (i > 0) { stringBuilder.Append(", "); } stringBuilder.Append("') .Append(Esc(list[i].Name.ToUpperInvariant())) .Append(""); } ((TMP_Text)_eventText).text = stringBuilder.ToString(); } private void RefreshTicker(BridgePayload p, bool connected, string moon, int qi, int day, int deaths) { bool value = ConfigSettings.ShowTicker.Value; _tickerGo.SetActive(value); if (value) { string text = ((p != null && !string.IsNullOrEmpty(p.weatherFull)) ? p.weatherFull : "-"); string value2 = ((p != null && p.total > 0) ? $"{p.alive}/{p.total}" : "-"); StringBuilder stringBuilder = new StringBuilder(160); stringBuilder.Append(Localization.T("crew")).Append(": ").Append(value2) .Append(" // ") .Append(Localization.T("tMoon")) .Append(": ") .Append(moon.ToUpperInvariant()) .Append(" // ") .Append(Localization.T("tWx")) .Append(": ") .Append(text.ToUpperInvariant()) .Append(" // ") .Append(Localization.T("day")) .Append(' ') .Append(day) .Append(" // ") .Append(Localization.T("tQuota")) .Append(' ') .Append(qi) .Append(" // ") .Append(Localization.T("deaths")) .Append(' ') .Append(deaths); if (_events.Count > 0) { stringBuilder.Append(" // ").Append(Localization.T("tEvent")).Append(": ") .Append(_events[0].Name.ToUpperInvariant()); } if (!connected) { stringBuilder.Append(" // ").Append(Localization.T("offline")); } stringBuilder.Append(" // ").Append(Localization.T("tObjective")).Append(" //"); _ticker.SetContent(stringBuilder.ToString()); } } private static bool HasTurretTrap(string[] traps) { if (traps == null) { return false; } foreach (string text in traps) { if (text != null && text.IndexOf("turret", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } private bool TurretEventActive() { foreach (BcmerEvents.EventInfo @event in _events) { string text = (@event.Name ?? "").ToLowerInvariant(); string[] turretEventKeys = TurretEventKeys; foreach (string value in turretEventKeys) { if (text.Contains(value)) { return true; } } } return false; } private string ColorizeWeather(string w) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(w) || w.Equals("None", StringComparison.OrdinalIgnoreCase)) { return ""; } string[] array = w.Split('+'); StringBuilder stringBuilder = new StringBuilder(); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text = array2[i].Trim(); if (text.Length == 0) { continue; } string text2 = text.ToLowerInvariant(); string text3 = null; (string, string)[] wxColors = WxColors; for (int j = 0; j < wxColors.Length; j++) { var (value, text4) = wxColors[j]; if (text2.Contains(value)) { text3 = text4; break; } } if (stringBuilder.Length > 0) { stringBuilder.Append(" + "); } if (text3 != null) { stringBuilder.Append("') .Append(Esc(text.ToUpperInvariant())) .Append(""); } else { stringBuilder.Append(Esc(text.ToUpperInvariant())); } } return stringBuilder.ToString(); } public static string Esc(string s) { return (s ?? "").Replace("<", "<"); } public static string FmtTime(int s) { if (s < 0) { s = 0; } int num = s / 3600; int num2 = s % 3600 / 60; int num3 = s % 60; if (num <= 0) { return $"{num2:00}:{num3:00}"; } return $"{num:00}:{num2:00}:{num3:00}"; } public static string FmtTimeMs(float s) { if (s < 0f) { s = 0f; } int num = (int)s; int num2 = num / 3600; int num3 = num % 3600 / 60; int num4 = num % 60; int num5 = (int)((s - (float)num) * 1000f); if (num5 > 999) { num5 = 999; } if (num2 <= 0) { return $"{num3:00}:{num4:00}.{num5:000}"; } return $"{num2}:{num3:00}:{num4:00}.{num5:000}"; } private void EnsureFonts() { if (_fontsResolved) { return; } try { TMP_FontAsset val = null; TMP_FontAsset val2 = null; if (ConfigSettings.RussianActive) { if ((Object)(object)_dynFont == (Object)null) { _dynFont = CreateDynamicCyrillicFont(); } TMP_FontAsset val3 = _dynFont; TMP_FontAsset val4 = FindRtlcFont(); if ((Object)(object)val4 != (Object)null) { val3 = val4; } val = (val2 = val3); } else { HUDManager instance = HUDManager.Instance; TMP_FontAsset val5 = (((Object)(object)instance != (Object)null && (Object)(object)instance.chatText != (Object)null) ? ((TMP_Text)instance.chatText).font : null); val = TryOsFont("Pixelify Sans") ?? val5; val2 = TryOsFont("Jersey 10") ?? val5; } if ((Object)(object)val == (Object)null && (Object)(object)val2 == (Object)null) { return; } if ((Object)(object)val == (Object)null) { val = val2; } if ((Object)(object)val2 == (Object)null) { val2 = val; } _fontBody = val; _fontBig = val2; _fontsResolved = true; foreach (TextMeshProUGUI allText in _allTexts) { if ((Object)(object)allText != (Object)null) { ((TMP_Text)allText).font = val; } } foreach (TextMeshProUGUI bigText in _bigTexts) { if ((Object)(object)bigText != (Object)null) { ((TMP_Text)bigText).font = val2; } } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("Шрифты оверлея: заголовки=" + ((Object)val2).name + ", текст=" + ((Object)val).name)); } } catch { } } private static TMP_FontAsset FindRtlcFont() { try { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); foreach (TMP_FontAsset val in array) { if (!((Object)(object)val == (Object)null) && (((Object)val).name ?? "").ToLowerInvariant().IndexOf("rtlc", StringComparison.Ordinal) >= 0) { bool flag; try { flag = val.HasCharacter('Я', false, false) && val.HasCharacter('а', false, false); } catch { flag = false; } if (flag) { return val; } } } } catch { } return null; } private static TMP_FontAsset TryOsFont(string name) { if (_osFontCache.TryGetValue(name, out var value)) { return value; } TMP_FontAsset val = null; try { string[] oSInstalledFontNames = Font.GetOSInstalledFontNames(); bool flag = false; if (oSInstalledFontNames != null) { string[] array = oSInstalledFontNames; for (int i = 0; i < array.Length; i++) { if (string.Equals(array[i], name, StringComparison.OrdinalIgnoreCase)) { flag = true; break; } } } if (flag) { Font val2 = Font.CreateDynamicFontFromOSFont(name, 32); if ((Object)(object)val2 != (Object)null) { val = TMP_FontAsset.CreateFontAsset(val2); } } } catch { } _osFontCache[name] = val; return val; } private void ApplyBootstrapFont() { try { TMP_FontAsset val = TMP_Settings.defaultFontAsset; if ((Object)(object)val == (Object)null) { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); if (array != null && array.Length != 0) { val = array[0]; } } if ((Object)(object)val != (Object)null) { foreach (TextMeshProUGUI allText in _allTexts) { if ((Object)(object)allText != (Object)null) { ((TMP_Text)allText).font = val; } } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("Временный шрифт оверлея: " + ((Object)val).name)); } } else { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)"Не найден ни один TMP-шрифт."); } } } catch { } } private static TMP_FontAsset CreateDynamicCyrillicFont() { string[] array = new string[5] { "Arial", "Segoe UI", "Verdana", "Tahoma", "Consolas" }; foreach (string text in array) { try { Font val = Font.CreateDynamicFontFromOSFont(text, 28); if ((Object)(object)val == (Object)null) { continue; } TMP_FontAsset val2 = TMP_FontAsset.CreateFontAsset(val); if (!((Object)(object)val2 != (Object)null)) { continue; } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("Русский шрифт оверлея: " + text)); } return val2; } catch { } } try { Font val3 = Resources.GetBuiltinResource("LegacyRuntime.ttf") ?? Resources.GetBuiltinResource("Arial.ttf"); if ((Object)(object)val3 != (Object)null) { return TMP_FontAsset.CreateFontAsset(val3); } } catch { } return null; } private void BuildUi() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown _canvas = ((Component)this).gameObject.AddComponent(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 500; CanvasScaler obj = ((Component)this).gameObject.AddComponent(); obj.uiScaleMode = (ScaleMode)1; obj.referenceResolution = new Vector2(1920f, 1080f); obj.matchWidthOrHeight = 1f; GameObject val = NewUI("Root", ((Component)this).transform); _root = (RectTransform)val.transform; RectTransform root = _root; RectTransform root2 = _root; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(1f, 0.5f); root2.anchorMax = val2; root.anchorMin = val2; _root.pivot = new Vector2(1f, 0.5f); _root.sizeDelta = new Vector2(340f, 100f); ((Transform)_root).localScale = Vector3.one * Mathf.Clamp(ConfigSettings.Scale.Value, 0.5f, 2f); ((Transform)_root).localRotation = Quaternion.Euler(0f, 0f, 1f); _group = val.AddComponent(); _group.interactable = false; _group.blocksRaycasts = false; _group.alpha = 0f; _bgImage = AddImage(val, S.Bg); VerticalLayoutGroup obj2 = val.AddComponent(); ((LayoutGroup)obj2).padding = new RectOffset(15, 15, 13, 11); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 9f; ((LayoutGroup)obj2).childAlignment = (TextAnchor)0; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; val.AddComponent().verticalFit = (FitMode)2; BuildHeader(val.transform); BuildLocation(val.transform); BuildQuota(val.transform); BuildDayDeaths(val.transform); BuildVictory(val.transform); BuildTicker(val.transform); BuildFrame(val); BuildScanlines(val); BuildRails(); BuildEventPlate(); ApplyBootstrapFont(); ApplyPerspective(); ((Component)_root).gameObject.SetActive(false); } private void ApplyPerspective() { float value = ConfigSettings.PerspectiveStrength.Value; if (value <= 0f) { return; } Graphic[] componentsInChildren = ((Component)_root).GetComponentsInChildren(true); foreach (Graphic val in componentsInChildren) { if ((Object)(object)val == (Object)null) { continue; } if ((Object)(object)_topEye != (Object)null && ((Component)val).transform.IsChildOf(((Component)_topEye).transform)) { PerspectiveWarp perspectiveWarp = ((Component)val).gameObject.AddComponent(); perspectiveWarp.Panel = _root; perspectiveWarp.Width = 340f; perspectiveWarp.Strength = value; perspectiveWarp.Continuous = true; val.SetVerticesDirty(); continue; } bool flag = (Object)(object)_tickerGo != (Object)null && ((Component)val).transform.IsChildOf(_tickerGo.transform); string name = ((Object)((Component)val).gameObject).name; int num; switch (name) { default: num = ((name == "Pixbit") ? 1 : 0); break; case "Corner": case "Bracket": case "Edge": num = 1; break; } bool flag2 = (byte)num != 0; AddPerspective(val, flag || flag2); } } internal void AddPerspective(Graphic g, bool continuous) { float value = ConfigSettings.PerspectiveStrength.Value; if (!(value <= 0f) && !((Object)(object)g == (Object)null)) { if (g is TextMeshProUGUI) { TMPPerspective tMPPerspective = ((Component)g).gameObject.AddComponent(); tMPPerspective.Panel = _root; tMPPerspective.Width = 340f; tMPPerspective.Strength = value; tMPPerspective.Continuous = continuous; } else { PerspectiveWarp perspectiveWarp = ((Component)g).gameObject.AddComponent(); perspectiveWarp.Panel = _root; perspectiveWarp.Width = 340f; perspectiveWarp.Strength = value; perspectiveWarp.Continuous = continuous; } g.SetVerticesDirty(); } } internal void AddPerspectiveToTree(Transform root) { if (ConfigSettings.PerspectiveStrength.Value <= 0f || (Object)(object)root == (Object)null) { return; } Graphic[] componentsInChildren = ((Component)root).GetComponentsInChildren(true); foreach (Graphic val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).GetComponent() != (Object)null) && !((Object)(object)((Component)val).GetComponent() != (Object)null)) { AddPerspective(val, continuous: false); } } _lastPanelH = -1f; } private void RewarpOnResize() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (ConfigSettings.PerspectiveStrength.Value <= 0f || (Object)(object)_root == (Object)null) { return; } Rect rect = _root.rect; float height = ((Rect)(ref rect)).height; if (Mathf.Abs(height - _lastPanelH) < 0.5f) { return; } _lastPanelH = height; TMP_Text[] componentsInChildren = ((Component)_root).GetComponentsInChildren(true); foreach (TMP_Text val in componentsInChildren) { if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).GetComponent() != (Object)null) { val.ForceMeshUpdate(false, false); } } Graphic[] componentsInChildren2 = ((Component)_root).GetComponentsInChildren(true); foreach (Graphic val2 in componentsInChildren2) { if ((Object)(object)val2 != (Object)null && !(val2 is TextMeshProUGUI) && (Object)(object)((Component)val2).GetComponent() != (Object)null) { val2.SetVerticesDirty(); } } } private void BuildScanlines(GameObject panel) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_004b: 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_0060: 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_0070: Unknown result type (might be due to invalid IL or missing references) if (ConfigSettings.Scanlines.Value) { if ((Object)(object)_scanTex == (Object)null) { _scanTex = new Texture2D(1, 3, (TextureFormat)4, false) { filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)0 }; _scanTex.SetPixels32((Color32[])(object)new Color32[3] { new Color32((byte)0, (byte)0, (byte)0, (byte)160), new Color32((byte)0, (byte)0, (byte)0, (byte)0), new Color32((byte)0, (byte)0, (byte)0, (byte)0) }); _scanTex.Apply(); } GameObject obj = NewUI("Scanlines", panel.transform); RectTransform val = (RectTransform)obj.transform; val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; obj.AddComponent().ignoreLayout = true; RawImage val2 = obj.AddComponent(); val2.texture = (Texture)(object)_scanTex; ((Graphic)val2).raycastTarget = false; ((Graphic)val2).color = new Color(1f, 1f, 1f, 0.5f); ScanlineUV scanlineUV = obj.AddComponent(); scanlineUV.Img = val2; scanlineUV.LinePx = 3f; obj.transform.SetAsLastSibling(); } } private static Sprite Grunge() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_grunge != (Object)null) { return _grunge; } Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false) { filterMode = (FilterMode)0 }; Color32[] array = (Color32[])(object)new Color32[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = Mathf.PerlinNoise((float)j * 0.35f + 3.1f, (float)i * 0.35f + 7.7f); float num2 = Mathf.PerlinNoise((float)j * 0.9f + 11f, (float)i * 0.9f + 2f); byte b = byte.MaxValue; if (num < 0.3f) { b = 30; } else if (num2 < 0.28f) { b = 140; } array[i * 32 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b); } } val.SetPixels32(array); val.Apply(); _grunge = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 1f); return _grunge; } private void BuildHeader(Transform parent) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) _headerGo = Row(parent, 8f); Flexible(NewUI("SpacerL", _headerGo.transform), 1f); _topEye = EclipseSun.BuildInlineEye(_headerGo.transform, 60f, 46f); Flexible(NewUI("SpacerR", _headerGo.transform), 1f); GameObject val = NewUI("TimerBox", _headerGo.transform); AddImage(val, S.Frame); LayoutElement obj = val.AddComponent(); obj.preferredWidth = 205f; obj.minWidth = 205f; HorizontalLayoutGroup obj2 = val.AddComponent(); ((LayoutGroup)obj2).padding = new RectOffset(12, 12, 9, 3); ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; ((LayoutGroup)obj2).childAlignment = (TextAnchor)4; _timerText = MakeText(val.transform, "00:00", 28f, Color.white, (TextAlignmentOptions)514, bold: false, big: true); ((TMP_Text)_timerText).enableWordWrapping = false; ((TMP_Text)_timerText).overflowMode = (TextOverflowModes)0; _headerDivider = NewUI("Divider", parent); _headerDivider.AddComponent().preferredHeight = 2f; if (S.LegacyCorners) { Vector2 val3 = default(Vector2); for (float num = 0f; num < 312f; num += 10f) { GameObject obj3 = NewUI("Dash", _headerDivider.transform); RectTransform val2 = (RectTransform)obj3.transform; ((Vector2)(ref val3))..ctor(0f, 0.5f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0f, 0.5f); val2.sizeDelta = new Vector2(6f, 2f); val2.anchoredPosition = new Vector2(num, 0f); AddImage(obj3, OverlayStyle.WithA(S.Frame, 0.3f)); } } else { AddImage(_headerDivider, OverlayStyle.WithA(S.Frame, 0.5f)); } } private void BuildLocation(Transform parent) { //IL_0033: 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_0095: 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_0100: Unknown result type (might be due to invalid IL or missing references) _locationGo = Col(parent, 2f); MakeText(_locationGo.transform, Localization.T("location"), 13f, S.TextDim, (TextAlignmentOptions)513, bold: true); _moonText = MakeText(_locationGo.transform, "- -", 26f, S.Text, (TextAlignmentOptions)513, bold: false, big: true); _interiorText = MakeText(_locationGo.transform, "", 15f, S.Text, (TextAlignmentOptions)513); _itemsText = MakeText(_locationGo.transform, "", 14f, S.TextDim, (TextAlignmentOptions)513); _oldBirdText = MakeText(_locationGo.transform, Localization.T("oldBird"), 17f, S.Danger, (TextAlignmentOptions)513, bold: true); ((Component)_oldBirdText).gameObject.SetActive(false); } private void BuildQuota(Transform parent) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_021c: 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_027d: Expected O, but got Unknown //IL_0283: 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_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) _quotaGo = Col(parent, 4f); MakeText(_quotaGo.transform, Localization.T("deadline"), 13f, S.TextDim, (TextAlignmentOptions)513, bold: true); GameObject val = Row(_quotaGo.transform, 6f); ((HorizontalOrVerticalLayoutGroup)val.GetComponent()).childForceExpandWidth = true; for (int i = 0; i < 3; i++) { GameObject val2 = NewUI("QTab" + (i + 1), val.transform); _qtabBgs[i] = AddImage(val2, new Color(1f, 1f, 1f, 0.06f)); LayoutElement obj = val2.AddComponent(); obj.flexibleWidth = 1f; obj.preferredHeight = 30f; if (S.LegacyCorners) { AddBorder(val2, S.FrameDim, 2f); } TextMeshProUGUI val3 = MakeText(val2.transform, "Q" + (i + 1), 20f, S.TextDim, (TextAlignmentOptions)514, bold: false, big: true); StretchInto(((TMP_Text)val3).rectTransform); _qtabTexts[i] = val3; } GameObject val4 = Row(_quotaGo.transform, 8f); Flexible(((Component)MakeText(val4.transform, Localization.T("lootQuota"), 14f, S.TextDim, (TextAlignmentOptions)513, bold: true)).gameObject, 1f); _lootQuotaText = MakeText(val4.transform, "0/0", 26f, S.Text, (TextAlignmentOptions)516, bold: false, big: true); GameObject val5 = NewUI("Bar", _quotaGo.transform); AddImage(val5, OverlayStyle.WithA(S.Frame, S.LegacyCorners ? 0.05f : 0.15f)); val5.AddComponent().preferredHeight = 18f; if (S.LegacyCorners) { AddBorder(val5, S.Frame, 2f); } GameObject val6 = NewUI("Fill", val5.transform); _barFill = (RectTransform)val6.transform; _barFill.anchorMin = Vector2.zero; _barFill.anchorMax = new Vector2(0f, 1f); _barFill.offsetMin = Vector2.zero; _barFill.offsetMax = Vector2.zero; _barFillImg = AddImage(val6, S.LegacyCorners ? S.Frame : OverlayStyle.WithA(S.Accent, 0.7f)); _barText = MakeText(val5.transform, "", 13f, Color.white, (TextAlignmentOptions)514, bold: true); StretchInto(((TMP_Text)_barText).rectTransform); ((Component)_barText).gameObject.SetActive(false); _onPlanetGo = Row(_quotaGo.transform, 6f); GameObject obj2 = NewUI("LBorder", _onPlanetGo.transform); LayoutElement obj3 = obj2.AddComponent(); obj3.preferredWidth = 3f; obj3.preferredHeight = 20f; AddImage(obj2, S.Frame); Flexible(((Component)MakeText(_onPlanetGo.transform, Localization.T("onPlanet"), 11f, S.TextDim, (TextAlignmentOptions)513, bold: true)).gameObject, 1f); _onPlanetVal = MakeText(_onPlanetGo.transform, "$0", 20f, S.Text, (TextAlignmentOptions)516, bold: false, big: true); _onPlanetGo.SetActive(false); } private void BuildDayDeaths(Transform parent) { //IL_0024: 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) _dayDeathsGo = Row(parent, 8f); _dayText = MakeCell(Localization.T("day"), S.Text); _deathsText = MakeCell(Localization.T("deaths"), S.Danger); TextMeshProUGUI MakeCell(string label, Color valColor) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_005f: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) GameObject val = Col(_dayDeathsGo.transform, 1f); VerticalLayoutGroup component = val.GetComponent(); ((LayoutGroup)component).padding = new RectOffset(8, 8, 6, 7); ((LayoutGroup)component).childAlignment = (TextAnchor)4; Flexible(val, 1f); AddBorder(val, S.LegacyCorners ? S.Frame : S.FrameDim, S.LegacyCorners ? 2f : 1f); MakeText(val.transform, label, 12f, S.TextDim, (TextAlignmentOptions)514, bold: true); return MakeText(val.transform, "0", 26f, valColor, (TextAlignmentOptions)514, bold: false, big: true); } } private void BuildVictory(Transform parent) { GameObject val = Col(parent, 4f); ((Object)val).name = "Victory"; _victory = val.AddComponent(); _victory.Init(this); } private void BuildTicker(Transform parent) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //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_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_0175: Unknown result type (might be due to invalid IL or missing references) _tickerGo = NewUI("Ticker", parent); _tickerGo.AddComponent().preferredHeight = 20f; Image obj = _tickerGo.AddComponent(); ((Graphic)obj).color = new Color(1f, 1f, 1f, 0.004f); ((Graphic)obj).raycastTarget = false; _tickerGo.AddComponent().showMaskGraphic = false; GameObject obj2 = NewUI("Line", _tickerGo.transform); RectTransform val = (RectTransform)obj2.transform; val.anchorMin = new Vector2(0f, 1f); val.anchorMax = new Vector2(1f, 1f); val.pivot = new Vector2(0.5f, 1f); val.sizeDelta = new Vector2(0f, 2f); val.anchoredPosition = Vector2.zero; AddImage(obj2, OverlayStyle.WithA(S.Frame, 0.6f)); RectTransform val2 = (RectTransform)NewUI("Track", _tickerGo.transform).transform; val2.anchorMin = new Vector2(0f, 0f); val2.anchorMax = new Vector2(0f, 1f); val2.pivot = new Vector2(0f, 0.5f); val2.sizeDelta = new Vector2(4000f, 0f); val2.anchoredPosition = Vector2.zero; TextMeshProUGUI copy = MakeTickerCopy((Transform)(object)val2); TextMeshProUGUI copy2 = MakeTickerCopy((Transform)(object)val2); _ticker = _tickerGo.AddComponent(); _ticker.Init(val2, copy, copy2); } private TextMeshProUGUI MakeTickerCopy(Transform track) { //IL_0012: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = MakeText(track, "", 13f, S.TextDim, (TextAlignmentOptions)513); ((TMP_Text)obj).enableWordWrapping = false; ((TMP_Text)obj).overflowMode = (TextOverflowModes)0; RectTransform rectTransform = ((TMP_Text)obj).rectTransform; rectTransform.anchorMin = new Vector2(0f, 0.5f); rectTransform.anchorMax = new Vector2(0f, 0.5f); rectTransform.pivot = new Vector2(0f, 0.5f); rectTransform.anchoredPosition = Vector2.zero; rectTransform.sizeDelta = new Vector2(400f, 18f); return obj; } private void BuildRails() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_00a0: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) RectTransform left = Rail("MobLeft", new Vector2(0f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -64f)); RectTransform right = Rail("MobRight", new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -64f)); RectTransform val = Rail("TrapRail", new Vector2(0.5f, 0f), new Vector2(0.5f, 1f), new Vector2(0f, -12f)); RectTransform val2 = Rail("TrapFx", new Vector2(0.5f, 0f), new Vector2(0.5f, 1f), new Vector2(0f, -12f)); _trapRailRt = val; _trapFxRt = val2; GameObject val3 = NewUI("Rails", (Transform)(object)_root); val3.AddComponent().ignoreLayout = true; _mobRail = val3.AddComponent(); _mobRail.Init(this, left, right, val); _mobRail.CountColor = S.Frame; _trapFire = ((Component)val2).gameObject.AddComponent(); _trapFire.Init(val2, null, S.Accent); _trapFire.Emitters = _mobRail.TurretIcons; RectTransform Rail(string name, Vector2 anchor, Vector2 pivot, Vector2 pos) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown GameObject val4 = NewUI(name, (Transform)(object)_root); RectTransform val5 = (RectTransform)val4.transform; Vector2 anchorMin = (val5.anchorMax = anchor); val5.anchorMin = anchorMin; val5.pivot = pivot; val5.sizeDelta = Vector2.zero; val5.anchoredPosition = pos; val4.AddComponent().ignoreLayout = true; return val5; } } private void PositionTrapRail() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) if (!((Object)(object)_trapRailRt == (Object)null)) { float num = 14f; if ((Object)(object)_eventPlate != (Object)null && ((Component)_eventPlate).gameObject.activeSelf && (Object)(object)_eventPlateRt != (Object)null) { Rect rect = _eventPlateRt.rect; float num2 = ((Rect)(ref rect)).height * _eventPlate.Progress; num = 14f + num2 + 8f; } _trapRailRt.anchoredPosition = new Vector2(0f, 0f - num); if ((Object)(object)_trapFxRt != (Object)null) { _trapFxRt.anchoredPosition = new Vector2(0f, 0f - num); } } } private void BuildEventPlate() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) GameObject val = NewUI("EventPlate", (Transform)(object)_root); RectTransform val2 = (RectTransform)val.transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0.5f, 1f); val2.sizeDelta = new Vector2(316f, 56f); val2.anchoredPosition = new Vector2(0f, -14f); _eventPlateRt = val2; val.AddComponent().ignoreLayout = true; AddImage(val, S.Bg); VerticalLayoutGroup obj = val.AddComponent(); ((LayoutGroup)obj).padding = new RectOffset(16, 16, 9, 11); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 2f; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; val.AddComponent().verticalFit = (FitMode)2; MakeText(val.transform, Localization.T("brutalEvent"), 13f, S.Danger, (TextAlignmentOptions)513, bold: true); _eventText = MakeText(val.transform, "", 22f, S.Text, (TextAlignmentOptions)513, bold: false, big: true); AddStyleFrame(val, full: false); _eventPlate = val.AddComponent(); _eventPlate.Init(val2); } private void BuildFrame(GameObject rootGo) { AddStyleFrame(rootGo, full: true); } private void AddStyleFrame(GameObject host, bool full) { //IL_006f: 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_002f: 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_005b: Unknown result type (might be due to invalid IL or missing references) if (S.LegacyCorners) { AddCorner(host, new Vector2(0f, 1f)); AddCorner(host, new Vector2(1f, 1f)); AddCorner(host, new Vector2(0f, 0f)); AddCorner(host, new Vector2(1f, 0f)); } else { AddBrackets(host, S.Frame); } AddPixbits(host, full); } private void AddCorner(GameObject rootGo, Vector2 corner) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0056: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) float num = ((corner.x == 0f) ? 1f : (-1f)); float num2 = ((corner.y == 0f) ? 1f : (-1f)); AddCornerBar(rootGo, corner, new Vector2(26f, 4f), new Vector2((0f - num) * 2f, (0f - num2) * 2f)); AddCornerBar(rootGo, corner, new Vector2(4f, 26f), new Vector2((0f - num) * 2f, (0f - num2) * 2f)); } private void AddCornerBar(GameObject rootGo, Vector2 corner, Vector2 size, Vector2 offset) { //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) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0033: 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_0047: Unknown result type (might be due to invalid IL or missing references) GameObject obj = NewUI("Corner", rootGo.transform); RectTransform val = (RectTransform)obj.transform; Vector2 anchorMin = (val.anchorMax = corner); val.anchorMin = anchorMin; val.pivot = corner; val.sizeDelta = size; val.anchoredPosition = offset; Image val3 = AddImage(obj, S.Frame); val3.sprite = Grunge(); val3.type = (Type)0; _frameImages.Add(val3); obj.AddComponent().ignoreLayout = true; } private void AddBrackets(GameObject host, Color c) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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) Bracket(new Vector2(0f, 1f)); Bracket(new Vector2(1f, 1f)); Bracket(new Vector2(0f, 0f)); Bracket(new Vector2(1f, 0f)); void Bracket(Vector2 corner) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) float num = ((corner.x == 0f) ? 1f : (-1f)); float num2 = ((corner.y == 0f) ? 1f : (-1f)); Bar(host, corner, new Vector2(20f, 3f), new Vector2(num * 0f, num2 * 0f), c); Bar(host, corner, new Vector2(3f, 20f), new Vector2(num * 0f, num2 * 0f), c); } } private void Bar(GameObject host, Vector2 corner, Vector2 size, Vector2 offset, Color c) { //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) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0033: 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_0041: Unknown result type (might be due to invalid IL or missing references) GameObject obj = NewUI("Bracket", host.transform); RectTransform val = (RectTransform)obj.transform; Vector2 anchorMin = (val.anchorMax = corner); val.anchorMin = anchorMin; val.pivot = corner; val.sizeDelta = size; val.anchoredPosition = offset; Image val3 = AddImage(obj, c); val3.sprite = Grunge(); val3.type = (Type)0; _frameImages.Add(val3); obj.AddComponent().ignoreLayout = true; } private void AddBorder(GameObject go, Color c, float t) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) MakeEdge(go, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, t), c); MakeEdge(go, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, t), c); MakeEdge(go, new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(t, 0f), c); MakeEdge(go, new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(t, 0f), c); } private static Image MakeEdge(GameObject parent, Vector2 aMin, Vector2 aMax, Vector2 thickness, Color c) { //IL_0017: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0046: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) GameObject val = NewUI("Edge", parent.transform); RectTransform val2 = (RectTransform)val.transform; val2.anchorMin = aMin; val2.anchorMax = aMax; val2.pivot = new Vector2((aMin.x == aMax.x) ? aMin.x : 0.5f, (aMin.y == aMax.y) ? aMin.y : 0.5f); val2.sizeDelta = thickness; val2.anchoredPosition = Vector2.zero; Image obj = AddImage(val, c); obj.sprite = Grunge(); obj.type = (Type)0; val.AddComponent().ignoreLayout = true; return obj; } private void AddPixbits(GameObject rootGo, bool full) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01de: 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_020e: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) Bit(new Vector2(0f, 1f), new Vector2(32f, 0f), 1.1f, 0f); Bit(new Vector2(0f, 1f), new Vector2(42f, 0f), 1.5f, 0.4f); Bit(new Vector2(1f, 1f), new Vector2(-32f, 0f), 0.7f, 0.15f); Bit(new Vector2(1f, 1f), new Vector2(-42f, 0f), 0.9f, 0.6f); Bit(new Vector2(0f, 0f), new Vector2(32f, -0f), 0.9f, 0.6f); Bit(new Vector2(0f, 0f), new Vector2(42f, -0f), 0.7f, 0.15f); Bit(new Vector2(1f, 0f), new Vector2(-32f, -0f), 1.1f, 0f); Bit(new Vector2(1f, 0f), new Vector2(-42f, -0f), 1.5f, 0.4f); if (full) { Bit(new Vector2(0f, 1f), new Vector2(-0f, -32f), 0.7f, 0.15f); Bit(new Vector2(0f, 0f), new Vector2(-0f, 32f), 0.9f, 0.6f); Bit(new Vector2(1f, 1f), new Vector2(0f, -32f), 1.5f, 0.4f); Bit(new Vector2(1f, 0f), new Vector2(0f, 32f), 1.1f, 0f); } void Bit(Vector2 anchor, Vector2 pos, float period, float phase) { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0046: 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_005b: 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) GameObject obj = NewUI("Pixbit", rootGo.transform); RectTransform val = (RectTransform)obj.transform; Vector2 anchorMin = (val.anchorMax = anchor); val.anchorMin = anchorMin; val.pivot = new Vector2(0.5f, 0.5f); val.sizeDelta = new Vector2(5f, 5f); val.anchoredPosition = pos; Image img = AddImage(obj, S.Frame); obj.AddComponent().ignoreLayout = true; PixbitFlicker pixbitFlicker = obj.AddComponent(); pixbitFlicker.Init(img, period, phase); _pixbits.Add(pixbitFlicker); } } internal static GameObject NewUI(string name, Transform parent) { //IL_0014: 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_0027: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); return val; } private static Image AddImage(GameObject go, Color c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Image obj = go.AddComponent(); ((Graphic)obj).color = c; ((Graphic)obj).raycastTarget = false; return obj; } private GameObject Row(Transform parent, float spacing) { GameObject obj = NewUI("Row", parent); HorizontalLayoutGroup obj2 = obj.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = spacing; ((LayoutGroup)obj2).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; return obj; } private GameObject Col(Transform parent, float spacing) { GameObject obj = NewUI("Col", parent); VerticalLayoutGroup obj2 = obj.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = spacing; ((LayoutGroup)obj2).childAlignment = (TextAnchor)0; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; return obj; } internal GameObject MakeCol(Transform parent, float spacing) { return Col(parent, spacing); } private static void Flexible(GameObject go, float w) { LayoutElement val = go.GetComponent(); if ((Object)(object)val == (Object)null) { val = go.AddComponent(); } val.flexibleWidth = w; } private static void StretchInto(RectTransform rt) { //IL_0001: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.offsetMin = Vector2.zero; rt.offsetMax = Vector2.zero; ((Component)rt).gameObject.AddComponent().ignoreLayout = true; } internal TextMeshProUGUI MakeText(Transform parent, string text, float size, Color color, TextAlignmentOptions align = (TextAlignmentOptions)513, bool bold = false, bool big = false) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = NewUI("Text", parent).AddComponent(); ((TMP_Text)val).text = text; ((TMP_Text)val).fontSize = size; ((Graphic)val).color = color; ((TMP_Text)val).alignment = align; ((TMP_Text)val).enableWordWrapping = true; ((TMP_Text)val).richText = true; ((Graphic)val).raycastTarget = false; ((TMP_Text)val).fontStyle = (FontStyles)1; TMP_FontAsset val2 = (big ? (_fontBig ?? _fontBody) : _fontBody); if ((Object)(object)val2 != (Object)null) { ((TMP_Text)val).font = val2; } _allTexts.Add(val); if (big) { _bigTexts.Add(val); } return val; } } public class OverlayStyle { public Color Bg; public Color Accent; public Color AccentDim; public Color Frame; public Color FrameDim; public Color Text; public Color TextDim; public Color Danger; public bool LegacyCorners; public bool BlueBrackets; public static OverlayStyle Legacy() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_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_005a: 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) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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) return new OverlayStyle { Bg = new Color(4f / 51f, 2f / 85f, 2f / 85f, 0.62f), Accent = FromHex("FF7A1A"), AccentDim = FromHex("C25910"), Frame = FromHex("FF3A2E"), FrameDim = FromHex("C43022"), Text = FromHex("FF7A1A"), TextDim = FromHex("C25910"), Danger = FromHex("FF5141"), LegacyCorners = true, BlueBrackets = false }; } public static OverlayStyle Game() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00ad: Unknown result type (might be due to invalid IL or missing references) return new OverlayStyle { Bg = new Color(0f, 0f, 0f, 0f), Accent = FromHex("FF9A3D"), AccentDim = FromHex("B96A20"), Frame = new Color(0.43f, 0.44f, 0.86f, 0.85f), FrameDim = new Color(0.43f, 0.44f, 0.86f, 0.45f), Text = FromHex("E6E6F2"), TextDim = FromHex("9BA0C4"), Danger = FromHex("FF5C5C"), LegacyCorners = false, BlueBrackets = true }; } public static Color FromHex(string hex) { //IL_001a: 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) Color result = default(Color); if (!ColorUtility.TryParseHtmlString("#" + hex, ref result)) { return Color.white; } return result; } public static string Hex(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return ColorUtility.ToHtmlStringRGB(c); } public static Color WithA(Color c, float a) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) return new Color(c.r, c.g, c.b, a); } } [BepInPlugin("gdlp.lcbridgeoverlay", "LCBridgeOverlay", "1.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string GUID = "gdlp.lcbridgeoverlay"; public const string NAME = "LCBridgeOverlay"; public const string VERSION = "1.3.0"; private Harmony _harmony; private static bool _quitting; private static GameObject _tickerGo; private float _watchdogT; public static Plugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } private void Awake() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; ConfigSettings.Bind(((BaseUnityPlugin)this).Config); if (!ConfigSettings.Enabled.Value) { Log.LogInfo((object)"LCBridgeOverlay выключен в конфиге (General.Enabled = false)."); return; } try { _harmony = new Harmony("gdlp.lcbridgeoverlay"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); Log.LogInfo((object)"Harmony-патчи применены."); } catch (Exception ex) { Log.LogWarning((object)("Не удалось применить Harmony-патчи: " + ex.Message)); } int value = ConfigSettings.Port.Value; try { BridgeServer.Start(value); Log.LogInfo((object)$"Встроенный мост запущен на ws://localhost:{value} (для HTML-оверлея/OBS)."); } catch (Exception ex2) { Log.LogError((object)$"Не удалось поднять мост на порту {value} (возможно, порт занят — удали старый мод LCBridge): {ex2.Message}"); } EnsureTicker(); Application.quitting += OnApplicationQuitting; CreateOverlay(); Log.LogInfo((object)"LCBridgeOverlay v1.3.0 готов (мост встроен, отдельный LCBridge не требуется)."); } private static void EnsureTicker() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (!((Object)(object)_tickerGo != (Object)null)) { _tickerGo = new GameObject("LCBridgeTicker") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)(object)_tickerGo); _tickerGo.AddComponent(); } } private static void CreateOverlay() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown GameObject val = new GameObject("LCBridgeOverlay") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)val); val.AddComponent(); } private void Update() { if (!ConfigSettings.Enabled.Value) { return; } _watchdogT += Time.unscaledDeltaTime; if (!(_watchdogT < 3f)) { _watchdogT = 0f; if ((Object)(object)_tickerGo == (Object)null) { EnsureTicker(); } if ((Object)(object)OverlayManager.Instance == (Object)null) { Log.LogWarning((object)"Объект оверлея был уничтожен — пересоздаю."); CreateOverlay(); } } } private static void OnApplicationQuitting() { _quitting = true; try { BridgeServer.Stop(); } catch { } } private void OnDestroy() { if (!_quitting) { ManualLogSource log = Log; if (log != null) { log.LogInfo((object)"Компонент LCBridgeOverlay уничтожен сменой сцены — мост и тикер продолжают работать."); } return; } try { BridgeServer.Stop(); } catch { } try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } } } public static class Rtlc { private static bool _checked; private static bool _present; public static bool Present { get { if (_checked) { return _present; } _checked = true; try { foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { string obj = pluginInfo.Key ?? ""; PluginInfo value = pluginInfo.Value; object obj2; if (value == null) { obj2 = null; } else { BepInPlugin metadata = value.Metadata; obj2 = ((metadata != null) ? metadata.Name : null); } if (obj2 == null) { obj2 = ""; } string text = (string)obj2; string text2 = obj + " " + text; if (text2.IndexOf("RTLC", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Russian", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("314ZDA", StringComparison.OrdinalIgnoreCase) >= 0 || (text2.IndexOf("BrutalCompany", StringComparison.OrdinalIgnoreCase) >= 0 && text2.IndexOf("RUS", StringComparison.OrdinalIgnoreCase) >= 0)) { _present = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("Обнаружен русификатор (" + text + ") — язык оверлея по умолчанию русский.")); } break; } } } catch { } return _present; } } } public static class SpriteBank { private static readonly Dictionary _cache = new Dictionary(); public static Sprite Get(string key) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(key)) { return null; } if (_cache.TryGetValue(key, out var value)) { return value; } Sprite val = null; try { Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LCBridgeOverlay.res.mobs." + key + ".png"); if (manifestResourceStream != null) { byte[] array; using (MemoryStream memoryStream = new MemoryStream()) { manifestResourceStream.CopyTo(memoryStream); array = memoryStream.ToArray(); } manifestResourceStream.Dispose(); Texture2D val2 = new Texture2D(2, 2, (TextureFormat)4, false); if (ImageConversion.LoadImage(val2, array)) { ((Texture)val2).filterMode = (FilterMode)1; val = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), 100f); } } } catch { } _cache[key] = val; return val; } } public static class EclipseSun { private static Sprite _sprite; public static Sprite Get() { if ((Object)(object)_sprite != (Object)null) { return _sprite; } _sprite = LoadEmbedded() ?? Procedural(); return _sprite; } private static Sprite LoadEmbedded() { //IL_0049: 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_0056: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) try { Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LCBridgeOverlay.res.eye.png"); if (manifestResourceStream == null) { return null; } byte[] array; using (MemoryStream memoryStream = new MemoryStream()) { manifestResourceStream.CopyTo(memoryStream); array = memoryStream.ToArray(); } manifestResourceStream.Dispose(); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { filterMode = (FilterMode)1 }; if (!ImageConversion.LoadImage(val, array)) { return null; } return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); } catch { return null; } } private static Sprite Procedural() { //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Expected O, but got Unknown //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) int num = 240; int num2 = 136; float num3 = (float)(num - 1) / 2f; float num4 = (float)(num2 - 1) / 2f; float num5 = 108f; float num6 = 58f; float num7 = 9.6f; float num8 = 38f; float num9 = 9.6f; float num10 = 16.8f; float[] array = new float[num * num2]; for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { float num11 = (float)j - num3; float num12 = (float)i - num4; float num13 = num11 / num5; bool flag = false; if (Mathf.Abs(num13) <= 1f) { float num14 = num6 * (1f - num13 * num13); if (Mathf.Abs(num12 - num14) < num7 || Mathf.Abs(num12 + num14) < num7) { flag = true; } } float num15 = Mathf.Sqrt(num11 * num11 + num12 * num12); if (num15 < num10) { flag = true; } else if (Mathf.Abs(num15 - num8) < num9) { flag = true; } if (flag) { array[i * num + j] = 1f; } } } Color32[] array2 = (Color32[])(object)new Color32[2040]; for (int k = 0; k < 34; k++) { for (int l = 0; l < 60; l++) { float num16 = 0f; for (int m = 0; m < 4; m++) { for (int n = 0; n < 4; n++) { num16 += array[(k * 4 + m) * num + (l * 4 + n)]; } } byte b = (byte)Mathf.Clamp(Mathf.RoundToInt(num16 / 16f * 255f), 0, 255); array2[k * 60 + l] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b); } } Texture2D val = new Texture2D(60, 34, (TextureFormat)4, false) { filterMode = (FilterMode)1 }; val.SetPixels32(array2); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 60f, 34f), new Vector2(0.5f, 0.5f), 100f); } public static EyeWidget BuildInlineEye(Transform parent, float w, float h) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("EyeLogo", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); RectTransform rt = (RectTransform)val.transform; Image val2 = val.AddComponent(); val2.sprite = Get(); ((Graphic)val2).raycastTarget = false; val2.preserveAspect = true; LayoutElement obj = val.AddComponent(); obj.preferredWidth = w; obj.preferredHeight = h; EyeWidget eyeWidget = val.AddComponent(); eyeWidget.Init(rt, val2); return eyeWidget; } public static EyeWidget BuildCornerEye(RectTransform panel) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0049: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("EyeLogo", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)panel, false); RectTransform val2 = (RectTransform)val.transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0f, 1f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0f, 1f); val2.sizeDelta = new Vector2(44f, 32f); val2.anchoredPosition = new Vector2(15f, -12f); val.AddComponent().ignoreLayout = true; Image val4 = val.AddComponent(); val4.sprite = Get(); ((Graphic)val4).raycastTarget = false; val4.preserveAspect = true; EyeWidget eyeWidget = val.AddComponent(); eyeWidget.Init(val2, val4); return eyeWidget; } public static EyeWidget BuildOverlay(RectTransform panel) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0049: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("EyeTop", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)panel, false); RectTransform val2 = (RectTransform)val.transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 1f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0.5f, 0.5f); val2.sizeDelta = new Vector2(52f, 52f); val2.anchoredPosition = new Vector2(0f, 8f); val.AddComponent().ignoreLayout = true; Image val4 = val.AddComponent(); val4.sprite = Get(); ((Graphic)val4).raycastTarget = false; val4.preserveAspect = true; val.transform.SetAsFirstSibling(); EyeWidget eyeWidget = val.AddComponent(); eyeWidget.Init(val2, val4); return eyeWidget; } } public class EventPlateWidget : MonoBehaviour { private const float AnimTime = 0.4f; private RectTransform _rt; private CanvasGroup _cg; private bool _wantVisible; private float _t; public bool Visible => _wantVisible; public float Progress => _t; public void Init(RectTransform rt) { _rt = rt; _cg = ((Component)rt).gameObject.GetComponent(); if ((Object)(object)_cg == (Object)null) { _cg = ((Component)rt).gameObject.AddComponent(); } _cg.alpha = 0f; ((Component)this).gameObject.SetActive(false); } public void SetVisible(bool v) { if (_wantVisible != v) { _wantVisible = v; if (v) { ((Component)this).gameObject.SetActive(true); } } } private void Update() { float num = (_wantVisible ? 1f : 0f); _t = Mathf.MoveTowards(_t, num, Time.unscaledDeltaTime / 0.4f); float alpha = 1f - Mathf.Pow(1f - _t, 3f); if ((Object)(object)_cg != (Object)null) { _cg.alpha = alpha; } if (!_wantVisible && _t <= 0.001f && ((Component)this).gameObject.activeSelf) { ((Component)this).gameObject.SetActive(false); } } } public class EyeWidget : MonoBehaviour { public Image Img; private RectTransform _rt; private float _open = 1f; private float _target = 1f; public void Init(RectTransform rt, Image img) { _rt = rt; Img = img; } public void SetOpen(float target) { _target = Mathf.Clamp01(target); } private void Update() { //IL_003e: 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_004a: 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_0057: Unknown result type (might be due to invalid IL or missing references) _open = Mathf.MoveTowards(_open, _target, Time.unscaledDeltaTime / 0.35f); float num = Mathf.Lerp(0.06f, 1f, _open); Vector3 localScale = ((Transform)_rt).localScale; ((Transform)_rt).localScale = new Vector3(localScale.x, num, localScale.z); } } public class MobRailWidget : MonoBehaviour { private class SwayItem { public RectTransform Rt; public float Speed; public float Phase; public float Amp; public float Scale; public float Appear; } private class Desc { public string Name; public int Cnt; public bool Turret; public bool Slayer; public bool Kamikaze; public string GroupKey; public string IconKey; public int Rank => ((Slayer || Kamikaze) ? 2 : 0) + (Turret ? 1 : 0); } private class Group { public string Key; public int Total; public readonly List Variants = new List(); } private const float Icon = 42f; private const float Overlap = 21f; private const float RowStep = 48f; private OverlayManager _mgr; private RectTransform _left; private RectTransform _right; private RectTransform _traps; private string _sigMobs = ""; private string _sigTraps = ""; private readonly List _sway = new List(); public readonly List TurretIcons = new List(); public Color CountColor = OverlayStyle.FromHex("FF5141"); private static readonly string[] HideKeys = new string[5] { "manticoil", "locust", "docile", "vain", "shroud" }; public void Init(OverlayManager mgr, RectTransform left, RectTransform right, RectTransform traps) { _mgr = mgr; _left = left; _right = right; _traps = traps; } private void Update() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) float unscaledTime = Time.unscaledTime; float unscaledDeltaTime = Time.unscaledDeltaTime; for (int i = 0; i < _sway.Count; i++) { SwayItem swayItem = _sway[i]; if (!((Object)(object)swayItem.Rt == (Object)null)) { if (swayItem.Appear < 1f) { swayItem.Appear = Mathf.MoveTowards(swayItem.Appear, 1f, unscaledDeltaTime / 0.3f); } float num = swayItem.Scale * EaseOutBack(swayItem.Appear); ((Transform)swayItem.Rt).localScale = new Vector3(num, num, 1f); ((Transform)swayItem.Rt).localRotation = Quaternion.Euler(0f, 0f, Mathf.Sin((unscaledTime + swayItem.Phase) * swayItem.Speed) * swayItem.Amp); } } } private static float EaseOutBack(float x) { if (x >= 1f) { return 1f; } float num = x - 1f; return 1f + 2.70158f * num * num * num + 1.70158f * num * num; } public void SetMobs(string[] outside, string[] inside) { string text = JoinSorted(outside) + "||" + JoinSorted(inside); if (!(text == _sigMobs)) { _sigMobs = text; RebuildRail(_left, outside, growLeft: true); RebuildRail(_right, inside, growLeft: false); } } public void SetTraps(string[] traps) { string text = JoinSorted(traps); if (!(text == _sigTraps)) { _sigTraps = text; RebuildTraps(traps); } } private static string JoinSorted(string[] arr) { if (arr == null || arr.Length == 0) { return ""; } string[] array = (string[])arr.Clone(); Array.Sort(array, (IComparer?)StringComparer.Ordinal); return string.Join("|", array); } private static string Norm(string s) { StringBuilder stringBuilder = new StringBuilder(); string text = (s ?? "").ToLowerInvariant(); foreach (char c in text) { if ((c >= 'a' && c <= 'z') || (c >= 'а' && c <= 'я') || c == '+') { stringBuilder.Append(c); } } return stringBuilder.ToString(); } private static bool Hidden(string name) { string text = (name ?? "").ToLowerInvariant(); if (text.Contains("+turret") || text.Contains("slayer")) { return false; } string text2 = Norm(name); string[] hideKeys = HideKeys; foreach (string value in hideKeys) { if (text2.Contains(value)) { return true; } } return false; } private static string Canon(string name) { string text = Norm(name); if (text.Contains("nut")) { return "Nutcracker"; } if (text.Contains("manti")) { return "Manticoil"; } if (text.Contains("toil") || text.Contains("spring") || text.Contains("coil")) { return "Coil-Head"; } if (text.Contains("hoard") || text.Contains("kamikaz")) { return "Hoarding bug"; } return name; } private static string IconFor(string baseName) { string text = Norm(baseName); if (text.Contains("masked") || text.Contains("mimic")) { return "masked"; } if (text.Contains("spring") || text.Contains("coil")) { return "coil"; } if (text.Contains("nutcracker")) { return "nutcracker"; } if (text.Contains("spider")) { return "spider"; } if (text.Contains("flowerman") || text.Contains("bracken")) { return "bracken"; } if (text.Contains("crawler") || text.Contains("thumper")) { return "thumper"; } if (text.Contains("hoard")) { return "hoardingbug"; } if (text.Contains("centipede") || text.Contains("snare")) { return "snareflea"; } if (text.Contains("jester")) { return "jester"; } if (text.Contains("blob") || text.Contains("hygrodere")) { return "hygrodere"; } if (text.Contains("girl") || text.Contains("ghost")) { return "ghostgirl"; } if (text.Contains("puffer") || text.Contains("spore")) { return "sporelizard"; } if (text.Contains("hornet") || text.Contains("butlerbees")) { return "maskhornets"; } if (text.Contains("butler")) { return "butler"; } if (text.Contains("mouthdog") || text.Contains("eyeless")) { return "eyelessdog"; } if (text.Contains("sapsucker")) { return "sapsucker"; } if (text.Contains("forest") || text.Contains("giant")) { return "forestkeeper"; } if (text.Contains("leviathan")) { return "leviathan"; } if (text.Contains("baboon")) { return "baboonhawk"; } if (text.Contains("oldbird") || text.Contains("radmech")) { return "oldbird"; } if (text.Contains("tulip") || text.Contains("flowersnake")) { return "tulip"; } if (text.Contains("bushwolf") || text.Contains("kidnapper") || text.Contains("fox")) { return "kidnapper"; } if (text.Contains("barber") || text.Contains("surgeon") || text.Contains("claysurgeon")) { return "barber"; } if (text.Contains("maneater") || text.Contains("cavedweller")) { return "maneater"; } if (text.Contains("cadaverbloom")) { return "cadaverbloom"; } if (text.Contains("cadaver")) { return "cadaver"; } if (text.Contains("feiopar")) { return "feiopar"; } if (text.Contains("gunkfish")) { return "gunkfish"; } if (text.Contains("manticoil")) { return "manticoil"; } if (text.Contains("redlocust")) { return "redlocust"; } if (text.Contains("lasso")) { return "lassoman"; } return null; } private static Desc Parse(string entry) { string text = entry ?? ""; Match match = Regex.Match(text, "^(.*?)(?:\\s+x(\\d+))?$"); string text2 = (match.Success ? match.Groups[1].Value.Trim() : text); int result = 1; if (match.Success && match.Groups[2].Success) { int.TryParse(match.Groups[2].Value, out result); } string text3 = text2.ToLowerInvariant(); bool flag = text3.Contains("+turret") || text3.Contains("toil"); bool slayer = text3.Contains("slayer"); bool flag2 = text3.Contains("kamikaz"); string name = Regex.Replace(text2, "\\+turret|\\+slayer", "", RegexOptions.IgnoreCase).Trim(); name = Canon(name); string text4 = Norm(name); if (text4.Length == 0) { text4 = text3; } bool flag3 = text4.Contains("manticoil"); bool flag4 = !flag3 && (text4.Contains("coil") || text4.Contains("spring")); string text5; if (flag && flag3) { text5 = "mantitoil"; } else if (flag && flag4) { text5 = "toilhead"; } else { text5 = IconFor(name); if (text5 == null && flag2) { text5 = "hoardingbug"; } } return new Desc { Name = text2, Cnt = Math.Max(1, result), Turret = flag, Slayer = slayer, Kamikaze = flag2, GroupKey = text4, IconKey = text5 }; } private void ClearRail(RectTransform rail) { _sway.RemoveAll((SwayItem x) => (Object)(object)x.Rt == (Object)null || ((Transform)x.Rt).IsChildOf((Transform)(object)rail)); for (int num = ((Transform)rail).childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)((Transform)rail).GetChild(num)).gameObject); } } private void RebuildRail(RectTransform rail, string[] list, bool growLeft) { //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) ClearRail(rail); if (list == null || list.Length == 0) { return; } List list2 = new List(); Dictionary dictionary = new Dictionary(); foreach (string text in list) { if (Hidden(text)) { continue; } Desc d = Parse(text); if (d.IconKey != null && !((Object)(object)SpriteBank.Get(d.IconKey) == (Object)null)) { if (!dictionary.TryGetValue(d.GroupKey, out var value)) { value = new Group { Key = d.GroupKey }; dictionary[d.GroupKey] = value; list2.Add(value); } Desc desc = value.Variants.Find((Desc v) => v.Rank == d.Rank && v.IconKey == d.IconKey); if (desc != null) { desc.Cnt += d.Cnt; } else { value.Variants.Add(d); } value.Total += d.Cnt; } } list2.Sort((Group a, Group b) => b.Total.CompareTo(a.Total)); bool value2 = ConfigSettings.ScaleMonstersByCount.Value; float num = 0f; foreach (Group item in list2) { float scale = 1f; float amp = 5f; if (value2) { int num2 = Mathf.Clamp(item.Total - 1, 0, 8); scale = 1f + (float)num2 * 0.1f; amp = 5f + (float)num2 * 2.2f; } item.Variants.Sort((Desc a, Desc b) => a.Rank.CompareTo(b.Rank)); float num3 = 0f; foreach (Desc variant in item.Variants) { MakeIcon(rail, variant.IconKey, variant.Slayer || variant.Kamikaze, item.Key.GetHashCode(), scale, amp).anchoredPosition = new Vector2(growLeft ? (0f - num3) : num3, num); num3 += 21f; } if (!value2 && item.Total > 1) { TextMeshProUGUI val = _mgr.MakeText((Transform)(object)rail, item.Total.ToString(), 26f, CountColor, (TextAlignmentOptions)514, bold: true, big: true); ((TMP_Text)val).enableWordWrapping = false; ((TMP_Text)val).overflowMode = (TextOverflowModes)0; RectTransform rectTransform = ((TMP_Text)val).rectTransform; Vector2 anchorMin = (rectTransform.anchorMax = new Vector2(0.5f, 0.5f)); rectTransform.anchorMin = anchorMin; rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.sizeDelta = new Vector2(34f, 30f); float num4 = (growLeft ? (0f - (num3 - 21f)) : (num3 - 21f)) + (growLeft ? (-11f) : 11f); float num5 = num - 21f + 10f; rectTransform.anchoredPosition = new Vector2(num4, num5); _mgr.AddPerspective((Graphic)(object)val, continuous: false); } num -= 48f; } } private void RebuildTraps(string[] traps) { //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) ClearRail(_traps); TurretIcons.Clear(); if (traps == null || traps.Length == 0) { return; } List list = new List(); Dictionary dictionary = new Dictionary(); for (int i = 0; i < traps.Length; i++) { Desc desc = Parse(traps[i]); string text = Norm(desc.Name); string text2 = ((text.Contains("turret") || text.Contains("турел")) ? "turret" : ((text.Contains("mine") || text.Contains("мин")) ? "landmine" : ((text.Contains("spike") || text.Contains("шип")) ? "spiketrap" : null))); if (text2 != null && !((Object)(object)SpriteBank.Get(text2) == (Object)null)) { if (!dictionary.ContainsKey(text2)) { dictionary[text2] = 0; list.Add(text2); } dictionary[text2] += desc.Cnt; } } if (list.Count == 0) { return; } bool value = ConfigSettings.ScaleMonstersByCount.Value; float num = 52f; float num2 = (0f - ((float)list.Count * num - 10f)) / 2f + 21f; Vector2 val3 = default(Vector2); for (int j = 0; j < list.Count; j++) { string text3 = list[j]; int num3 = dictionary[text3]; float scale = 1f; float amp = 5f; if (value) { int num4 = Mathf.Clamp(num3 - 1, 0, 8); scale = 1f + (float)num4 * 0.1f; amp = 5f + (float)num4 * 2.2f; } RectTransform val = MakeIcon(_traps, text3, angry: false, j * 17, scale, amp); val.anchoredPosition = new Vector2(num2 + (float)j * num, -23f); if (text3 == "turret") { TurretIcons.Add(val); } if (!value && num3 > 1) { TextMeshProUGUI val2 = _mgr.MakeText(((Component)val).transform, num3.ToString(), 26f, CountColor, (TextAlignmentOptions)514, bold: true, big: true); ((TMP_Text)val2).enableWordWrapping = false; ((TMP_Text)val2).overflowMode = (TextOverflowModes)0; RectTransform rectTransform = ((TMP_Text)val2).rectTransform; ((Vector2)(ref val3))..ctor(0.5f, 0f); rectTransform.anchorMax = val3; rectTransform.anchorMin = val3; rectTransform.pivot = new Vector2(0.5f, 1f); rectTransform.sizeDelta = new Vector2(48f, 30f); rectTransform.anchoredPosition = new Vector2(0f, 2f); _mgr.AddPerspective((Graphic)(object)val2, continuous: false); } } } private RectTransform MakeIcon(RectTransform rail, string iconKey, bool angry, int seed, float scale, float amp) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0067: 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 = OverlayManager.NewUI("Mob_" + iconKey, (Transform)(object)rail); RectTransform val = (RectTransform)obj.transform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); val.anchorMax = val2; val.anchorMin = val2; val.pivot = new Vector2(0.5f, 0.5f); val.sizeDelta = new Vector2(42f, 42f); ((Transform)val).localScale = Vector3.zero; Image val3 = obj.AddComponent(); val3.sprite = SpriteBank.Get(iconKey); val3.preserveAspect = true; ((Graphic)val3).raycastTarget = false; if (angry) { ((Graphic)val3).color = new Color(1f, 0.25f, 0.2f, 1f); } _mgr.AddPerspective((Graphic)(object)val3, continuous: true); _sway.Add(new SwayItem { Rt = val, Speed = 2f + (float)(Mathf.Abs(seed) % 7) * 0.15f, Phase = (float)(Mathf.Abs(seed) % 13) * 0.5f, Amp = amp, Scale = scale, Appear = 0f }); return val; } } public class PerspectiveWarp : BaseMeshEffect { public RectTransform Panel; public float Width = 340f; public float Strength = 0.16f; public bool Continuous; private void LateUpdate() { if (Continuous && (Object)(object)((BaseMeshEffect)this).graphic != (Object)null) { ((BaseMeshEffect)this).graphic.SetVerticesDirty(); } } public override void ModifyMesh(VertexHelper vh) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0032: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0063: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) if (((UIBehaviour)this).IsActive() && !((Object)(object)Panel == (Object)null) && !(Strength <= 0f)) { RectTransform val = (RectTransform)((Component)this).transform; UIVertex val2 = default(UIVertex); int currentVertCount = vh.currentVertCount; for (int i = 0; i < currentVertCount; i++) { vh.PopulateUIVertex(ref val2, i); Vector3 val3 = ((Transform)val).TransformPoint(val2.position); Vector3 val4 = ((Transform)Panel).InverseTransformPoint(val3); float num = Mathf.Clamp01((0f - val4.x) / Width); val4.y *= Mathf.Lerp(1f, 1f - Strength, num); val4.x *= Mathf.Lerp(1f, 1f - Strength * 0.35f, num); Vector3 val5 = ((Transform)Panel).TransformPoint(val4); val2.position = ((Transform)val).InverseTransformPoint(val5); vh.SetUIVertex(val2, i); } } } } public class PixbitFlicker : MonoBehaviour { private Image _img; private float _period = 1.1f; private float _phase; public bool Master = true; public void Init(Image img, float period, float phase) { _img = img; _period = Mathf.Max(0.2f, period); _phase = phase; } private void Update() { if ((Object)(object)_img == (Object)null) { return; } if (!Master) { if (((Behaviour)_img).enabled) { ((Behaviour)_img).enabled = false; } return; } float num = Mathf.Repeat(Time.unscaledTime / _period + _phase, 1f); bool flag = num < 0.5f || num >= 0.72f; if (((Behaviour)_img).enabled != flag) { ((Behaviour)_img).enabled = flag; } } } public class ScanlineUV : MonoBehaviour { public RawImage Img; public float LinePx = 4f; private void LateUpdate() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) if (!((Object)(object)Img == (Object)null)) { Rect rect = ((RectTransform)((Component)this).transform).rect; float num = Mathf.Max(1f, ((Rect)(ref rect)).height / LinePx); Img.uvRect = new Rect(0f, 0f, 1f, num); } } } public class TickerWidget : MonoBehaviour { private const float Speed = 60f; private const float Gap = 48f; private RectTransform _track; private TextMeshProUGUI _copy1; private TextMeshProUGUI _copy2; private float _copyWidth; private float _offset; private string _lastText; private bool _dirtyWidth; public void Init(RectTransform track, TextMeshProUGUI copy1, TextMeshProUGUI copy2) { _track = track; _copy1 = copy1; _copy2 = copy2; } public void SetContent(string text) { if (!(text == _lastText)) { _lastText = text; ((TMP_Text)_copy1).text = text; ((TMP_Text)_copy2).text = text; _dirtyWidth = true; } } private void LateUpdate() { //IL_0040: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_copy1 == (Object)null || (Object)(object)_track == (Object)null) { return; } if (_dirtyWidth) { _dirtyWidth = false; Vector2 preferredValues = ((TMP_Text)_copy1).GetPreferredValues(((TMP_Text)_copy1).text); float num = Mathf.Max(40f, preferredValues.x); _copyWidth = num + 48f; ((TMP_Text)_copy1).rectTransform.sizeDelta = new Vector2(num + 4f, preferredValues.y); ((TMP_Text)_copy2).rectTransform.sizeDelta = new Vector2(num + 4f, preferredValues.y); ((TMP_Text)_copy2).rectTransform.anchoredPosition = new Vector2(_copyWidth, 0f); if (_offset <= 0f - _copyWidth) { _offset = 0f; } } _offset -= 60f * Time.unscaledDeltaTime; if (_offset <= 0f - _copyWidth) { _offset += _copyWidth; } _track.anchoredPosition = new Vector2(_offset, 0f); } } public class TMPPerspective : MonoBehaviour { public RectTransform Panel; public float Width = 340f; public float Strength = 0.16f; public bool Continuous; private TMP_Text _tmp; private bool _busy; private void Awake() { _tmp = ((Component)this).GetComponent(); } private void LateUpdate() { if (Continuous && (Object)(object)_tmp != (Object)null && Strength > 0f) { _tmp.ForceMeshUpdate(false, false); } } private void OnEnable() { TMPro_EventManager.TEXT_CHANGED_EVENT.Add((Action)OnChanged); if ((Object)(object)_tmp != (Object)null) { ((Graphic)_tmp).SetVerticesDirty(); } } private void OnDisable() { TMPro_EventManager.TEXT_CHANGED_EVENT.Remove((Action)OnChanged); } private void OnChanged(Object obj) { if (obj == (Object)(object)_tmp) { Warp(); } } private void Warp() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_008c: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) if (_busy || (Object)(object)_tmp == (Object)null || (Object)(object)Panel == (Object)null || Strength <= 0f) { return; } _busy = true; try { TMP_TextInfo textInfo = _tmp.textInfo; if (textInfo == null || textInfo.meshInfo == null) { return; } RectTransform val = (RectTransform)((Component)this).transform; for (int i = 0; i < textInfo.meshInfo.Length; i++) { Vector3[] vertices = textInfo.meshInfo[i].vertices; if (vertices != null) { for (int j = 0; j < vertices.Length; j++) { Vector3 val2 = ((Transform)val).TransformPoint(vertices[j]); Vector3 val3 = ((Transform)Panel).InverseTransformPoint(val2); float num = Mathf.Clamp01((0f - val3.x) / Width); val3.y *= Mathf.Lerp(1f, 1f - Strength, num); val3.x *= Mathf.Lerp(1f, 1f - Strength * 0.35f, num); vertices[j] = ((Transform)val).InverseTransformPoint(((Transform)Panel).TransformPoint(val3)); } Mesh mesh = textInfo.meshInfo[i].mesh; if ((Object)(object)mesh != (Object)null) { mesh.vertices = vertices; _tmp.UpdateGeometry(mesh, i); } } } } catch { } finally { _busy = false; } } } public class TrapFireEffect : MonoBehaviour { private class Tracer { public RectTransform Rt; public Image Img; public float T; public Vector2 Start; public float DirY; } private const int PoolSize = 8; private const float TracerLife = 0.3f; private const float SpawnEvery = 0.26f; private const float FlyDistance = 84f; private readonly List _pool = new List(8); private RectTransform _layer; private TextMeshProUGUI _text; private Color _baseColor; private float _spawnT; public bool Firing; public List Emitters; public void Init(RectTransform layer, TextMeshProUGUI text, Color baseColor) { //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_0034: 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_004b: 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_0057: Expected O, but got Unknown //IL_006a: 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_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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) _layer = layer; _text = text; _baseColor = baseColor; Vector2 val3 = default(Vector2); for (int i = 0; i < 8; i++) { GameObject val = new GameObject("Tracer", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)_layer, false); RectTransform val2 = (RectTransform)val.transform; ((Vector2)(ref val3))..ctor(0.5f, 0.5f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(1f, 0.5f); val2.sizeDelta = new Vector2(42f, 3f); Image val4 = val.AddComponent(); ((Graphic)val4).color = OverlayStyle.FromHex("FFD246"); ((Graphic)val4).raycastTarget = false; val.SetActive(false); _pool.Add(new Tracer { Rt = val2, Img = val4, T = -1f }); } } private void Update() { try { UpdateInner(); } catch { } } private void UpdateInner() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_layer == (Object)null) { return; } float unscaledDeltaTime = Time.unscaledDeltaTime; if (Firing) { _spawnT += unscaledDeltaTime; if (_spawnT >= 0.26f) { _spawnT = 0f; if (Random.value < 0.8f) { Spawn(); } } if ((Object)(object)_text != (Object)null) { float num = 0.5f + 0.5f * Mathf.Sin(Time.unscaledTime * 14f); ((Graphic)_text).color = Color.Lerp(_baseColor, Color.white, num * 0.6f); } } else if ((Object)(object)_text != (Object)null && ((Graphic)_text).color != _baseColor) { ((Graphic)_text).color = _baseColor; } for (int i = 0; i < _pool.Count; i++) { Tracer tracer = _pool[i]; if (!(tracer.T < 0f)) { tracer.T += unscaledDeltaTime / 0.3f; if (tracer.T >= 1f) { tracer.T = -1f; ((Component)tracer.Rt).gameObject.SetActive(false); continue; } tracer.Rt.anchoredPosition = tracer.Start + new Vector2(-84f * tracer.T, tracer.DirY * tracer.T); float num2 = ((tracer.T < 0.18f) ? (tracer.T / 0.18f) : (1f - (tracer.T - 0.18f) / 0.82f)); Color color = ((Graphic)tracer.Img).color; color.a = num2 * 0.95f; ((Graphic)tracer.Img).color = color; } } } private void Spawn() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _pool.Count; i++) { Tracer tracer = _pool[i]; if (tracer.T >= 0f) { continue; } if (Emitters != null && Emitters.Count > 0) { RectTransform val = Emitters[Random.Range(0, Emitters.Count)]; if ((Object)(object)val == (Object)null) { break; } tracer.Start = val.anchoredPosition + new Vector2(-16f, Random.Range(2f, 16f)); } else { Rect rect = _layer.rect; tracer.Start = new Vector2(Random.Range(0f, ((Rect)(ref rect)).width * 0.45f), Random.Range((0f - ((Rect)(ref rect)).height) * 0.25f, ((Rect)(ref rect)).height * 0.25f)); } tracer.DirY = Random.Range(-8f, 8f); tracer.T = 0f; tracer.Rt.anchoredPosition = tracer.Start; ((Transform)tracer.Rt).localRotation = Quaternion.Euler(0f, 0f, Random.Range(-6f, 6f)); ((Component)tracer.Rt).gameObject.SetActive(true); break; } } } public class VictoryWidget : MonoBehaviour { private class DayInfo { public string Moon; public readonly List Events = new List(); public readonly List Deaths = new List(); } private OverlayManager _mgr; private GameObject _content; private static readonly Dictionary KillerRu = new Dictionary { ["Fall"] = "Падение", ["Drowning"] = "Утопление", ["Suffocation"] = "Удушье", ["Fire"] = "Огонь", ["Shock"] = "Ток", ["Crushed"] = "Раздавлен", ["Unknown"] = "Неизвестно" }; public void Init(OverlayManager mgr) { _mgr = mgr; ((Component)this).gameObject.SetActive(false); } public void Show(BridgePayload p, int timerSec) { BuildContent(p, timerSec); ((Component)this).gameObject.SetActive(true); _mgr.AddPerspectiveToTree(((Component)this).transform); } public void Hide() { ((Component)this).gameObject.SetActive(false); } private static string LocKiller(string s) { if (ConfigSettings.RussianActive && s != null && KillerRu.TryGetValue(s.Trim(), out var value)) { return value; } return s; } private void BuildContent(BridgePayload p, int timerSec) { //IL_0059: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0753: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_content != (Object)null) { Object.Destroy((Object)(object)_content); } OverlayStyle style = _mgr.Style; _content = _mgr.MakeCol(((Component)this).transform, 4f); GameObject val = new GameObject("Divider", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(_content.transform, false); Image obj = val.AddComponent(); ((Graphic)obj).color = style.Frame; ((Graphic)obj).raycastTarget = false; val.AddComponent().preferredHeight = 3f; _mgr.MakeText(_content.transform, Localization.T("vicStamp"), 14f, OverlayStyle.FromHex("FFB000"), (TextAlignmentOptions)514, bold: true, big: true); _mgr.MakeText(_content.transform, Localization.T("vicTitle"), 34f, style.Danger, (TextAlignmentOptions)514, bold: true, big: true); _mgr.MakeText(_content.transform, Localization.T("vicSub"), 11f, style.Text, (TextAlignmentOptions)514); string text = Localization.T("vicTime") + " " + OverlayManager.FmtTime(timerSec) + " " + string.Format("{0} ${1} ", Localization.T("vicLoot"), p?.shipLoot ?? 0) + string.Format("{0} {1}", Localization.T("vicDeaths"), p?.deaths ?? 0); _mgr.MakeText(_content.transform, text, 13f, OverlayStyle.FromHex("FFB000"), (TextAlignmentOptions)514); RunInfo runInfo = p?.run; if (runInfo == null) { return; } if (runInfo.quotas != null && runInfo.quotas.Length != 0) { Section(Localization.T("vicQuotas")); StringBuilder stringBuilder = new StringBuilder(); RunQuota[] quotas = runInfo.quotas; foreach (RunQuota runQuota in quotas) { if (stringBuilder.Length > 0) { stringBuilder.Append('\n'); } stringBuilder.Append(("Q" + runQuota.i).PadRight(4)).Append(("$" + runQuota.money).PadLeft(7)).Append(OverlayManager.FmtTime(runQuota.sec).PadLeft(9)) .Append(("X" + runQuota.deaths).PadLeft(5)); } Body(stringBuilder.ToString()); } if (runInfo.moons != null && runInfo.moons.Length != 0) { Section(Localization.T("vicMoons")); StringBuilder stringBuilder2 = new StringBuilder(); int num = 0; RunMoon[] moons = runInfo.moons; foreach (RunMoon runMoon in moons) { if (num++ >= 6) { break; } if (stringBuilder2.Length > 0) { stringBuilder2.Append('\n'); } string text2 = runMoon.name ?? "?"; if (text2.Length > 13) { text2 = text2.Substring(0, 13); } stringBuilder2.Append((num == 1) ? "* " : " ").Append(text2.PadRight(14)).Append(("$" + runMoon.profit).PadLeft(7)) .Append(("x" + runMoon.visits).PadLeft(4)); } Body(stringBuilder2.ToString()); } if (runInfo.monsters != null && runInfo.monsters.Length != 0) { Section(Localization.T("vicMonsters")); StringBuilder stringBuilder3 = new StringBuilder(); int num2 = 0; RunMonster[] monsters = runInfo.monsters; foreach (RunMonster runMonster in monsters) { if (num2++ >= 8) { break; } if (stringBuilder3.Length > 0) { stringBuilder3.Append('\n'); } string text3 = runMonster.name ?? "?"; if (text3.Length > 18) { text3 = text3.Substring(0, 18); } stringBuilder3.Append(text3.PadRight(19)).Append(("x" + runMonster.count).PadLeft(4)); } Body(stringBuilder3.ToString()); } if (runInfo.timeline == null || runInfo.timeline.Length == 0) { return; } Section(Localization.T("vicTimeline")); SortedDictionary sortedDictionary = new SortedDictionary(); string[] timeline = runInfo.timeline; for (int i = 0; i < timeline.Length; i++) { string[] array = (timeline[i] ?? "").Split(new char[1] { '|' }, 3); if (array.Length >= 3 && int.TryParse(array[0], out var result)) { if (!sortedDictionary.TryGetValue(result, out var value)) { value = (sortedDictionary[result] = new DayInfo()); } switch (array[1]) { case "day": value.Moon = array[2]; break; case "event": value.Events.Add(array[2]); break; case "death": { int num3 = array[2].IndexOf('@'); value.Deaths.Add(LocKiller((num3 > 0) ? array[2].Substring(0, num3) : array[2])); break; } } } } StringBuilder stringBuilder4 = new StringBuilder(); foreach (KeyValuePair item in sortedDictionary) { if (stringBuilder4.Length > 0) { stringBuilder4.Append('\n'); } DayInfo value2 = item.Value; stringBuilder4.Append('D').Append(item.Key).Append(' ') .Append(value2.Moon ?? "?"); if (value2.Events.Count > 0) { stringBuilder4.Append(" ").Append(Localization.T("vicEvent")).Append(": ") .Append(OverlayManager.Esc(string.Join(", ", value2.Events))) .Append(""); } if (value2.Deaths.Count > 0) { stringBuilder4.Append(" ").Append(Localization.T("vicDeath")).Append(": ") .Append(OverlayManager.Esc(string.Join(", ", value2.Deaths))) .Append(""); } else { stringBuilder4.Append(" ') .Append(Localization.T("vicNoLosses")) .Append(""); } } Body(stringBuilder4.ToString(), 11f); } private void Section(string title) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) _mgr.MakeText(_content.transform, title, 11f, _mgr.Style.Danger, (TextAlignmentOptions)514, bold: true); } private void Body(string text, float size = 12f) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) _mgr.MakeText(_content.transform, text, size, _mgr.Style.Text, (TextAlignmentOptions)513); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LCBridgeOverlay"; public const string PLUGIN_NAME = "LCBridgeOverlay"; public const string PLUGIN_VERSION = "1.3.0"; } }