Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TeleporterScanner v2.4.3
TeleporterScanner.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyVersion("0.0.0.0")] [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 TeleporterScanner { [BepInPlugin("com.example.teleporterscanner", "TeleporterScanner", "2.5.0")] public class TeleporterScannerPlugin : BaseUnityPlugin { private class Entry { public string Name; public int Count; public Texture Icon; public Color Tint; } private ConfigEntry<bool> showIcons; private ConfigEntry<bool> radarOnCharge; private ConfigEntry<bool> use3dFallback; private readonly Dictionary<string, Texture2D> pictures = new Dictionary<string, Texture2D>(); private readonly Dictionary<string, string> pictureKeyCache = new Dictionary<string, string>(); private bool guiWarmedUp; private float panelAlpha; private bool previewWarmedUp; private List<Entry> warmupEntries; private GameObject scannerPrefab; private readonly List<Entry> entries = new List<Entry>(); private int total; private bool panelVisible; private float nextScan; private float nextRebuild; private float nextPreload; private readonly Dictionary<string, string> nameCache = new Dictionary<string, string>(); private GUIStyle textStyle; private GUIStyle headerStyle; private GUIStyle shadowStyle; private GUIStyle headerShadowStyle; private readonly Dictionary<string, RenderTexture> iconCache = new Dictionary<string, RenderTexture>(); private Camera previewCamera; private Light previewLight; private static readonly Vector3 PreviewOrigin = new Vector3(0f, -5000f, 0f); private void Awake() { showIcons = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowIcons", true, "Show small pictures of the real in-game models next to each object type."); radarOnCharge = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RadarWhenTeleporterCharged", true, "When the teleporter is fully charged, send out a Radar Scanner pulse that shows remaining objects for about 10 seconds."); use3dFallback = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Use3DModelsWhenNoPicture", false, "If an object has no picture, draw a small image of its real 3D model instead of a colored square."); LoadAllPictures(); TeleporterInteraction.onTeleporterChargedGlobal += OnTeleporterCharged; ((BaseUnityPlugin)this).Logger.LogInfo((object)"TeleporterScanner 2.5 loaded!"); } private void OnDestroy() { TeleporterInteraction.onTeleporterChargedGlobal -= OnTeleporterCharged; } private void OnTeleporterCharged(TeleporterInteraction teleporter) { //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_0053: 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) if (!radarOnCharge.Value || (Object)(object)teleporter == (Object)null || !NetworkServer.active) { return; } try { GameObject val = GetScannerPrefab(); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Radar Scanner effect was not found, pulse skipped."); } else { NetworkServer.Spawn(Object.Instantiate<GameObject>(val, ((Component)teleporter).transform.position + Vector3.up, Quaternion.identity)); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not create radar pulse: " + ex.Message)); } } private GameObject GetScannerPrefab() { //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) if ((Object)(object)scannerPrefab != (Object)null) { return scannerPrefab; } try { scannerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Scanner/ChestScanner.prefab").WaitForCompletion(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Addressables load failed: " + ex.Message)); } if ((Object)(object)scannerPrefab == (Object)null) { scannerPrefab = Resources.Load<GameObject>("Prefabs/NetworkedObjects/ChestScanner"); } return scannerPrefab; } private void WarmUpPreview() { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).hideFlags = (HideFlags)61; val.transform.position = PreviewOrigin + Vector3.up * 1000f; RenderTexture val2 = RenderPreview(val); Object.DestroyImmediate((Object)(object)val); if ((Object)(object)val2 != (Object)null) { val2.Release(); Object.Destroy((Object)(object)val2); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Preview warm-up failed: " + ex.Message)); } } private List<Entry> BuildWarmupEntries() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_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) string text = ""; for (char c = ' '; c <= '~'; c = (char)(c + 1)) { text += c; } return new List<Entry> { new Entry { Name = text, Count = 1, Tint = Color.white }, new Entry { Name = "Warm up", Count = 2, Tint = Color.red, Icon = (Texture)(object)Texture2D.whiteTexture } }; } private void Update() { float unscaledTime = Time.unscaledTime; panelAlpha = Mathf.MoveTowards(panelAlpha, panelVisible ? 1f : 0f, Time.unscaledDeltaTime * 6f); if (!previewWarmedUp && showIcons.Value && use3dFallback.Value) { previewWarmedUp = true; WarmUpPreview(); } if (showIcons.Value && use3dFallback.Value && unscaledTime >= nextPreload && !PreloadOneIcon()) { nextPreload = unscaledTime + 0.25f; } if (unscaledTime >= nextRebuild) { nextRebuild = unscaledTime + 0.5f; Rebuild(); } if (unscaledTime >= nextScan) { nextScan = unscaledTime + 0.2f; panelVisible = IsLookingAtTeleporter(); } } private string GetName(string token) { if (!nameCache.TryGetValue(token, out var value)) { value = Language.GetString(token); nameCache[token] = value; } return value; } private bool PreloadOneIcon() { foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList<PurchaseInteraction>()) { if (!((Object)(object)instances == (Object)null) && ((Behaviour)instances).isActiveAndEnabled && instances.available && !string.IsNullOrEmpty(instances.displayNameToken)) { string name = GetName(instances.displayNameToken); if (!iconCache.ContainsKey(name)) { iconCache[name] = MakeIcon(name, instances); return true; } } } return false; } private bool IsLookingAtTeleporter() { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser == null || (Object)(object)firstLocalUser.cachedBody == (Object)null) { return false; } InteractionDriver component = ((Component)firstLocalUser.cachedBody).GetComponent<InteractionDriver>(); if ((Object)(object)component == (Object)null) { return false; } GameObject val = component.FindBestInteractableObject(); if ((Object)(object)val == (Object)null) { return false; } return (Object)(object)val.GetComponentInParent<TeleporterInteraction>() != (Object)null; } private void Rebuild() { //IL_00ae: 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) entries.Clear(); total = 0; foreach (IGrouping<string, PurchaseInteraction> item in (from p in InstanceTracker.GetInstancesList<PurchaseInteraction>() where (Object)(object)p != (Object)null && ((Behaviour)p).isActiveAndEnabled && p.available && !string.IsNullOrEmpty(p.displayNameToken) group p by GetName(p.displayNameToken) into g orderby g.Count() descending select g).ToList()) { PurchaseInteraction val = item.First(); Entry entry = new Entry { Name = item.Key, Count = item.Count(), Tint = GetTint(val) }; if (showIcons.Value) { if (!pictureKeyCache.TryGetValue(item.Key, out var value)) { value = GetPictureKey(item.Key, val); pictureKeyCache[item.Key] = value; } if (value != null && pictures.TryGetValue(value, out var value2)) { entry.Icon = (Texture)(object)value2; } if ((Object)(object)entry.Icon == (Object)null && use3dFallback.Value) { entry.Icon = GetIcon(item.Key, val); } } entries.Add(entry); total += entry.Count; } } private void LoadAllPictures() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown try { Assembly assembly = typeof(TeleporterScannerPlugin).Assembly; string[] manifestResourceNames = assembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (!text.StartsWith("TeleporterScanner.Images.") || !text.EndsWith(".png")) { continue; } string key = text.Substring("TeleporterScanner.Images.".Length, text.Length - "TeleporterScanner.Images.".Length - 4); using Stream stream = assembly.GetManifestResourceStream(text); using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ((Object)val).hideFlags = (HideFlags)61; ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; if (ImageConversion.LoadImage(val, memoryStream.ToArray())) { pictures[key] = val; } else { Object.Destroy((Object)(object)val); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded " + pictures.Count + " pictures.")); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not load pictures: " + ex.Message)); } } private static string GetPictureKey(string displayName, PurchaseInteraction p) { string text = (displayName + " " + p.displayNameToken + " " + ((Object)((Component)p).gameObject).name).ToUpperInvariant(); if (text.Contains("TC-280") || text.Contains("TC280") || text.Contains("MEGADRONE")) { return "tc280"; } if (text.Contains("EMERGENCY")) { return "emergency_drone"; } if (text.Contains("TURRET")) { return "gunner_turret"; } if (text.Contains("DRONE")) { if (text.Contains("INCINERATOR") || text.Contains("FLAMETHROWER")) { return "incinerator_drone"; } if (text.Contains("MISSILE")) { return "missile_drone"; } if (text.Contains("HEALING")) { return "healing_drone"; } if (text.Contains("EQUIPMENT")) { return "equipment_drone"; } if (text.Contains("GUNNER")) { return "gunner_drone"; } } if (text.Contains("NEWT")) { return "newt_altar"; } if (text.Contains("ALTAR OF GOLD") || text.Contains("GOLDSHORES")) { return "altar_gold"; } if (text.Contains("SHRINE")) { if (text.Contains("BLOOD")) { return "shrine_blood"; } if (text.Contains("CHANCE")) { return "shrine_chance"; } if (text.Contains("COMBAT")) { return "shrine_combat"; } if (text.Contains("ORDER") || text.Contains("RESTACK")) { return "shrine_order"; } if (text.Contains("MOUNTAIN") || text.Contains("SHRINEBOSS")) { return "shrine_mountain"; } if (text.Contains("WOODS") || text.Contains("HEALING")) { return "shrine_woods"; } return null; } if (text.Contains("DUPLICATOR") || text.Contains("PRINTER")) { if (text.Contains("MILITARY") || text.Contains("MILI-TECH") || text.Contains("MILI TECH")) { return "mili_printer"; } if (text.Contains("WILD") || text.Contains("OVERGROWN")) { return "overgrown_printer"; } if (text.Contains("LARGE") || text.Contains("UNCOMMON")) { return "printer_uncommon"; } return "printer"; } if (text.Contains("SCRAPPER")) { return "scrapper"; } if (text.Contains("RADIO") || text.Contains("SCANNER")) { return "radio_scanner"; } if (text.Contains("MULTISHOP") || text.Contains("TRIPLE")) { if (!text.Contains("EQUIPMENT")) { return "multishop"; } return "equipment_triple"; } if (text.Contains("EQUIPMENT")) { return "equipment_barrel"; } if (text.Contains("ENCRUSTED") || text.Contains("LOCKBOXVOID")) { return "encrusted_cache"; } if (text.Contains("LOCKBOX")) { return "rusty_lockbox"; } if (text.Contains("CRADLE") || text.Contains("VOIDCHEST")) { return "void_cradle"; } if (text.Contains("LUNAR") && (text.Contains("POD") || text.Contains("CHEST"))) { return "lunar_pod"; } if (text.Contains("LEGENDARY") || text.Contains("GOLDCHEST")) { return "legendary_chest"; } if (text.Contains("ADAPTIVE") || text.Contains("CASINO")) { return "adaptive_chest"; } if (text.Contains("CLOAKED") || text.Contains("STEALTH")) { return "cloaked_chest"; } if (text.Contains("CHEST")) { if (text.Contains("DAMAGE")) { return "chest_damage"; } if (text.Contains("HEALING")) { return "chest_healing"; } if (text.Contains("UTILITY")) { return "chest_utility"; } if (text.Contains("CHEST2") || text.Contains("LARGE")) { return "large_chest"; } return "small_chest"; } return null; } private static Color GetTint(PurchaseInteraction p) { //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_022d: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0258: 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) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0268: 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_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) string text = (p.displayNameToken + " " + ((Object)((Component)p).gameObject).name).ToUpperInvariant(); Color result = default(Color); ((Color)(ref result))..ctor(0.92f, 0.92f, 0.92f); Color result2 = default(Color); ((Color)(ref result2))..ctor(0.3f, 0.8f, 0.3f); Color result3 = default(Color); ((Color)(ref result3))..ctor(0.9f, 0.2f, 0.2f); Color result4 = default(Color); ((Color)(ref result4))..ctor(0.95f, 0.85f, 0.2f); Color result5 = default(Color); ((Color)(ref result5))..ctor(1f, 0.55f, 0.1f); Color result6 = default(Color); ((Color)(ref result6))..ctor(0.3f, 0.6f, 1f); Color result7 = default(Color); ((Color)(ref result7))..ctor(0.7f, 0.3f, 0.9f); Color result8 = default(Color); ((Color)(ref result8))..ctor(0.6f, 0.62f, 0.65f); Color result9 = default(Color); ((Color)(ref result9))..ctor(0.6f, 0.4f, 0.2f); if (text.Contains("DRONE") || text.Contains("TURRET") || text.Contains("GUNNER")) { return result8; } if (text.Contains("VOID")) { return result7; } if (text.Contains("LUNAR")) { return result6; } if (text.Contains("EQUIPMENT")) { return result5; } if (text.Contains("LOCKBOX")) { return result9; } if (text.Contains("NEWT") || text.Contains("BAZAAR") || text.Contains("GOLDSHORES")) { return result6; } if (text.Contains("SHRINE")) { if (text.Contains("BLOOD")) { return result3; } if (text.Contains("COMBAT")) { return result5; } if (text.Contains("CHANCE")) { return result4; } if (text.Contains("MOUNTAIN")) { return result6; } if (text.Contains("WOODS") || text.Contains("HEALING")) { return result2; } if (text.Contains("ORDER")) { return result8; } text.Contains("BOSS"); return result4; } if (text.Contains("GREENTORED")) { return result3; } if (text.Contains("WHITETOGREEN")) { return result2; } if (text.Contains("REDTOWHITE")) { return result; } if (text.Contains("DUPLICATOR")) { if (text.Contains("MILITARY")) { return result3; } if (text.Contains("WILD")) { return result4; } if (text.Contains("LARGE")) { return result2; } return result; } if (text.Contains("DAMAGE")) { return result3; } if (text.Contains("UTILITY")) { return result4; } if (text.Contains("GOLDCHEST") || text.Contains("LEGENDARY")) { return result3; } if (text.Contains("CHEST2") || text.Contains("LARGE")) { return result2; } text.Contains("CHEST1"); return result; } private Texture GetIcon(string key, PurchaseInteraction sample) { if (!iconCache.TryGetValue(key, out var value)) { return null; } return (Texture)(object)value; } private RenderTexture MakeIcon(string key, PurchaseInteraction sample) { try { return RenderPreview(((Component)sample).gameObject); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not render icon for " + key + ": " + ex.Message)); return null; } } private void EnsurePreviewObjects() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_006e: 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_00c7: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)previewCamera != (Object)null) || !((Object)(object)previewLight != (Object)null)) { GameObject val = new GameObject("TeleporterScannerPreviewCamera"); ((Object)val).hideFlags = (HideFlags)61; previewCamera = val.AddComponent<Camera>(); ((Behaviour)previewCamera).enabled = false; previewCamera.clearFlags = (CameraClearFlags)2; previewCamera.backgroundColor = new Color(0.08f, 0.14f, 0.24f, 1f); previewCamera.fieldOfView = 30f; previewCamera.nearClipPlane = 0.05f; previewCamera.cullingMask = 1; previewCamera.allowHDR = false; previewCamera.allowMSAA = false; GameObject val2 = new GameObject("TeleporterScannerPreviewLight"); ((Object)val2).hideFlags = (HideFlags)61; previewLight = val2.AddComponent<Light>(); previewLight.type = (LightType)1; previewLight.intensity = 1.3f; previewLight.shadows = (LightShadows)0; val2.transform.rotation = Quaternion.Euler(40f, -35f, 0f); ((Behaviour)previewLight).enabled = false; } } private RenderTexture RenderPreview(GameObject target) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_00a3: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_01af: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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_020a: 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_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) EnsurePreviewObjects(); List<Renderer> list = (from r in target.GetComponentsInChildren<Renderer>(false) where r.enabled && (r is MeshRenderer || r is SkinnedMeshRenderer) select r).ToList(); if (list.Count == 0) { return null; } Bounds bounds = list[0].bounds; foreach (Renderer item in list) { ((Bounds)(ref bounds)).Encapsulate(item.bounds); } Vector3 val = ((Bounds)(ref bounds)).extents; float num = Mathf.Max(((Vector3)(ref val)).magnitude, 0.1f); Matrix4x4 val2 = Matrix4x4.Translate(PreviewOrigin - ((Bounds)(ref bounds)).center); foreach (Renderer item2 in list) { Mesh val3 = null; MeshRenderer val4 = (MeshRenderer)(object)((item2 is MeshRenderer) ? item2 : null); if ((Object)(object)val4 != (Object)null) { MeshFilter component = ((Component)val4).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null) { val3 = component.sharedMesh; } } else { SkinnedMeshRenderer val5 = (SkinnedMeshRenderer)(object)((item2 is SkinnedMeshRenderer) ? item2 : null); if ((Object)(object)val5 != (Object)null) { val3 = val5.sharedMesh; } } if ((Object)(object)val3 == (Object)null) { continue; } Matrix4x4 val6 = val2 * item2.localToWorldMatrix; Material[] sharedMaterials = item2.sharedMaterials; for (int num2 = 0; num2 < val3.subMeshCount && num2 < sharedMaterials.Length; num2++) { if ((Object)(object)sharedMaterials[num2] != (Object)null) { Graphics.DrawMesh(val3, val6, sharedMaterials[num2], 0, previewCamera, num2); } } } val = new Vector3(0.6f, 0.45f, -1f); Vector3 normalized = ((Vector3)(ref val)).normalized; float num3 = num / Mathf.Sin(previewCamera.fieldOfView * 0.5f * (MathF.PI / 180f)) * 1.1f; previewCamera.farClipPlane = num3 + num * 3f; ((Component)previewCamera).transform.position = PreviewOrigin + normalized * num3; ((Component)previewCamera).transform.LookAt(PreviewOrigin); RenderTexture val7 = new RenderTexture(96, 96, 16, (RenderTextureFormat)0); val7.Create(); previewCamera.targetTexture = val7; ((Behaviour)previewLight).enabled = true; previewCamera.Render(); ((Behaviour)previewLight).enabled = false; previewCamera.targetTexture = null; return val7; } private void EnsureStyles() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_005a: 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_0075: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) if (textStyle == null) { textStyle = new GUIStyle(GUI.skin.label); textStyle.fontSize = 18; textStyle.alignment = (TextAnchor)3; textStyle.wordWrap = false; textStyle.richText = true; textStyle.normal.textColor = Color.white; headerStyle = new GUIStyle(textStyle); headerStyle.fontSize = 20; headerStyle.fontStyle = (FontStyle)1; shadowStyle = new GUIStyle(textStyle); shadowStyle.richText = false; shadowStyle.normal.textColor = Color.black; headerShadowStyle = new GUIStyle(headerStyle); headerShadowStyle.richText = false; headerShadowStyle.normal.textColor = Color.black; } } private void OnGUI() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 EnsureStyles(); if (!guiWarmedUp) { if ((int)Event.current.type == 7) { guiWarmedUp = true; if (warmupEntries == null) { warmupEntries = BuildWarmupEntries(); } DrawPanel(warmupEntries, 3, 0.02f); } } else if (!(panelAlpha <= 0.01f)) { DrawPanel(entries, total, panelAlpha); } } private static void FillRect(Rect r, Color col, float alpha) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0029: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = new Color(col.r, col.g, col.b, col.a * alpha); GUI.DrawTexture(r, (Texture)(object)Texture2D.whiteTexture); GUI.color = color; } private static void DrawShadowed(Rect r, string rich, string plain, GUIStyle main, GUIStyle shadow) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0053: 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_0066: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, color.a * 0.8f); GUI.Label(new Rect(((Rect)(ref r)).x + 1.5f, ((Rect)(ref r)).y + 1.5f, ((Rect)(ref r)).width, ((Rect)(ref r)).height), plain, shadow); GUI.color = color; GUI.Label(r, rich, main); } private void DrawPanel(List<Entry> list, int totalCount, float alpha) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_042c: 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_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0386: 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) Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, alpha); float num = Mathf.Clamp((float)Screen.height / 1080f, 0.8f, 1.6f); bool value = showIcons.Value; float num2 = 48f * num; float num3 = (value ? 54f : 28f) * num; float num4 = 400f * num; float num5 = 12f * num; float num6 = 34f * num; float num7 = 4f * num; float num8 = 1f - (1f - alpha) * (1f - alpha); float num9 = (20f - (1f - num8) * 40f) * num; float num10 = (float)Screen.height * 0.3f; textStyle.fontSize = Mathf.RoundToInt(18f * num); shadowStyle.fontSize = textStyle.fontSize; headerStyle.fontSize = Mathf.RoundToInt(20f * num); headerShadowStyle.fontSize = headerStyle.fontSize; float num11 = ((list.Count == 0) ? (30f * num) : ((float)list.Count * num3 + 40f * num)); float num12 = num5 * 2f + num6 + num11; FillRect(new Rect(num9, num10, num4, num12), new Color(0.04f, 0.06f, 0.09f, 0.88f), alpha); FillRect(new Rect(num9, num10, num7, num12), new Color(0.3f, 0.75f, 1f, 1f), alpha); float num13 = num9 + num7 + num5; float num14 = num4 - num7 - num5 * 2f; float num15 = num10 + num5; DrawShadowed(new Rect(num13, num15, num14, num6 - 4f * num), "Remaining on the map", "Remaining on the map", headerStyle, headerShadowStyle); num15 += num6; FillRect(new Rect(num13, num15 - 3f * num, num14, 1f), new Color(1f, 1f, 1f, 0.18f), alpha); if (list.Count == 0) { string text = "Everything is activated!"; DrawShadowed(new Rect(num13, num15 + 2f * num, num14, 26f * num), text, text, textStyle, shadowStyle); GUI.color = color; return; } Rect r = default(Rect); Rect r2 = default(Rect); Rect val = default(Rect); for (int i = 0; i < list.Count; i++) { Entry entry = list[i]; ((Rect)(ref r))..ctor(num13, num15, num14, num3); if (i % 2 == 1) { FillRect(r, new Color(1f, 1f, 1f, 0.05f), alpha); } float num16 = num13 + 4f * num; if (value) { ((Rect)(ref r2))..ctor(num16, num15 + (num3 - num2) * 0.5f, num2, num2); FillRect(r2, new Color(0f, 0f, 0f, 0.7f), alpha); ((Rect)(ref val))..ctor(((Rect)(ref r2)).x + 2f * num, ((Rect)(ref r2)).y + 2f * num, ((Rect)(ref r2)).width - 4f * num, ((Rect)(ref r2)).height - 4f * num); if ((Object)(object)entry.Icon != (Object)null) { GUI.DrawTexture(val, entry.Icon, (ScaleMode)2, !(entry.Icon is RenderTexture)); } else { FillRect(val, entry.Tint, alpha); } num16 += num2 + 12f * num; } string text2 = ColorUtility.ToHtmlStringRGB(Color.Lerp(entry.Tint, Color.white, 0.25f)); string rich = "<b><color=#" + text2 + ">" + entry.Count + "×</color></b> " + entry.Name; string plain = entry.Count + "× " + entry.Name; DrawShadowed(new Rect(num16, num15, num14 - (num16 - num13), num3), rich, plain, textStyle, shadowStyle); num15 += num3; } FillRect(new Rect(num13, num15 + 4f * num, num14, 1f), new Color(1f, 1f, 1f, 0.18f), alpha); string text3 = "Total: " + totalCount; DrawShadowed(new Rect(num13, num15 + 8f * num, num14, 28f * num), text3, text3, headerStyle, headerShadowStyle); GUI.color = color; } } }