Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of Instant Camera v1.0.0
Mods/WoodStudios.InstantCamera.dll
Decompiled 20 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.IO.Compression; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.Json; using HarmonyLib; using HoldTheFort; using Il2CppFishNet; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne; using Il2CppScheduleOne.AvatarFramework; using Il2CppScheduleOne.AvatarFramework.Animation; using Il2CppScheduleOne.Building; using Il2CppScheduleOne.Core.Items.Framework; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.Economy; using Il2CppScheduleOne.Equipping; using Il2CppScheduleOne.Instancing; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.Map; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.NPCs.Relation; using Il2CppScheduleOne.Networking; using Il2CppScheduleOne.Persistence; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.Storage; using Il2CppScheduleOne.Tiles; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Shop; using Il2CppScheduleOne.Weather; using Il2CppSteamworks; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using Il2CppTMPro; using InstantCamera; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using S1API.Entities; using S1API.Items; using S1API.Items.Storable; using S1API.Lifecycle; using S1API.Rendering; using S1API.Shops; using Schedule2; using Schedule2.Game; using UnityEngine; using UnityEngine.AI; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.UI; using WS_IC.FybCommon; using WS_IC.WoodKit; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(CamCore), "Instant Camera", "1.0.0", "Wood Studios", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: MelonOptionalDependencies(new string[] { "HoldTheFort" })] [assembly: AssemblyTitle("WoodStudios.InstantCamera")] [assembly: AssemblyProduct("WoodStudios.InstantCamera")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Schedule2 { internal static class Res { private static readonly Assembly Asm = typeof(Res).Assembly; public static Stream Open(string name) { Stream manifestResourceStream = Asm.GetManifestResourceStream(name); if (manifestResourceStream == null) { return null; } int num = manifestResourceStream.ReadByte(); int num2 = manifestResourceStream.ReadByte(); manifestResourceStream.Position = 0L; if (num != 31 || num2 != 139) { return manifestResourceStream; } MemoryStream memoryStream = new MemoryStream(); using (GZipStream gZipStream = new GZipStream(manifestResourceStream, CompressionMode.Decompress)) { gZipStream.CopyTo(memoryStream); } memoryStream.Position = 0L; return memoryStream; } } } namespace Schedule2.Game { internal static class Sfx { public static AudioClip Create(string name, int lengthSamples, int channels, int frequency, bool stream) { return AudioClip.Create(name, lengthSamples, channels, frequency, stream); } public static bool SetData(AudioClip clip, Il2CppStructArray<float> data, int offset) { if ((Object)(object)clip != (Object)null) { return clip.SetData(data, offset); } return false; } } } namespace InstantCamera { internal static class Album { public static bool Open; private static int _page; private static string _sel; private static bool _typing; private static readonly StringBuilder Buf = new StringBuilder(); private static string _msg = ""; private static float _msgAt = -10f; public static void Show() { Open = true; _page = Mathf.Max(0, (Photo.All().Count - 1) / 8); _sel = null; _typing = false; FortifyApi.OpenMenu("ic_album"); } public static void Close() { if (Open) { Open = false; _typing = false; FortifyApi.CloseMenu("ic_album"); } } public static void Update() { if (!Open) { return; } if (_typing) { Keys.MarkTextBox(); if (Keys.RawDown((KeyCode)13) || Keys.RawDown((KeyCode)271)) { _typing = false; if (Photo.SetCaption(_sel, Buf.ToString())) { Say("Caption written on the photo."); } return; } if (Keys.RawDown((KeyCode)27)) { _typing = false; return; } string text = Keys.Typed(Keys.RawHeld((KeyCode)304) || Keys.RawHeld((KeyCode)303)); foreach (char c in text) { if (c == '\b') { if (Buf.Length > 0) { Buf.Length--; } } else if (Buf.Length < 26 && (c == ' ' || Glyphs.CanShow(c)) && (c != ' ' || (Buf.Length != 0 && Buf[Buf.Length - 1] != ' '))) { Buf.Append(c); } } return; } if (Keys.RawDown((KeyCode)27) || Keys.RawDown((KeyCode)9)) { if (_sel != null) { _sel = null; } else { Close(); } } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } private static void Say(string s) { _msg = s; _msgAt = Time.unscaledTime; } public static void Draw() { //IL_002f: 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_00c1: 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_00df: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_097a: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_09af: Unknown result type (might be due to invalid IL or missing references) //IL_09de: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_0a17: Unknown result type (might be due to invalid IL or missing references) //IL_06a8: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_0a6f: Unknown result type (might be due to invalid IL or missing references) //IL_0a74: Unknown result type (might be due to invalid IL or missing references) //IL_0a89: Unknown result type (might be due to invalid IL or missing references) //IL_0aa4: Unknown result type (might be due to invalid IL or missing references) //IL_0722: Unknown result type (might be due to invalid IL or missing references) //IL_0741: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_0871: Unknown result type (might be due to invalid IL or missing references) //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_07a0: Unknown result type (might be due to invalid IL or missing references) //IL_07a1: Unknown result type (might be due to invalid IL or missing references) //IL_07ab: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_0855: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_08ca: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_092e: Unknown result type (might be due to invalid IL or missing references) if (!Open) { return; } WS_IC.FybCommon.Ui.Capture(); float num = Screen.width; float num2 = Screen.height; float num3 = num2 / 1080f; WS_IC.FybCommon.Ui.Fill(new Rect(0f, 0f, num, num2), new Color(0f, 0f, 0f, 0.6f)); Rect r = default(Rect); ((Rect)(ref r))..ctor(num / 2f - 820f * num3, num2 / 2f - 470f * num3, 1640f * num3, 940f * num3); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref r)).x - 14f * num3, ((Rect)(ref r)).y - 14f * num3, ((Rect)(ref r)).width + 28f * num3, ((Rect)(ref r)).height + 28f * num3), new Color(0.32f, 0.07f, 0.06f)); WS_IC.FybCommon.Ui.Fill(r, new Color(0.95f, 0.93f, 0.86f)); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref r)).center.x - 2f * num3, ((Rect)(ref r)).y, 4f * num3, ((Rect)(ref r)).height), new Color(0.78f, 0.75f, 0.68f)); WS_IC.FybCommon.Ui.Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 14f * num3, ((Rect)(ref r)).width, 40f * num3), "PHOTO ALBUM", Mathf.RoundToInt(28f * num3), new Color(0.32f, 0.07f, 0.06f), (TextAnchor)4); List<string> list = Photo.All(); Color c = default(Color); ((Color)(ref c))..ctor(0.2f, 0.18f, 0.16f); if (list.Count == 0) { WS_IC.FybCommon.Ui.Text(r, "No photos yet.\nHold your instant camera and click to take one.", Mathf.RoundToInt(24f * num3), c, (TextAnchor)4); } else if (_sel == null) { int num4 = (list.Count + 7) / 8; _page = Mathf.Clamp(_page, 0, num4 - 1); float num5 = 300f * num3; float num6 = num5 * 1284f / 1056f; Rect r2 = default(Rect); Color c2 = default(Color); for (int i = 0; i < 8; i++) { int num7 = _page * 8 + i; if (num7 >= list.Count) { break; } int num8 = i % 4; int num9 = i / 4; float num10 = ((num8 < 2) ? (((Rect)(ref r)).x + 70f * num3) : (((Rect)(ref r)).center.x + 70f * num3)) + (float)(num8 % 2) * (num5 + 60f * num3); float num11 = ((Rect)(ref r)).y + 70f * num3 + (float)num9 * (num6 + 30f * num3); ((Rect)(ref r2))..ctor(num10, num11, num5, num6); float num12 = (float)(num7 * 37 % 7 - 3) * 1.2f * num3; WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref r2)).x + 5f * num3, ((Rect)(ref r2)).y + 6f * num3 + num12, ((Rect)(ref r2)).width, ((Rect)(ref r2)).height), new Color(0f, 0f, 0f, 0.22f)); Texture2D val = Photo.Load(list[num7]); if ((Object)(object)val != (Object)null) { WS_IC.WoodKit.Ui.Image(new Rect(((Rect)(ref r2)).x, ((Rect)(ref r2)).y + num12, ((Rect)(ref r2)).width, ((Rect)(ref r2)).height), val); } ((Color)(ref c2))..ctor(0.15f, 0.12f, 0.1f); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref r2)).x - 6f * num3, ((Rect)(ref r2)).y + num12 - 6f * num3, 26f * num3, 6f * num3), c2); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref r2)).xMax - 20f * num3, ((Rect)(ref r2)).yMax + num12, 26f * num3, 6f * num3), c2); if (WS_IC.FybCommon.Ui.Hover(r2)) { WS_IC.FybCommon.Ui.Frame(new Rect(((Rect)(ref r2)).x - 3f * num3, ((Rect)(ref r2)).y + num12 - 3f * num3, ((Rect)(ref r2)).width + 6f * num3, ((Rect)(ref r2)).height + 6f * num3), new Color(1f, 0.55f, 0.12f), 3f * num3); } if (WS_IC.FybCommon.Ui.Click(r2)) { _sel = list[num7]; } } WS_IC.FybCommon.Ui.Text(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - 50f * num3, ((Rect)(ref r)).width, 30f * num3), $"Page {_page + 1} of {num4} - {list.Count} photo{((list.Count == 1) ? "" : "s")}", Mathf.RoundToInt(17f * num3), c, (TextAnchor)4, bold: false); if (_page > 0 && WS_IC.FybCommon.Ui.Button(new Rect(((Rect)(ref r)).x + 40f * num3, ((Rect)(ref r)).yMax - 60f * num3, 150f * num3, 44f * num3), "< Back")) { _page--; } if (_page < num4 - 1 && WS_IC.FybCommon.Ui.Button(new Rect(((Rect)(ref r)).xMax - 190f * num3, ((Rect)(ref r)).yMax - 60f * num3, 150f * num3, 44f * num3), "Next >")) { _page++; } } else { Texture2D val2 = Photo.Load(_sel); float num13 = 800f * num3; float num14 = num13 * 1056f / 1284f; Rect r3 = default(Rect); ((Rect)(ref r3))..ctor(((Rect)(ref r)).x + 120f * num3, ((Rect)(ref r)).y + 70f * num3, num14, num13); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref r3)).x + 8f * num3, ((Rect)(ref r3)).y + 10f * num3, ((Rect)(ref r3)).width, ((Rect)(ref r3)).height), new Color(0f, 0f, 0f, 0.25f)); if ((Object)(object)val2 != (Object)null) { WS_IC.WoodKit.Ui.Image(r3, val2); } float num15 = ((Rect)(ref r)).center.x + 80f * num3; float num16 = 560f * num3; float num17 = ((Rect)(ref r)).y + 120f * num3; string text = Photo.Caption(_sel); WS_IC.FybCommon.Ui.Text(new Rect(num15, num17, num16, 40f * num3), (text.Length > 0) ? ("\"" + text + "\"") : "No caption", Mathf.RoundToInt(26f * num3), c, (TextAnchor)3, bold: true, wrap: false); WS_IC.FybCommon.Ui.Text(new Rect(num15, num17 + 44f * num3, num16, 30f * num3), Nice(_sel), Mathf.RoundToInt(17f * num3), new Color(0.4f, 0.38f, 0.35f), (TextAnchor)3, bold: false, wrap: false); num17 += 110f * num3; if (_typing) { Rect r4 = new Rect(num15, num17, num16, 50f * num3); WS_IC.FybCommon.Ui.Fill(r4, Color.white); WS_IC.FybCommon.Ui.Frame(r4, new Color(1f, 0.55f, 0.12f), 2f * num3); WS_IC.FybCommon.Ui.Text(r4, string.Concat(str1: (Time.unscaledTime % 1f < 0.5f) ? "|" : " ", str0: Buf.ToString().ToUpperInvariant()), Mathf.RoundToInt(24f * num3), new Color(0.11f, 0.13f, 0.3f), (TextAnchor)4); WS_IC.FybCommon.Ui.Text(new Rect(num15, num17 + 56f * num3, num16, 26f * num3), "Enter to write it on the photo - Esc to cancel", Mathf.RoundToInt(15f * num3), c, (TextAnchor)3, bold: false, wrap: false); } else { if (WS_IC.FybCommon.Ui.Button(new Rect(num15, num17, num16, 54f * num3), (text.Length > 0) ? "Rewrite the caption" : "Write a caption")) { _typing = true; Buf.Length = 0; Buf.Append(text); } if (WS_IC.FybCommon.Ui.Button(new Rect(num15, num17 + 70f * num3, num16, 54f * num3), (Prints.Next == _sel) ? "Next print shows this one" : "Use for my next print", enabled: true, Prints.Next == _sel)) { Prints.Next = _sel; Say("The next photo you hang will show this one."); } if (WS_IC.FybCommon.Ui.Button(new Rect(num15, num17 + 140f * num3, num16, 54f * num3), "Open the photo folder")) { try { Application.OpenURL("file:///" + Photo.Folder.Replace('\\', '/')); } catch { } } if (WS_IC.FybCommon.Ui.Button(new Rect(num15, num17 + 210f * num3, num16, 54f * num3), "Back to all photos")) { _sel = null; } } WS_IC.FybCommon.Ui.Text(new Rect(num15, ((Rect)(ref r)).yMax - 160f * num3, num16, 80f * num3), "Saved as a PNG in\n" + Photo.Folder, Mathf.RoundToInt(15f * num3), new Color(0.4f, 0.38f, 0.35f), (TextAnchor)0, bold: false); } if (WS_IC.FybCommon.Ui.Button(new Rect(((Rect)(ref r)).xMax - 70f * num3, ((Rect)(ref r)).y + 12f * num3, 52f * num3, 44f * num3), "X")) { Close(); } if (Time.unscaledTime - _msgAt < 2.5f) { Rect r5 = new Rect(num / 2f - 300f * num3, ((Rect)(ref r)).yMax + 24f * num3, 600f * num3, 40f * num3); WS_IC.FybCommon.Ui.Fill(r5, new Color(0.03f, 0.06f, 0.13f, 0.85f)); WS_IC.FybCommon.Ui.Text(r5, _msg, Mathf.RoundToInt(18f * num3), Color.white, (TextAnchor)4); } } private static string Nice(string name) { try { return DateTime.ParseExact(name.Substring(3, 19), "yyyy-MM-dd_HH-mm-ss", CultureInfo.InvariantCulture).ToString("MMM d, yyyy h:mm tt", CultureInfo.InvariantCulture); } catch { return name; } } } public sealed class CamCore : MelonMod { internal const string CameraId = "ic_camera"; internal const string FilmId = "ic_film"; internal const string PrintId = "ic_photo"; internal const string CorkId = "ic_cork"; internal const string AlbumId = "ic_album"; internal static readonly string[] GasMarts = new string[2] { "Gas-Mart (Central)", "Gas-Mart (West)" }; internal static readonly string[] Hardware = new string[2] { "Dan's Hardware", "Handy Hank's Hardware" }; internal static readonly string[] Both = new string[4] { "Dan's Hardware", "Handy Hank's Hardware", "Gas-Mart (Central)", "Gas-Mart (West)" }; internal static MelonPreferences_Entry<bool> Mark; internal static MelonPreferences_Entry<bool> Captions; internal static MelonPreferences_Entry<string> FolderPref; internal static MelonPreferences_Entry<int> Shots; internal static MelonPreferences_Entry<int> FilterPref; internal static MelonPreferences_Entry<float> Price; private static MelonPreferences_Category _cat; private static Instance _log; private static float _warnedAt = -100f; internal static void Log(string s) { Instance log = _log; if (log != null) { log.Msg(s); } } internal static void SavePrefs() { try { MelonPreferences_Category cat = _cat; if (cat != null) { cat.SaveToFile(false); } } catch { } } public override void OnInitializeMelon() { //IL_01db: 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_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) _log = ((MelonBase)this).LoggerInstance; try { Host.Init((MelonMod)(object)this, "InstantCamera", "Instant Camera", "ic_", null, Loaded, Unloaded); _cat = MelonPreferences.GetCategory("InstantCamera") ?? MelonPreferences.CreateCategory("InstantCamera", "Instant Camera"); Mark = _cat.CreateEntry<bool>("WoodStudiosMark", true, "Wood Studios mark", "Prints a small Wood Studios mark in the corner of each photo's white border. Turn off for a clean border.", false, false, (ValueValidator)null, (string)null); Captions = _cat.CreateEntry<bool>("AskForCaption", false, "Offer a caption", "", true, false, (ValueValidator)null, (string)null); FolderPref = _cat.CreateEntry<string>("PhotoFolder", "", "Photo folder", "Where photos are saved. Empty = Pictures\\Hyland Point Photos.", false, false, (ValueValidator)null, (string)null); Price = _cat.CreateEntry<float>("PriceMultiplier", 1f, "Price multiplier", "Multiplies the prices (1 = normal, 0 = free). Applies after a game restart.", false, false, (ValueValidator)null, (string)null); Shots = _cat.CreateEntry<int>("ShotsLeft", 0, "Shots left", "", true, false, (ValueValidator)null, (string)null); FilterPref = _cat.CreateEntry<int>("Filter", 0, "Filter", "", true, false, (ValueValidator)null, (string)null); Kit.PriceMultiplier = () => Mathf.Max(0f, Price?.Value ?? 1f); FortifyApi.SetNotifyIcon("ic_camera"); Catalog.Add(new ItemSpec { Id = "ic_camera", Name = "Instant Camera", Kind = PlaceKind.Ground, Price = 250f, RotateStep = 45f, StackLimit = 1, Stores = Both, IconColor = new Color(0.08f, 0.12f, 0.3f), BuildModel = () => CamModels.Load("ic_Camera", "PC_Camera.glb", collider: true), Description = "A Wood Studios instant camera. Hold it and click to take a photo - it prints right out and develops in your hands. Uses instant film." }); Catalog.Add(new ItemSpec { Id = "ic_film", Name = "Instant Film (10 shots)", Kind = PlaceKind.Ground, Price = 30f, RotateStep = 45f, StackLimit = 10, Stores = Both, IconColor = new Color(0.08f, 0.12f, 0.35f), BuildModel = () => CamModels.Load("ic_Film", "PC_Film.glb", collider: true), Description = "A pack of instant film, ten shots. The camera loads a new pack by itself when the last one runs out." }); Catalog.Add(new ItemSpec { Id = "ic_photo", Name = "Photo", Kind = PlaceKind.Wall, Price = 1f, RotateStep = 15f, StackLimit = 50, NotSold = true, IconColor = new Color(0.95f, 0.95f, 0.92f), BuildModel = CamModels.Print, IconModel = CamModels.PrintIcon, Description = "One of your photos. Hang it on any wall or pin it to a corkboard. Press E on a hung photo to flip to a different one of yours." }); Catalog.Add(new ItemSpec { Id = "ic_cork", Name = "Corkboard", Kind = PlaceKind.Wall, Price = 60f, RotateStep = 0f, StackLimit = 5, Stores = Hardware, IconColor = new Color(0.55f, 0.38f, 0.2f), BuildModel = () => CamModels.OffWall(CamModels.Load("ic_Cork", "PC_Cork.glb", collider: true), 0.035f), Description = "A big framed corkboard for the wall. Pin your photos to it." }); Catalog.Add(new ItemSpec { Id = "ic_album", Name = "Photo Album", Kind = PlaceKind.Ground, Price = 40f, RotateStep = 15f, StackLimit = 3, Stores = Hardware, IconColor = new Color(0.4f, 0.08f, 0.07f), BuildModel = () => CamModels.Load("ic_Album", "PC_Album.glb", collider: true), Description = "A leather photo album. Put it on a table and press E to look through every photo you've taken, write captions, and pick which photo your next print shows." }); Kit.CustomPlace["ic_camera"] = Snap.Held; Kit.Use["ic_photo"] = Prints.UsePrint; Kit.Use["ic_album"] = Prints.UseAlbum; Kit.Created += Prints.Created; Kit.Busy = () => Album.Open || Snap.Typing; Host.WhereToBuyNote = "Instant Camera: cameras and film at the Gas-Marts and hardware stores; corkboards and photo albums at the hardware stores."; Host.Ok = true; ((MelonBase)this).LoggerInstance.Msg("Instant Camera loaded. Photos save to " + Photo.Folder); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("Instant Camera couldn't start: " + ex.Message + ". It needs MelonLoader 0.7 and S1API (Bars fork) 3.2.3 or newer."); } } private static void Loaded() { Snap.Reset(); Prints.Reset(); } private static void Unloaded() { Snap.Reset(); Prints.Reset(); Album.Close(); } public override void OnUpdate() { if (!Host.Update()) { return; } try { Snap.Update(); Prints.Update(); Album.Update(); } catch (Exception ex) { if (Time.unscaledTime - _warnedAt > 30f) { _warnedAt = Time.unscaledTime; ((MelonBase)this).LoggerInstance.Warning("Instant Camera: " + ex.Message + " " + ex.StackTrace); } } } public override void OnGUI() { Host.DrawHint(); if (!Host.Ok || !FortifyApi.InGame) { return; } try { Snap.Draw(); Album.Draw(); } catch { } } } internal static class CamModels { private static readonly HashSet<int> Fixed = new HashSet<int>(); public const float CardW = 0.088f; public const float CardH = 0.107f; private static Material _blank; private static Material _sample; public static GameObject Load(string name, string file, bool collider) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00c3: 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_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_00f3: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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) GameObject val = new GameObject(name); ((Object)GltfLoader.LoadEmbedded(file, val.transform)).name = "Model"; foreach (Renderer componentsInChild in val.GetComponentsInChildren<Renderer>(true)) { foreach (Material item in (Il2CppArrayBase<Material>)(object)componentsInChild.sharedMaterials) { if (!((Object)(object)item == (Object)null) && Fixed.Add(((Object)item).GetInstanceID())) { Color color = item.color; Color val2 = (item.color = ((Color)(ref color)).gamma); if (item.HasProperty("_BaseColor")) { item.SetColor("_BaseColor", val2); } } } } if (collider) { Bounds val3 = LocalBounds(val); BoxCollider obj = val.AddComponent<BoxCollider>(); obj.center = ((Bounds)(ref val3)).center; obj.size = Vector3.Max(((Bounds)(ref val3)).size, new Vector3(0.03f, 0.03f, 0.03f)); } return val; } public static GameObject Print() { //IL_0054: 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) //IL_0092: 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_00f6: Expected O, but got Unknown //IL_010e: 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_0137: Unknown result type (might be due to invalid IL or missing references) GameObject val = Load("ic_Print", "PC_Photo.glb", collider: false); GameObject obj = GameObject.CreatePrimitive((PrimitiveType)5); Object.Destroy((Object)(object)obj.GetComponent<Collider>()); ((Object)obj).name = "ic_Pic"; obj.transform.SetParent(val.transform, false); obj.transform.localPosition = new Vector3(0f, 0f, 0.0014f); obj.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); obj.transform.localScale = new Vector3(0.088f, 0.107f, 1f); Renderer component = obj.GetComponent<Renderer>(); component.sharedMaterial = Blank(); component.shadowCastingMode = (ShadowCastingMode)0; BoxCollider obj2 = val.AddComponent<BoxCollider>(); obj2.center = new Vector3(0f, 0f, 0.004f); obj2.size = new Vector3(0.088f, 0.107f, 0.008f); GameObject val2 = new GameObject("ic_PrintRoot"); val.transform.SetParent(val2.transform, false); val.transform.localScale = Vector3.one * 1.6f; val.transform.localPosition = new Vector3(0f, 0f, 0.012f); return val2; } public static GameObject OffWall(GameObject go, float by) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) Transform val = go.transform.Find("Model"); if ((Object)(object)val != (Object)null) { val.localPosition += new Vector3(0f, 0f, by); } BoxCollider component = go.GetComponent<BoxCollider>(); if ((Object)(object)component != (Object)null) { component.center += new Vector3(0f, 0f, by / 2f); component.size += new Vector3(0f, 0f, by); } Bounds val2 = LocalBounds(go); GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); Object.Destroy((Object)(object)obj.GetComponent<Collider>()); ((Object)obj).name = "ic_Back"; obj.transform.SetParent(go.transform, false); obj.transform.localPosition = new Vector3(((Bounds)(ref val2)).center.x, ((Bounds)(ref val2)).center.y, by / 2f); obj.transform.localScale = new Vector3(((Bounds)(ref val2)).size.x * 0.96f, ((Bounds)(ref val2)).size.y * 0.94f, by); obj.GetComponent<Renderer>().sharedMaterial = FortifyApi.Mat("ic_backing", new Color(0.12f, 0.08f, 0.05f)); return go; } public static Transform Pic(Transform root) { if (((Object)root).name == "ic_Pic") { return root; } for (int i = 0; i < root.childCount; i++) { Transform val = Pic(root.GetChild(i)); if ((Object)(object)val != (Object)null) { return val; } } return null; } public static GameObject PrintIcon() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0037: 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_0051: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ic_PrintIcon"); GameObject obj = Print(); obj.transform.SetParent(val.transform, false); obj.transform.localRotation = Quaternion.Euler(0f, 180f, 8f); obj.transform.localScale = Vector3.one * 1.4f; Transform obj2 = Pic(obj.transform); Renderer val2 = ((obj2 != null) ? ((Component)obj2).GetComponent<Renderer>() : null); if ((Object)(object)val2 != (Object)null) { val2.sharedMaterial = Sample(); } return val; } private static Material Blank() { //IL_0021: 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_003f: Expected O, but got Unknown if ((Object)(object)_blank == (Object)null) { _blank = new Material(FortifyApi.Mat("ic_blank", new Color(0.96f, 0.95f, 0.92f))); ((Object)_blank).hideFlags = (HideFlags)32; } return _blank; } private static Material Sample() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00b1: 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) if ((Object)(object)_sample != (Object)null) { return _sample; } int num = 88; int num2 = 107; Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.96f, 0.95f, 0.92f); Color[] array = (Color[])(object)new Color[num * num2]; for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { Color val3 = val2; if (j >= 5 && j < 83 && i >= 22 && i < 100) { float num3 = (float)(i - 22) / 78f; val3 = Color.Lerp(new Color(1f, 0.55f, 0.2f), new Color(0.2f, 0.25f, 0.55f), num3); float num4 = j - 44; float num5 = i - 48; if (num4 * num4 + num5 * num5 < 120f) { ((Color)(ref val3))..ctor(1f, 0.85f, 0.4f); } if (i < 40) { ((Color)(ref val3))..ctor(0.1f, 0.12f, 0.2f); } } array[i * num + j] = val3; } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); _sample = Textured(val); return _sample; } public static Material Textured(Texture2D t) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_000c: 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) Material val = new Material(Blank()); val.color = Color.white; if (val.HasProperty("_BaseColor")) { val.SetColor("_BaseColor", Color.white); } val.mainTexture = (Texture)(object)t; if (val.HasProperty("_BaseMap")) { val.SetTexture("_BaseMap", (Texture)(object)t); } if (val.HasProperty("_Smoothness")) { val.SetFloat("_Smoothness", 0.55f); } ((Object)val).hideFlags = (HideFlags)32; return val; } public static Bounds LocalBounds(GameObject go) { //IL_0004: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00dc: 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_00e1: 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_00e8: 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) bool flag = false; Bounds result = default(Bounds); Matrix4x4 worldToLocalMatrix = go.transform.worldToLocalMatrix; Vector3 val2 = default(Vector3); foreach (MeshFilter componentsInChild in go.GetComponentsInChildren<MeshFilter>(true)) { if ((Object)(object)componentsInChild.sharedMesh == (Object)null) { continue; } Bounds bounds = componentsInChild.sharedMesh.bounds; Matrix4x4 val = worldToLocalMatrix * ((Component)componentsInChild).transform.localToWorldMatrix; for (int i = 0; i < 8; i++) { ((Vector3)(ref val2))..ctor(((i & 1) == 0) ? ((Bounds)(ref bounds)).min.x : ((Bounds)(ref bounds)).max.x, ((i & 2) == 0) ? ((Bounds)(ref bounds)).min.y : ((Bounds)(ref bounds)).max.y, ((i & 4) == 0) ? ((Bounds)(ref bounds)).min.z : ((Bounds)(ref bounds)).max.z); Vector3 val3 = ((Matrix4x4)(ref val)).MultiplyPoint3x4(val2); if (!flag) { result = new Bounds(val3, Vector3.zero); flag = true; } else { ((Bounds)(ref result)).Encapsulate(val3); } } } return result; } public static GameObject Plain(GameObject template, string name) { GameObject val = Object.Instantiate<GameObject>(template); ((Object)val).name = name; val.SetActive(true); foreach (Collider componentsInChild in val.GetComponentsInChildren<Collider>(true)) { Object.Destroy((Object)(object)componentsInChild); } foreach (Renderer componentsInChild2 in val.GetComponentsInChildren<Renderer>(true)) { componentsInChild2.shadowCastingMode = (ShadowCastingMode)0; } return val; } } internal static class Glyphs { private static readonly Dictionary<char, string> Defs = new Dictionary<char, string> { ['A'] = "0,0 0,3.8 1.2,5 1.8,5 3,3.8 3,0;0,2.4 3,2.4", ['B'] = "0,0 0,5 2.2,5 2.8,4.4 2.8,3.1 2.2,2.5 0,2.5;2.2,2.5 3,1.8 3,0.6 2.4,0 0,0", ['C'] = "3,4.3 2.3,5 0.7,5 0,4.3 0,0.7 0.7,0 2.3,0 3,0.7", ['D'] = "0,0 0,5 1.8,5 3,3.8 3,1.2 1.8,0 0,0", ['E'] = "3,0 0,0 0,5 3,5;0,2.5 2.2,2.5", ['F'] = "0,0 0,5 3,5;0,2.5 2.2,2.5", ['G'] = "3,4.3 2.3,5 0.7,5 0,4.3 0,0.7 0.7,0 2.3,0 3,0.7 3,2.2 1.7,2.2", ['H'] = "0,0 0,5;3,0 3,5;0,2.5 3,2.5", ['I'] = "0.6,5 2.4,5;1.5,5 1.5,0;0.6,0 2.4,0", ['J'] = "0.8,5 3,5;2.2,5 2.2,0.7 1.5,0 0.7,0 0,0.7 0,1.2", ['K'] = "0,0 0,5;3,5 0,2;1,2.9 3,0", ['L'] = "0,5 0,0 3,0", ['M'] = "0,0 0,5 1.5,2.8 3,5 3,0", ['N'] = "0,0 0,5 3,0 3,5", ['O'] = "0.7,0 2.3,0 3,0.7 3,4.3 2.3,5 0.7,5 0,4.3 0,0.7 0.7,0", ['P'] = "0,0 0,5 2.3,5 3,4.3 3,3.2 2.3,2.5 0,2.5", ['Q'] = "0.7,0 2.3,0 3,0.7 3,4.3 2.3,5 0.7,5 0,4.3 0,0.7 0.7,0;1.8,1.2 3.1,-0.2", ['R'] = "0,0 0,5 2.3,5 3,4.3 3,3.2 2.3,2.5 0,2.5;1.3,2.5 3,0", ['S'] = "3,4.3 2.3,5 0.7,5 0,4.3 0,3.2 0.7,2.5 2.3,2.5 3,1.8 3,0.7 2.3,0 0.7,0 0,0.7", ['T'] = "0,5 3,5;1.5,5 1.5,0", ['U'] = "0,5 0,0.7 0.7,0 2.3,0 3,0.7 3,5", ['V'] = "0,5 1.5,0 3,5", ['W'] = "0,5 0.6,0 1.5,3 2.4,0 3,5", ['X'] = "0,5 3,0;0,0 3,5", ['Y'] = "0,5 1.5,2.6 3,5;1.5,2.6 1.5,0", ['Z'] = "0,5 3,5 0,0 3,0", ['0'] = "0.7,0 2.3,0 3,0.7 3,4.3 2.3,5 0.7,5 0,4.3 0,0.7 0.7,0", ['1'] = "0.7,4 1.7,5 1.7,0;0.7,0 2.7,0", ['2'] = "0,4.3 0.7,5 2.3,5 3,4.3 3,3.3 0,0 3,0", ['3'] = "0,4.3 0.7,5 2.3,5 3,4.3 3,3.2 2.3,2.5 1,2.5;2.3,2.5 3,1.8 3,0.7 2.3,0 0.7,0 0,0.7", ['4'] = "2.3,0 2.3,5 0,1.5 3,1.5", ['5'] = "3,5 0,5 0,2.8 2.3,2.8 3,2.1 3,0.7 2.3,0 0.7,0 0,0.7", ['6'] = "2.8,4.6 2.2,5 0.7,5 0,4.3 0,0.7 0.7,0 2.3,0 3,0.7 3,2 2.3,2.7 0.7,2.7 0,2", ['7'] = "0,5 3,5 1.2,0", ['8'] = "0.7,2.5 0,3.2 0,4.3 0.7,5 2.3,5 3,4.3 3,3.2 2.3,2.5 0.7,2.5 0,1.8 0,0.7 0.7,0 2.3,0 3,0.7 3,1.8 2.3,2.5", ['9'] = "0.2,0.4 0.8,0 2.3,0 3,0.7 3,4.3 2.3,5 0.7,5 0,4.3 0,3 0.7,2.3 2.3,2.3 3,3", ['!'] = "0.5,5 0.5,1.5;0.5,0.35 0.5,0", ['.'] = "0.4,0.35 0.4,0", ['\''] = "0.4,5 0.4,3.8", ['-'] = "0.3,2.5 2.2,2.5", [','] = "0.6,0.5 0.2,-0.7", ['?'] = "0,4.3 0.7,5 2.3,5 3,4.3 3,3.4 1.5,2.2 1.5,1.4;1.5,0.35 1.5,0", [':'] = "0.5,3.4 0.5,3.05;0.5,0.35 0.5,0", ['#'] = "0.8,0 1.2,5;2,0 2.4,5;0,1.6 3,1.6;0,3.4 3,3.4", ['/'] = "0,0 2.4,5", ['+'] = "0.2,2.5 2.6,2.5;1.4,1.3 1.4,3.7", ['&'] = "3,0 0.6,3.6 0.6,4.4 1.2,5 1.8,5 2.4,4.4 2.4,3.8 0,1.6 0,0.6 0.6,0 1.6,0 3,1.6" }; private static readonly Dictionary<char, (List<Vector2[]> lines, float width)> Parsed = new Dictionary<char, (List<Vector2[]>, float)>(); private static (List<Vector2[]> lines, float width) Get(char c) { //IL_009f: 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) c = char.ToUpperInvariant(c); if (Parsed.TryGetValue(c, out (List<Vector2[]>, float) value)) { return value; } List<Vector2[]> list = new List<Vector2[]>(); float item = 1.6f; if (Defs.TryGetValue(c, out var value2)) { item = 0f; string[] array = value2.Split(';'); Vector2 val = default(Vector2); foreach (string obj in array) { List<Vector2> list2 = new List<Vector2>(); string[] array2 = obj.Split(' ', StringSplitOptions.RemoveEmptyEntries); for (int j = 0; j < array2.Length; j++) { string[] array3 = array2[j].Split(','); ((Vector2)(ref val))..ctor(float.Parse(array3[0], CultureInfo.InvariantCulture), float.Parse(array3[1], CultureInfo.InvariantCulture)); list2.Add(val); item = Mathf.Max(item, val.x); } if (list2.Count >= 2) { list.Add(list2.ToArray()); } } item = Mathf.Max(item, 0.8f); } Parsed[c] = (list, item); return Parsed[c]; } public static bool CanShow(char c) { if (c != ' ') { return Defs.ContainsKey(char.ToUpperInvariant(c)); } return true; } public static float Width(char c) { return Get(c).width; } public static List<Vector2[]> Lines(char c) { return Get(c).lines; } } internal static class Photo { public const int CardW = 1056; public const int CardH = 1284; public const int Img = 948; public const int ImgX = 54; public const int ImgTop = 72; public static readonly string[] Filters = new string[3] { "Classic", "Black & White", "Night Flash" }; private static string _folder; private static List<string> _list; private static float _listAt = -100f; public static int Version; private static Dictionary<string, string> _captions; private static readonly Color Paper = new Color(0.965f, 0.958f, 0.93f); private static readonly Dictionary<string, Texture2D> Cache = new Dictionary<string, Texture2D>(); private static readonly List<string> CacheOrder = new List<string>(); public static int ImgY => 264; public static int Bottom => ImgY; public static string Folder { get { if (_folder != null) { return _folder; } string text = CamCore.FolderPref?.Value; string text2 = null; try { if (!string.IsNullOrWhiteSpace(text)) { text2 = text.Trim(); } else { string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); if (!string.IsNullOrEmpty(folderPath)) { text2 = Path.Combine(folderPath, "Hyland Point Photos"); } } if (text2 == null) { text2 = Path.Combine(MelonEnvironment.UserDataDirectory, "Hyland Point Photos"); } Directory.CreateDirectory(text2); } catch { text2 = Path.Combine(MelonEnvironment.UserDataDirectory, "Hyland Point Photos"); Directory.CreateDirectory(text2); } _folder = text2; return text2; } } private static string CaptionFile => Path.Combine(Folder, "captions.txt"); public static void SetFolder(string dir) { Directory.CreateDirectory(dir); _folder = dir; _list = null; _captions = null; Touch(); } public static List<string> All() { if (_list != null && Time.unscaledTime - _listAt < 3f) { return _list; } _listAt = Time.unscaledTime; List<string> list = new List<string>(); try { string[] files = Directory.GetFiles(Folder, "HP_*.png"); foreach (string path in files) { list.Add(Path.GetFileName(path)); } } catch { } list.Sort(StringComparer.Ordinal); _list = list; return list; } public static void Touch() { _listAt = -100f; Version++; } public static string Caption(string name) { LoadCaptions(); if (name == null || !_captions.TryGetValue(name, out var value)) { return ""; } return value; } private static void LoadCaptions() { if (_captions != null) { return; } _captions = new Dictionary<string, string>(); try { if (!File.Exists(CaptionFile)) { return; } string[] array = File.ReadAllLines(CaptionFile); foreach (string text in array) { int num = text.IndexOf('|'); if (num > 0) { _captions[text.Substring(0, num)] = text.Substring(num + 1); } } } catch { } } private static void SaveCaptions() { try { List<string> list = new List<string>(); foreach (KeyValuePair<string, string> caption in _captions) { if (caption.Value.Length > 0) { list.Add(caption.Key + "|" + caption.Value); } } File.WriteAllLines(CaptionFile, list); } catch { } } private static byte[] ToManaged(Il2CppStructArray<byte> a) { byte[] array = new byte[((Il2CppArrayBase<byte>)(object)a).Length]; Marshal.Copy(IntPtr.Add(((Il2CppObjectBase)a).Pointer, 4 * IntPtr.Size), array, 0, array.Length); return array; } private static Il2CppStructArray<byte> ToIl2Cpp(byte[] a) { Il2CppStructArray<byte> val = new Il2CppStructArray<byte>((long)a.Length); Marshal.Copy(a, 0, IntPtr.Add(((Il2CppObjectBase)val).Pointer, 4 * IntPtr.Size), a.Length); return val; } public static byte[] Render(Camera from, Vector3 pos, Quaternion rot, float fov, int cullAdd) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_004d: 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_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_008b: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ic_ShotCam"); RenderTexture val2 = null; Texture2D val3 = null; try { Camera val4 = val.AddComponent<Camera>(); if ((Object)(object)from != (Object)null) { val4.CopyFrom(from); } try { val.AddComponent<UniversalAdditionalCameraData>().renderPostProcessing = true; } catch { } val4.cullingMask |= cullAdd; val.transform.SetPositionAndRotation(pos, rot); val4.fieldOfView = fov; val4.nearClipPlane = 0.05f; val4.aspect = 1f; val2 = (val4.targetTexture = new RenderTexture(948, 948, 24, (RenderTextureFormat)0) { antiAliasing = 4 }); val4.Render(); RenderTexture active = RenderTexture.active; RenderTexture.active = val2; val3 = new Texture2D(948, 948, (TextureFormat)3, false); val3.ReadPixels(new Rect(0f, 0f, 948f, 948f), 0, 0, false); val3.Apply(false); RenderTexture.active = active; val4.targetTexture = null; return ToManaged(val3.GetRawTextureData()); } finally { if ((Object)(object)val3 != (Object)null) { Object.Destroy((Object)(object)val3); } if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)val2); } Object.Destroy((Object)(object)val); } } public static void Develop(byte[] px, int filter, int seed) { Random random = new Random(seed); float num = 474f; for (int i = 0; i < 948; i++) { for (int j = 0; j < 948; j++) { int num2 = (i * 948 + j) * 3; float num3 = (float)(int)px[num2] / 255f; float num4 = (float)(int)px[num2 + 1] / 255f; float num5 = (float)(int)px[num2 + 2] / 255f; float num6 = ((float)j - num) / num; float num7 = ((float)i - num) / num; float num8 = num6 * num6 + num7 * num7; float num9 = 1f - 0.32f * num8 * num8; float num10 = 0.299f * num3 + 0.587f * num4 + 0.114f * num5; switch (filter) { case 1: { float num13 = Curve((num10 - 0.5f) * 1.18f + 0.52f) * num9; num3 = num13 * 1.02f + 0.015f; num4 = num13; num5 = num13 * 0.95f; break; } case 2: { float num12 = Mathf.Lerp(1.55f, 0.45f, Mathf.Clamp01(num8 * 0.75f)); num3 = Curve((num3 * num12 - 0.5f) * 1.25f + 0.5f) * 0.97f; num4 = Curve((num4 * num12 - 0.5f) * 1.25f + 0.5f); num5 = Curve((num5 * num12 - 0.5f) * 1.25f + 0.5f) * 1.06f + 0.02f; break; } default: { float num11 = 0.86f; num3 = Mathf.Lerp(num10, num3, num11); num4 = Mathf.Lerp(num10, num4, num11); num5 = Mathf.Lerp(num10, num5, num11); num3 = (Curve(num3 * 1.05f + 0.01f) * 0.9f + 0.075f) * num9; num4 = (Curve(num4 * 1f) * 0.9f + 0.06f) * num9; num5 = (Curve(num5 * 0.88f) * 0.88f + 0.055f) * num9; break; } } float num14 = ((float)random.NextDouble() - 0.5f) * 0.035f; px[num2] = ToByte(num3 + num14); px[num2 + 1] = ToByte(num4 + num14); px[num2 + 2] = ToByte(num5 + num14); } } } private static float Curve(float v) { v = Mathf.Clamp01(v); return v * v * (3f - 2f * v) * 0.6f + v * 0.4f; } private static byte ToByte(float v) { return (byte)Mathf.Clamp(Mathf.RoundToInt(v * 255f), 0, 255); } public static byte[] Card(byte[] img, string caption, bool mark) { byte[] array = new byte[4067712]; PaintPaper(array, 0, 1284); int imgY = ImgY; for (int i = 0; i < 948; i++) { Buffer.BlockCopy(img, i * 948 * 3, array, ((imgY + i) * 1056 + 54) * 3, 2844); } for (int j = 53; j <= 1002; j++) { Shade(array, j, imgY - 1, 0.9f); Shade(array, j, imgY + 948, 0.9f); } for (int k = imgY - 1; k <= imgY + 948; k++) { Shade(array, 53, k, 0.9f); Shade(array, 1002, k, 0.9f); } Writing(array, caption, mark); return array; } private static void PaintPaper(byte[] card, int fromY, int toY) { for (int i = fromY; i < toY; i++) { for (int j = 0; j < 1056; j++) { float num = (float)((((j * 73856093) ^ (i * 19349663)) >> 8) & 0xFF) / 255f - 0.5f; int num2 = (i * 1056 + j) * 3; card[num2] = ToByte(Paper.r + num * 0.012f); card[num2 + 1] = ToByte(Paper.g + num * 0.012f); card[num2 + 2] = ToByte(Paper.b + num * 0.012f); } } } private static void Shade(byte[] card, int x, int y, float k) { if (x >= 0 && y >= 0 && x < 1056 && y < 1284) { int num = (y * 1056 + x) * 3; card[num] = (byte)((float)(int)card[num] * k); card[num + 1] = (byte)((float)(int)card[num + 1] * k); card[num + 2] = (byte)((float)(int)card[num + 2] * k); } } private static void Writing(byte[] card, string caption, bool mark) { //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_017e: 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_0192: 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_01ec: 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_01fe: Unknown result type (might be due to invalid IL or missing references) //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_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) PaintPaper(card, 0, ImgY - 2); float[] array = new float[1056 * ImgY]; string text2; if (!string.IsNullOrWhiteSpace(caption)) { string text = caption.Trim().ToUpperInvariant(); float num = 0f; text2 = text; foreach (char c in text2) { num += Adv(c); } num -= 1.2f; float num2 = Mathf.Clamp(908f / Mathf.Max(1f, num), 7f, 15f); float num3 = 528f - num * num2 / 2f; float num4 = (float)ImgY * 0.5f - 2.5f * num2 + 14f; Random random = new Random(text.GetHashCode()); text2 = text; foreach (char c2 in text2) { float num5 = num2 * (0.94f + (float)random.NextDouble() * 0.12f); float num6 = num4 + ((float)random.NextDouble() - 0.5f) * num2 * 0.5f; foreach (Vector2[] item in Glyphs.Lines(c2)) { for (int j = 0; j + 1 < item.Length; j++) { Vector2 val = Wobble(item[j], random); Vector2 val2 = Wobble(item[j + 1], random); Stroke(array, num3 + (val.x + val.y * 0.16f) * num5, num6 + val.y * num5, num3 + (val2.x + val2.y * 0.16f) * num5, num6 + val2.y * num5, Mathf.Max(2.6f, num2 * 0.28f), 1f); } if (item.Length == 2) { Vector2 val3 = item[0] - item[1]; if (((Vector2)(ref val3)).sqrMagnitude < 0.2f) { Vector2 val4 = item[0]; Stroke(array, num3 + (val4.x + val4.y * 0.16f) * num5, num6 + val4.y * num5, num3 + (val4.x + val4.y * 0.16f) * num5 + 0.5f, num6 + val4.y * num5, Mathf.Max(3f, num2 * 0.32f), 1f); } } } num3 += Adv(c2) * num5; } Blend(card, array, new Color(0.11f, 0.13f, 0.3f)); Array.Clear(array, 0, array.Length); } if (!mark) { return; } float num7 = 3.1f; float num8 = 0f; text2 = "WOOD STUDIOS"; foreach (char c3 in text2) { num8 += Adv(c3); } float num9 = 1002f - num8 * num7; float num10 = 26f; text2 = "WOOD STUDIOS"; foreach (char c4 in text2) { foreach (Vector2[] item2 in Glyphs.Lines(c4)) { for (int k = 0; k + 1 < item2.Length; k++) { Stroke(array, num9 + item2[k].x * num7, num10 + item2[k].y * num7, num9 + item2[k + 1].x * num7, num10 + item2[k + 1].y * num7, 1.25f, 1f); } } num9 += Adv(c4) * num7; } Blend(card, array, new Color(0.6f, 0.6f, 0.62f)); float num11 = 1002f - num8 * num7 - 22f; for (int l = 24; l < 42; l++) { for (int m = 0; m < 5; m++) { Put(card, (int)num11 + m, l, new Color(1f, 0.45f, 0.1f)); Put(card, (int)num11 + 7 + m, l, new Color(0.08f, 0.14f, 0.36f)); } } } private static float Adv(char c) { if (c != ' ') { return Glyphs.Width(c) + 1.2f; } return 2.4f; } private static Vector2 Wobble(Vector2 p, Random rng) { //IL_0000: 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) return p + new Vector2(((float)rng.NextDouble() - 0.5f) * 0.22f, ((float)rng.NextDouble() - 0.5f) * 0.22f); } private static void Stroke(float[] ink, float ax, float ay, float bx, float by, float r, float a) { int num = Mathf.Max(0, Mathf.FloorToInt(Mathf.Min(ax, bx) - r - 1f)); int num2 = Mathf.Min(1055, Mathf.CeilToInt(Mathf.Max(ax, bx) + r + 1f)); int num3 = Mathf.Max(0, Mathf.FloorToInt(Mathf.Min(ay, by) - r - 1f)); int num4 = Mathf.Min(ImgY - 1, Mathf.CeilToInt(Mathf.Max(ay, by) + r + 1f)); float num5 = bx - ax; float num6 = by - ay; float num7 = num5 * num5 + num6 * num6; for (int i = num3; i <= num4; i++) { for (int j = num; j <= num2; j++) { float num8 = ((num7 > 0.0001f) ? Mathf.Clamp01((((float)j - ax) * num5 + ((float)i - ay) * num6) / num7) : 0f); float num9 = (float)j - (ax + num5 * num8); float num10 = (float)i - (ay + num6 * num8); float num11 = Mathf.Clamp01(r - Mathf.Sqrt(num9 * num9 + num10 * num10) + 0.5f) * a; int num12 = i * 1056 + j; if (num11 > ink[num12]) { ink[num12] = num11; } } } } private static void Blend(byte[] card, float[] ink, Color c) { //IL_0020: 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_0064: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < ink.Length; i++) { float num = ink[i]; if (!(num <= 0f)) { int num2 = i * 3; card[num2] = ToByte(Mathf.Lerp((float)(int)card[num2] / 255f, c.r, num)); card[num2 + 1] = ToByte(Mathf.Lerp((float)(int)card[num2 + 1] / 255f, c.g, num)); card[num2 + 2] = ToByte(Mathf.Lerp((float)(int)card[num2 + 2] / 255f, c.b, num)); } } } private static void Put(byte[] card, int x, int y, Color c) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (x >= 0 && y >= 0 && x < 1056 && y < 1284) { int num = (y * 1056 + x) * 3; card[num] = ToByte(c.r); card[num + 1] = ToByte(c.g); card[num + 2] = ToByte(c.b); } } public static Texture2D ToTexture(byte[] card) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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_002b: 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_003b: Expected O, but got Unknown Texture2D val = new Texture2D(1056, 1284, (TextureFormat)3, false); val.LoadRawTextureData(ToIl2Cpp(card)); val.Apply(false); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).anisoLevel = 4; ((Object)val).hideFlags = (HideFlags)32; return val; } public static string Save(byte[] card) { string text = "HP_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".png"; string path = Path.Combine(Folder, text); int num = 2; while (File.Exists(path)) { text = "HP_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + "_" + num + ".png"; path = Path.Combine(Folder, text); num++; } Write(path, card); Touch(); return text; } private static void Write(string path, byte[] card) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Texture2D val = new Texture2D(1056, 1284, (TextureFormat)3, false); try { val.LoadRawTextureData(ToIl2Cpp(card)); val.Apply(false); File.WriteAllBytes(path, ToManaged(ImageConversion.EncodeToPNG(val))); } finally { Object.Destroy((Object)(object)val); } } public static Texture2D Load(string name) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown if (string.IsNullOrEmpty(name)) { return null; } if (Cache.TryGetValue(name, out var value) && (Object)(object)value != (Object)null) { return value; } try { string path = Path.Combine(Folder, name); if (!File.Exists(path)) { return null; } value = new Texture2D(2, 2, (TextureFormat)3, true); ImageConversion.LoadImage(value, ToIl2Cpp(File.ReadAllBytes(path))); ((Texture)value).wrapMode = (TextureWrapMode)1; ((Texture)value).anisoLevel = 4; ((Object)value).hideFlags = (HideFlags)32; Cache[name] = value; CacheOrder.Add(name); while (CacheOrder.Count > 40) { string key = CacheOrder[0]; CacheOrder.RemoveAt(0); if (Cache.TryGetValue(key, out var value2) && (Object)(object)value2 != (Object)null) { Object.Destroy((Object)(object)value2); } Cache.Remove(key); } return value; } catch { return null; } } public static void Remember(string name, Texture2D t) { Cache[name] = t; CacheOrder.Add(name); } public static bool SetCaption(string name, string caption) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown try { LoadCaptions(); caption = (caption ?? "").Trim(); _captions[name] = caption; SaveCaptions(); string path = Path.Combine(Folder, name); Texture2D val = new Texture2D(2, 2, (TextureFormat)3, false); ImageConversion.LoadImage(val, ToIl2Cpp(File.ReadAllBytes(path))); if (((Texture)val).width != 1056 || ((Texture)val).height != 1284) { Object.Destroy((Object)(object)val); return false; } Texture2D val2 = new Texture2D(1056, 1284, (TextureFormat)3, false); val2.SetPixels32(val.GetPixels32()); byte[] card = ToManaged(val2.GetRawTextureData()); Object.Destroy((Object)(object)val); Object.Destroy((Object)val2); Writing(card, caption, CamCore.Mark.Value); Write(path, card); if (Cache.TryGetValue(name, out var value) && (Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } Cache.Remove(name); Touch(); return true; } catch (Exception ex) { CamCore.Log("Couldn't write the caption: " + ex.Message); return false; } } } internal static class Prints { private sealed class Shown { public string Name; public int Version; } public static string Next; private static float _scanAt; public static void Reset() { Next = null; } public static void Created(Placement.Placed p) { if (!(p?.Spec?.Id != "ic_photo") && string.IsNullOrEmpty(p.Text)) { Assign(p, PickForNewPrint()); } } private static string PickForNewPrint() { List<string> list = Photo.All(); if (Next != null && list.Contains(Next)) { string next = Next; Next = null; return next; } HashSet<string> hashSet = new HashSet<string>(); foreach (Placement.Placed item in Placement.All) { if (item?.Spec?.Id == "ic_photo" && !string.IsNullOrEmpty(item.Text)) { hashSet.Add(item.Text); } } for (int num = list.Count - 1; num >= 0; num--) { if (!hashSet.Contains(list[num])) { return list[num]; } } if (list.Count <= 0) { return null; } return list[list.Count - 1]; } private static void Assign(Placement.Placed p, string name) { p.Text = name ?? ""; try { Placement.UpdateRecord(p); } catch { } Apply(p); } private static void Apply(Placement.Placed p) { if ((Object)(object)p?.Go == (Object)null || (p.State is Shown shown && shown.Name == p.Text && shown.Version == Photo.Version)) { return; } Transform val = CamModels.Pic(p.Go.transform); if (!((Object)(object)val == (Object)null)) { Texture2D val2 = Photo.Load(p.Text); if ((Object)(object)val2 != (Object)null) { ((Component)val).GetComponent<Renderer>().sharedMaterial = CamModels.Textured(val2); } p.State = new Shown { Name = p.Text, Version = Photo.Version }; } } public static void Update() { if (Time.unscaledTime < _scanAt) { return; } _scanAt = Time.unscaledTime + 0.5f; foreach (Placement.Placed item in Placement.All) { if (!(item?.Spec?.Id != "ic_photo") && !((Object)(object)item.Go == (Object)null)) { if (string.IsNullOrEmpty(item.Text)) { Assign(item, PickForNewPrint()); } else { Apply(item); } } } } public static bool UsePrint(Placement.Placed p, RaycastHit hit, out string hint) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) hint = null; if (p == null) { return false; } List<string> list = Photo.All(); if (list.Count == 0) { hint = "No photos yet"; return true; } string text = Photo.Caption(p.Text); KeyCode useKey = FortifyApi.UseKey; int num = list.IndexOf(p.Text); hint = ((text.Length > 0) ? ("\"" + text + "\" ") : "") + $"[{useKey}] Show a different photo ({num + 1} of {list.Count})"; if (FortifyApi.KeyDown(useKey)) { Assign(p, list[(num + 1 + list.Count) % list.Count]); } return true; } public static bool UseAlbum(Placement.Placed p, RaycastHit hit, out string hint) { //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_002a: 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) KeyCode useKey = FortifyApi.UseKey; int count = Photo.All().Count; hint = $"[{useKey}] Open the photo album ({count} photo{((count == 1) ? "" : "s")})"; if (FortifyApi.KeyDown(useKey)) { Album.Show(); } return true; } } internal static class Snap { private static int _heldFrame = -10; private static Camera _cam; private static GameObject _view; private static bool _selfie; private static bool _aiming; private static float _readyAt; private static float _flashAt = -10f; private static Light _flash; private static Texture2D _print; private static string _printName; private static float _printAt = -100f; public static bool Typing; private static readonly StringBuilder Buf = new StringBuilder(); private static string _note = ""; private static float _noteAt = -100f; private static RenderTexture _prevRt; private static Texture2D _prev; private static float _prevAt; public static string Last = ""; private static int Filter { get { return Mathf.Clamp(CamCore.FilterPref.Value, 0, Photo.Filters.Length - 1); } set { CamCore.FilterPref.Value = value; CamCore.SavePrefs(); } } public static void Reset() { if ((Object)(object)_view != (Object)null) { Object.Destroy((Object)(object)_view); } _view = null; _print = null; _printAt = -100f; if (Typing) { StopTyping(save: false); } } public static bool Held(ItemSpec spec, Camera cam, Player pl, out string hint) { _heldFrame = Time.frameCount; _cam = cam; int value = CamCore.Shots.Value; uint num = Count("ic_film"); string text = ((value > 0) ? $"{value} shot{((value == 1) ? "" : "s")} left" : ((num != 0) ? "loading film" : "No film - Gas-Marts and hardware stores sell it")); hint = (Typing ? null : ("[Click] Take photo " + text)); return true; } public static void Update() { if (Typing) { TypeCaption(); } bool num = _heldFrame >= Time.frameCount - 1 && (Object)(object)_cam != (Object)null; if ((Object)(object)_flash != (Object)null) { float num2 = Mathf.Clamp01(1f - (Time.time - _flashAt) / 0.12f); _flash.intensity = num2 * 9f; ((Behaviour)_flash).enabled = num2 > 0f; } if (!num) { if ((Object)(object)_view != (Object)null && _view.activeSelf) { _view.SetActive(false); } _aiming = false; return; } ShowView(); if (Typing || Album.Open || Cursor.visible) { return; } _aiming = false; _selfie = false; if (CamCore.Shots.Value <= 0 && Count("ic_film") != 0 && Take("ic_film")) { CamCore.Shots.Value = 10; CamCore.SavePrefs(); Note("Loaded a new film pack - 10 shots"); } bool flag = false; try { flag = GameInput.GetButtonDown((ButtonCode)0); } catch { flag = Keys.MouseDown(0); } if (flag && Time.time >= _readyAt) { if (CamCore.Shots.Value <= 0) { Note("Out of film. The Gas-Marts and hardware stores sell film packs."); _readyAt = Time.time + 0.5f; } else { TakePhoto(); } } } public static string TakePhoto() { //IL_003f: 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_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_015e: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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_0116: Invalid comparison between Unknown and I4 //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) Camera val = (((Object)(object)_cam != (Object)null) ? _cam : Camera.main); if ((Object)(object)val == (Object)null) { return "no camera"; } _readyAt = Time.time + 1.4f; Vector3 position = ((Component)val).transform.position; int num = 0; List<(Renderer, ShadowCastingMode)> list = new List<(Renderer, ShadowCastingMode)>(); Vector3 val2; Quaternion rot; if (_selfie) { Vector3 forward = ((Component)val).transform.forward; val2 = position + forward * 0.62f + ((Component)val).transform.right * 0.12f + Vector3.up * 0.06f; rot = Quaternion.LookRotation(position + Vector3.down * 0.08f - val2, Vector3.up); try { Player local = Player.Local; if ((Object)(object)local != (Object)null) { foreach (Renderer componentsInChild in ((Component)local).GetComponentsInChildren<Renderer>(true)) { num |= 1 << ((Component)componentsInChild).gameObject.layer; if ((int)componentsInChild.shadowCastingMode == 3) { list.Add((componentsInChild, componentsInChild.shadowCastingMode)); componentsInChild.shadowCastingMode = (ShadowCastingMode)1; } } } } catch { } } else { val2 = position; rot = ((Component)val).transform.rotation; } bool active = (Object)(object)_view != (Object)null && _view.activeSelf; if ((Object)(object)_view != (Object)null) { _view.SetActive(false); } Fire(_selfie ? val2 : (position + ((Component)val).transform.forward * 0.25f)); byte[] array; try { array = Photo.Render(val, val2, rot, _selfie ? 72f : Mathf.Clamp(val.fieldOfView * 0.92f, 45f, 75f), num); } finally { foreach (var (val3, shadowCastingMode) in list) { if ((Object)(object)val3 != (Object)null) { val3.shadowCastingMode = shadowCastingMode; } } if ((Object)(object)_view != (Object)null) { _view.SetActive(active); } } Photo.Develop(array, 0, Environment.TickCount); byte[] card = Photo.Card(array, "", CamCore.Mark.Value); string text = Photo.Save(card); Texture2D val4 = Photo.ToTexture(card); Photo.Remember(text, val4); _print = val4; _printName = text; _printAt = Time.time; CamCore.Shots.Value = Mathf.Max(0, CamCore.Shots.Value - 1); CamCore.SavePrefs(); CamSound.Play(CamSound.Shutter, position, 0.5f); CamSound.Play(CamSound.Eject, position, 0.35f, 0.15f); bool flag = Give("ic_photo"); Prints.Next = text; Last = text + (flag ? " (print in your pockets)" : " (pockets full - still saved)"); if (!flag) { Note("Your pockets are full - the photo is still saved in your album."); } return Last; } private static void Fire(Vector3 at) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_flash == (Object)null) { GameObject val = new GameObject("ic_Flash"); Object.DontDestroyOnLoad((Object)val); _flash = val.AddComponent<Light>(); _flash.type = (LightType)2; _flash.range = 14f; _flash.color = new Color(1f, 0.98f, 0.94f); _flash.shadows = (LightShadows)0; } ((Component)_flash).transform.position = at; _flash.intensity = 9f; ((Behaviour)_flash).enabled = true; _flashAt = Time.time; } private static void StartTyping() { Typing = true; Buf.Length = 0; FortifyApi.OpenMenu("ic_caption"); } private static void StopTyping(bool save) { Typing = false; FortifyApi.CloseMenu("ic_caption"); if (save && _printName != null) { string text = Buf.ToString().Trim(); if (Photo.SetCaption(_printName, text)) { _print = Photo.Load(_printName); _printAt = Time.time - 1.5f; Note((text.Length > 0) ? "Caption written." : "Caption cleared."); } } } private static void TypeCaption() { Keys.MarkTextBox(); if (Keys.RawDown((KeyCode)13) || Keys.RawDown((KeyCode)271)) { StopTyping(save: true); return; } if (Keys.RawDown((KeyCode)27)) { StopTyping(save: false); return; } string text = Keys.Typed(Keys.RawHeld((KeyCode)304) || Keys.RawHeld((KeyCode)303)); foreach (char c in text) { if (c == '\b') { if (Buf.Length > 0) { Buf.Length--; } } else if (Buf.Length < 26 && (c == ' ' || Glyphs.CanShow(c)) && (c != ' ' || (Buf.Length != 0 && Buf[Buf.Length - 1] != ' '))) { Buf.Append(c); } } } public static string DevCaption(string text) { Buf.Length = 0; Buf.Append(text); StopTyping(save: true); return "caption " + text + " on " + _printName; } private static uint Count(string id) { try { PlayerInventory instance = PlayerSingleton<PlayerInventory>.Instance; return (instance != null) ? instance.GetAmountOfItem(id) : 0u; } catch { return 0u; } } private static bool Take(string id) { try { PlayerSingleton<PlayerInventory>.Instance.RemoveAmountOfItem(id, 1u); return true; } catch { return false; } } public static bool Give(string id) { try { PlayerInventory instance = PlayerSingleton<PlayerInventory>.Instance; ItemDefinition item = Registry.GetItem<ItemDefinition>(id); if ((Object)(object)instance == (Object)null || (Object)(object)item == (Object)null) { return false; } ItemInstance defaultInstance = item.GetDefaultInstance(1); if (defaultInstance == null || !instance.CanItemFitInInventory(defaultInstance, 1)) { return false; } instance.AddItemToInventory(defaultInstance); return true; } catch { return false; } } private static void ShowView() { //IL_0111: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_view == (Object)null || (Object)(object)_view.transform.parent != (Object)(object)((Component)_cam).transform) { if ((Object)(object)_view != (Object)null) { Object.Destroy((Object)(object)_view); } GameObject val = Catalog.Get("ic_camera")?.Template; if ((Object)(object)val == (Object)null) { return; } _view = CamModels.Plain(val, "ic_CameraView"); _view.transform.SetParent(((Component)_cam).transform, false); } if (!_view.activeSelf) { _view.SetActive(true); } float num = Time.time - (_readyAt - 1.4f); float num2 = ((num >= 0f && num < 0.25f) ? Mathf.Sin(num / 0.25f * (float)Math.PI) : 0f); Vector3 val2 = default(Vector3); Quaternion val3; if (_selfie) { ((Vector3)(ref val2))..ctor(0.05f, -0.12f, 0.5f); val3 = Quaternion.Euler(-6f, 180f, 0f); } else if (_aiming) { ((Vector3)(ref val2))..ctor(0.03f, -0.105f, 0.16f); val3 = Quaternion.Euler(0f, 0f, 0f); } else { ((Vector3)(ref val2))..ctor(0.19f, -0.2f, 0.36f); val3 = Quaternion.Euler(4f, -12f, 0f); } Transform transform = _view.transform; transform.localPosition = Vector3.Lerp(transform.localPosition, val2 + new Vector3(0f, num2 * 0.012f, (0f - num2) * 0.02f), 1f - Mathf.Exp((0f - Time.deltaTime) * 14f)); transform.localRotation = Quaternion.Slerp(transform.localRotation, val3, 1f - Mathf.Exp((0f - Time.deltaTime) * 14f)); } private static void Note(string s) { _note = s; _noteAt = Time.time; } public static void Draw() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) float num = Screen.width; float num2 = Screen.height; float num3 = num2 / 1080f; float num4 = 1f - (Time.time - _flashAt) / 0.35f; if (num4 > 0f) { WS_IC.FybCommon.Ui.Fill(new Rect(0f, 0f, num, num2), new Color(1f, 1f, 1f, num4 * 0.85f)); } if (_heldFrame >= Time.frameCount - 1 && !Cursor.visible && (_aiming || _selfie) && !Typing) { Viewfinder(num, num2, num3); } float num5 = Time.time - _printAt; if ((Object)(object)_print != (Object)null && num5 < 10f) { float num6 = Mathf.Clamp01(num5 / 0.7f); num6 = 1f - (1f - num6) * (1f - num6); float num7 = Mathf.Clamp01((num5 - 9.2f) / 0.8f); float num8 = 380f * num3; float num9 = num8 * 1056f / 1284f; float num10 = num - num9 - 60f * num3; float num11 = num2 - (num8 + 70f * num3) * num6 + num7 * (num8 + 90f * num3); Rect r = default(Rect); ((Rect)(ref r))..ctor(num10, num11, num9, num8); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref r)).x + 6f * num3, ((Rect)(ref r)).y + 8f * num3, ((Rect)(ref r)).width, ((Rect)(ref r)).height), new Color(0f, 0f, 0f, 0.3f)); WS_IC.WoodKit.Ui.Image(r, _print); float num12 = Mathf.Clamp01((num5 - 0.5f) / 5f); float num13 = 9f / 176f * num9; float num14 = 0.056074765f * num8; float num15 = 79f / 88f * num9; WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref r)).x + num13, ((Rect)(ref r)).y + num14, num15, num15), new Color(0.17f, 0.19f, 0.24f, 1f - num12 * num12 * (3f - 2f * num12))); if (!Typing && num5 > 1.5f && num5 < 9f) { WS_IC.FybCommon.Ui.Text(new Rect(((Rect)(ref r)).x - 20f * num3, ((Rect)(ref r)).yMax + 4f * num3, num9 + 40f * num3, 26f * num3), "Added to your photos - hang it on a wall", Mathf.RoundToInt(16f * num3), new Color(1f, 1f, 1f, 0.9f), (TextAnchor)4, bold: true, wrap: false); } } if (Typing) { Rect r2 = default(Rect); ((Rect)(ref r2))..ctor(num / 2f - 330f * num3, num2 * 0.42f, 660f * num3, 124f * num3); WS_IC.FybCommon.Ui.Fill(r2, new Color(0.03f, 0.06f, 0.13f, 0.92f)); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref r2)).x, ((Rect)(ref r2)).y, ((Rect)(ref r2)).width, 3f * num3), new Color(1f, 0.55f, 0.12f)); WS_IC.FybCommon.Ui.Text(new Rect(((Rect)(ref r2)).x, ((Rect)(ref r2)).y + 10f * num3, ((Rect)(ref r2)).width, 26f * num3), "WRITE A CAPTION", Mathf.RoundToInt(16f * num3), new Color(1f, 0.6f, 0.15f), (TextAnchor)4); Rect r3 = new Rect(((Rect)(ref r2)).x + 24f * num3, ((Rect)(ref r2)).y + 42f * num3, ((Rect)(ref r2)).width - 48f * num3, 44f * num3); WS_IC.FybCommon.Ui.Fill(r3, new Color(0.96f, 0.95f, 0.92f)); WS_IC.FybCommon.Ui.Text(r3, string.Concat(str1: (Time.unscaledTime % 1f < 0.5f) ? "|" : " ", str0: Buf.ToString().ToUpperInvariant()), Mathf.RoundToInt(24f * num3), new Color(0.11f, 0.13f, 0.3f), (TextAnchor)4); WS_IC.FybCommon.Ui.Text(new Rect(((Rect)(ref r2)).x, ((Rect)(ref r2)).y + 92f * num3, ((Rect)(ref r2)).width, 24f * num3), "Enter to write it on the photo - Esc to cancel", Mathf.RoundToInt(14f * num3), new Color(1f, 1f, 1f, 0.75f), (TextAnchor)4, bold: false); } if (Time.time - _noteAt < 2.5f && _note.Length > 0) { float num16 = Mathf.Clamp01((2.5f - (Time.time - _noteAt)) * 2f); Rect r4 = new Rect(num / 2f - 300f * num3, num2 * 0.7f, 600f * num3, 40f * num3); WS_IC.FybCommon.Ui.Fill(r4, new Color(0.03f, 0.06f, 0.13f, 0.75f * num16)); WS_IC.FybCommon.Ui.Text(r4, _note, Mathf.RoundToInt(18f * num3), new Color(1f, 1f, 1f, num16), (TextAnchor)4, bold: true, wrap: false); } } private static void Viewfinder(float W, float H, float s) { //IL_005c: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_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_0104: 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_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_0144: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) float num = H * 0.8f; Rect f = default(Rect); ((Rect)(ref f))..ctor(W / 2f - num / 2f, H / 2f - num / 2f, num, num); Color c = default(Color); ((Color)(ref c))..ctor(0f, 0f, 0f, 0.45f); WS_IC.FybCommon.Ui.Fill(new Rect(0f, 0f, ((Rect)(ref f)).x, H), c); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref f)).xMax, 0f, W - ((Rect)(ref f)).xMax, H), c); Color c2 = default(Color); ((Color)(ref c2))..ctor(1f, 1f, 1f, 0.85f); float num2 = 46f * s; float num3 = 3f * s; WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref f)).x, ((Rect)(ref f)).y, num2, num3), c2); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref f)).x, ((Rect)(ref f)).y, num3, num2), c2); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref f)).xMax - num2, ((Rect)(ref f)).y, num2, num3), c2); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref f)).xMax - num3, ((Rect)(ref f)).y, num3, num2), c2); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref f)).x, ((Rect)(ref f)).yMax - num3, num2, num3), c2); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref f)).x, ((Rect)(ref f)).yMax - num2, num3, num2), c2); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref f)).xMax - num2, ((Rect)(ref f)).yMax - num3, num2, num3), c2); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref f)).xMax - num3, ((Rect)(ref f)).yMax - num2, num3, num2), c2); WS_IC.FybCommon.Ui.Text(new Rect(((Rect)(ref f)).x, ((Rect)(ref f)).yMax + 8f * s, ((Rect)(ref f)).width, 26f * s), (_selfie ? "SELFIE - " : "") + Photo.Filters[Filter].ToUpperInvariant() + $" - {CamCore.Shots.Value} LEFT", Mathf.RoundToInt(15f * s), c2, (TextAnchor)4, bold: true, wrap: false); if (_selfie) { SelfiePreview(f, s); } } private static void SelfiePreview(Rect f, float s) { //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_00fa: 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_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_0116: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Invalid comparison between Unknown and I4 //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) Camera val = (((Object)(object)_cam != (Object)null) ? _cam : Camera.main); if ((Object)(object)val == (Object)null) { return; } if (Event.current != null && (int)Event.current.type == 7 && Time.unscaledTime - _prevAt > 0.1f) { _prevAt = Time.unscaledTime; try { if (_prevRt == null) { _prevRt = new RenderTexture(256, 256, 24, (RenderTextureFormat)0); } if (_prev == null) { _prev = new Texture2D(256, 256, (TextureFormat)3, false) { hideFlags = (HideFlags)32 }; } GameObject val2 = new GameObject("ic_Preview"); Camera val3 = val2.AddComponent<Camera>(); val3.CopyFrom(val); Vector3 position = ((Component)val).transform.position; Vector3 val4 = position + ((Component)val).transform.forward * 0.62f + ((Component)val).transform.right * 0.12f + Vector3.up * 0.06f; val2.transform.SetPositionAndRotation(val4, Quaternion.LookRotation(position + Vector3.down * 0.08f - val4, Vector3.up)); val3.fieldOfView = 72f; val3.aspect = 1f; Player local = Player.Local; List<(Renderer, ShadowCastingMode)> list = new List<(Renderer, ShadowCastingMode)>(); if ((Object)(object)local != (Object)null) { foreach (Renderer componentsInChild in ((Component)local).GetComponentsInChildren<Renderer>(true)) { val3.cullingMask |= 1 << ((Component)componentsInChild).gameObject.layer; if ((int)componentsInChild.shadowCastingMode == 3) { list.Add((componentsInChild, componentsInChild.shadowCastingMode)); componentsInChild.shadowCastingMode = (ShadowCastingMode)1; } } } bool active = (Object)(object)_view != (Object)null && _view.activeSelf; if ((Object)(object)_view != (Object)null) { _view.SetActive(false); } val3.targetTexture = _prevRt; val3.Render(); foreach (var (val5, shadowCastingMode) in list) { if ((Object)(object)val5 != (Object)null) { val5.shadowCastingMode = shadowCastingMode; } } if ((Object)(object)_view != (Object)null) { _view.SetActive(active); } RenderTexture active2 = RenderTexture.active; RenderTexture.active = _prevRt; _prev.ReadPixels(new Rect(0f, 0f, 256f, 256f), 0, 0, false); _prev.Apply(false); RenderTexture.active = active2; val3.targetTexture = null; Object.Destroy((Object)(object)val2); } catch { } } if ((Object)(object)_prev != (Object)null) { float num = 300f * s; Rect r = default(Rect); ((Rect)(ref r))..ctor(((Rect)(ref f)).xMax + 30f * s, ((Rect)(ref f)).y + 20f * s, num, num); WS_IC.FybCommon.Ui.Fill(new Rect(((Rect)(ref r)).x - 6f * s, ((Rect)(ref r)).y - 6f * s, ((Rect)(ref r)).width + 12f * s, ((Rect)(ref r)).height + 40f * s), new Color(0.96f, 0.95f, 0.92f)); WS_IC.WoodKit.Ui.Image(r, _prev); } } } internal static class CamSound { private const float Tau = (float)Math.PI * 2f; private sta