Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of PolaroidCompany v1.0.1
PolaroidCompany.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PolaroidCompany")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("PolaroidCompany")] [assembly: AssemblyTitle("PolaroidCompany")] [assembly: AssemblyVersion("1.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PolaroidCompany { internal class ArmRig { public Transform upperR; public Transform lowerR; public Transform handR; public Transform upperL; public Transform lowerL; public Transform handL; public Transform shoulderR; public Transform shoulderL; public Transform chest; public Transform head; public SkinnedMeshRenderer source; public bool Valid { get { if ((Object)(object)upperR != (Object)null && (Object)(object)lowerR != (Object)null && (Object)(object)handR != (Object)null && (Object)(object)upperL != (Object)null && (Object)(object)lowerL != (Object)null) { return (Object)(object)handL != (Object)null; } return false; } } public static ArmRig From(SkinnedMeshRenderer smr) { ArmRig armRig = new ArmRig { source = smr }; if ((Object)(object)smr == (Object)null) { return armRig; } Transform[] bones = smr.bones; foreach (Transform val in bones) { if (!((Object)(object)val == (Object)null)) { switch (((Object)val).name) { case "arm.R_upper": armRig.upperR = val; break; case "arm.R_lower": armRig.lowerR = val; break; case "hand.R": armRig.handR = val; break; case "arm.L_upper": armRig.upperL = val; break; case "arm.L_lower": armRig.lowerL = val; break; case "hand.L": armRig.handL = val; break; case "shoulder.R": armRig.shoulderR = val; break; case "shoulder.L": armRig.shoulderL = val; break; case "spine.003": armRig.chest = val; break; case "spine.004": armRig.head = val; break; } } } return armRig; } } internal static class TwoBoneIK { public static void Solve(Transform upper, Transform lower, Transform end, Vector3 target, Quaternion? targetRot, Vector3 hint, float poleWeight) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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_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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) Vector3 position = upper.position; Vector3 position2 = lower.position; Vector3 position3 = end.position; Vector3 val = position2 - position; float magnitude = ((Vector3)(ref val)).magnitude; val = position3 - position2; float magnitude2 = ((Vector3)(ref val)).magnitude; if (!(magnitude < 0.0001f) && !(magnitude2 < 0.0001f)) { val = target - position; float num = Mathf.Clamp(((Vector3)(ref val)).magnitude, 0.01f, (magnitude + magnitude2) * 0.999f); float num2 = Angle(position3 - position, position2 - position); float num3 = Angle(position - position2, position3 - position2); float num4 = Mathf.Acos(Mathf.Clamp((magnitude2 * magnitude2 - magnitude * magnitude - num * num) / (-2f * magnitude * num), -1f, 1f)); float num5 = Mathf.Acos(Mathf.Clamp((num * num - magnitude * magnitude - magnitude2 * magnitude2) / (-2f * magnitude * magnitude2), -1f, 1f)); Vector3 val2 = Vector3.Cross(position3 - position, position2 - position); if (((Vector3)(ref val2)).sqrMagnitude < 1E-10f) { val2 = Vector3.Cross(position3 - position, hint - position); } if (((Vector3)(ref val2)).sqrMagnitude < 1E-10f) { val2 = Vector3.Cross(position3 - position, Vector3.up); } ((Vector3)(ref val2)).Normalize(); upper.rotation = Quaternion.AngleAxis((num4 - num2) * 57.29578f, val2) * upper.rotation; lower.rotation = Quaternion.AngleAxis((num5 - num3) * 57.29578f, val2) * lower.rotation; position3 = end.position; upper.rotation = Quaternion.FromToRotation(position3 - position, target - position) * upper.rotation; val = target - position; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val3 = Vector3.ProjectOnPlane(lower.position - position, normalized); Vector3 val4 = Vector3.ProjectOnPlane(hint - position, normalized); if (((Vector3)(ref val3)).sqrMagnitude > 1E-08f && ((Vector3)(ref val4)).sqrMagnitude > 1E-08f) { upper.rotation = Quaternion.AngleAxis(Vector3.SignedAngle(val3, val4, normalized) * Mathf.Clamp01(poleWeight), normalized) * upper.rotation; } if (targetRot.HasValue) { end.rotation = targetRot.Value; } } } private static float Angle(Vector3 x, Vector3 y) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return Mathf.Acos(Mathf.Clamp(Vector3.Dot(((Vector3)(ref x)).normalized, ((Vector3)(ref y)).normalized), -1f, 1f)); } } internal static class Cfg { public static ConfigEntry<int> Price; public static ConfigEntry<Language> Lang; public static ConfigEntry<string> HoldAnim; public static ConfigEntry<bool> TwoHandedAnim; public static ConfigEntry<string> HoldPos; public static ConfigEntry<string> HoldRot; public static ConfigEntry<float> RaiseTime; public static ConfigEntry<float> LowerTime; public static ConfigEntry<float> ArcHeight; public static ConfigEntry<float> OverlayStart; public static ConfigEntry<float> ZoomFov; public static ConfigEntry<float> HoldAfterShot; public static ConfigEntry<float> ShotCooldown; public static ConfigEntry<float> FlashBrightness; public static ConfigEntry<float> EmissionScale; public static ConfigEntry<float> ModelScale; public static ConfigEntry<bool> DetectThirdPerson; public static ConfigEntry<float> ZoomMin; public static ConfigEntry<float> ZoomMax; public static ConfigEntry<float> ZoomStep; public static ConfigEntry<float> DevelopMin; public static ConfigEntry<float> DevelopMax; public static ConfigEntry<string> PhotoHoldPos; public static ConfigEntry<string> PhotoHoldRot; public static ConfigEntry<string> PhotoFpPos; public static ConfigEntry<string> PhotoFpRot; public static ConfigEntry<float> PhotoScale; public static ConfigEntry<float> RenderScale; public static ConfigEntry<float> PhotoContrast; public static ConfigEntry<float> PhotoSaturation; public static ConfigEntry<float> PhotoGamma; public static ConfigEntry<int> PhotoQuality; public static ConfigEntry<string> PaintKey; public static ConfigEntry<string> WallKey; public static ConfigEntry<string> ViewKey; private static ConfigFile hidden; public static bool ViewIsClick { get { string text = (ViewKey.Value ?? "").Trim().ToLowerInvariant(); switch (text) { default: return text == "좌클릭"; case "": case "leftclick": case "lmb": case "mouse0": return true; } } } public static string ViewKeyLabel { get { if (!ViewIsClick) { return ViewKey.Value.Trim().ToUpper(); } return "LMB"; } } public static void Bind(ConfigFile c) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown Lang = c.Bind<Language>("1. 일반 (General)", "언어 (Language)", Language.Korean, "화면 글자 언어 (게임 재시작 후 적용) / Display language (restart required): Korean, English, Chinese, Japanese"); Price = c.Bind<int>("1. 일반 (General)", "카메라 가격 (Camera price)", 100, "터미널 상점 가격 / Store price (credits)"); ViewKey = c.Bind<string>("2. 단축키 (Keys)", "사진 크게 보기 (View photo)", "LeftClick", "사진을 들고 이 키로 크게 보기. LeftClick 또는 키 이름(V, Q ...) / Key to view a held photo. LeftClick or a key name (V, Q ...)"); WallKey = c.Bind<string>("2. 단축키 (Keys)", "벽에 붙이기 (Hang on wall)", "F", "사진을 들고 함선 벽을 보며 누르기. 키 이름(F, G ...) / Key to hang a photo on the ship wall"); hidden = new ConfigFile(Path.Combine(Path.GetTempPath(), "PolaroidCompany_internal_" + Guid.NewGuid().ToString("N") + ".cfg"), false); hidden.SaveOnConfigSet = false; ConfigFile obj = hidden; PaintKey = obj.Bind<string>("i", "PaintKey", "R", ""); ModelScale = obj.Bind<float>("i", "ModelScale", 2.03f, ""); RaiseTime = obj.Bind<float>("i", "RaiseTime", 0.38f, ""); LowerTime = obj.Bind<float>("i", "LowerTime", 0.3f, ""); HoldAfterShot = obj.Bind<float>("i", "HoldAfterShot", 0.45f, ""); ShotCooldown = obj.Bind<float>("i", "ShotCooldown", 0.8f, ""); FlashBrightness = obj.Bind<float>("i", "FlashBrightness", 1f, ""); ZoomFov = obj.Bind<float>("i", "ZoomFov", 56f, ""); ZoomMin = obj.Bind<float>("i", "ZoomMin", 18f, ""); ZoomMax = obj.Bind<float>("i", "ZoomMax", 70f, ""); ZoomStep = obj.Bind<float>("i", "ZoomStep", 4f, ""); PhotoScale = obj.Bind<float>("i", "PhotoScale", 2.4f, ""); DevelopMin = obj.Bind<float>("i", "DevelopMin", 5f, ""); DevelopMax = obj.Bind<float>("i", "DevelopMax", 10f, ""); PhotoQuality = obj.Bind<int>("i", "PhotoQuality", 92, ""); RenderScale = obj.Bind<float>("i", "RenderScale", 2f, ""); PhotoContrast = obj.Bind<float>("i", "PhotoContrast", 1.12f, ""); PhotoSaturation = obj.Bind<float>("i", "PhotoSaturation", 1.12f, ""); PhotoGamma = obj.Bind<float>("i", "PhotoGamma", 1.08f, ""); HoldAnim = obj.Bind<string>("i", "HoldAnim", "HoldLung", ""); TwoHandedAnim = obj.Bind<bool>("i", "TwoHandedAnim", true, ""); HoldPos = obj.Bind<string>("i", "HoldPos", "0,0.03,0", ""); HoldRot = obj.Bind<string>("i", "HoldRot", "0,0,0", ""); ArcHeight = obj.Bind<float>("i", "ArcHeight", 0.05f, ""); OverlayStart = obj.Bind<float>("i", "OverlayStart", 0.72f, ""); EmissionScale = obj.Bind<float>("i", "EmissionScale", 30f, ""); DetectThirdPerson = obj.Bind<bool>("i", "DetectThirdPerson", true, ""); PhotoFpPos = obj.Bind<string>("i", "PhotoFpPos", "0.15,-0.16,0.42", ""); PhotoFpRot = obj.Bind<string>("i", "PhotoFpRot", "-82,-8,0", ""); PhotoHoldPos = obj.Bind<string>("i", "PhotoHoldPos", "0,0.02,0", ""); PhotoHoldRot = obj.Bind<string>("i", "PhotoHoldRot", "90,0,0", ""); } public static Vector3 V(ConfigEntry<string> e) { //IL_006c: 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) string[] array = e.Value.Split(','); if (array.Length != 3) { return Vector3.zero; } float.TryParse(array[0].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result); float.TryParse(array[1].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result2); float.TryParse(array[2].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result3); return new Vector3(result, result2, result3); } } public class GlbModel { public class Node { public string name; public Vector3 t = Vector3.zero; public Quaternion r = Quaternion.identity; public Vector3 s = Vector3.one; public int mesh = -1; public List<int> children = new List<int>(); } public class MatDef { public string name; public Color baseLinear = Color.white; public float metallic; public float roughness = 0.5f; public Color emissiveLinear = Color.black; public bool blend; } public readonly List<Node> nodes = new List<Node>(); public readonly List<Mesh> meshes = new List<Mesh>(); public readonly List<MatDef> mats = new List<MatDef>(); public readonly List<int> roots = new List<int>(); public static readonly Dictionary<Mesh, string[]> MeshMaterialNames = new Dictionary<Mesh, string[]>(); private byte[] bin; private Dictionary<string, object> js; public static GlbModel Load(byte[] data) { GlbModel glbModel = new GlbModel(); glbModel.Parse(data); return glbModel; } private void Parse(byte[] data) { //IL_011f: 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_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Expected O, but got Unknown //IL_0722: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) if (BitConverter.ToUInt32(data, 0) != 1179937895) { throw new Exception("GLB 파일이 아닙니다"); } int num = BitConverter.ToInt32(data, 12); js = MiniJson.O(MiniJson.Parse(Encoding.UTF8.GetString(data, 20, num))); int num2 = 20 + num; int num3 = BitConverter.ToInt32(data, num2); bin = new byte[num3]; Buffer.BlockCopy(data, num2 + 8, bin, 0, num3); List<object> list = MiniJson.L(MiniJson.Get(js, "materials")); if (list != null) { foreach (object item in list) { Dictionary<string, object> d = MiniJson.O(item); MatDef matDef = new MatDef { name = (string)MiniJson.Get(d, "name") }; Dictionary<string, object> d2 = MiniJson.O(MiniJson.Get(d, "pbrMetallicRoughness")); List<object> list2 = MiniJson.L(MiniJson.Get(d2, "baseColorFactor")); if (list2 != null) { matDef.baseLinear = new Color(MiniJson.F(list2[0]), MiniJson.F(list2[1]), MiniJson.F(list2[2]), MiniJson.F(list2[3])); } if (MiniJson.Get(d2, "metallicFactor") != null) { matDef.metallic = MiniJson.F(MiniJson.Get(d2, "metallicFactor")); } if (MiniJson.Get(d2, "roughnessFactor") != null) { matDef.roughness = MiniJson.F(MiniJson.Get(d2, "roughnessFactor")); } List<object> list3 = MiniJson.L(MiniJson.Get(d, "emissiveFactor")); float num4 = 1f; Dictionary<string, object> dictionary = MiniJson.O(MiniJson.Get(MiniJson.O(MiniJson.Get(d, "extensions")), "KHR_materials_emissive_strength")); if (dictionary != null) { num4 = MiniJson.F(MiniJson.Get(dictionary, "emissiveStrength")); } if (list3 != null) { matDef.emissiveLinear = new Color(MiniJson.F(list3[0]) * num4, MiniJson.F(list3[1]) * num4, MiniJson.F(list3[2]) * num4, 1f); } matDef.blend = (string)MiniJson.Get(d, "alphaMode") == "BLEND"; mats.Add(matDef); } } foreach (object item2 in MiniJson.L(MiniJson.Get(js, "meshes"))) { Dictionary<string, object> d3 = MiniJson.O(item2); List<object> list4 = MiniJson.L(MiniJson.Get(d3, "primitives")); List<Vector3> list5 = new List<Vector3>(); List<Vector3> list6 = new List<Vector3>(); List<Vector2> list7 = new List<Vector2>(); List<int[]> list8 = new List<int[]>(); List<string> list9 = new List<string>(); bool flag = false; foreach (object item3 in list4) { if (MiniJson.O(MiniJson.Get(MiniJson.O(item3), "attributes")).ContainsKey("TEXCOORD_0")) { flag = true; } } foreach (object item4 in list4) { Dictionary<string, object> d4 = MiniJson.O(item4); Dictionary<string, object> dictionary2 = MiniJson.O(MiniJson.Get(d4, "attributes")); int count = list5.Count; float[] array = ReadFloats(MiniJson.I(MiniJson.Get(dictionary2, "POSITION"))); float[] array2 = ReadFloats(MiniJson.I(MiniJson.Get(dictionary2, "NORMAL"))); float[] array3 = (dictionary2.ContainsKey("TEXCOORD_0") ? ReadFloats(MiniJson.I(MiniJson.Get(dictionary2, "TEXCOORD_0"))) : null); int num5 = array.Length / 3; for (int i = 0; i < num5; i++) { list5.Add(new Vector3(0f - array[i * 3], array[i * 3 + 1], array[i * 3 + 2])); list6.Add(new Vector3(0f - array2[i * 3], array2[i * 3 + 1], array2[i * 3 + 2])); if (flag) { list7.Add((Vector2)((array3 != null) ? new Vector2(array3[i * 2], 1f - array3[i * 2 + 1]) : Vector2.zero)); } } int[] array4 = ReadIndices(MiniJson.I(MiniJson.Get(d4, "indices"))); int[] array5 = new int[array4.Length]; for (int j = 0; j < array4.Length; j += 3) { array5[j] = array4[j] + count; array5[j + 1] = array4[j + 2] + count; array5[j + 2] = array4[j + 1] + count; } list8.Add(array5); int num6 = ((MiniJson.Get(d4, "material") != null) ? MiniJson.I(MiniJson.Get(d4, "material")) : (-1)); list9.Add((num6 >= 0) ? mats[num6].name : ""); } Mesh val = new Mesh { name = (string)MiniJson.Get(d3, "name") }; if (list5.Count > 65000) { val.indexFormat = (IndexFormat)1; } val.SetVertices(list5); val.SetNormals(list6); if (flag) { val.SetUVs(0, list7); } val.subMeshCount = list8.Count; for (int k = 0; k < list8.Count; k++) { val.SetTriangles(list8[k], k, false); } val.RecalculateBounds(); val.UploadMeshData(false); meshes.Add(val); MeshMaterialNames[val] = list9.ToArray(); } foreach (object item5 in MiniJson.L(MiniJson.Get(js, "nodes"))) { Dictionary<string, object> d5 = MiniJson.O(item5); Node node = new Node { name = (((string)MiniJson.Get(d5, "name")) ?? "node") }; List<object> list10 = MiniJson.L(MiniJson.Get(d5, "translation")); List<object> list11 = MiniJson.L(MiniJson.Get(d5, "rotation")); List<object> list12 = MiniJson.L(MiniJson.Get(d5, "scale")); if (list10 != null) { node.t = new Vector3(0f - MiniJson.F(list10[0]), MiniJson.F(list10[1]), MiniJson.F(list10[2])); } if (list11 != null) { node.r = new Quaternion(MiniJson.F(list11[0]), 0f - MiniJson.F(list11[1]), 0f - MiniJson.F(list11[2]), MiniJson.F(list11[3])); } if (list12 != null) { node.s = new Vector3(MiniJson.F(list12[0]), MiniJson.F(list12[1]), MiniJson.F(list12[2])); } if (MiniJson.Get(d5, "mesh") != null) { node.mesh = MiniJson.I(MiniJson.Get(d5, "mesh")); } List<object> list13 = MiniJson.L(MiniJson.Get(d5, "children")); if (list13 != null) { foreach (object item6 in list13) { node.children.Add(MiniJson.I(item6)); } } nodes.Add(node); } foreach (object item7 in MiniJson.L(MiniJson.Get(MiniJson.O(MiniJson.L(MiniJson.Get(js, "scenes"))[0]), "nodes"))) { roots.Add(MiniJson.I(item7)); } } private float[] ReadFloats(int accIndex) { Dictionary<string, object> d = MiniJson.O(MiniJson.L(MiniJson.Get(js, "accessors"))[accIndex]); Dictionary<string, object> d2 = MiniJson.O(MiniJson.L(MiniJson.Get(js, "bufferViews"))[MiniJson.I(MiniJson.Get(d, "bufferView"))]); int num = CompCount((string)MiniJson.Get(d, "type")); int num2 = MiniJson.I(MiniJson.Get(d, "count")); int num3 = MiniJson.I(MiniJson.Get(d2, "byteOffset")) + MiniJson.I(MiniJson.Get(d, "byteOffset")); float[] array = new float[num2 * num]; for (int i = 0; i < array.Length; i++) { array[i] = BitConverter.ToSingle(bin, num3 + i * 4); } return array; } private int[] ReadIndices(int accIndex) { Dictionary<string, object> d = MiniJson.O(MiniJson.L(MiniJson.Get(js, "accessors"))[accIndex]); Dictionary<string, object> d2 = MiniJson.O(MiniJson.L(MiniJson.Get(js, "bufferViews"))[MiniJson.I(MiniJson.Get(d, "bufferView"))]); int num = MiniJson.I(MiniJson.Get(d, "count")); int num2 = MiniJson.I(MiniJson.Get(d, "componentType")); int num3 = MiniJson.I(MiniJson.Get(d2, "byteOffset")) + MiniJson.I(MiniJson.Get(d, "byteOffset")); int[] array = new int[num]; for (int i = 0; i < num; i++) { switch (num2) { case 5123: array[i] = BitConverter.ToUInt16(bin, num3 + i * 2); break; case 5125: array[i] = (int)BitConverter.ToUInt32(bin, num3 + i * 4); break; default: array[i] = bin[num3 + i]; break; } } return array; } private static int CompCount(string t) { return t switch { "SCALAR" => 1, "VEC2" => 2, "VEC3" => 3, "VEC4" => 4, _ => 1, }; } public GameObject Instantiate(Transform parent) { GameObject val = null; foreach (int root in roots) { GameObject val2 = Build(root, parent); if ((Object)(object)val == (Object)null) { val = val2; } } return val; } public GameObject InstantiateNode(string name, Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < nodes.Count; i++) { if (!(nodes[i].name != name)) { GameObject obj = Build(i, parent); obj.transform.localPosition = Vector3.zero; obj.transform.localRotation = Quaternion.identity; return obj; } } return null; } public static void FlipU(MeshFilter mf) { //IL_005a: 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_0072: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)mf == (Object)null) && !((Object)(object)mf.sharedMesh == (Object)null)) { Mesh sharedMesh = mf.sharedMesh; Mesh val = Object.Instantiate<Mesh>(sharedMesh); ((Object)val).name = ((Object)sharedMesh).name + "_flip"; List<Vector2> list = new List<Vector2>(); val.GetUVs(0, list); for (int i = 0; i < list.Count; i++) { list[i] = new Vector2(1f - list[i].x, list[i].y); } val.SetUVs(0, list); if (MeshMaterialNames.TryGetValue(sharedMesh, out var value)) { MeshMaterialNames[val] = value; } mf.sharedMesh = val; } } private GameObject Build(int ni, Transform parent) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) Node node = nodes[ni]; GameObject val = new GameObject(node.name); val.layer = (((Object)(object)parent != (Object)null) ? ((Component)parent).gameObject.layer : 0); val.transform.SetParent(parent, false); val.transform.localPosition = node.t; val.transform.localRotation = node.r; val.transform.localScale = node.s; if (node.mesh >= 0) { val.AddComponent<MeshFilter>().sharedMesh = meshes[node.mesh]; ((Renderer)val.AddComponent<MeshRenderer>()).shadowCastingMode = (ShadowCastingMode)1; } foreach (int child in node.children) { Build(child, val.transform); } return val; } public MatDef FindMat(string name) { foreach (MatDef mat in mats) { if (mat.name == name) { return mat; } } return null; } } public enum Language { Korean, English, Chinese, Japanese } internal static class Lang { private static readonly Dictionary<string, string[]> T = new Dictionary<string, string[]> { ["cam_name"] = new string[4] { "폴라로이드 카메라", "Polaroid camera", "拍立得相机", "ポラロイドカメラ" }, ["cam_sub"] = new string[4] { "추억을 남겨요", "Capture the moment", "留下回忆", "思い出を残そう" }, ["photo_name"] = new string[4] { "폴라로이드 사진", "Polaroid photo", "拍立得照片", "ポラロイド写真" }, ["photo_sub"] = new string[4] { "가치: 0", "Value: 0", "价值: 0", "価値: 0" }, ["tip_aim"] = new string[4] { "눈에 대기 / 찰칵 : [LMB]", "Raise / Snap : [LMB]", "举起 / 拍照 : [LMB]", "構える / 撮る : [LMB]" }, ["tip_lower"] = new string[4] { "내리기 : [RMB]", "Lower : [RMB]", "放下 : [RMB]", "下ろす : [RMB]" }, ["tip_view"] = new string[4] { "크게 보기 : [{0}]", "View : [{0}]", "查看 : [{0}]", "見る : [{0}]" }, ["lmb"] = new string[4] { "좌클릭", "LMB", "左键", "左クリック" }, ["tip_wall"] = new string[4] { "벽에 붙이기 : [{0}]", "Hang on wall : [{0}]", "挂到墙上 : [{0}]", "壁に貼る : [{0}]" }, ["term_info"] = new string[4] { "폴라로이드 카메라\n\n좌클릭으로 눈에 대고, 한 번 더 누르면 찰칵!\n찍은 사진은 꾸며서 함선 벽에 걸 수 있어요.\n\n", "Polaroid camera\n\nLeft click to raise it to your eye, click again to snap!\nDecorate your photos and hang them on the ship walls.\n\n", "拍立得相机\n\n左键举到眼前,再按一次拍照!\n照片可以装饰后挂在飞船墙上。\n\n", "ポラロイドカメラ\n\n左クリックで構えて、もう一度押すと撮影!\n写真はデコって船の壁に飾れます。\n\n" }, ["vf_hint"] = new string[4] { "좌클릭 찰칵 휠 줌 우클릭 내리기", "LMB Snap Wheel Zoom RMB Lower", "左键 拍照 滚轮 缩放 右键 放下", "左クリック 撮影 ホイール ズーム 右クリック 下ろす" }, ["pv_paint"] = new string[4] { "[{0}] 꾸미기", "[{0}] Decorate", "[{0}] 装饰", "[{0}] デコる" }, ["pv_close"] = new string[4] { "{0} · 우클릭 닫기", "{0} · RMB Close", "{0} · 右键 关闭", "{0} · 右クリック 閉じる" }, ["pp_title"] = new string[4] { "사진 꾸미기", "Decorate photo", "装饰照片", "写真デコ" }, ["pp_sub"] = new string[4] { "그림은 언제든 다시 고칠 수 있어요", "You can edit your drawing anytime", "随时可以再修改", "描いた絵はいつでも直せます" }, ["pp_pen"] = new string[4] { "펜", "Pen", "画笔", "ペン" }, ["pp_eraser"] = new string[4] { "지우개", "Eraser", "橡皮擦", "消しゴム" }, ["pp_sticker"] = new string[4] { "스티커", "Stickers", "贴纸", "ステッカー" }, ["pp_color"] = new string[4] { "색", "Color", "颜色", "色" }, ["pp_size"] = new string[4] { "굵기", "Size", "粗细", "太さ" }, ["pp_thin"] = new string[4] { "가늘게", "Thin", "细", "細い" }, ["pp_mid"] = new string[4] { "보통", "Medium", "中", "普通" }, ["pp_thick"] = new string[4] { "굵게", "Thick", "粗", "太い" }, ["pp_hint_draw"] = new string[4] { "Ctrl+Z 되돌리기 · Enter 완료 · ESC 취소", "Ctrl+Z Undo · Enter Done · ESC Cancel", "Ctrl+Z 撤销 · Enter 完成 · ESC 取消", "Ctrl+Z 元に戻す · Enter 完了 · ESC キャンセル" }, ["pp_hint_place"] = new string[4] { "사진을 클릭하면 붙어요", "Click the photo to stick it", "点击照片贴上", "写真をクリックで貼る" }, ["pp_hint_sticker"] = new string[4] { "드래그 이동 · 휠 크기 · Q/E 회전 · 우클릭 삭제", "Drag move · Wheel size · Q/E rotate · RMB delete", "拖动移动 · 滚轮大小 · Q/E 旋转 · 右键删除", "ドラッグ移動 · ホイール大きさ · Q/E 回転 · 右クリック削除" }, ["pp_undo"] = new string[4] { "되돌리기", "Undo", "撤销", "元に戻す" }, ["pp_clear"] = new string[4] { "모두 지우기", "Clear all", "全部清除", "全部消す" }, ["pp_cancel"] = new string[4] { "취소", "Cancel", "取消", "キャンセル" }, ["pp_done"] = new string[4] { "완료", "Done", "完成", "完了" }, ["pe_title"] = new string[4] { "폴라로이드 자세 편집", "Polaroid pose editor", "拍立得姿势编辑", "ポラロイド ポーズ編集" }, ["pe_sub"] = new string[4] { "End 또는 ESC 로 닫기 · 바꾸면 바로 적용돼요", "Close with End or ESC · changes apply instantly", "End 或 ESC 关闭 · 修改立即生效", "EndかESCで閉じる · 変更はすぐ反映" }, ["pe_hold_first"] = new string[4] { "카메라를 손에 들어야 미리볼 수 있어요.", "Hold the camera to preview.", "手持相机才能预览。", "カメラを持つとプレビューできます。" }, ["pe_tp_hint"] = new string[4] { "3인칭은 Imperium 자유시점으로 내 캐릭터를 보면서 맞추세요.", "For third person, use Imperium freecam to watch your character.", "第三人称请用 Imperium 自由视角观察角色来调整。", "三人称は Imperium のフリーカメラで自分を見ながら調整してください。" }, ["pe_hide_vf"] = new string[4] { " 편집하는 동안 뷰파인더 화면 끄기", " Hide viewfinder while editing", " 编辑时隐藏取景器", " 編集中はファインダーを隠す" }, ["pe_scale_sec"] = new string[4] { "카메라 크기", "Camera size", "相机大小", "カメラの大きさ" }, ["pe_scale"] = new string[4] { "크기", "Size", "大小", "大きさ" }, ["pe_body"] = new string[4] { "몸", "Body", "身体", "体" }, ["pe_reset"] = new string[4] { "이 자세 초기화", "Reset this pose", "重置此姿势", "このポーズをリセット" }, ["pe_copy"] = new string[4] { "값 복사", "Copy values", "复制数值", "値をコピー" }, ["pe_save"] = new string[4] { "저장하고 닫기", "Save & close", "保存并关闭", "保存して閉じる" }, ["pe_reset_toast"] = new string[4] { "{0} 자세를 처음 값으로 돌렸어요", "Reset {0} to defaults", "已将{0}恢复默认", "{0}を初期値に戻しました" }, ["pe_copy_toast"] = new string[4] { "모든 자세 값을 복사했어요. 채팅에 붙여 주세요", "Copied all pose values", "已复制全部姿势数值", "全ポーズの値をコピーしました" } }; private static readonly string[][] PoseTitles = new string[4][] { new string[4] { "1인칭 들기", "1P hold", "第一人称·手持", "一人称・持つ" }, new string[4] { "1인칭 눈에 대기", "1P aim", "第一人称·举到眼前", "一人称・構える" }, new string[4] { "3인칭 들기", "3P hold", "第三人称·手持", "三人称・持つ" }, new string[4] { "3인칭 눈에 대기", "3P aim", "第三人称·举到眼前", "三人称・構える" } }; private static readonly string[][] VecNames = new string[10][] { new string[4] { "카메라 위치", "Camera position", "相机位置", "カメラの位置" }, new string[4] { "카메라 각도", "Camera angle", "相机角度", "カメラの角度" }, new string[4] { "오른손 위치 (카메라 기준)", "Right hand position (on camera)", "右手位置(相对相机)", "右手の位置(カメラ基準)" }, new string[4] { "오른손 각도", "Right hand angle", "右手角度", "右手の角度" }, new string[4] { "왼손 위치 (카메라 기준)", "Left hand position (on camera)", "左手位置(相对相机)", "左手の位置(カメラ基準)" }, new string[4] { "왼손 각도", "Left hand angle", "左手角度", "左手の角度" }, new string[4] { "오른 팔꿈치 방향", "Right elbow direction", "右肘方向", "右ひじの向き" }, new string[4] { "왼 팔꿈치 방향", "Left elbow direction", "左肘方向", "左ひじの向き" }, new string[4] { "오른 어깨 각도", "Right shoulder angle", "右肩角度", "右肩の角度" }, new string[4] { "왼 어깨 각도", "Left shoulder angle", "左肩角度", "左肩の角度" } }; private static readonly string[][] FloatNames = new string[2][] { new string[4] { "허리 숙이기 (도)", "Lean (deg)", "弯腰(度)", "前かがみ(度)" }, new string[4] { "고개 숙이기 (도)", "Head tilt (deg)", "低头(度)", "うつむき(度)" } }; private static readonly string[][][] Axes = new string[3][][] { new string[4][] { new string[3] { "좌우", "높이", "앞뒤" }, new string[3] { "Left/Right", "Height", "Fwd/Back" }, new string[3] { "左右", "高度", "前后" }, new string[3] { "左右", "高さ", "前後" } }, new string[4][] { new string[3] { "앞뒤 기울기", "좌우 돌리기", "옆 비틀기" }, new string[3] { "Pitch", "Yaw", "Roll" }, new string[3] { "俯仰", "偏转", "翻滚" }, new string[3] { "前後の傾き", "左右の向き", "ひねり" } }, new string[4][] { new string[3] { "바깥 / 안", "위 / 아래", "앞 / 뒤" }, new string[3] { "Out / In", "Up / Down", "Front / Back" }, new string[3] { "外 / 内", "上 / 下", "前 / 后" }, new string[3] { "外 / 内", "上 / 下", "前 / 後" } } }; private static int Idx { get { if (Cfg.Lang == null) { return 0; } return (int)Cfg.Lang.Value; } } public static string Get(string key) { if (!T.TryGetValue(key, out var value)) { return key; } int idx = Idx; if (idx < 0 || idx >= value.Length || string.IsNullOrEmpty(value[idx])) { return value[0]; } return value[idx]; } public static string Get(string key, object arg) { return string.Format(Get(key), arg); } private static string Pick(string[] v) { int idx = Idx; if (idx < 0 || idx >= v.Length) { return v[0]; } return v[idx]; } public static string PoseTitle(int i) { return Pick(PoseTitles[i]); } public static string Vec(int i) { return Pick(VecNames[i]); } public static string Float(int i) { return Pick(FloatNames[i]); } public static string[] AxisNames(int kind) { int idx = Idx; string[][] array = Axes[kind]; if (idx < 0 || idx >= array.Length) { return array[0]; } return array[idx]; } } internal static class MiniJson { public static object Parse(string s) { int i = 0; return Value(s, ref i); } private static void Ws(string s, ref int i) { while (i < s.Length && char.IsWhiteSpace(s[i])) { i++; } } private static object Value(string s, ref int i) { Ws(s, ref i); switch (s[i]) { case '{': return Obj(s, ref i); case '[': return Arr(s, ref i); case '"': return Str(s, ref i); case 't': i += 4; return true; case 'f': i += 5; return false; case 'n': i += 4; return null; default: return Num(s, ref i); } } private static Dictionary<string, object> Obj(string s, ref int i) { Dictionary<string, object> dictionary = new Dictionary<string, object>(); i++; Ws(s, ref i); if (s[i] == '}') { i++; return dictionary; } while (true) { Ws(s, ref i); string key = Str(s, ref i); Ws(s, ref i); i++; dictionary[key] = Value(s, ref i); Ws(s, ref i); if (s[i] != ',') { break; } i++; } i++; return dictionary; } private static List<object> Arr(string s, ref int i) { List<object> list = new List<object>(); i++; Ws(s, ref i); if (s[i] == ']') { i++; return list; } while (true) { list.Add(Value(s, ref i)); Ws(s, ref i); if (s[i] != ',') { break; } i++; } i++; return list; } private static string Str(string s, ref int i) { StringBuilder stringBuilder = new StringBuilder(); i++; while (s[i] != '"') { char c = s[i++]; if (c == '\\') { char c2 = s[i++]; switch (c2) { case 'n': stringBuilder.Append('\n'); break; case 't': stringBuilder.Append('\t'); break; case 'r': stringBuilder.Append('\r'); break; case 'b': stringBuilder.Append('\b'); break; case 'f': stringBuilder.Append('\f'); break; case 'u': stringBuilder.Append((char)Convert.ToInt32(s.Substring(i, 4), 16)); i += 4; break; default: stringBuilder.Append(c2); break; } } else { stringBuilder.Append(c); } } i++; return stringBuilder.ToString(); } private static double Num(string s, ref int i) { int num = i; while (i < s.Length && "+-0123456789.eE".IndexOf(s[i]) >= 0) { i++; } return double.Parse(s.Substring(num, i - num), NumberStyles.Float, CultureInfo.InvariantCulture); } public static Dictionary<string, object> O(object o) { return o as Dictionary<string, object>; } public static List<object> L(object o) { return o as List<object>; } public static float F(object o) { if (o != null) { return (float)Convert.ToDouble(o, CultureInfo.InvariantCulture); } return 0f; } public static int I(object o) { if (o != null) { return Convert.ToInt32(o, CultureInfo.InvariantCulture); } return 0; } public static object Get(Dictionary<string, object> d, string k) { if (d == null) { return null; } if (!d.TryGetValue(k, out var value)) { return null; } return value; } } internal static class PhotoCard { public const int W = 528; public const int H = 642; public const int PicS = 474; public const int PicX = 27; public const int PicY = 141; public static readonly Color32 Paper = new Color32((byte)250, (byte)248, (byte)241, byte.MaxValue); public static readonly Color32 Undeveloped = new Color32((byte)26, (byte)28, (byte)31, byte.MaxValue); public static byte[] Capture(Camera cam) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) Texture2D val = null; try { val = RenderSharp(cam); } catch (Exception ex) { Plugin.Log.LogWarning((object)("고해상도 촬영 실패, 화면 복사로 대신: " + ex.Message)); } if ((Object)(object)val == (Object)null) { val = CopyScreen(cam); } if ((Object)(object)val == (Object)null) { return null; } Texture2D val2 = new Texture2D(528, 642, (TextureFormat)3, false); Color32[] array = (Color32[])(object)new Color32[338976]; for (int i = 0; i < array.Length; i++) { array[i] = Paper; } Color32[] pixels = val.GetPixels32(); Enhance(pixels); for (int j = 0; j < 474; j++) { Array.Copy(pixels, j * 474, array, (141 + j) * 528 + 27, 474); } val2.SetPixels32(array); val2.Apply(); byte[] result = ImageConversion.EncodeToJPG(val2, Mathf.Clamp(Cfg.PhotoQuality.Value, 50, 100)); Object.Destroy((Object)(object)val2); Object.Destroy((Object)(object)val); return result; } private static Texture2D RenderSharp(Camera cam) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown RenderTexture targetTexture = cam.targetTexture; float num = Mathf.Clamp(Cfg.RenderScale.Value, 1f, 4f); int num2 = (((Object)(object)targetTexture != (Object)null) ? ((Texture)targetTexture).width : Screen.width); int num3 = (((Object)(object)targetTexture != (Object)null) ? ((Texture)targetTexture).height : Screen.height); num2 = Mathf.Clamp((int)((float)num2 * num), 256, 4096); num3 = Mathf.Clamp((int)((float)num3 * num), 256, 4096); StandardRequest val = new StandardRequest(); if (!RenderPipeline.SupportsRenderRequest<StandardRequest>(cam, val)) { return null; } RenderTexture val2 = (val.destination = RenderTexture.GetTemporary(num2, num3, 24, (RenderTextureFormat)0, (RenderTextureReadWrite)2)); RenderPipeline.SubmitRenderRequest<StandardRequest>(cam, val); Texture2D result = CropSquare(val2); RenderTexture.ReleaseTemporary(val2); return result; } private static Texture2D CopyScreen(Camera cam) { RenderTexture targetTexture = cam.targetTexture; if (!((Object)(object)targetTexture != (Object)null)) { return null; } return CropSquare(targetTexture); } private static Texture2D CropSquare(RenderTexture src) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown float num = (float)((Texture)src).height * 0.74f; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(num / (float)((Texture)src).width, num / (float)((Texture)src).height); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor((1f - val.x) * 0.5f, (1f - val.y) * 0.5f); RenderTexture temporary = RenderTexture.GetTemporary(474, 474, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); RenderTexture active = RenderTexture.active; Graphics.Blit((Texture)(object)src, temporary, val, val2); RenderTexture.active = temporary; Texture2D val3 = new Texture2D(474, 474, (TextureFormat)3, false); val3.ReadPixels(new Rect(0f, 0f, 474f, 474f), 0, 0); val3.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); return val3; } private static void Enhance(Color32[] px) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_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) float value = Cfg.PhotoContrast.Value; float value2 = Cfg.PhotoSaturation.Value; float value3 = Cfg.PhotoGamma.Value; byte[] array = new byte[256]; for (int i = 0; i < 256; i++) { float num = Mathf.Pow((float)i / 255f, value3); num = (num - 0.5f) * value + 0.5f; array[i] = (byte)Mathf.Clamp(Mathf.RoundToInt(num * 255f), 0, 255); } for (int j = 0; j < px.Length; j++) { Color32 val = px[j]; float num2 = (int)array[val.r]; float num3 = (int)array[val.g]; float num4 = (int)array[val.b]; float num5 = num2 * 0.299f + num3 * 0.587f + num4 * 0.114f; num2 = num5 + (num2 - num5) * value2; num3 = num5 + (num3 - num5) * value2; num4 = num5 + (num4 - num5) * value2; px[j] = new Color32((byte)Mathf.Clamp(num2, 0f, 255f), (byte)Mathf.Clamp(num3, 0f, 255f), (byte)Mathf.Clamp(num4, 0f, 255f), byte.MaxValue); } } public static void Develop(Color32[] full, Color32[] outPx, float k) { //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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) Array.Copy(full, outPx, full.Length); if (k >= 0.999f) { return; } byte b = (byte)Mathf.Clamp(Mathf.RoundToInt(k * 255f), 0, 255); Color32 undeveloped = Undeveloped; for (int i = 141; i < 615; i++) { int num = i * 528; for (int j = 27; j < 501; j++) { int num2 = num + j; Color32 val = full[num2]; outPx[num2] = new Color32((byte)(undeveloped.r + (val.r - undeveloped.r) * b / 255), (byte)(undeveloped.g + (val.g - undeveloped.g) * b / 255), (byte)(undeveloped.b + (val.b - undeveloped.b) * b / 255), byte.MaxValue); } } } public static Mesh FaceMesh() { //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_0011: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) Mesh val = new Mesh { name = "PolaroidCardFace" }; val.vertices = (Vector3[])(object)new Vector3[4] { new Vector3(-0.044f, 0.0011f, -0.0535f), new Vector3(0.044f, 0.0011f, -0.0535f), new Vector3(0.044f, 0.0011f, 0.0535f), new Vector3(-0.044f, 0.0011f, 0.0535f) }; val.normals = (Vector3[])(object)new Vector3[4] { Vector3.up, Vector3.up, Vector3.up, Vector3.up }; val.uv = (Vector2[])(object)new Vector2[4] { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 1f) }; val.triangles = new int[6] { 0, 3, 2, 0, 2, 1 }; val.RecalculateBounds(); return val; } } internal struct Sticker { public int idx; public float x; public float y; public float scale; public float rot; public const float BaseSize = 110f; public static string Encode(List<Sticker> list) { StringBuilder stringBuilder = new StringBuilder(); CultureInfo invariantCulture = CultureInfo.InvariantCulture; foreach (Sticker item in list) { if (stringBuilder.Length > 0) { stringBuilder.Append(';'); } stringBuilder.Append(item.idx.ToString(invariantCulture)).Append('|').Append(item.x.ToString("0.#", invariantCulture)) .Append('|') .Append(item.y.ToString("0.#", invariantCulture)) .Append('|') .Append(item.scale.ToString("0.###", invariantCulture)) .Append('|') .Append(item.rot.ToString("0.#", invariantCulture)); } return stringBuilder.ToString(); } public static List<Sticker> Decode(string s) { List<Sticker> list = new List<Sticker>(); if (string.IsNullOrEmpty(s)) { return list; } CultureInfo invariantCulture = CultureInfo.InvariantCulture; string[] array = s.Split(';'); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split('|'); if (array2.Length == 5) { try { list.Add(new Sticker { idx = int.Parse(array2[0], invariantCulture), x = float.Parse(array2[1], invariantCulture), y = float.Parse(array2[2], invariantCulture), scale = float.Parse(array2[3], invariantCulture), rot = float.Parse(array2[4], invariantCulture) }); } catch { } } } return list; } } internal static class StickerLib { public static Texture2D[] Tex = (Texture2D[])(object)new Texture2D[0]; public static Color32[][] Px = new Color32[0][]; public static void Load(string dir) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown List<Texture2D> list = new List<Texture2D>(); try { if (Directory.Exists(dir)) { string[] files = Directory.GetFiles(dir, "*.png"); Array.Sort(files, (IComparer<string>?)StringComparer.OrdinalIgnoreCase); string[] array = files; foreach (string path in array) { Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1 }; if (ImageConversion.LoadImage(val, File.ReadAllBytes(path))) { list.Add(val); } } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("스티커 읽기 실패: " + ex.Message)); } Tex = list.ToArray(); Px = new Color32[Tex.Length][]; for (int j = 0; j < Tex.Length; j++) { Px[j] = Tex[j].GetPixels32(); } Plugin.Log.LogInfo((object)("스티커 " + Tex.Length + "개")); } } internal static class PhotoCompose { public static Color32[] Composite(Color32[] basePx, Color32[] overlay, List<Sticker> stickers) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) Color32[] array = (Color32[])basePx.Clone(); if (overlay != null && overlay.Length == array.Length) { for (int i = 0; i < array.Length; i++) { Color32 val = overlay[i]; if (val.a != 0) { array[i] = Over(array[i], val); } } } if (stickers != null) { foreach (Sticker sticker in stickers) { DrawSticker(array, sticker); } } return array; } public static Color32 Over(Color32 b, Color32 o) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) int a = o.a; int num = 255 - a; return new Color32((byte)((b.r * num + o.r * a) / 255), (byte)((b.g * num + o.g * a) / 255), (byte)((b.b * num + o.b * a) / 255), byte.MaxValue); } private static void DrawSticker(Color32[] px, Sticker s) { //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) if (s.idx < 0 || s.idx >= StickerLib.Px.Length) { return; } Color32[] src = StickerLib.Px[s.idx]; int width = ((Texture)StickerLib.Tex[s.idx]).width; int height = ((Texture)StickerLib.Tex[s.idx]).height; float num = 110f * s.scale; float num2 = num * 0.7072f; int num3 = Mathf.Max(0, (int)(s.x - num2)); int num4 = Mathf.Min(527, (int)(s.x + num2)); int num5 = Mathf.Max(0, (int)(s.y - num2)); int num6 = Mathf.Min(641, (int)(s.y + num2)); float num7 = (0f - s.rot) * (MathF.PI / 180f); float num8 = Mathf.Cos(num7); float num9 = Mathf.Sin(num7); for (int i = num5; i <= num6; i++) { for (int j = num3; j <= num4; j++) { float num10 = (float)j + 0.5f - s.x; float num11 = (float)i + 0.5f - s.y; float num12 = (num10 * num8 - num11 * num9) / num + 0.5f; float num13 = (num10 * num9 + num11 * num8) / num + 0.5f; if (!(num12 < 0f) && !(num12 >= 1f) && !(num13 < 0f) && !(num13 >= 1f)) { Color32 val = Sample(src, width, height, num12, num13); if (val.a != 0) { int num14 = i * 528 + j; px[num14] = Over(px[num14], val); } } } } } private static Color32 Sample(Color32[] src, int w, int h, float u, float v) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00a8: Unknown result type (might be due to invalid IL or missing references) float num = u * (float)w - 0.5f; float num2 = v * (float)h - 0.5f; int num3 = Mathf.Clamp((int)Mathf.Floor(num), 0, w - 1); int num4 = Mathf.Clamp((int)Mathf.Floor(num2), 0, h - 1); int num5 = Mathf.Min(num3 + 1, w - 1); int num6 = Mathf.Min(num4 + 1, h - 1); float num7 = Mathf.Clamp01(num - (float)num3); float num8 = Mathf.Clamp01(num2 - (float)num4); Color32 val = Color32.Lerp(src[num4 * w + num3], src[num4 * w + num5], num7); Color32 val2 = Color32.Lerp(src[num6 * w + num3], src[num6 * w + num5], num7); return Color32.Lerp(val, val2, num8); } } internal struct PhotoData { public int photoId; public float developSeconds; public double developStart; public byte[] jpg; public byte[] overlay; public string stickers; public bool onWall; public Vector3 wallPos; public Quaternion wallRot; } internal static class PhotoStore { private static readonly Dictionary<int, byte[]> mem = new Dictionary<int, byte[]>(); private static readonly Dictionary<int, (Vector3 p, Quaternion r)> walls = new Dictionary<int, (Vector3, Quaternion)>(); private static string wallsFor; private static bool migrated; private static string Dir { get { string path = (((Object)(object)GameNetworkManager.Instance != (Object)null && !string.IsNullOrEmpty(GameNetworkManager.Instance.currentSaveFileName)) ? GameNetworkManager.Instance.currentSaveFileName : "default"); string result = Path.Combine(Application.persistentDataPath, "PolaroidCompany", path); if (!migrated) { migrated = true; MigrateAll(); } return result; } } public static void MigrateAll() { migrated = true; try { string text = Path.Combine(Paths.ConfigPath, "PolaroidCompany"); string path = Path.Combine(text, "photos"); if (!Directory.Exists(path)) { return; } string[] directories = Directory.GetDirectories(path); foreach (string path2 in directories) { string text2 = Path.Combine(Application.persistentDataPath, "PolaroidCompany", Path.GetFileName(path2)); Directory.CreateDirectory(text2); string[] files = Directory.GetFiles(path2); foreach (string text3 in files) { string text4 = Path.Combine(text2, Path.GetFileName(text3).Replace(".txt", ".dat")); if (!File.Exists(text4)) { File.Copy(text3, text4); } } } Directory.Delete(text, recursive: true); Plugin.Log.LogInfo((object)("예전 사진 폴더를 옮김 → " + Path.Combine(Application.persistentDataPath, "PolaroidCompany"))); } catch (Exception ex) { Plugin.Log.LogWarning((object)("사진 폴더 옮기기 실패: " + ex.Message)); } } public static void Put(int id, byte[] jpg) { mem[id] = jpg; try { Directory.CreateDirectory(Dir); File.WriteAllBytes(Path.Combine(Dir, id + ".jpg"), jpg); } catch (Exception ex) { Plugin.Log.LogWarning((object)("사진 저장 실패: " + ex.Message)); } } public static byte[] Get(int id) { if (mem.TryGetValue(id, out var value)) { return value; } try { string path = Path.Combine(Dir, id + ".jpg"); if (File.Exists(path)) { value = File.ReadAllBytes(path); mem[id] = value; return value; } } catch (Exception ex) { Plugin.Log.LogWarning((object)("사진 읽기 실패: " + ex.Message)); } return null; } private static void LoadWalls() { //IL_00ac: 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) string dir = Dir; if (wallsFor == dir) { return; } wallsFor = dir; walls.Clear(); try { string path = Path.Combine(dir, "walls.dat"); if (!File.Exists(path)) { return; } string[] array = File.ReadAllLines(path); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(';'); if (array2.Length == 8) { float[] array3 = new float[7]; for (int j = 0; j < 7; j++) { array3[j] = float.Parse(array2[j + 1], CultureInfo.InvariantCulture); } walls[int.Parse(array2[0], CultureInfo.InvariantCulture)] = (new Vector3(array3[0], array3[1], array3[2]), new Quaternion(array3[3], array3[4], array3[5], array3[6])); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("벽 사진 위치 읽기 실패: " + ex.Message)); } } private static void SaveWalls() { //IL_0030: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_00a3: 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_00c1: Unknown result type (might be due to invalid IL or missing references) try { Directory.CreateDirectory(Dir); StringBuilder stringBuilder = new StringBuilder(); foreach (KeyValuePair<int, (Vector3, Quaternion)> wall in walls) { Vector3 item = wall.Value.Item1; Quaternion item2 = wall.Value.Item2; stringBuilder.AppendLine(string.Join(";", wall.Key.ToString(CultureInfo.InvariantCulture), F(item.x), F(item.y), F(item.z), F(item2.x), F(item2.y), F(item2.z), F(item2.w))); } File.WriteAllText(Path.Combine(Dir, "walls.dat"), stringBuilder.ToString()); } catch (Exception ex) { Plugin.Log.LogWarning((object)("벽 사진 위치 저장 실패: " + ex.Message)); } } private static string F(float v) { return v.ToString("R", CultureInfo.InvariantCulture); } public static void PutLayers(int id, byte[] png, string stickers) { try { Directory.CreateDirectory(Dir); string path = Path.Combine(Dir, id + "_draw.png"); string path2 = Path.Combine(Dir, id + "_stickers.dat"); if (png != null && png.Length != 0) { File.WriteAllBytes(path, png); } else if (File.Exists(path)) { File.Delete(path); } File.WriteAllText(path2, stickers ?? ""); } catch (Exception ex) { Plugin.Log.LogWarning((object)("꾸미기 저장 실패: " + ex.Message)); } } public static void GetLayers(int id, out byte[] png, out string stickers) { png = new byte[0]; stickers = ""; try { string path = Path.Combine(Dir, id + "_draw.png"); string path2 = Path.Combine(Dir, id + "_stickers.dat"); if (File.Exists(path)) { png = File.ReadAllBytes(path); } if (File.Exists(path2)) { stickers = File.ReadAllText(path2); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("꾸미기 읽기 실패: " + ex.Message)); } } public static void SetWall(int id, bool on, Vector3 p, Quaternion r) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) LoadWalls(); if (on) { walls[id] = (p, r); } else if (!walls.Remove(id)) { return; } SaveWalls(); } public static bool GetWall(int id, out Vector3 p, out Quaternion r) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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) LoadWalls(); if (walls.TryGetValue(id, out (Vector3, Quaternion) value)) { (p, r) = value; return true; } p = Vector3.zero; r = Quaternion.identity; return false; } public static void ClearSave() { try { if (Directory.Exists(Dir)) { Directory.Delete(Dir, recursive: true); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("사진 폴더 정리 실패: " + ex.Message)); } mem.Clear(); walls.Clear(); wallsFor = null; Plugin.Log.LogInfo((object)"[사진] 해고: 사진과 벽 장식을 모두 지웠어요"); } } public class PolaroidPhotoItem : GrabbableObject { public int photoId; internal PhotoData data; private bool hasImage; private Material faceMat; private Texture2D fullTex; private Texture2D showTex; private Color32[] fullPx; private Color32[] showPx; private Color32[] basePx; private Color32[] overlayPx; private List<Sticker> stickerList = new List<Sticker>(); private float lastK = -1f; private float nextDevelopAt; private float nextRequest; private int requests; private bool shipChecked; private bool viewing; private int lastClickFrame = -1; private PlayerControllerB rigFor; private ArmRig armsRig; internal bool onWall; private Vector3 wallPos; private Quaternion wallRot = Quaternion.identity; private GameObject preview; private Transform visual; private static readonly Dictionary<ulong, PhotoData> pending = new Dictionary<ulong, PhotoData>(); private static Mesh faceMesh; private static Texture2D blankTex; private Texture CurrentTex { get { if (!hasImage) { return (Texture)(object)blankTex; } if (!(lastK >= 0.999f)) { return (Texture)(object)showTex; } return (Texture)(object)fullTex; } } private bool IsLocalHolder { get { if ((Object)(object)base.playerHeldBy != (Object)null && (Object)(object)GameNetworkManager.Instance != (Object)null) { return (Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController; } return false; } } public override void Start() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) visual = ((Component)this).transform.Find("Visual"); if ((Object)(object)visual != (Object)null) { PolaroidAssets.ApplyMaterials(visual); Transform val = FindDeep(visual, "PhotoImage"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } Transform val2 = FindDeep(visual, "Photo"); if ((Object)(object)val2 != (Object)null) { if ((Object)(object)faceMesh == (Object)null) { faceMesh = PhotoCard.FaceMesh(); } GameObject val3 = new GameObject("CardFace") { layer = ((Component)val2).gameObject.layer }; val3.transform.SetParent(val2, false); val3.AddComponent<MeshFilter>().sharedMesh = faceMesh; MeshRenderer obj = val3.AddComponent<MeshRenderer>(); faceMat = new Material(PolaroidAssets.Get("사진_테두리")); faceMat.SetColor("_BaseColor", Color.white); faceMat.SetColor("_Color", Color.white); faceMat.SetFloat("_Smoothness", 0.35f); ((Renderer)obj).sharedMaterial = faceMat; MeshRenderer component = ((Component)val2).GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null) { base.mainObjectRenderer = component; } } } if ((Object)(object)blankTex == (Object)null) { blankTex = MakeBlank(); } SetFace(CurrentTex); if (hasImage) { RefreshDevelop(force: true); } if ((Object)(object)base.itemProperties != (Object)null) { PolaroidAssets.EnsureSfx(base.itemProperties); } try { ((GrabbableObject)this).Start(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("사진 Start 오류: " + ex.Message)); } try { ((GrabbableObject)this).SetScrapValue(0); } catch { } if (pending.TryGetValue(((NetworkBehaviour)this).NetworkObjectId, out var value)) { pending.Remove(((NetworkBehaviour)this).NetworkObjectId); Apply(value); } nextRequest = Time.time + 0.5f; } private static Texture2D MakeBlank() { //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_0019: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(528, 642, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1 }; Color32[] array = (Color32[])(object)new Color32[338976]; for (int i = 0; i < array.Length; i++) { array[i] = PhotoCard.Paper; } for (int j = 141; j < 615; j++) { for (int k = 27; k < 501; k++) { array[j * 528 + k] = PhotoCard.Undeveloped; } } val.SetPixels32(array); val.Apply(); return val; } private static Transform FindDeep(Transform t, string name) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (((Object)t).name == name) { return t; } foreach (Transform item in t) { Transform val = FindDeep(item, name); if ((Object)(object)val != (Object)null) { return val; } } return null; } private void SetFace(Texture t) { if ((Object)(object)faceMat != (Object)null && (Object)(object)t != (Object)null) { faceMat.SetTexture("_BaseColorMap", t); faceMat.SetTexture("_MainTex", t); } if (viewing) { PhotoViewer.SetTexture(t); } } public override void Update() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.itemProperties != (Object)null) { base.itemProperties.positionOffset = Cfg.V(Cfg.PhotoHoldPos); base.itemProperties.rotationOffset = Cfg.V(Cfg.PhotoHoldRot); } try { ((GrabbableObject)this).Update(); } catch { } bool flag = IsLocalHolder && !base.isPocketed; if (flag && !PhotoPaint.IsOpen && !PoseEditor.IsOpen && (int)Cursor.lockState == 1) { Mouse current = Mouse.current; Keyboard current2 = Keyboard.current; if (Cfg.ViewIsClick) { if (current != null && current.leftButton.wasPressedThisFrame) { ToggleView(); } } else if (current2 != null && KeyDown(current2, Cfg.ViewKey.Value.Trim())) { ToggleView(); } if (viewing && current != null && current.rightButton.wasPressedThisFrame) { CloseView(); } if (viewing && current2 != null && KeyDown(current2, Cfg.PaintKey.Value)) { StartPaint(); } if (!viewing && current2 != null) { UpdateWallAim(current2); } else { HidePreview(); } } else { HidePreview(); } if (viewing && !flag) { CloseView(); } if (onWall && base.isHeld) { onWall = false; data.onWall = false; NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton != (Object)null && singleton.IsServer && photoId != 0) { PhotoStore.SetWall(photoId, on: false, Vector3.zero, Quaternion.identity); } } CheckShip(); if (!hasImage) { RequestImage(); } else { RefreshDevelop(force: false); } } private static bool KeyDown(Keyboard kb, string key) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!Enum.TryParse<Key>(key, ignoreCase: true, out Key result) || (int)result == 0) { return false; } return ((ButtonControl)kb[result]).wasPressedThisFrame; } private void CheckShip() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (shipChecked || base.isHeld || !base.reachedFloorTarget || onWall) { return; } shipChecked = true; StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)instance != (Object)null) || !((Object)(object)instance.shipBounds != (Object)null)) { return; } Bounds bounds = instance.shipBounds.bounds; if (((Bounds)(ref bounds)).Contains(((Component)this).transform.position)) { base.isInShipRoom = true; base.isInElevator = true; if ((Object)(object)((Component)this).transform.parent != (Object)(object)instance.elevatorTransform && (Object)(object)base.parentObject == (Object)null) { ((Component)this).transform.SetParent(instance.elevatorTransform, true); base.targetFloorPosition = ((Component)this).transform.localPosition; base.startFallingPosition = ((Component)this).transform.localPosition; } } } private void RequestImage() { NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton != (Object)null && singleton.IsServer) { if (photoId != 0 && requests == 0) { requests = 1; byte[] array = PhotoStore.Get(photoId); if (array != null) { PhotoData d = new PhotoData { photoId = photoId, developSeconds = 0f, jpg = array }; d.onWall = PhotoStore.GetWall(photoId, out d.wallPos, out d.wallRot); PhotoStore.GetLayers(photoId, out d.overlay, out d.stickers); Apply(d); } } } else if (Time.time >= nextRequest && requests < 10) { requests++; nextRequest = Time.time + 2f; PolaroidNet.RequestPhoto(((NetworkBehaviour)this).NetworkObjectId); } } private void RefreshDevelop(bool force) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00f9: Expected O, but got Unknown float num = 1f; if (data.developSeconds > 0f) { NetworkManager singleton = NetworkManager.Singleton; double num2; if (!((Object)(object)singleton != (Object)null)) { num2 = 0.0; } else { NetworkTime serverTime = singleton.ServerTime; num2 = ((NetworkTime)(ref serverTime)).Time; } num = Mathf.Clamp01((float)((num2 - data.developStart) / (double)data.developSeconds)); num = num * num * (3f - 2f * num); } if (!force && Mathf.Approximately(num, lastK)) { return; } if (num >= 0.999f) { lastK = 1f; SetFace((Texture)(object)fullTex); } else if (force || !(Time.time < nextDevelopAt)) { nextDevelopAt = Time.time + 0.12f; lastK = num; if ((Object)(object)showTex == (Object)null) { showTex = new Texture2D(528, 642, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1 }; } if (showPx == null) { showPx = (Color32[])(object)new Color32[fullPx.Length]; } PhotoCard.Develop(fullPx, showPx, num); showTex.SetPixels32(showPx); showTex.Apply(); SetFace((Texture)(object)showTex); } } internal void Apply(PhotoData d) { //IL_001e: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown data = d; photoId = d.photoId; if (d.onWall) { SetWall(on: true, d.wallPos, d.wallRot, save: false); } if (d.jpg == null || d.jpg.Length == 0) { return; } if ((Object)(object)fullTex == (Object)null) { fullTex = new Texture2D(2, 2, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1 }; } if (!ImageConversion.LoadImage(fullTex, d.jpg)) { return; } showPx = null; if (((Texture)fullTex).width != 528 || ((Texture)fullTex).height != 642) { fullPx = fullTex.GetPixels32(); basePx = null; lastK = 1f; hasImage = true; SetFace((Texture)(object)fullTex); return; } basePx = fullTex.GetPixels32(); overlayPx = null; if (d.overlay != null && d.overlay.Length != 0) { Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (ImageConversion.LoadImage(val, d.overlay) && ((Texture)val).width == 528 && ((Texture)val).height == 642) { overlayPx = val.GetPixels32(); } Object.Destroy((Object)(object)val); } stickerList = Sticker.Decode(d.stickers); fullPx = PhotoCompose.Composite(basePx, overlayPx, stickerList); fullTex.SetPixels32(fullPx); fullTex.Apply(); hasImage = true; lastK = -1f; RefreshDevelop(force: true); } internal static void Receive(ulong netId, PhotoData d) { PolaroidPhotoItem polaroidPhotoItem = Find(netId); if ((Object)(object)polaroidPhotoItem != (Object)null) { polaroidPhotoItem.Apply(d); } else { pending[netId] = d; } } internal static PolaroidPhotoItem Find(ulong netId) { NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton != (Object)null && singleton.SpawnManager.SpawnedObjects.TryGetValue(netId, out var value) && (Object)(object)value != (Object)null) { return ((Component)value).GetComponent<PolaroidPhotoItem>(); } return null; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && !PhotoPaint.IsOpen && Cfg.ViewIsClick) { ToggleView(); } } private void ToggleView() { if (IsLocalHolder && !base.isPocketed && lastClickFrame != Time.frameCount) { lastClickFrame = Time.frameCount; if (viewing) { CloseView(); return; } viewing = true; PhotoViewer.Open(CurrentTex, hasImage); } } private void CloseView() { if (viewing) { viewing = false; PhotoViewer.Close(); } } private void StartPaint() { if (hasImage && basePx != null) { CloseView(); ulong id = ((NetworkBehaviour)this).NetworkObjectId; PhotoPaint.Begin(basePx, overlayPx, stickerList, delegate(byte[] png, string st) { PolaroidNet.SendPhotoEdit(id, png, st); }); } } internal void ServerEdit(byte[] png, string stickers) { if (photoId != 0 && data.jpg != null) { PhotoStore.PutLayers(photoId, png, stickers); PhotoData d = data; d.photoId = photoId; d.overlay = png ?? new byte[0]; d.stickers = stickers ?? ""; d.developSeconds = 0f; Apply(d); PolaroidNet.BroadcastPhoto(((NetworkBehaviour)this).NetworkObjectId, d); Plugin.Log.LogInfo((object)("[사진] 꾸민 사진 저장 " + photoId)); } } private void UpdateWallAim(Keyboard kb) { //IL_0014: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!WallTarget(out var pos, out var rot)) { HidePreview(); return; } ShowPreview(pos, rot); if (KeyDown(kb, Cfg.WallKey.Value)) { PlaceOnWall(pos, rot); } } private bool WallTarget(out Vector3 pos, out Quaternion rot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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) pos = Vector3.zero; rot = Quaternion.identity; StartOfRound instance = StartOfRound.Instance; Camera val = (((Object)(object)base.playerHeldBy != (Object)null) ? base.playerHeldBy.gameplayCamera : null); if ((Object)(object)instance == (Object)null || (Object)(object)val == (Object)null || (Object)(object)instance.shipBounds == (Object)null) { return false; } RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(new Ray(((Component)val).transform.position, ((Component)val).transform.forward), ref val2, 3f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return false; } if (Mathf.Abs(((RaycastHit)(ref val2)).normal.y) > 0.5f) { return false; } Bounds bounds = instance.shipBounds.bounds; if (!((Bounds)(ref bounds)).Contains(((RaycastHit)(ref val2)).point)) { return false; } Vector3 val3 = Vector3.ProjectOnPlane(Vector3.up, ((RaycastHit)(ref val2)).normal); Vector3 normalized = ((Vector3)(ref val3)).normalized; rot = Quaternion.LookRotation(normalized, ((RaycastHit)(ref val2)).normal); pos = ((RaycastHit)(ref val2)).point + ((RaycastHit)(ref val2)).normal * 0.006f; return true; } private void ShowPreview(Vector3 pos, Quaternion rot) { //IL_0098: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)preview == (Object)null && (Object)(object)visual != (Object)null) { preview = Object.Instantiate<GameObject>(((Component)visual).gameObject); ((Object)preview).name = "PolaroidWallPreview"; Collider[] componentsInChildren = preview.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } } if (!((Object)(object)preview == (Object)null)) { if (!preview.activeSelf) { preview.SetActive(true); } preview.transform.SetPositionAndRotation(pos, rot); preview.transform.localScale = ((Component)this).transform.lossyScale; float num = 1f + 0.03f * Mathf.Sin(Time.time * 6f); Transform transform = preview.transform; transform.localScale *= num; } } private void HidePreview() { if ((Object)(object)preview != (Object)null && preview.activeSelf) { preview.SetActive(false); } } private void PlaceOnWall(Vector3 pos, Quaternion rot) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) Transform elevatorTransform = StartOfRound.Instance.elevatorTransform; Vector3 lp = elevatorTransform.InverseTransformPoint(pos); Quaternion lr = Quaternion.Inverse(elevatorTransform.rotation) * rot; HidePreview(); CloseView(); PolaroidNet.SendPhotoWall(((NetworkBehaviour)this).NetworkObjectId, lp, lr); SetWall(on: true, lp, lr, save: false); PlayerControllerB playerHeldBy = base.playerHeldBy; try { playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } catch (Exception ex) { Plugin.Log.LogWarning((object)("사진 내려놓기 실패: " + ex.Message)); } Plugin.Log.LogInfo((object)("[사진] 벽에 붙임 " + photoId)); } internal void SetWall(bool on, Vector3 lp, Quaternion lr, bool save) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_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) onWall = on; wallPos = lp; wallRot = lr; data.onWall = on; data.wallPos = lp; data.wallRot = lr; shipChecked = true; if (save && photoId != 0) { PhotoStore.SetWall(photoId, on, lp, lr); } } public override void LateUpdate() { //IL_0062: 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_007f: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type