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 Mirror of Memories v0.2.5
MirrorOfMemories.dll
Decompiled 41 minutes ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("MirrorOfMemories")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.5.0")] [assembly: AssemblyInformationalVersion("0.2.5+e22e549a6a23174061beee37d7549c24c1dae1b7")] [assembly: AssemblyProduct("MirrorOfMemories")] [assembly: AssemblyTitle("MirrorOfMemories")] [assembly: AssemblyVersion("0.2.5.0")] namespace VolvaMirror; public static class Assets { public const string MirrorItem = "VM_Mirror"; public const string PhotoItem = "VM_Photo"; public const string Cauldron = "VM_Cauldron"; public static readonly string[] Frames = new string[3] { "VM_FrameS", "VM_FrameM", "VM_FrameL" }; private static AssetBundle s_bundle; private static readonly Dictionary<string, AudioClip> s_sounds = new Dictionary<string, AudioClip>(); private static readonly Dictionary<string, Material> s_mats = new Dictionary<string, Material>(); private static AudioMixerGroup s_sfx; private static Texture2D s_noise; private static Texture2D s_frost; private static Material s_wood; private static Material s_stone; private static Material s_standard; private static readonly Dictionary<string, Sprite> s_icons = new Dictionary<string, Sprite>(); private static Mesh s_quad; public static Quaternion HandBase { get; private set; } = Quaternion.identity; public static bool LoadBundle(string dir) { string text = Path.Combine(dir, "volvamirror"); if (!File.Exists(text)) { Plugin.Log.LogError((object)("Asset bundle not found: " + text)); return false; } s_bundle = AssetBundle.LoadFromFile(text); if (!Object.op_Implicit((Object)(object)s_bundle)) { Plugin.Log.LogError((object)("Could not load " + text)); return false; } AudioClip[] array = s_bundle.LoadAllAssets<AudioClip>(); foreach (AudioClip val in array) { s_sounds[((Object)val).name] = val; } Sprite[] array2 = s_bundle.LoadAllAssets<Sprite>(); foreach (Sprite val2 in array2) { s_icons[((Object)val2).name] = val2; } Plugin.Log.LogInfo((object)("Bundle loaded: " + s_sounds.Count + " sounds, " + s_icons.Count + " icons")); return true; } public static AudioClip Sound(string n) { if (!s_sounds.TryGetValue(n, out var value)) { return null; } return value; } public static void SetMixer(AudioSource a) { if (Object.op_Implicit((Object)(object)s_sfx)) { a.outputAudioMixerGroup = s_sfx; } } public static void Setup3D(AudioSource a, float maxDist = 12f) { a.playOnAwake = false; a.spatialBlend = 1f; a.rolloffMode = (AudioRolloffMode)1; a.minDistance = 1f; a.maxDistance = maxDist; a.dopplerLevel = 0f; SetMixer(a); } public static void PlayAt(string clip, Vector3 pos, float vol, float maxDist = 12f) { //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown AudioClip val = Sound(clip); if (Object.op_Implicit((Object)(object)val)) { GameObject val2 = new GameObject("vm_sfx"); val2.transform.position = pos; AudioSource obj = val2.AddComponent<AudioSource>(); Setup3D(obj, maxDist); obj.PlayOneShot(val, vol * Plugin.Volume.Value); Object.Destroy((Object)val2, val.length + 0.2f); } } public static void PlayVanillaFx(string[] names, Vector3 pos) { //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) if (!Object.op_Implicit((Object)(object)ZNetScene.instance)) { return; } foreach (string text in names) { GameObject prefab = ZNetScene.instance.GetPrefab(text); if (Object.op_Implicit((Object)(object)prefab)) { ZNetView.m_forceDisableInit = true; try { Object.Instantiate<GameObject>(prefab, pos, Quaternion.identity); break; } finally { ZNetView.m_forceDisableInit = false; } } } } private static Texture2D Noise() { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)s_noise)) { return s_noise; } s_noise = new Texture2D(32, 32, (TextureFormat)4, false) { filterMode = (FilterMode)0, name = "vm_noise" }; Random random = new Random(77); Color[] array = (Color[])(object)new Color[1024]; for (int i = 0; i < array.Length; i++) { float num = 0.88f + (float)random.NextDouble() * 0.12f; array[i] = new Color(num, num, num, 1f); } s_noise.SetPixels(array); s_noise.Apply(); return s_noise; } public static Texture2D FrostTexture() { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)s_frost)) { return s_frost; } float[] a = new float[262144]; Random rng = new Random(5); for (int i = 0; i < 70; i++) { int num = i % 4; float num2 = (float)rng.NextDouble() * 512f; Branch(num switch { 1 => 511f, 0 => 0f, _ => num2, }, num switch { 3 => 511f, 2 => 0f, _ => num2, }, num switch { 2 => (float)Math.PI / 2f, 1 => (float)Math.PI, 0 => 0f, _ => -(float)Math.PI / 2f, } + (float)(rng.NextDouble() - 0.5) * 1.2f, 60f + (float)rng.NextDouble() * 120f, 0); } s_frost = new Texture2D(512, 512, (TextureFormat)4, false) { name = "vm_frost", wrapMode = (TextureWrapMode)1 }; Color32[] array = (Color32[])(object)new Color32[262144]; for (int j = 0; j < 512; j++) { for (int k = 0; k < 512; k++) { float num3 = (float)Mathf.Min(Mathf.Min(k, 511 - k), Mathf.Min(j, 511 - j)) / 256f; float num4 = Mathf.Clamp01(0.55f - num3 * 2.2f); float num5 = Mathf.Clamp01(a[j * 512 + k] * 0.9f + num4); array[j * 512 + k] = new Color32((byte)225, (byte)245, byte.MaxValue, (byte)(num5 * 255f)); } } s_frost.SetPixels32(array); s_frost.Apply(); return s_frost; void Branch(float x, float y, float ang, float len, int depth) { for (int l = 0; (float)l < len; l++) { x += Mathf.Cos(ang); y += Mathf.Sin(ang); ang += (float)(rng.NextDouble() - 0.5) * 0.25f; int num6 = (int)x; int num7 = (int)y; if (num6 < 1 || num7 < 1 || num6 >= 511 || num7 >= 511) { break; } float num8 = 1f - (float)l / len * 0.6f; a[num7 * 512 + num6] = Mathf.Max(a[num7 * 512 + num6], num8); a[num7 * 512 + num6 + 1] = Mathf.Max(a[num7 * 512 + num6 + 1], num8 * 0.5f); a[(num7 + 1) * 512 + num6] = Mathf.Max(a[(num7 + 1) * 512 + num6], num8 * 0.5f); if (depth < 3 && rng.NextDouble() < 0.06) { Branch(x, y, ang + ((rng.NextDouble() < 0.5) ? 0.9f : (-0.9f)), len * 0.45f, depth + 1); } } } } private static Material Pick(string[] prefabs, Func<string, bool> shaderOk, Func<string, bool> nameOk) { for (int i = 0; i < prefabs.Length; i++) { GameObject prefab = Cache.GetPrefab<GameObject>(prefabs[i]); if (!Object.op_Implicit((Object)(object)prefab)) { continue; } Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); for (int j = 0; j < componentsInChildren.Length; j++) { Material[] sharedMaterials = componentsInChildren[j].sharedMaterials; foreach (Material val in sharedMaterials) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.shader) && shaderOk(((Object)val.shader).name) && nameOk(((Object)val).name.ToLowerInvariant())) { return val; } } } } return null; } private static void FindBaseMaterials() { //IL_0149: Unknown result type (might be due to invalid IL or missing references) s_wood = Pick(new string[4] { "wood_wall", "wood_floor", "piece_chair", "piece_table" }, (string s) => s.Contains("Piece") && !s.Contains("Snow"), (string m) => m.Contains("wood") && !m.Contains("snow")); s_stone = Pick(new string[4] { "stone_wall_1x1", "stone_wall_2x1", "stone_floor_2x2", "piece_stonecutter" }, (string s) => s.Contains("Piece") && !s.Contains("Snow"), (string m) => m.Contains("stone") && !m.Contains("snow")) ?? s_wood; Material val = Pick(new string[1] { "Boar" }, (string s) => s == "Standard", (string m) => true); s_standard = (Material)(Object.op_Implicit((Object)(object)val) ? ((object)val) : ((object)new Material(Shader.Find("Standard")))); Plugin.Log.LogInfo((object)("Materials: wood=" + Name(s_wood) + " stone=" + Name(s_stone) + " standard=" + Name(s_standard))); } private static string Name(Material m) { if (!Object.op_Implicit((Object)(object)m)) { return "none"; } return ((Object)m).name + " [" + ((Object)m.shader).name + "]"; } public static Material Mat(string slot) { //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_0339: 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_029a: 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) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) if (s_mats.TryGetValue(slot, out var value) && Object.op_Implicit((Object)(object)value)) { return value; } switch (slot) { case "VM_Wood": value = StdTex(s_wood, new Color(0.95f, 0.85f, 0.75f)); break; case "VM_WoodDark": value = StdTex(s_wood, new Color(0.5f, 0.38f, 0.3f)); break; case "VM_Stone": value = StdTex(s_stone, Color.white); break; case "VM_Canvas": value = Std(new Color(0.9f, 0.85f, 0.74f), 0f, 0.1f); break; case "VM_Leather": value = Std(new Color(0.38f, 0.22f, 0.13f), 0f, 0.3f); break; case "VM_Rope": value = Std(new Color(0.66f, 0.54f, 0.35f), 0f, 0.1f); break; case "VM_Raven": value = Std(new Color(0.07f, 0.07f, 0.09f), 0.2f, 0.55f); break; case "VM_Feather": value = Std(new Color(0.1f, 0.1f, 0.13f), 0.1f, 0.4f); break; case "VM_Beak": value = Std(new Color(0.5f, 0.42f, 0.22f), 0.3f, 0.4f); break; case "VM_Bronze": value = Std(new Color(0.72f, 0.5f, 0.24f), 0.85f, 0.55f); break; case "VM_Glass": value = Std(new Color(0.78f, 0.84f, 0.88f), 1f, 0.95f, new Color(0.02f, 0.05f, 0.06f)); break; case "VM_Rune": value = Std(new Color(0.1f, 0.6f, 0.58f), 0f, 0.5f, new Color(0.15f, 1.1f, 1f)); break; case "VM_Liquid": value = Std(new Color(0.1f, 0.45f, 0.5f), 0.2f, 0.92f, new Color(0.1f, 0.7f, 0.75f)); break; case "VM_Photo": value = Std(new Color(0.9f, 0.85f, 0.74f), 0f, 0.12f); break; default: return null; } s_mats[slot] = value; return value; Material Std(Color c, float metal, float smooth, Color? emit = null) { //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_0018: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(s_standard) { name = slot }; val.SetTexture("_MainTex", (Texture)(object)Noise()); val.SetTexture("_BumpMap", (Texture)null); val.SetTexture("_MetallicGlossMap", (Texture)null); val.SetColor("_Color", c); val.SetFloat("_Metallic", metal); val.SetFloat("_Glossiness", smooth); if (emit.HasValue) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", emit.Value); val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; } else { val.DisableKeyword("_EMISSION"); val.SetColor("_EmissionColor", Color.black); } return val; } Material StdTex(Material vanilla, Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Material val = Std(c, 0f, 0.12f); Texture val2 = ((Object.op_Implicit((Object)(object)vanilla) && vanilla.HasProperty("_MainTex")) ? vanilla.GetTexture("_MainTex") : null); if (Object.op_Implicit((Object)(object)val2)) { val.SetTexture("_MainTex", val2); } return val; } } public static void ApplyMaterials(GameObject root) { Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { Material[] sharedMaterials = val.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { if (Object.op_Implicit((Object)(object)sharedMaterials[j])) { string text = ((Object)sharedMaterials[j]).name; int num = text.IndexOf(' '); if (num > 0) { text = text.Substring(0, num); } Material val2 = Mat(text); if (Object.op_Implicit((Object)(object)val2)) { sharedMaterials[j] = val2; } } } val.sharedMaterials = sharedMaterials; } } public static Material NewPhotoMaterial() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown return new Material(Mat("VM_Photo")) { name = "VM_PhotoInstance" }; } public static void SetPhoto(Material m, Texture tex, float brightness = 1f) { //IL_008b: 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_0028: 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_0055: 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_0065: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)m)) { if (Object.op_Implicit((Object)(object)tex)) { m.mainTexture = tex; m.color = new Color(0.9f, 0.9f, 0.9f) * brightness; m.EnableKeyword("_EMISSION"); m.SetTexture("_EmissionMap", tex); m.SetColor("_EmissionColor", Color.white * 0.12f * brightness); } else { m.mainTexture = (Texture)(object)Texture2D.whiteTexture; m.color = new Color(0.86f, 0.81f, 0.7f); m.SetTexture("_EmissionMap", (Texture)null); m.SetColor("_EmissionColor", Color.black); m.DisableKeyword("_EMISSION"); } } } public static Mesh PhotoQuad() { //IL_0012: 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_0027: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_0099: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)s_quad)) { return s_quad; } s_quad = new Mesh { name = "vm_photo_quad" }; s_quad.vertices = (Vector3[])(object)new Vector3[4] { new Vector3(-0.5f, -0.5f, 0f), new Vector3(0.5f, -0.5f, 0f), new Vector3(0.5f, 0.5f, 0f), new Vector3(-0.5f, 0.5f, 0f) }; s_quad.uv = (Vector2[])(object)new Vector2[4] { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 1f) }; s_quad.normals = (Vector3[])(object)new Vector3[4] { Vector3.back, Vector3.back, Vector3.back, Vector3.back }; s_quad.triangles = new int[6] { 0, 3, 2, 0, 2, 1 }; s_quad.RecalculateBounds(); s_quad.RecalculateTangents(); return s_quad; } public static void FixPhotoSurface(Renderer r, float lift) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0050: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)r)) { MeshFilter component = ((Component)r).GetComponent<MeshFilter>(); if (Object.op_Implicit((Object)(object)component)) { component.sharedMesh = PhotoQuad(); } Transform transform = ((Component)r).transform; transform.localPosition += ((Component)r).transform.localRotation * new Vector3(0f, 0f, 0f - lift); r.shadowCastingMode = (ShadowCastingMode)0; r.receiveShadows = false; } } public static Sprite IconSprite(string name) { if (!s_icons.TryGetValue(name, out var value)) { return null; } return value; } private static GameObject Model(string n) { if (!Object.op_Implicit((Object)(object)s_bundle)) { return null; } return s_bundle.LoadAsset<GameObject>(n); } private static GameObject AddModel(Transform parent, string model, string childName) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown GameObject val = Model(model); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogError((object)("Model missing in bundle: " + model)); return new GameObject(childName); } GameObject val2 = Object.Instantiate<GameObject>(val, parent, false); ((Object)val2).name = childName; Collider[] componentsInChildren = val2.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } ApplyMaterials(val2); return val2; } private static Sprite Icon(GameObject src, Quaternion rot) { //IL_001c: 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_0040: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(src); val.transform.position = new Vector3(0f, -5000f, 0f); val.SetActive(true); ApplyMaterials(val); Sprite result = null; try { result = RenderManager.Instance.Render(new RenderRequest(val) { Rotation = rot, Width = 128, Height = 128 }); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Icon render failed: " + ex.Message)); } Object.Destroy((Object)(object)val); return result; } public static void Build() { //IL_008f: 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_00db: Unknown result type (might be due to invalid IL or missing references) FindBaseMaterials(); string[] array = new string[3] { "sfx_build_hammer_wood", "sfx_build_hammer_crystal", "sfx_pickable_pick" }; for (int i = 0; i < array.Length; i++) { GameObject prefab = Cache.GetPrefab<GameObject>(array[i]); AudioSource val = (Object.op_Implicit((Object)(object)prefab) ? prefab.GetComponentInChildren<AudioSource>(true) : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.outputAudioMixerGroup)) { s_sfx = val.outputAudioMixerGroup; break; } } BuildMirror(); BuildPhotoItem(); BuildCauldron(); BuildFrame(0, "frames", new Vector2(0.4f, 0.3f), "Wood", 4, "Resin", 1); BuildFrame(1, "framem", new Vector2(0.76f, 0.57f), "FineWood", 4, "Resin", 2); BuildFrame(2, "framel", new Vector2(1.4f, 1.05f), "FineWood", 8, "Resin", 3); Plugin.Log.LogInfo((object)"Mirror of Memories prefabs registered."); } private unsafe static Quaternion TorchGrip() { //IL_0044: 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_0054: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_00ae: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: 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_01f1: 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_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0271: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00ed: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = Cache.GetPrefab<GameObject>("Torch"); Transform val = (Object.op_Implicit((Object)(object)prefab) ? prefab.transform.Find("attach") : null); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)"Torch attach not found; mirror uses the config pose only."); return Quaternion.identity; } Vector3 val2 = Vector3.one * 1E+09f; Vector3 val3 = -Vector3.one * 1E+09f; MeshFilter[] componentsInChildren = ((Component)val).GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val4 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val4.sharedMesh)) { Bounds bounds = val4.sharedMesh.bounds; for (int j = 0; j < 8; j++) { Vector3 val5 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1)))); Vector3 val6 = val.InverseTransformPoint(((Component)val4).transform.TransformPoint(val5)); val2 = Vector3.Min(val2, val6); val3 = Vector3.Max(val3, val6); } } } Vector3 val7 = val3 - val2; int num = ((!(val7.x >= val7.y) || !(val7.x >= val7.z)) ? ((val7.y >= val7.z) ? 1 : 2) : 0); Vector3 val8 = Vector3.zero; ((Vector3)(ref val8))[num] = 1f; Light componentInChildren = ((Component)val).GetComponentInChildren<Light>(true); float num2; Vector3 val9; if (!Object.op_Implicit((Object)(object)componentInChildren)) { num2 = ((Mathf.Abs(((Vector3)(ref val3))[num]) > Mathf.Abs(((Vector3)(ref val2))[num])) ? ((Vector3)(ref val3))[num] : ((Vector3)(ref val2))[num]); } else { val9 = val.InverseTransformPoint(((Component)componentInChildren).transform.position); num2 = ((Vector3)(ref val9))[num]; } if (num2 < 0f) { val8 = -val8; } ManualLogSource log = Plugin.Log; string[] obj = new string[7] { "Torch in hand: bounds ", ((Vector3)(ref val2)).ToString("F2"), "..", ((Vector3)(ref val3)).ToString("F2"), ", grip axis ", null, null }; val9 = val8; obj[5] = ((object)(*(Vector3*)(&val9))/*cast due to .constrained prefix*/).ToString(); obj[6] = (Object.op_Implicit((Object)(object)componentInChildren) ? " (light found)" : ""); log.LogInfo((object)string.Concat(obj)); return Quaternion.FromToRotation(Vector3.up, val8); } private static GameObject CloneItemBase(CustomItem ci) { GameObject itemPrefab = ci.ItemPrefab; for (int num = itemPrefab.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)itemPrefab.transform.GetChild(num)).gameObject); } Collider[] components = itemPrefab.GetComponents<Collider>(); for (int i = 0; i < components.Length; i++) { Object.DestroyImmediate((Object)(object)components[i]); } return itemPrefab; } private static void BuildMirror() { //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_0010: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00a8: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_01cc: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) ItemConfig val = new ItemConfig { Name = "$vm_mirror", Description = "$vm_mirror_desc", CraftingStation = "forge", MinStationLevel = 1 }; val.AddRequirement(new RequirementConfig("Bronze", 2, 0, false)); val.AddRequirement(new RequirementConfig("FineWood", 3, 0, false)); val.AddRequirement(new RequirementConfig("GreydwarfEye", 2, 0, false)); CustomItem val2 = new CustomItem("VM_Mirror", "Raspberry", val); GameObject val3 = CloneItemBase(val2); AddModel(val3.transform, "mirror", "model").transform.localRotation = Quaternion.Euler(90f, 0f, 0f); BoxCollider obj = val3.AddComponent<BoxCollider>(); obj.size = new Vector3(0.2f, 0.06f, 0.38f); obj.center = new Vector3(0f, 0.03f, 0f); GameObject val4 = new GameObject("attach"); val4.transform.SetParent(val3.transform, false); AddModel(val4.transform, "mirror", "handmodel"); val4.AddComponent<HeldMirror>(); SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_name = "$vm_mirror"; shared.m_description = "$vm_mirror_desc"; shared.m_itemType = (ItemType)15; shared.m_animationState = (AnimationState)5; shared.m_maxStackSize = 1; shared.m_weight = 1f; shared.m_value = 0; shared.m_teleportable = true; shared.m_useDurability = false; shared.m_food = 0f; shared.m_foodStamina = 0f; shared.m_foodEitr = 0f; shared.m_consumeStatusEffect = null; shared.m_attack = new Attack { m_attackType = (AttackType)3 }; shared.m_secondaryAttack = new Attack { m_attackType = (AttackType)3 }; Sprite val5 = IconSprite("icon_mirror") ?? Icon(Model("mirror"), Quaternion.Euler(0f, 20f, -15f)); if (Object.op_Implicit((Object)(object)val5)) { shared.m_icons = (Sprite[])(object)new Sprite[1] { val5 }; } HandBase = TorchGrip(); ItemManager.Instance.AddItem(val2); } private static void BuildPhotoItem() { //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_0010: 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_0023: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0065: 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_0113: Unknown result type (might be due to invalid IL or missing references) ItemConfig val = new ItemConfig { Name = "$vm_photo", Description = "$vm_photo_desc", Enabled = false }; CustomItem val2 = new CustomItem("VM_Photo", "Raspberry", val); GameObject obj = CloneItemBase(val2); AddModel(obj.transform, "photoitem", "model"); obj.AddComponent<BoxCollider>().size = new Vector3(0.26f, 0.2f, 0.02f); obj.AddComponent<PhotoItemVisual>(); SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_name = "$vm_photo"; shared.m_description = "$vm_photo_desc"; shared.m_itemType = (ItemType)16; shared.m_maxStackSize = 1; shared.m_weight = 0.2f; shared.m_value = 0; shared.m_teleportable = true; shared.m_food = 0f; shared.m_foodStamina = 0f; shared.m_foodEitr = 0f; shared.m_consumeStatusEffect = null; Sprite val3 = IconSprite("icon_photo") ?? Icon(Model("photoitem"), Quaternion.Euler(0f, 180f, 0f)); if (Object.op_Implicit((Object)(object)val3)) { shared.m_icons = (Sprite[])(object)new Sprite[1] { val3 }; } ItemManager.Instance.AddItem(val2); } private static CustomPiece NewPiece(string name, PieceConfig cfg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown CustomPiece val = new CustomPiece(name, true, cfg); GameObject piecePrefab = val.PiecePrefab; Object.DestroyImmediate((Object)(object)piecePrefab.GetComponent<MeshRenderer>()); Object.DestroyImmediate((Object)(object)piecePrefab.GetComponent<MeshFilter>()); Object.DestroyImmediate((Object)(object)piecePrefab.GetComponent<BoxCollider>()); piecePrefab.layer = LayerMask.NameToLayer("piece"); return val; } private static void BoxCol(GameObject go, Vector3 c, Vector3 s) { //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_0016: 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_0034: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("col") { layer = go.layer }; val.transform.SetParent(go.transform, false); BoxCollider obj = val.AddComponent<BoxCollider>(); obj.center = c; obj.size = s; } private static void BuildCauldron() { //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_0010: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00c2: 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_00f0: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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) PieceConfig val = new PieceConfig { Name = "$vm_cauldron", Description = "$vm_cauldron_desc", PieceTable = "Hammer", Category = PieceCategories.Crafting, CraftingStation = "piece_workbench" }; val.AddRequirement(new RequirementConfig("Stone", 10, 0, true)); val.AddRequirement(new RequirementConfig("Wood", 8, 0, true)); val.AddRequirement(new RequirementConfig("Bronze", 2, 0, true)); val.AddRequirement(new RequirementConfig("GreydwarfEye", 4, 0, true)); CustomPiece val2 = NewPiece("VM_Cauldron", val); GameObject piecePrefab = val2.PiecePrefab; AddModel(piecePrefab.transform, "cauldron", "model"); BoxCol(piecePrefab, new Vector3(0f, 0.35f, 0f), new Vector3(0.95f, 0.7f, 0.95f)); BoxCol(piecePrefab, new Vector3(0f, 0.95f, 0.6f), new Vector3(0.85f, 1.9f, 0.25f)); Setup3D(piecePrefab.AddComponent<AudioSource>(), 14f); piecePrefab.AddComponent<VisionCauldron>(); val2.Piece.m_icon = IconSprite("icon_cauldron") ?? Icon(Model("cauldron"), Quaternion.Euler(15f, 0f, 0f) * Quaternion.Euler(0f, 200f, 0f)); PieceManager.Instance.AddPiece(val2); } private static void BuildFrame(int size, string model, Vector2 inner, string mat1, int n1, string mat2, int n2) { //IL_001f: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00d8: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_0195: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[3] { "$vm_frame_s", "$vm_frame_m", "$vm_frame_l" }; PieceConfig val = new PieceConfig { Name = array[size], Description = "$vm_frame_desc", PieceTable = "Hammer", Category = PieceCategories.Furniture, CraftingStation = "piece_workbench" }; val.AddRequirement(new RequirementConfig(mat1, n1, 0, true)); val.AddRequirement(new RequirementConfig(mat2, n2, 0, true)); CustomPiece val2 = NewPiece(Frames[size], val); GameObject piecePrefab = val2.PiecePrefab; AddModel(piecePrefab.transform, model, "model"); float num = size switch { 1 => 0.08f, 0 => 0.06f, _ => 0.11f, }; float num2 = size switch { 1 => 0.055f, 0 => 0.045f, _ => 0.07f, }; Vector2 val3 = inner + Vector2.one * 2f * num; BoxCol(piecePrefab, new Vector3(0f, 0f, (0f - num2) / 2f), new Vector3(val3.x, val3.y, num2)); val2.Piece.m_notOnFloor = true; val2.Piece.m_groundPiece = false; PictureFrame pictureFrame = piecePrefab.AddComponent<PictureFrame>(); pictureFrame.Inner = inner; pictureFrame.Outer = val3; val2.Piece.m_icon = IconSprite("icon_frame_" + "sml"[size]) ?? Icon(Model(model), Quaternion.Euler(0f, 180f, 0f)); PieceManager.Instance.AddPiece(val2); } } public class DevelopUI : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__19_0; public static UnityAction <>9__19_1; public static UnityAction <>9__19_2; internal void <Build>b__19_0() { s_ui.DoDevelop(); } internal void <Build>b__19_1() { s_ui.Close(); } internal void <Build>b__19_2() { s_ui.DoErase(); } } private static DevelopUI s_ui; private const float W = 860f; private const float H = 600f; private const float CellW = 240f; private const float CellH = 180f; private VisionCauldron m_cauldron; private readonly List<GameObject> m_cells = new List<GameObject>(); private Text m_cost; private Text m_empty; private Button m_develop; private Button m_erase; private string m_selected; private bool m_justOpened; private float m_confirmUntil; private Text m_eraseText; public static bool IsOpen { get { if (Object.op_Implicit((Object)(object)s_ui)) { return ((Component)s_ui).gameObject.activeSelf; } return false; } } public static void Open(VisionCauldron c) { //IL_0060: 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) if (!((Object)(object)GUIManager.CustomGUIFront == (Object)null)) { if (!Object.op_Implicit((Object)(object)s_ui)) { Build(); } s_ui.m_cauldron = c; s_ui.m_selected = null; ((Component)s_ui).gameObject.SetActive(true); GUIManager.BlockInput(true); s_ui.Refresh(); Assets.PlayAt("vm_bookFlip2", ((Component)c).transform.position, 0.5f); Assets.PlayAt("vm_magic_5", ((Component)c).transform.position, 0.4f); } } private void Close() { ((Component)this).gameObject.SetActive(false); GUIManager.BlockInput(false); } private void Update() { //IL_0021: 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) Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer) || !Object.op_Implicit((Object)(object)m_cauldron) || Vector3.Distance(((Component)localPlayer).transform.position, ((Component)m_cauldron).transform.position) > 5f || ZInput.GetKeyDown((KeyCode)27, true) || (ZInput.GetButtonDown("Use") && Time.frameCount > 0 && !m_justOpened)) { Close(); } m_justOpened = false; if (m_confirmUntil > 0f && Time.unscaledTime > m_confirmUntil) { m_confirmUntil = 0f; if (Object.op_Implicit((Object)(object)m_eraseText)) { m_eraseText.text = Localization.instance.Localize("$vm_erase"); } } } private void OnEnable() { m_justOpened = true; } private static void Build() { //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_002f: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00fe: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown //IL_0273: Unknown result type (might be due to invalid IL or missing references) GUIManager instance = GUIManager.Instance; GameObject val = instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 860f, 600f, false); s_ui = val.AddComponent<DevelopUI>(); Label(val.transform, "$vm_cauldron", new Vector2(0f, -22f), 34, instance.NorseBold, new Color(1f, 0.82f, 0.45f)); Label(val.transform, "$vm_choose", new Vector2(0f, -66f), 18, instance.AveriaSerifBold, new Color(0.9f, 0.85f, 0.75f)); s_ui.m_empty = Label(val.transform, "$vm_mirror_empty", new Vector2(0f, -280f), 20, instance.AveriaSerifBold, new Color(0.8f, 0.75f, 0.65f)); s_ui.m_cost = Label(val.transform, "", new Vector2(0f, -492f), 18, instance.AveriaSerifBold, Color.white); DevelopUI developUI = s_ui; Transform transform = val.transform; Vector2 pos = new Vector2(40f, -548f); object obj = <>c.<>9__19_0; if (obj == null) { UnityAction val2 = delegate { s_ui.DoDevelop(); }; <>c.<>9__19_0 = val2; obj = (object)val2; } developUI.m_develop = MakeButton(transform, "$vm_develop", pos, (UnityAction)obj, 230f, 50f); Transform transform2 = val.transform; Vector2 pos2 = new Vector2(310f, -548f); object obj2 = <>c.<>9__19_1; if (obj2 == null) { UnityAction val3 = delegate { s_ui.Close(); }; <>c.<>9__19_1 = val3; obj2 = (object)val3; } MakeButton(transform2, "$vm_close", pos2, (UnityAction)obj2, 160f, 46f); DevelopUI developUI2 = s_ui; Transform transform3 = val.transform; Vector2 pos3 = new Vector2(-325f, -554f); object obj3 = <>c.<>9__19_2; if (obj3 == null) { UnityAction val4 = delegate { s_ui.DoErase(); }; <>c.<>9__19_2 = val4; obj3 = (object)val4; } developUI2.m_erase = MakeButton(transform3, "$vm_erase", pos3, (UnityAction)obj3, 150f, 36f); s_ui.m_eraseText = ((Component)s_ui.m_erase).GetComponentInChildren<Text>(); if (Object.op_Implicit((Object)(object)s_ui.m_eraseText)) { ((Graphic)s_ui.m_eraseText).color = new Color(1f, 0.6f, 0.55f); s_ui.m_eraseText.fontSize = 15; } val.SetActive(false); } private static Text Label(Transform parent, string text, Vector2 pos, int size, Font font, Color color) { //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_002f: 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_0036: Unknown result type (might be due to invalid IL or missing references) Text component = GUIManager.Instance.CreateText(Localization.instance.Localize(text), parent, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), pos, font, size, color, true, Color.black, 800f, (float)size * 1.8f, false).GetComponent<Text>(); component.alignment = (TextAnchor)4; return component; } private static Button MakeButton(Transform parent, string text, Vector2 pos, UnityAction a, float w, float h) { //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_002f: Unknown result type (might be due to invalid IL or missing references) Button component = GUIManager.Instance.CreateButton(Localization.instance.Localize(text), parent, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), pos, w, h).GetComponent<Button>(); ((UnityEvent)component.onClick).AddListener(a); return component; } private void Refresh() { //IL_00df: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject cell in m_cells) { Object.Destroy((Object)(object)cell); } m_cells.Clear(); Player localPlayer = Player.m_localPlayer; List<Shot> list = Mirror.Shots(Mirror.Any(localPlayer)); if (m_selected == null && list.Count > 0) { m_selected = list[list.Count - 1].Id; } ((Component)m_empty).gameObject.SetActive(list.Count == 0); Vector2 pos = default(Vector2); for (int i = 0; i < list.Count; i++) { Shot sh = list[i]; int num = i % 3; int num2 = i / 3; ((Vector2)(ref pos))..ctor((float)(num - 1) * 262f, -118f - (float)num2 * 202f - 90f); m_cells.Add(Cell(sh, pos, sh.Id == m_selected)); } bool flag = Object.op_Implicit((Object)(object)localPlayer) && Have(localPlayer) && list.Count > 0; int num3 = (Object.op_Implicit((Object)(object)localPlayer) ? VisionCauldron.Have(localPlayer, "LeatherScraps") : 0); int num4 = (Object.op_Implicit((Object)(object)localPlayer) ? VisionCauldron.Have(localPlayer, "Resin") : 0); m_cost.text = Localization.instance.Localize("$vm_cost: " + Col(num3 >= 1) + "1 $item_leatherscraps (" + num3 + ")</color>, " + Col(num4 >= 1) + "1 $item_resin (" + num4 + ")</color>"); ((Selectable)m_develop).interactable = flag && m_selected != null; ((Selectable)m_erase).interactable = m_selected != null; } private static bool Have(Player p) { if (VisionCauldron.Have(p, "LeatherScraps") >= 1) { return VisionCauldron.Have(p, "Resin") >= 1; } return false; } private static string Col(bool ok) { if (!ok) { return "<color=#FF8A80>"; } return "<color=#C8F0B0>"; } private GameObject Cell(Shot sh, Vector2 pos, bool selected) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0057: 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_0066: 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_00bb: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_010c: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_01a0: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("cell", new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent(((Component)this).transform, false); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 1f); val2.anchorMax = val3; val2.anchorMin = val3; val2.anchoredPosition = pos; val2.sizeDelta = new Vector2(248f, 188f); Image val4 = val.AddComponent<Image>(); ((Graphic)val4).color = (selected ? new Color(0.35f, 0.95f, 0.88f, 0.95f) : new Color(0.1f, 0.07f, 0.05f, 0.85f)); Button obj = val.AddComponent<Button>(); ((Selectable)obj).targetGraphic = (Graphic)(object)val4; string id = sh.Id; ((UnityEvent)obj.onClick).AddListener((UnityAction)delegate { //IL_0026: Unknown result type (might be due to invalid IL or missing references) m_selected = id; Assets.PlayAt("vm_bookFlip1", ((Component)m_cauldron).transform.position, 0.35f); Refresh(); }); RawImage obj2 = new GameObject("pic", new Type[1] { typeof(RectTransform) }).AddComponent<RawImage>(); RectTransform rectTransform = ((Graphic)obj2).rectTransform; ((Transform)rectTransform).SetParent((Transform)(object)val2, false); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); rectTransform.anchorMax = val3; rectTransform.anchorMin = val3; rectTransform.sizeDelta = (sh.Tall ? new Vector2(135f, 180f) : new Vector2(240f, 180f)); Texture2D val5 = (Texture2D)(object)(obj2.texture = (Texture)(object)PhotoStore.Get(sh.Id)); ((Graphic)obj2).color = (Color)(Object.op_Implicit((Object)(object)val5) ? Color.white : new Color(0.3f, 0.3f, 0.32f)); ((Graphic)obj2).raycastTarget = false; return val; } private void DoDevelop() { Player localPlayer = Player.m_localPlayer; ItemData val = Mirror.Any(localPlayer); if (!Object.op_Implicit((Object)(object)localPlayer) || val == null || m_selected == null) { return; } Shot shot = Mirror.Shots(val).Find((Shot s) => s.Id == m_selected); if (shot.Id != null) { if (m_cauldron.Develop(localPlayer, val, shot)) { Close(); } else { Refresh(); } } } private void DoErase() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) ItemData val = Mirror.Any(Player.m_localPlayer); if (val == null || m_selected == null) { return; } if (Time.unscaledTime > m_confirmUntil) { m_confirmUntil = Time.unscaledTime + 3f; if (Object.op_Implicit((Object)(object)m_eraseText)) { m_eraseText.text = Localization.instance.Localize("$vm_erase_sure"); } return; } m_confirmUntil = 0f; if (Object.op_Implicit((Object)(object)m_eraseText)) { m_eraseText.text = Localization.instance.Localize("$vm_erase"); } Mirror.Remove(val, m_selected); m_selected = null; Assets.PlayAt("vm_shatter_LedasLuzta4", ((Component)m_cauldron).transform.position, 0.5f); Refresh(); } } internal static class FramePlacement { [HarmonyPatch(typeof(Player), "UpdatePlacementGhost")] private static class AlignToWall { private static void Postfix(Player __instance) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0170: 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) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) GameObject val = Ghost.Invoke(__instance); if (!Object.op_Implicit((Object)(object)val) || !val.activeSelf) { return; } PictureFrame component = val.GetComponent<PictureFrame>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)GameCamera.instance)) { return; } if (s_mask == 0) { s_mask = LayerMask.GetMask(new string[6] { "Default", "static_solid", "Default_small", "piece", "terrain", "vehicle" }); } Transform transform = ((Component)GameCamera.instance).transform; if (!Nearest(transform.position, transform.forward, 50f, val.transform, out var best)) { return; } Vector3 normal = ((RaycastHit)(ref best)).normal; if (Mathf.Abs(normal.y) > 0.35f) { return; } normal.y = 0f; ((Vector3)(ref normal)).Normalize(); Quaternion val2 = Quaternion.LookRotation(-normal, Vector3.up); float num = Mathf.Max(component.Outer.x, component.Outer.y) * 0.5f * 0.92f; Vector3 val3 = val2 * Vector3.right; float num2 = 0f; for (int i = -2; i <= 2; i++) { for (int j = -2; j <= 2; j++) { if (Nearest(((RaycastHit)(ref best)).point + val3 * ((float)i / 2f * num) + Vector3.up * ((float)j / 2f * num) + normal * 0.3f, -normal, 0.6f, val.transform, out var best2)) { num2 = Mathf.Max(num2, 0.3f - ((RaycastHit)(ref best2)).distance); } } } val.transform.SetPositionAndRotation(((RaycastHit)(ref best)).point + normal * (num2 + 0.003f), val2); } } [HarmonyPatch(typeof(Piece), "DropResources")] private static class DropPicture { private static void Postfix(Piece __instance) { PictureFrame pictureFrame = (Object.op_Implicit((Object)(object)__instance) ? ((Component)__instance).GetComponent<PictureFrame>() : null); if (Object.op_Implicit((Object)(object)pictureFrame)) { pictureFrame.DropPicture(); } } } private static readonly FieldRef<Player, GameObject> Ghost = AccessTools.FieldRefAccess<Player, GameObject>("m_placementGhost"); private static int s_mask; private static bool Nearest(Vector3 from, Vector3 dir, float dist, Transform ignore, out RaycastHit best) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) best = default(RaycastHit); float num = float.MaxValue; RaycastHit[] array = Physics.RaycastAll(from, dir, dist, s_mask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; if (!((Component)((RaycastHit)(ref val)).collider).transform.IsChildOf(ignore) && !(((RaycastHit)(ref val)).distance >= num) && (!Object.op_Implicit((Object)(object)Player.m_localPlayer) || !((Component)((RaycastHit)(ref val)).collider).transform.IsChildOf(((Component)Player.m_localPlayer).transform))) { best = val; num = ((RaycastHit)(ref val)).distance; } } return num < float.MaxValue; } } public static class GlassArt { private static Texture2D s_rune; private static Texture2D s_glint; public static Texture2D Mist(int sw, int sh, Rect win) { //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected O, but got Unknown //IL_01bf: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: 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) int num = Mathf.Max(8, sw / 4); int num2 = Mathf.Max(8, sh / 4); Color32[] array = (Color32[])(object)new Color32[num * num2]; float num3 = Mathf.Max(new float[4] { ((Rect)(ref win)).xMin, (float)sw - ((Rect)(ref win)).xMax, ((Rect)(ref win)).yMin, (float)sh - ((Rect)(ref win)).yMax }) + 1f; Color val = default(Color); for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { float num4 = ((float)j + 0.5f) * 4f; float num5 = ((float)i + 0.5f) * 4f; float num6 = Mathf.Max(new float[3] { ((Rect)(ref win)).xMin - num4, 0f, num4 - ((Rect)(ref win)).xMax }); float num7 = Mathf.Max(new float[3] { ((Rect)(ref win)).yMin - num5, 0f, num5 - ((Rect)(ref win)).yMax }); float num8 = Mathf.Sqrt(num6 * num6 + num7 * num7); if (num8 <= 0f) { float num9 = Mathf.Min(Mathf.Min(num4 - ((Rect)(ref win)).xMin, ((Rect)(ref win)).xMax - num4), Mathf.Min(num5 - ((Rect)(ref win)).yMin, ((Rect)(ref win)).yMax - num5)); float num10 = Mathf.Clamp01(1f - num9 / 14f) * 0.22f; ((Color)(ref val))..ctor(0.75f, 1f, 0.97f, num10); } else { float num11 = Mathf.SmoothStep(0f, 1f, num8 / num3); ((Color)(ref val))..ctor(0.02f, 0.04f, 0.05f, 0.32f + 0.18f * num11); if (num8 < 10f) { val = Color.Lerp(new Color(0.05f, 0.09f, 0.1f, 0.7f), val, num8 / 10f); } if (num8 < 3.5f) { val = Color.Lerp(new Color(0.7f, 1f, 0.96f, 0.95f), val, num8 / 3.5f); } } array[i * num + j] = Color32.op_Implicit(val); } } Texture2D val2 = new Texture2D(num, num2, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1, name = "vm_mist" }; val2.SetPixels32(array); val2.Apply(); return val2; } public static Texture2D Rune() { //IL_0031: 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_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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_008d: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_01a6: 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_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)s_rune)) { return s_rune; } Color32[] array = (Color32[])(object)new Color32[4096]; Vector2[,] array2 = new Vector2[4, 2] { { new Vector2(32f, 8f), new Vector2(32f, 56f) }, { new Vector2(32f, 34f), new Vector2(15f, 52f) }, { new Vector2(32f, 34f), new Vector2(49f, 52f) }, { new Vector2(24f, 12f), new Vector2(40f, 12f) } }; Vector2 p = default(Vector2); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { ((Vector2)(ref p))..ctor((float)j + 0.5f, (float)i + 0.5f); float num = 99f; for (int k = 0; k < array2.GetLength(0); k++) { num = Mathf.Min(num, SegDist(p, array2[k, 0], array2[k, 1])); } float num2 = Mathf.Clamp01(2.2f - num); float num3 = Mathf.Clamp01(1f - num / 9f) * 0.45f; float num4 = Mathf.Max(num2, num3); Color val = Color.Lerp(new Color(0.3f, 0.95f, 0.9f), Color.white, num2); array[i * 64 + j] = Color32.op_Implicit(new Color(val.r, val.g, val.b, num4)); } } s_rune = new Texture2D(64, 64, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, name = "vm_rune" }; s_rune.SetPixels32(array); s_rune.Apply(); return s_rune; } public static Texture2D Glint() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //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_009b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)s_glint)) { return s_glint; } Color32[] array = (Color32[])(object)new Color32[1024]; for (int i = 0; i < 128; i++) { float num = (float)i / 127f * 2f - 1f; float num2 = Mathf.Exp((0f - num) * num * 6f) * 0.32f + Mathf.Exp((0f - (num - 0.45f)) * (num - 0.45f) * 90f) * 0.18f; for (int j = 0; j < 8; j++) { array[j * 128 + i] = Color32.op_Implicit(new Color(1f, 1f, 1f, num2)); } } s_glint = new Texture2D(128, 8, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, name = "vm_glint" }; s_glint.SetPixels32(array); s_glint.Apply(); return s_glint; } private static float SegDist(Vector2 p, Vector2 a, Vector2 b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) Vector2 val = b - a; float num = Mathf.Clamp01(Vector2.Dot(p - a, val) / ((Vector2)(ref val)).sqrMagnitude); return Vector2.Distance(p, a + val * num); } private static float Hash(int x, int y) { int num = x * 374761393 + y * 668265263; int num2 = (num ^ (num >> 13)) * 1274126177; return (float)((num2 ^ (num2 >> 16)) & 0xFFFF) / 65535f; } private static float Noise(float x, float y) { int num = Mathf.FloorToInt(x); int num2 = Mathf.FloorToInt(y); float num3 = x - (float)num; float num4 = y - (float)num2; num3 = num3 * num3 * (3f - 2f * num3); num4 = num4 * num4 * (3f - 2f * num4); float num5 = Hash(num, num2); float num6 = Hash(num + 1, num2); float num7 = Hash(num, num2 + 1); float num8 = Hash(num + 1, num2 + 1); return Mathf.Lerp(Mathf.Lerp(num5, num6, num3), Mathf.Lerp(num7, num8, num3), num4); } } public class HeldMirror : MonoBehaviour { private Transform m_model; private Renderer m_glass; private Material m_glassMat; private Material m_photoMat; private Vector2 m_glassAspect = new Vector2(1f, 1f); private string m_shown; private float m_tick; private bool m_local; private void Start() { //IL_0033: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) m_model = ((Component)this).transform.Find("handmodel"); if (Object.op_Implicit((Object)(object)m_model)) { m_model.localPosition = Plugin.ParseVec(Plugin.HandOffset.Value); m_model.localRotation = Assets.HandBase * Quaternion.Euler(Plugin.ParseVec(Plugin.HandRotation.Value)); } Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (((Object)val).name == "Glass") { m_glass = val; } } Player componentInParent = ((Component)this).GetComponentInParent<Player>(); m_local = Object.op_Implicit((Object)(object)componentInParent) && (Object)(object)componentInParent == (Object)(object)Player.m_localPlayer; if (Object.op_Implicit((Object)(object)m_glass)) { m_glassMat = m_glass.sharedMaterial; PlanarUVs(); PhotoStore.Loaded += OnLoaded; } } private void OnDestroy() { PhotoStore.Loaded -= OnLoaded; } private void OnLoaded(string id) { if (id == m_shown) { m_shown = null; } } private void PlanarUVs() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_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_0092: 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_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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) MeshFilter component = ((Component)m_glass).GetComponent<MeshFilter>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.sharedMesh) && component.sharedMesh.isReadable) { Mesh val = Object.Instantiate<Mesh>(component.sharedMesh); Vector3[] vertices = val.vertices; Bounds bounds = val.bounds; Vector2[] array = (Vector2[])(object)new Vector2[vertices.Length]; for (int i = 0; i < vertices.Length; i++) { array[i] = new Vector2((((Bounds)(ref bounds)).max.x - vertices[i].x) / ((Bounds)(ref bounds)).size.x, (vertices[i].y - ((Bounds)(ref bounds)).min.y) / ((Bounds)(ref bounds)).size.y); } val.uv = array; component.sharedMesh = val; m_glassAspect = new Vector2(((Bounds)(ref bounds)).size.x, ((Bounds)(ref bounds)).size.y); } } private void Update() { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)m_glass)) { return; } m_tick -= Time.deltaTime; if (m_tick <= 0f) { m_tick = 0.5f; string text = null; bool tall = false; if (m_local) { List<Shot> list = Mirror.Shots(Mirror.Equipped(Player.m_localPlayer)); if (list.Count > 0) { text = list[list.Count - 1].Id; tall = list[list.Count - 1].Tall; } } if (text != m_shown) { ShowShot(text, tall); } } if (Object.op_Implicit((Object)(object)m_photoMat) && (Object)(object)m_glass.sharedMaterial == (Object)(object)m_photoMat) { float num = 0.35f + 0.08f * Mathf.Sin(Time.time * 2.4f); m_photoMat.SetColor("_EmissionColor", new Color(num, num, num)); } } private void ShowShot(string id, bool tall) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_00f3: 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) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) m_shown = id; Texture2D val = ((id == null) ? null : PhotoStore.Get(id)); if (!Object.op_Implicit((Object)(object)val)) { m_glass.sharedMaterial = m_glassMat; if (id != null) { m_shown = null; } return; } if (!Object.op_Implicit((Object)(object)m_photoMat)) { m_photoMat = new Material(Assets.Mat("VM_Glass")) { name = "VM_GlassPhoto" }; m_photoMat.SetFloat("_Metallic", 0.2f); m_photoMat.SetFloat("_Glossiness", 0.9f); m_photoMat.EnableKeyword("_EMISSION"); } Assets.SetPhoto(m_photoMat, (Texture)(object)val); float num = m_glassAspect.x / m_glassAspect.y; float num2 = (float)((Texture)val).width / (float)((Texture)val).height; Vector2 val2 = ((num2 > num) ? new Vector2(num / num2, 1f) : new Vector2(1f, num2 / num)); m_photoMat.mainTextureScale = val2; m_photoMat.mainTextureOffset = (Vector2.one - val2) / 2f; m_glass.sharedMaterial = m_photoMat; } } public struct Shot { public string Id; public bool Tall; } public static class Mirror { [HarmonyPatch(typeof(Humanoid), "StartAttack")] private static class NoAttack { private static bool Prefix(Humanoid __instance, ref bool __result) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val == null || Equipped(val) == null) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(Player), "SetControls")] private static class NoBlock { private static void Prefix(Player __instance, ref bool block, ref bool blockHold) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer && Equipped(__instance) != null) { block = false; blockHold = false; } } } [HarmonyPatch(typeof(ItemData), "GetTooltip", new Type[] { typeof(ItemData), typeof(int), typeof(bool), typeof(float), typeof(int), typeof(bool) })] private static class Tooltip { private static void Postfix(ItemData item, ref string __result) { if (IsMirror(item)) { __result += Localization.instance.Localize("\n\n$vm_mirror_count " + Shots(item).Count + "/" + 6 + "\n<color=#9FE8E0>$vm_mirror_controls</color>"); } } } public const int Capacity = 6; private const string KShots = "vm_shots"; public static bool IsMirror(ItemData it) { if (it != null && Object.op_Implicit((Object)(object)it.m_dropPrefab)) { return ((Object)it.m_dropPrefab).name == "VM_Mirror"; } return false; } public static ItemData Equipped(Player p) { if (!Object.op_Implicit((Object)(object)p)) { return null; } foreach (ItemData allItem in ((Humanoid)p).GetInventory().GetAllItems()) { if (allItem.m_equipped && IsMirror(allItem)) { return allItem; } } return null; } public static ItemData Any(Player p) { ItemData val = Equipped(p); if (val != null || !Object.op_Implicit((Object)(object)p)) { return val; } foreach (ItemData allItem in ((Humanoid)p).GetInventory().GetAllItems()) { if (IsMirror(allItem)) { return allItem; } } return null; } public static List<Shot> Shots(ItemData mirror) { List<Shot> list = new List<Shot>(); if (mirror == null || !mirror.m_customData.TryGetValue("vm_shots", out var value) || string.IsNullOrEmpty(value)) { return list; } string[] array = value.Split(';'); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(':'); if (array2.Length == 2 && array2[0].Length == 16) { list.Add(new Shot { Id = array2[0], Tall = (array2[1] == "P") }); } } return list; } public static void SetShots(ItemData mirror, List<Shot> shots) { List<string> list = new List<string>(); foreach (Shot shot in shots) { list.Add(shot.Id + ":" + (shot.Tall ? "P" : "L")); } mirror.m_customData["vm_shots"] = string.Join(";", list); } public static void Add(ItemData mirror, Shot shot) { List<Shot> list = Shots(mirror); list.Add(shot); SetShots(mirror, list); } public static void Remove(ItemData mirror, string id) { List<Shot> list = Shots(mirror); list.RemoveAll((Shot s) => s.Id == id); SetShots(mirror, list); } } public class MirrorView : MonoBehaviour { [HarmonyPatch(typeof(GameCamera), "LateUpdate")] private static class CameraPatch { private static void Postfix(GameCamera __instance) { //IL_001d: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_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_0071: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_009d: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: 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) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0150: 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_0190: Unknown result type (might be due to invalid IL or missing references) if (!Active) { return; } Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { return; } Vector3 position = ((Character)localPlayer).m_eye.position; Vector3 lookDir = ((Character)localPlayer).GetLookDir(); Vector3 val; Quaternion val2; if (!Selfie) { val = position + lookDir * 0.12f; val2 = Quaternion.LookRotation(lookDir); } else { Vector3 val3 = new Vector3(lookDir.x, 0f, lookDir.z); Vector3 normalized = ((Vector3)(ref val3)).normalized; Vector3 val4 = position + normalized * 1.25f + Vector3.up * Mathf.Clamp(lookDir.y, -0.7f, 0.7f) * 0.8f + ((Component)localPlayer).transform.right * 0.12f; Vector3 val5 = val4 - position; RaycastHit val6 = default(RaycastHit); if (Physics.SphereCast(position, 0.12f, ((Vector3)(ref val5)).normalized, ref val6, ((Vector3)(ref val5)).magnitude, LayerMask.GetMask(new string[5] { "Default", "static_solid", "Default_small", "piece", "terrain" }))) { val4 = position + ((Vector3)(ref val5)).normalized * Mathf.Max(0.45f, ((RaycastHit)(ref val6)).distance - 0.05f); } val = val4; val2 = Quaternion.LookRotation(position - Vector3.up * 0.06f - val); ((Component)localPlayer).transform.rotation = Quaternion.LookRotation(normalized); } ((Component)__instance).transform.SetPositionAndRotation(val, val2); Camera component = ((Component)__instance).GetComponent<Camera>(); if (Object.op_Implicit((Object)(object)component)) { component.fieldOfView = Fov; component.nearClipPlane = 0.05f; } if (Object.op_Implicit((Object)(object)__instance.m_skyCamera)) { __instance.m_skyCamera.fieldOfView = Fov; } } } private const int ShotW = 800; private const int ShotH = 600; private bool m_tall; private bool m_busy; private float m_fovTarget = 55f; private float m_enterT; private float m_cooldown; private bool m_hudWasHidden; private float m_camDistance = -1f; private readonly List<Renderer> m_hidden = new List<Renderer>(); private ZRoutedRpc m_rpcFor; private Canvas m_canvas; private RectTransform m_root; private RectTransform m_window; private Image m_frost; private Image m_flash; private Image m_glint; private readonly Image[] m_runes = (Image[])(object)new Image[4]; private RawImage m_mist; private RawImage m_freeze; private Texture2D m_mistTex; private string m_mistKey; private float m_nextGlint; private float m_glintT = -1f; private Text m_hint; private Text m_count; private Text m_zoom; private Text m_mode; private AudioSource m_audio; private static readonly FieldRef<GameCamera, float> CamDistance = AccessTools.FieldRefAccess<GameCamera, float>("m_distance"); public static bool Active { get; private set; } public static bool Selfie { get; private set; } public static float Fov { get; private set; } = 55f; private void Update() { //IL_011b: Unknown result type (might be due to invalid IL or missing references) RegisterRpc(); Player localPlayer = Player.m_localPlayer; ItemData val = Mirror.Equipped(localPlayer); m_cooldown -= Time.deltaTime; if (!Active) { if (val != null && ZInput.GetButtonDown("Block") && CanUse(localPlayer)) { Enter(); } return; } if (val == null || !Object.op_Implicit((Object)(object)localPlayer) || ((Character)localPlayer).IsDead() || !CanUse(localPlayer)) { Exit(); return; } if (m_busy) { Layout(); return; } if (ZInput.GetButtonDown("Block")) { Exit(); return; } float mouseScrollWheel = ZInput.GetMouseScrollWheel(); if (mouseScrollWheel > 0f) { m_fovTarget *= 0.86f; } else if (mouseScrollWheel < 0f) { m_fovTarget /= 0.86f; } m_fovTarget = (Selfie ? Mathf.Clamp(m_fovTarget, 32f, 75f) : Mathf.Clamp(m_fovTarget, 10f, 72f)); if (ZInput.GetButtonDown("SecondaryAttack")) { ToggleSelfie(localPlayer); } if (ZInput.GetKeyDown(Plugin.TurnKey.Value, true)) { m_tall = !m_tall; m_enterT = 0.1f; Play("vm_creak2", 0.5f); } if (ZInput.GetButtonDown("Attack") && m_cooldown <= 0f) { if (Mirror.Shots(val).Count >= 6) { ((Character)localPlayer).Message((MessageType)2, "$vm_mirror_full", 0, (Sprite)null, false); Play("vm_shatter_LedasLuzta2", 0.5f); } else { ((MonoBehaviour)this).StartCoroutine(Capture(localPlayer, val)); } } Fov = Mathf.Lerp(Fov, m_fovTarget, Time.deltaTime * 8f); Layout(); } private static bool CanUse(Player p) { if (Object.op_Implicit((Object)(object)p) && !InventoryGui.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen() && !TextInput.IsVisible() && !Console.IsVisible() && !StoreGui.IsVisible() && !Hud.IsPieceSelectionVisible() && !DevelopUI.IsOpen) { if (!((Object)(object)Chat.instance == (Object)null)) { return !Chat.instance.HasFocus(); } return true; } return false; } private void Enter() { //IL_0069: 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) BuildUI(); Active = true; Selfie = false; m_tall = false; Fov = (m_fovTarget = 55f); m_enterT = 0f; m_busy = false; ((Component)m_freeze).gameObject.SetActive(false); ((Graphic)m_frost).color = new Color(1f, 1f, 1f, 0f); ((Graphic)m_flash).color = new Color(1f, 1f, 1f, 0f); ((Behaviour)m_canvas).enabled = true; if (Object.op_Implicit((Object)(object)Hud.instance)) { m_hudWasHidden = Hud.instance.m_userHidden; Hud.instance.m_userHidden = true; } if (Object.op_Implicit((Object)(object)GameCamera.instance)) { m_camDistance = CamDistance.Invoke(GameCamera.instance); } HideSelf(hide: true); Play("vm_magic_6", 0.7f); Play("vm_cloth1", 0.5f); } private void Exit() { if (Active) { Active = false; Selfie = false; ((MonoBehaviour)this).StopAllCoroutines(); m_busy = false; if (Object.op_Implicit((Object)(object)m_canvas)) { ((Behaviour)m_canvas).enabled = false; } if (Object.op_Implicit((Object)(object)Hud.instance)) { Hud.instance.m_userHidden = m_hudWasHidden; } if (Object.op_Implicit((Object)(object)GameCamera.instance) && m_camDistance > 0f) { CamDistance.Invoke(GameCamera.instance) = m_camDistance; } HideSelf(hide: false); Play("vm_cloth2", 0.5f); } } private void ToggleSelfie(Player p) { Selfie = !Selfie; m_fovTarget = (Selfie ? 50f : 55f); HideSelf(!Selfie); Play("vm_magic_3", 0.45f); } private void HideSelf(bool hide) { foreach (Renderer item in m_hidden) { if (Object.op_Implicit((Object)(object)item)) { item.forceRenderingOff = false; } } m_hidden.Clear(); Player localPlayer = Player.m_localPlayer; if (!hide || !Object.op_Implicit((Object)(object)localPlayer)) { return; } Renderer[] componentsInChildren = ((Component)localPlayer).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (!val.forceRenderingOff) { val.forceRenderingOff = true; m_hidden.Add(val); } } } private IEnumerator Capture(Player p, ItemData mirror) { m_busy = true; m_cooldown = 1.2f; bool tall = m_tall; Play("vm_coldsnap", 0.85f); for (float t = 0f; t < 0.14f; t += Time.deltaTime) { ((Graphic)m_frost).color = new Color(1f, 1f, 1f, t / 0.14f * 0.55f); ((Transform)((Graphic)m_frost).rectTransform).localScale = Vector3.one * (1.15f - t); yield return null; } ((Behaviour)m_canvas).enabled = false; yield return (object)new WaitForEndOfFrame(); Texture2D val = ScreenCapture.CaptureScreenshotAsTexture(); ((Behaviour)m_canvas).enabled = true; Rect val2 = WindowPixels(tall); int ow = (tall ? 600 : 800); int oh = (tall ? 800 : 600); RenderTexture temporary = RenderTexture.GetTemporary(ow, oh, 0); Graphics.Blit((Texture)(object)val, temporary, new Vector2(((Rect)(ref val2)).width / (float)((Texture)val).width, ((Rect)(ref val2)).height / (float)((Texture)val).height), new Vector2(((Rect)(ref val2)).x / (float)((Texture)val).width, ((Rect)(ref val2)).y / (float)((Texture)val).height)); RenderTexture active = RenderTexture.active; RenderTexture.active = temporary; Texture2D raw = new Texture2D(ow, oh, (TextureFormat)3, false); raw.ReadPixels(new Rect(0f, 0f, (float)ow, (float)oh), 0, 0); raw.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); Object.Destroy((Object)(object)val); m_freeze.texture = (Texture)(object)raw; ((Component)m_freeze).gameObject.SetActive(true); ((Transform)((Graphic)m_freeze).rectTransform).localScale = Vector3.one; ((Graphic)m_freeze).color = Color.white; Assets.PlayVanillaFx(new string[1] { "sfx_build_hammer_crystal" }, ((Component)p).transform.position + Vector3.up * 1.5f); Broadcast(((Component)p).transform.position + Vector3.up * 1.5f); Color32[] px = raw.GetPixels32(); Color32[] painted = null; bool done = false; if (Plugin.Painterly.Value) { ThreadPool.QueueUserWorkItem(delegate { try { painted = PhotoFx.Paint(px, ow, oh); } catch (Exception ex) { Plugin.Log.LogError((object)("Painting failed: " + ex)); painted = px; } done = true; }); } else { painted = px; done = true; } for (float t = 0f; t < 0.5f || !done; t += Time.deltaTime) { float num = Mathf.Clamp01(t / 0.5f); ((Graphic)m_flash).color = new Color(0.85f, 0.97f, 1f, Mathf.Max(0f, 0.75f - num * 1.8f)); ((Graphic)m_frost).color = new Color(1f, 1f, 1f, 0.55f + 0.35f * Mathf.Sin(num * (float)Math.PI)); yield return null; } Texture2D val3 = new Texture2D(ow, oh, (TextureFormat)3, true) { wrapMode = (TextureWrapMode)1, anisoLevel = 4 }; val3.SetPixels32(painted); val3.Apply(); byte[] jpg = ImageConversion.EncodeToJPG(val3, Mathf.Clamp(Plugin.JpgQuality.Value, 50, 100)); string id = PhotoStore.NewId(); PhotoStore.Publish(id, jpg, val3); Mirror.Add(mirror, new Shot { Id = id, Tall = tall }); m_freeze.texture = (Texture)(object)val3; Object.Destroy((Object)(object)raw); Play("vm_magic_2", 0.6f); for (float t = 0f; t < 0.75f; t += Time.deltaTime) { ((Graphic)m_frost).color = new Color(1f, 1f, 1f, Mathf.Lerp(0.7f, 0f, t / 0.75f)); yield return null; } Vector3 start = Vector2.op_Implicit(((Graphic)m_freeze).rectTransform.anchoredPosition); Vector2 target = new Vector2((float)Screen.width * 0.9f, (float)Screen.height * 0.1f); for (float t = 0f; t < 0.45f; t += Time.deltaTime) { float num2 = Mathf.SmoothStep(0f, 1f, t / 0.45f); ((Graphic)m_freeze).rectTransform.anchoredPosition = Vector2.Lerp(Vector2.op_Implicit(start), target, num2); ((Transform)((Graphic)m_freeze).rectTransform).localScale = Vector3.one * Mathf.Lerp(1f, 0.08f, num2); ((Graphic)m_freeze).color = new Color(1f, 1f, 1