Decompiled source of PhotoFrames v1.1.1
PhotoFrames.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Microsoft.CodeAnalysis; using PhotoFrames.CruncherApp; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("PhotoFrames")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+41fa454e1bb5b42cf5eefae321b822bad09b3f35")] [assembly: AssemblyProduct("PhotoFrames")] [assembly: AssemblyTitle("PhotoFrames")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PhotoFrames { internal static class AmbientLight { internal static float Brightness(Interactable anchor) { try { NewNode val = ((anchor != null) ? anchor.node : null); NewRoom val2 = ((val != null) ? val.room : null); if ((Object)(object)val2 == (Object)null) { return 1f; } bool flag = false; try { flag = val2.mainLightStatus; } catch { } if (flag) { return 1f; } bool flag2 = false; try { flag2 = val2.GetSecondaryLightStatus(); } catch { } float num = Ambient(val2); return Mathf.Clamp01(flag2 ? Mathf.Max(0.55f, num) : (num * 0.25f)); } catch { return 1f; } } private static float Ambient(NewRoom room) { try { GameplayControls instance = GameplayControls.Instance; SessionData instance2 = SessionData.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance2 == (Object)null || instance.stealthAmbientLightLevel == null) { return 0.12f; } bool flag = false; try { flag = room.IsOutside(); } catch { } float num = (flag ? 1f : instance.interiorAmbientLightMultiplier); return Mathf.Clamp01(instance.stealthAmbientLightLevel.Evaluate(instance2.dayProgress) * num); } catch { return 0.12f; } } } internal static class CapturePin { [HarmonyPatch(typeof(CleanupController), "RemoveUnusedPlayerPhotoCaptures")] internal static class ReAddPinnedCaptures { private static void Postfix(Interactable captureDevice) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown try { if (captureDevice == null || captureDevice.sCap == null || Pinned.Count == 0) { return; } bool flag2 = default(bool); foreach (KeyValuePair<int, SceneCapture> item in Pinned) { SceneCapture value = item.Value; if (value == null) { continue; } bool flag = false; List<SceneCapture> sCap = captureDevice.sCap; for (int i = 0; i < sCap.Count; i++) { SceneCapture val = sCap[i]; if (val != null && val.id == item.Key) { flag = true; break; } } if (flag) { continue; } sCap.Add(value); ConfigEntry<bool> verbose = PhotoConfig.Verbose; if (verbose != null && verbose.Value) { ManualLogSource log = Plugin.Log2; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(67, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] re-pinned capture "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(item.Key); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" that the photo cleanup had pruned."); } log.LogInfo(val2); } } } catch { } } } internal static readonly Dictionary<int, SceneCapture> Pinned = new Dictionary<int, SceneCapture>(); internal static void Pin(SceneCapture capture) { if (capture != null) { Pinned[capture.id] = capture; } } internal static void Unpin(int captureID) { Pinned.Remove(captureID); } internal static void Clear() { Pinned.Clear(); } } public class CaseBoardController : MonoBehaviour { private sealed class YarnPlaced { public GameObject go; public Material mat; public LineRenderer line; public Color baseColor; public int interactableID; public Vector3 a; public Vector3 b; public float lastB = -1f; } private sealed class PostPlaced { public GameObject go; public TextMeshProUGUI tmp; public Image darken; public int interactableID; public int colourIndex; public float halfW; public float halfH; public string text; } internal static bool ModeActive; internal static bool EditActive; internal static bool MoveActive; internal static bool HoveringPost; internal static int RmbConsumedFrame = -1; private readonly List<YarnPlaced> _yarns = new List<YarnPlaced>(); private readonly List<PostPlaced> _posts = new List<PostPlaced>(); private readonly HashSet<int> _registered = new HashSet<int>(); private bool _yarnActive; private bool _haveFirst; private Vector3 _firstPoint; private int _yarnColor; private GameObject _preview; private LineRenderer _previewLine; private Material _previewMat; private YarnPlaced _hoveredYarn; private int _postColor; private bool _moving; private int _moveId = -1; private Vector3 _moveLastPos; private Vector3 _moveLastEuler; private bool _moveHasPose; private bool _editing; private int _editId = -1; private bool _editIsNew; private string _editOriginal = ""; private readonly StringBuilder _editBuf = new StringBuilder(160); private bool _skipInputFrame; private bool _editPaused; private const int MaxNote = 140; private bool _ptiByUs; private Player _lastPlayer; private bool _loadSweepDone; private float _darkTimer; private readonly HashSet<string> _uiRegistered = new HashSet<string>(); internal static CaseBoardController Instance { get; private set; } internal static bool Busy { get { if ((Object)(object)Instance != (Object)null && ((Behaviour)Instance).isActiveAndEnabled) { if (!ModeActive && !EditActive) { return MoveActive; } return true; } return false; } } internal static bool EditGate { get { if ((Object)(object)Instance != (Object)null && ((Behaviour)Instance).isActiveAndEnabled) { return EditActive; } return false; } } public CaseBoardController(IntPtr ptr) : base(ptr) { } internal static bool IsAimingAtPost() { try { return (Object)(object)Instance != (Object)null && ((Behaviour)Instance).isActiveAndEnabled && Instance.FindHoveredPost() != null; } catch { return false; } } private void Awake() { Instance = this; } private void Update() { //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Expected O, but got Unknown try { Player instance = Player.Instance; if ((Object)(object)instance != (Object)(object)_lastPlayer) { _lastPlayer = instance; OnWorldChanged(); } if (!_loadSweepDone && (Object)(object)instance != (Object)null && (Object)(object)SessionData.Instance != (Object)null && SessionData.Instance.startedGame && SessionData.Instance.play) { _loadSweepDone = true; LoadSweep(); } bool flag = PhotoConfig.YarnEnabled?.Value ?? true; bool flag2 = PhotoConfig.PostItEnabled?.Value ?? true; HoveringPost = false; if (_editing) { UpdateEdit(); } else if (!CanContinue()) { if (_yarnActive) { ExitYarn(); } if (_moving) { EndMove(); } } else { if (flag) { UpdateYarn(); } if (flag2 && !_yarnActive) { UpdatePostIt(); } } ReconcileGates(); if (_editPaused && !_editing) { try { SessionData instance2 = SessionData.Instance; if ((Object)(object)instance2 != (Object)null && !instance2.play && instance2.startedGame && (Object)(object)Player.Instance != (Object)null) { instance2.ResumeGame(); } } catch { } try { if ((Object)(object)SessionData.Instance == (Object)null || SessionData.Instance.play) { _editPaused = false; } } catch { _editPaused = false; } } KeepAnchorsHidden(); _darkTimer -= Time.unscaledDeltaTime; if (_darkTimer <= 0f) { _darkTimer = 0.3f; UpdateDarkening(); } } catch (Exception ex) { ManualLogSource log = Plugin.Log2; bool flag3 = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(38, 1, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PhotoFrames] caseboard update error: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } } private static bool CanContinue() { try { SessionData instance = SessionData.Instance; if ((Object)(object)instance == (Object)null || !instance.play || !instance.startedGame) { return false; } Player instance2 = Player.Instance; if ((Object)(object)instance2 == (Object)null || ((Actor)instance2).isDead || instance2.transitionActive || instance2.playerKOInProgress) { return false; } if (instance2.computerInteractable != null) { return false; } if ((Object)(object)CutSceneController.Instance != (Object)null && CutSceneController.Instance.cutSceneActive) { return false; } PopupMessageController instance3 = PopupMessageController.Instance; if ((Object)(object)instance3 != (Object)null && instance3.active) { return false; } return true; } catch { return false; } } private static bool CanStart() { if (!CanContinue()) { return false; } try { InteractionController instance = InteractionController.Instance; if ((Object)(object)instance != (Object)null && ((Object)(object)instance.currentLookingAtInteractable != (Object)null || (Object)(object)instance.carryingObject != (Object)null)) { return false; } } catch { return false; } return true; } private void ReconcileGates() { bool flag = _yarnActive || _editing || _moving; try { InterfaceController instance = InterfaceController.Instance; if ((Object)(object)instance == (Object)null) { return; } if (flag) { if (!instance.playerTextInputActive) { instance.SetPlayerTextInput(true); } _ptiByUs = true; } else if (_ptiByUs) { if (instance.playerTextInputActive) { instance.SetPlayerTextInput(false); } _ptiByUs = false; } } catch { } } private void RestoreGatesNow() { try { if (_ptiByUs && (Object)(object)InterfaceController.Instance != (Object)null && InterfaceController.Instance.playerTextInputActive) { InterfaceController.Instance.SetPlayerTextInput(false); } } catch { } _ptiByUs = false; try { if (_editPaused && (Object)(object)SessionData.Instance != (Object)null && SessionData.Instance.startedGame && (Object)(object)Player.Instance != (Object)null && !SessionData.Instance.play) { SessionData.Instance.ResumeGame(); } } catch { } _editPaused = false; } private void UpdateYarn() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) if (_moving) { return; } if (Input.GetKeyDown(PhotoConfig.YarnKey.Value)) { if (_yarnActive) { ExitYarn(); } else { EnterYarn(); } } else { if (!_yarnActive) { return; } int num = CaseBoardVisuals.YarnColors.Length; KeyCode value = PhotoConfig.YarnColorKey.Value; if ((int)value != 0 && Input.GetKeyDown(value)) { _yarnColor = (_yarnColor + 1) % num; } float num2 = 0f; try { num2 = Input.mouseScrollDelta.y; } catch { } if (num2 > 0.4f) { _yarnColor = (_yarnColor + 1) % num; } else if (num2 < -0.4f) { _yarnColor = (_yarnColor - 1 + num) % num; } UpdateYarnHighlight(); if (Input.GetMouseButtonDown(0)) { if (TryWallAim(out var point, out var normal, out var _)) { Vector3 val = point + normal * Mathf.Max(0.001f, PhotoConfig.YarnWallGap.Value); if (!_haveFirst) { _firstPoint = val; _haveFirst = true; } else { CreateYarn(_firstPoint, val, _yarnColor); _haveFirst = false; ClearPreview(); } } } else if (Input.GetMouseButtonDown(1)) { if (_haveFirst) { _haveFirst = false; ClearPreview(); } else if (_hoveredYarn != null) { RemoveYarn(_hoveredYarn); _hoveredYarn = null; } } UpdatePreview(); } } private void UpdateYarnHighlight() { YarnPlaced yarnPlaced = (_haveFirst ? null : FindHoveredYarn()); if (yarnPlaced != _hoveredYarn) { if (_hoveredYarn != null) { SetYarnHighlight(_hoveredYarn, on: false); } _hoveredYarn = yarnPlaced; if (_hoveredYarn != null) { SetYarnHighlight(_hoveredYarn, on: true); } } } private void SetYarnHighlight(YarnPlaced y, bool on) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) if (y == null) { return; } y.lastB = -1f; try { float num = Mathf.Max(0.001f, PhotoConfig.YarnWidth.Value); if (on) { if ((Object)(object)y.mat != (Object)null) { CaseBoardVisuals.TintYarn(y.mat, Color.Lerp(y.baseColor, Color.white, 0.75f)); } if ((Object)(object)y.line != (Object)null) { y.line.widthMultiplier = num * 2.4f; } } else { if ((Object)(object)y.mat != (Object)null) { CaseBoardVisuals.TintYarn(y.mat, y.baseColor); } if ((Object)(object)y.line != (Object)null) { y.line.widthMultiplier = num; } } } catch { } } private void EnterYarn() { _yarnActive = true; ModeActive = true; _haveFirst = false; Plugin.Log2.LogInfo((object)"[PhotoFrames] yarn mode ON."); } private void ExitYarn() { _yarnActive = false; ModeActive = false; _haveFirst = false; if (_hoveredYarn != null) { SetYarnHighlight(_hoveredYarn, on: false); _hoveredYarn = null; } ClearPreview(); } private void UpdatePreview() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00ff: 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_0116: 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) if (!_haveFirst) { ClearPreview(); return; } try { Vector3 b; if (TryWallAim(out var point, out var normal, out var _)) { b = point + normal * Mathf.Max(0.001f, PhotoConfig.YarnWallGap.Value); } else { Camera main = Camera.main; b = (((Object)(object)main != (Object)null) ? (((Component)main).transform.position + ((Component)main).transform.forward * 2f) : _firstPoint); } if ((Object)(object)_preview == (Object)null) { CaseBoardVisuals.YarnVisual yarnVisual = CaseBoardVisuals.BuildYarn(_firstPoint, b, CaseBoardVisuals.YarnColor(_yarnColor) * 0.7f, PhotoConfig.YarnWidth.Value, withPins: false); if (yarnVisual != null) { _preview = yarnVisual.go; _previewLine = yarnVisual.line; _previewMat = yarnVisual.mat; } } else if ((Object)(object)_previewLine != (Object)null) { CaseBoardVisuals.SetYarnPoints(_previewLine, _firstPoint, b); try { CaseBoardVisuals.TintYarn(_previewMat, CaseBoardVisuals.YarnColor(_yarnColor) * 0.7f); return; } catch { return; } } } catch { } } private void ClearPreview() { try { if ((Object)(object)_previewMat != (Object)null) { Object.Destroy((Object)(object)_previewMat); } } catch { } try { if ((Object)(object)_preview != (Object)null) { Object.Destroy((Object)(object)_preview); } } catch { } _preview = null; _previewLine = null; _previewMat = null; } private void CreateYarn(Vector3 a, Vector3 b, int colourIndex) { //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown if (AtCap()) { return; } bool flag = default(bool); try { Interactable val = SpawnAnchor(a, Vector3.zero); if (val == null) { Plugin.Log2.LogWarning((object)"[PhotoFrames] could not anchor yarn."); return; } YarnMark.Set(val, a, b, colourIndex); if (!YarnMark.IsYarn(val)) { Plugin.Log2.LogWarning((object)"[PhotoFrames] yarn marker did not persist; discarding anchor."); try { val.Delete(); return; } catch { return; } } CaseBoardVisuals.YarnVisual yarnVisual = CaseBoardVisuals.BuildYarn(a, b, CaseBoardVisuals.YarnColor(colourIndex), PhotoConfig.YarnWidth.Value); if (yarnVisual == null) { try { val.Delete(); return; } catch { return; } } _yarns.Add(new YarnPlaced { go = yarnVisual.go, mat = yarnVisual.mat, line = yarnVisual.line, baseColor = CaseBoardVisuals.YarnColor(colourIndex), interactableID = val.id, a = a, b = b }); _registered.Add(val.id); ManualLogSource log = Plugin.Log2; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(35, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] yarn placed. Total: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(_yarns.Count); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("."); } log.LogInfo(val2); } catch (Exception ex) { ManualLogSource log2 = Plugin.Log2; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PhotoFrames] create yarn failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } log2.LogWarning(val3); } } private void RemoveYarn(YarnPlaced y) { if (y == null) { return; } try { Interactable val = null; try { CityData.Instance.savableInteractableDictionary.TryGetValue(y.interactableID, ref val); } catch { } if (val != null) { YarnMark.Clear(val); try { val.Delete(); } catch { } } } catch { } try { if ((Object)(object)y.mat != (Object)null) { Object.Destroy((Object)(object)y.mat); } } catch { } try { if ((Object)(object)y.go != (Object)null) { Object.Destroy((Object)(object)y.go); } } catch { } _yarns.Remove(y); _registered.Remove(y.interactableID); PhotoRegistry.CaseBoardIds.Remove(y.interactableID); } private void UpdatePostIt() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (_moving) { HoveringPost = true; UpdateMove(); return; } PostPlaced postPlaced = FindHoveredPost(); HoveringPost = postPlaced != null; if (postPlaced != null && !PhotoFrameController.HoldingOurItem) { ShowPostPrompt(); } if (Input.GetKeyDown(PhotoConfig.PostItColorKey.Value)) { if (postPlaced != null) { RecolourPost(postPlaced); } else { _postColor = (_postColor + 1) % CaseBoardVisuals.PostColors.Length; } } if (Input.GetKeyDown(PhotoConfig.PostItKey.Value)) { Vector3 point; Vector3 normal; Quaternion rot; if (postPlaced != null) { BeginEdit(postPlaced.interactableID, postPlaced, isNew: false); } else if (CanStart() && TryWallAim(out point, out normal, out rot)) { Vector3 pos = point + normal * 0.02f; PostPlaced postPlaced2 = CreatePost(pos, ((Quaternion)(ref rot)).eulerAngles, _postColor, ""); if (postPlaced2 != null) { BeginEdit(postPlaced2.interactableID, postPlaced2, isNew: true); } } } else if (Input.GetMouseButtonDown(1) && postPlaced != null && !PhotoFrameController.HoldingOurItem) { RmbConsumedFrame = Time.frameCount; StartMove(postPlaced); } } private void ShowPostPrompt() { RegisterUiString("Move (P to edit)"); try { ControlsDisplayController.Instance.DisplayControlIcon((InteractionKey)2, "Move (P to edit)", 0.25f, true); } catch { } } private void RegisterUiString(string txt) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown if (string.IsNullOrEmpty(txt) || _uiRegistered.Contains(txt)) { return; } try { Dictionary<string, Dictionary<string, DisplayString>> stringTable = Strings.stringTable; if (stringTable != null && stringTable.ContainsKey("ui.interaction")) { Dictionary<string, DisplayString> val = stringTable["ui.interaction"]; if (val != null) { DisplayString val2 = new DisplayString(); val2.displayStr = txt; val2.alternateStr = txt; val[txt.ToLowerInvariant()] = val2; _uiRegistered.Add(txt); } } } catch { } } private void StartMove(PostPlaced p) { if (p != null) { _moving = true; MoveActive = true; _moveId = p.interactableID; _moveHasPose = false; SwallowClick(); } } private static void SwallowClick() { try { if ((Object)(object)InteractionController.Instance != (Object)null) { InteractionController.Instance.inputCooldown = 0.1f; } } catch { } } private void UpdateMove() { //IL_006c: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) PostPlaced postPlaced = FindPost(_moveId); if (postPlaced == null || (Object)(object)postPlaced.go == (Object)null) { EndMove(); return; } if (!CanContinue()) { EndMove(); return; } if (TryWallAim(out var point, out var normal, out var rot)) { Vector3 val = point + normal * 0.02f; try { postPlaced.go.transform.SetPositionAndRotation(val, rot); } catch { } _moveLastPos = val; _moveLastEuler = ((Quaternion)(ref rot)).eulerAngles; _moveHasPose = true; } if (Input.GetMouseButtonDown(1)) { RmbConsumedFrame = Time.frameCount; EndMove(); } } private void EndMove() { //IL_00a5: 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_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) //IL_00de: 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) PostPlaced postPlaced = FindPost(_moveId); _moving = false; MoveActive = false; if (postPlaced != null && _moveHasPose) { try { Interactable val = null; try { CityData.Instance.savableInteractableDictionary.TryGetValue(postPlaced.interactableID, ref val); } catch { } if (val != null) { try { val.MoveInteractable(_moveLastPos, _moveLastEuler, true); } catch { } try { val.SetSpawnPositionRelevent(true); } catch { } try { if ((Object)(object)val.controller != (Object)null) { val.controller.SetPhysics(false, (Actor)null); } } catch { } try { val.force = true; } catch { } PostItMark.Set(val, _moveLastPos, _moveLastEuler, postPlaced.colourIndex, postPlaced.text); try { PhotoModel.Hide(val.controller); } catch { } } try { postPlaced.go.transform.SetPositionAndRotation(_moveLastPos, Quaternion.Euler(_moveLastEuler)); } catch { } } catch { } } _moveId = -1; _moveHasPose = false; SwallowClick(); } private PostPlaced CreatePost(Vector3 pos, Vector3 euler, int colourIndex, string text) { //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_000c: 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_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) //IL_0061: 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_0063: 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) if (AtCap()) { return null; } try { Interactable val = SpawnAnchor(pos, euler); if (val == null) { Plugin.Log2.LogWarning((object)"[PhotoFrames] could not anchor post-it."); return null; } PostItMark.Set(val, pos, euler, colourIndex, text); if (!PostItMark.IsPostIt(val)) { Plugin.Log2.LogWarning((object)"[PhotoFrames] post-it marker did not persist; discarding anchor."); try { val.Delete(); } catch { } return null; } CaseBoardVisuals.PostItVisual postItVisual = CaseBoardVisuals.BuildPostIt(pos, Quaternion.Euler(euler), text, CaseBoardVisuals.PostColor(colourIndex), Mathf.Max(0.05f, PhotoConfig.PostItSize.Value)); if (postItVisual == null) { try { val.Delete(); } catch { } return null; } PostPlaced postPlaced = new PostPlaced { go = postItVisual.go, tmp = postItVisual.tmp, darken = postItVisual.darken, interactableID = val.id, colourIndex = colourIndex, halfW = postItVisual.halfW, halfH = postItVisual.halfH, text = (text ?? "") }; _posts.Add(postPlaced); _registered.Add(val.id); return postPlaced; } catch (Exception ex) { ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(37, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] create post-it failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } log.LogWarning(val2); return null; } } private void RecolourPost(PostPlaced p) { //IL_00a0: 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_0065: Unknown result type (might be due to invalid IL or missing references) if (p == null) { return; } try { p.colourIndex = (p.colourIndex + 1) % CaseBoardVisuals.PostColors.Length; Transform val = (((Object)(object)p.go != (Object)null) ? p.go.transform.Find("Paper") : null); Image val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<Image>() : null); if ((Object)(object)val2 != (Object)null) { ((Graphic)val2).color = CaseBoardVisuals.PostColor(p.colourIndex); } Interactable val3 = null; try { CityData.Instance.savableInteractableDictionary.TryGetValue(p.interactableID, ref val3); } catch { } if (val3 != null && PostItMark.TryGetPose(val3, out var pos, out var euler, out var _)) { PostItMark.Set(val3, pos, euler, p.colourIndex, p.text); } } catch { } } private void RemovePost(PostPlaced p) { if (p == null) { return; } try { Interactable val = null; try { CityData.Instance.savableInteractableDictionary.TryGetValue(p.interactableID, ref val); } catch { } if (val != null) { PostItMark.Clear(val); try { val.Delete(); } catch { } } } catch { } try { if ((Object)(object)p.go != (Object)null) { Object.Destroy((Object)(object)p.go); } } catch { } _posts.Remove(p); _registered.Remove(p.interactableID); PhotoRegistry.CaseBoardIds.Remove(p.interactableID); } private void BeginEdit(int id, PostPlaced p, bool isNew) { if (p == null) { return; } _editing = true; EditActive = true; _editId = id; _editIsNew = isNew; _editOriginal = p.text ?? ""; _editBuf.Length = 0; if (!isNew) { _editBuf.Append(_editOriginal); } _skipInputFrame = true; _editPaused = false; try { SessionData instance = SessionData.Instance; if ((Object)(object)instance != (Object)null && instance.play) { instance.PauseGame(false, true, false); _editPaused = !instance.play; } } catch { } } private void UpdateEdit() { PostPlaced postPlaced = FindPost(_editId); if (postPlaced == null) { EndEdit(); return; } Player instance = Player.Instance; if ((Object)(object)instance == (Object)null || ((Actor)instance).isDead) { EndEdit(); return; } try { if (_editPaused && (Object)(object)SessionData.Instance != (Object)null && SessionData.Instance.play) { EndEdit(); return; } } catch { } try { DepthOfField val = (((Object)(object)SessionData.Instance != (Object)null) ? SessionData.Instance.dof : null); if ((Object)(object)val != (Object)null && ((VolumeComponent)val).active) { ((VolumeComponent)val).active = false; } } catch { } if (_skipInputFrame) { _skipInputFrame = false; } else { string text = ""; try { text = Input.inputString; } catch { } foreach (char c in text) { switch (c) { case '\b': if (_editBuf.Length > 0) { _editBuf.Length--; } break; case '\n': case '\r': EndEdit(); return; default: if (!char.IsControl(c) && _editBuf.Length < 140) { _editBuf.Append(c); } break; } } } if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271) || Input.GetKeyDown((KeyCode)27)) { EndEdit(); return; } try { bool flag = (int)(Time.unscaledTime * 2f) % 2 == 0; if ((Object)(object)postPlaced.tmp != (Object)null) { ((TMP_Text)postPlaced.tmp).text = _editBuf.ToString() + (flag ? "|" : ""); } } catch { } } private void EndEdit() { PostPlaced postPlaced = FindPost(_editId); string text = _editBuf.ToString(); _editing = false; EditActive = false; if (postPlaced != null) { postPlaced.text = text; try { if ((Object)(object)postPlaced.tmp != (Object)null) { ((TMP_Text)postPlaced.tmp).text = text; } } catch { } Interactable val = null; try { CityData.Instance.savableInteractableDictionary.TryGetValue(postPlaced.interactableID, ref val); } catch { } if (val != null) { PostItMark.SetText(val, text); } if (string.IsNullOrWhiteSpace(text)) { RemovePost(postPlaced); } } _editId = -1; _editIsNew = false; _editBuf.Length = 0; try { if (_editPaused && (Object)(object)SessionData.Instance != (Object)null && !SessionData.Instance.play) { SessionData.Instance.ResumeGame(); } } catch { } try { if ((Object)(object)SessionData.Instance == (Object)null || SessionData.Instance.play) { _editPaused = false; } } catch { _editPaused = false; } try { if (_ptiByUs && !_yarnActive && (Object)(object)InterfaceController.Instance != (Object)null && InterfaceController.Instance.playerTextInputActive) { InterfaceController.Instance.SetPlayerTextInput(false); } } catch { } if (!_yarnActive) { _ptiByUs = false; } } private PostPlaced FindPost(int id) { for (int i = 0; i < _posts.Count; i++) { if (_posts[i] != null && _posts[i].interactableID == id) { return _posts[i]; } } return null; } private bool AtCap() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown int num = PhotoConfig.MaxCaseBoardItems?.Value ?? 0; if (num <= 0) { return false; } if (_yarns.Count + _posts.Count >= num) { ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(107, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PhotoFrames] case-board item cap ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") reached; raise or clear MaxCaseBoardItems in the config to place more."); } log.LogWarning(val); return true; } return false; } private Interactable SpawnAnchor(Vector3 pos, Vector3 euler) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //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) try { Interactable val = InteractableCreator.Instance.CreateWorldInteractable(InteriorControls.Instance.surveillancePrintout, (Human)(object)Player.Instance, (Human)(object)Player.Instance, (Human)null, pos, euler, (List<Passed>)null, (Object)null, ""); if (val == null) { return null; } try { val.MoveInteractable(pos, euler, true); } catch { } try { val.SetSpawnPositionRelevent(true); } catch { } try { if ((Object)(object)val.controller != (Object)null) { val.controller.SetPhysics(false, (Actor)null); } } catch { } try { val.force = true; } catch { } try { val.MarkAsTrash(false, false, 0f); } catch { } try { PhotoModel.Hide(val.controller); } catch { } try { PhotoRegistry.CaseBoardIds.Add(val.id); } catch { } return val; } catch (Exception ex) { ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] anchor spawn failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } log.LogWarning(val2); return null; } } private static bool TryWallAim(out Vector3 point, out Vector3 normal, 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_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_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) point = Vector3.zero; normal = Vector3.up; rot = Quaternion.identity; try { Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return false; } Transform transform = ((Component)main).transform; RaycastHit val = default(RaycastHit); if (Physics.Raycast(transform.position, transform.forward, ref val, 4f, 536870912)) { point = ((RaycastHit)(ref val)).point; normal = ((RaycastHit)(ref val)).normal; Vector3 val2 = ((Mathf.Abs(Vector3.Dot(normal, Vector3.up)) > 0.95f) ? Vector3.forward : Vector3.up); rot = Quaternion.LookRotation(normal, val2); return true; } } catch { } return false; } private static float Reach() { float num = 2.2f; try { if ((Object)(object)GameplayControls.Instance != (Object)null) { num = GameplayControls.Instance.interactionRange + 0.2f; } } catch { } return Mathf.Max(0.5f, num); } private PostPlaced FindHoveredPost() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_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_00dc: 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_00e0: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_00fc: 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_011e: Unknown result type (might be due to invalid IL or missing references) try { Camera val = (((Object)(object)CameraController.Instance != (Object)null) ? CameraController.Instance.cam : Camera.main); if ((Object)(object)val == (Object)null) { return null; } Vector3 position = ((Component)val).transform.position; Vector3 forward = ((Component)val).transform.forward; float num = Reach(); PostPlaced result = null; float num2 = float.PositiveInfinity; for (int i = 0; i < _posts.Count; i++) { PostPlaced postPlaced = _posts[i]; if (postPlaced == null || (Object)(object)postPlaced.go == (Object)null) { continue; } Transform transform = postPlaced.go.transform; Vector3 forward2 = transform.forward; float num3 = Vector3.Dot(forward, forward2); if (num3 >= -0.0001f) { continue; } float num4 = Vector3.Dot(transform.position - position, forward2) / num3; if (!(num4 <= 0.05f) && !(num4 > num)) { Vector3 val2 = position + forward * num4 - transform.position; if (!(Mathf.Abs(Vector3.Dot(val2, transform.right)) > postPlaced.halfW * 1.2f) && !(Mathf.Abs(Vector3.Dot(val2, transform.up)) > postPlaced.halfH * 1.2f) && num4 < num2) { num2 = num4; result = postPlaced; } } } return result; } catch { return null; } } private YarnPlaced FindHoveredYarn() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) try { Camera val = (((Object)(object)CameraController.Instance != (Object)null) ? CameraController.Instance.cam : Camera.main); if ((Object)(object)val == (Object)null) { return null; } Vector3 position = ((Component)val).transform.position; Vector3 forward = ((Component)val).transform.forward; Vector3 normalized = ((Vector3)(ref forward)).normalized; float num = Reach(); float num2 = float.PositiveInfinity; try { RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(position, normalized, ref val2, num + 0.5f, Toolbox.Instance.interactionRayLayerMask)) { num2 = ((RaycastHit)(ref val2)).distance; } } catch { } YarnPlaced result = null; float num3 = float.PositiveInfinity; for (int i = 0; i < _yarns.Count; i++) { YarnPlaced yarnPlaced = _yarns[i]; if (yarnPlaced != null) { float t; float num4 = RaySegDist(position, normalized, yarnPlaced.a, yarnPlaced.b, out t); if (!(t <= 0.05f) && !(t > num) && !(t >= num2 + 0.03f) && !(num4 > 0.09f) && t < num3) { num3 = t; result = yarnPlaced; } } } return result; } catch { return null; } } private static float RaySegDist(Vector3 o, Vector3 dir, Vector3 a, Vector3 b, out float t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_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_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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; Vector3 val2 = o - a; float num = Vector3.Dot(dir, dir); float num2 = Vector3.Dot(dir, val); float num3 = Vector3.Dot(val, val); float num4 = Vector3.Dot(dir, val2); float num5 = Vector3.Dot(val, val2); float num6 = num * num3 - num2 * num2; float num7 = ((num6 < 1E-06f) ? 0f : ((num * num5 - num2 * num4) / num6)); num7 = Mathf.Clamp01(num7); Vector3 val3 = o + dir * (t = (num2 * num7 - num4) / Mathf.Max(1E-06f, num)); Vector3 val4 = a + val * num7; return Vector3.Distance(val3, val4); } private void KeepAnchorsHidden() { try { CityData instance = CityData.Instance; Dictionary<int, Interactable> val = (((Object)(object)instance != (Object)null) ? instance.savableInteractableDictionary : null); if (val == null) { return; } for (int i = 0; i < _posts.Count; i++) { PostPlaced postPlaced = _posts[i]; if (postPlaced != null) { Interactable val2 = null; try { val.TryGetValue(postPlaced.interactableID, ref val2); } catch { } if (val2 != null) { PhotoModel.HideIfOwned(val2); } } } for (int j = 0; j < _yarns.Count; j++) { YarnPlaced yarnPlaced = _yarns[j]; if (yarnPlaced != null) { Interactable val3 = null; try { val.TryGetValue(yarnPlaced.interactableID, ref val3); } catch { } if (val3 != null) { PhotoModel.HideIfOwned(val3); } } } } catch { } } private void UpdateDarkening() { //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) bool flag = PhotoConfig.AmbientDarken?.Value ?? true; float maxDarken = PhotoConfig.MaxDarken?.Value ?? 0.8f; CityData instance = CityData.Instance; Dictionary<int, Interactable> val = (((Object)(object)instance != (Object)null) ? instance.savableInteractableDictionary : null); for (int i = 0; i < _posts.Count; i++) { PostPlaced postPlaced = _posts[i]; if (postPlaced == null || (Object)(object)postPlaced.darken == (Object)null) { continue; } float brightness = 1f; if (flag && val != null) { Interactable anchor = null; try { val.TryGetValue(postPlaced.interactableID, ref anchor); } catch { } brightness = AmbientLight.Brightness(anchor); } CaseBoardVisuals.ApplyDarken(postPlaced.darken, brightness, maxDarken); } for (int j = 0; j < _yarns.Count; j++) { YarnPlaced yarnPlaced = _yarns[j]; if (yarnPlaced == null || (Object)(object)yarnPlaced.mat == (Object)null || yarnPlaced == _hoveredYarn) { continue; } float num = 1f; if (flag && val != null) { Interactable anchor2 = null; try { val.TryGetValue(yarnPlaced.interactableID, ref anchor2); } catch { } num = AmbientLight.Brightness(anchor2); } if (!(Mathf.Abs(num - yarnPlaced.lastB) < 0.01f)) { yarnPlaced.lastB = num; CaseBoardVisuals.TintYarn(yarnPlaced.mat, yarnPlaced.baseColor * Mathf.Lerp(0.18f, 1f, Mathf.Clamp01(num))); } } } private void LoadSweep() { //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_0077: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_0167: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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) CityData instance = CityData.Instance; List<Interactable> val = (((Object)(object)instance != (Object)null) ? instance.interactableDirectory : null); if (val == null) { return; } int num = 0; for (int i = 0; i < val.Count; i++) { Interactable val2; try { val2 = val[i]; } catch { continue; } if (val2 == null || _registered.Contains(val2.id)) { continue; } try { if (YarnMark.IsYarn(val2)) { if (!YarnMark.TryGet(val2, out var a, out var b, out var colourIndex)) { continue; } CaseBoardVisuals.YarnVisual yarnVisual = CaseBoardVisuals.BuildYarn(a, b, CaseBoardVisuals.YarnColor(colourIndex), PhotoConfig.YarnWidth.Value); if (yarnVisual != null) { _yarns.Add(new YarnPlaced { go = yarnVisual.go, mat = yarnVisual.mat, line = yarnVisual.line, baseColor = CaseBoardVisuals.YarnColor(colourIndex), interactableID = val2.id, a = a, b = b }); _registered.Add(val2.id); try { PhotoRegistry.CaseBoardIds.Add(val2.id); } catch { } num++; } continue; } if (!PostItMark.IsPostIt(val2) || !PostItMark.TryGetPose(val2, out var pos, out var euler, out var colourIndex2)) { continue; } string text = PostItMark.GetText(val2); CaseBoardVisuals.PostItVisual postItVisual = CaseBoardVisuals.BuildPostIt(pos, Quaternion.Euler(euler), text, CaseBoardVisuals.PostColor(colourIndex2), Mathf.Max(0.05f, PhotoConfig.PostItSize.Value)); if (postItVisual != null) { _posts.Add(new PostPlaced { go = postItVisual.go, tmp = postItVisual.tmp, darken = postItVisual.darken, interactableID = val2.id, colourIndex = colourIndex2, halfW = postItVisual.halfW, halfH = postItVisual.halfH, text = (text ?? "") }); _registered.Add(val2.id); try { PhotoRegistry.CaseBoardIds.Add(val2.id); } catch { } num++; } } catch { } } if (num > 0) { ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(53, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PhotoFrames] restored "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" yarn/post-it item(s) on load."); } log.LogWarning(val3); } } private void OnWorldChanged() { _editing = false; EditActive = false; _editId = -1; _editBuf.Length = 0; _yarnActive = false; ModeActive = false; _haveFirst = false; _moving = false; MoveActive = false; _moveId = -1; _moveHasPose = false; _hoveredYarn = null; RestoreGatesNow(); ClearPreview(); foreach (YarnPlaced yarn in _yarns) { try { if ((Object)(object)yarn.mat != (Object)null) { Object.Destroy((Object)(object)yarn.mat); } } catch { } try { if ((Object)(object)yarn.go != (Object)null) { Object.Destroy((Object)(object)yarn.go); } } catch { } } foreach (PostPlaced post in _posts) { try { if ((Object)(object)post.go != (Object)null) { Object.Destroy((Object)(object)post.go); } } catch { } } _yarns.Clear(); _posts.Clear(); _registered.Clear(); try { PhotoRegistry.CaseBoardIds.Clear(); } catch { } _loadSweepDone = false; } private void OnDestroy() { RestoreGatesNow(); ModeActive = false; EditActive = false; MoveActive = false; if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void OnGUI() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) try { string text = null; if (_editing) { text = "PhotoFrames - post-it\n\nType your note.\nEnter or Esc = save (a blank new note is discarded)"; } else if (_moving) { text = "PhotoFrames - move note\n\nAim at a wall to reposition the note.\nRMB = drop it here"; } else if (_yarnActive) { string text2 = CaseBoardVisuals.YarnColorNames[_yarnColor % CaseBoardVisuals.YarnColorNames.Length]; string text3 = (((int)PhotoConfig.YarnColorKey.Value == 0) ? "mouse wheel" : (((object)PhotoConfig.YarnColorKey.Value/*cast due to .constrained prefix*/).ToString() + " / wheel")); text = "PhotoFrames - yarn\n\nColour: " + text2 + " (" + text3 + ")\nLMB: " + (_haveFirst ? "place END pin" : "place START pin") + "\nRMB: " + (_haveFirst ? "cancel line" : "remove yarn aimed at") + "\n" + ((object)PhotoConfig.YarnKey.Value/*cast due to .constrained prefix*/).ToString() + " = exit"; } if (text != null) { float num = (float)Screen.height * 0.5f - 66f; GUI.Box(new Rect(16f, num, 340f, 132f), text); } } catch { } } } internal static class CaseBoardVisuals { internal sealed class YarnVisual { public GameObject go; public LineRenderer line; public Material mat; } internal sealed class PostItVisual { public GameObject go; public TextMeshProUGUI tmp; public Image darken; public float halfW; public float halfH; } internal static readonly Color[] YarnColors = (Color[])(object)new Color[6] { new Color(0.86f, 0.13f, 0.13f), new Color(0.16f, 0.42f, 0.9f), new Color(0.95f, 0.82f, 0.15f), new Color(0.22f, 0.74f, 0.28f), new Color(0.62f, 0.26f, 0.82f), new Color(0.95f, 0.95f, 0.92f) }; internal static readonly string[] YarnColorNames = new string[6] { "Red", "Blue", "Yellow", "Green", "Purple", "White" }; internal static readonly Color[] PostColors = (Color[])(object)new Color[6] { new Color(0.98f, 0.9f, 0.36f), new Color(0.98f, 0.66f, 0.76f), new Color(0.62f, 0.82f, 0.96f), new Color(0.72f, 0.9f, 0.55f), new Color(0.98f, 0.72f, 0.38f), new Color(0.95f, 0.94f, 0.88f) }; internal static readonly string[] PostColorNames = new string[6] { "Yellow", "Pink", "Blue", "Green", "Orange", "White" }; private static readonly Color PostInk = new Color(0.12f, 0.1f, 0.08f, 1f); private static TMP_FontAsset _font; private static bool _fontTried; private static Mesh _sphere; private static Texture2D _yarnTex; private const int PW = 300; private const int PPad = 30; internal static Color YarnColor(int i) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) return YarnColors[(i % YarnColors.Length + YarnColors.Length) % YarnColors.Length]; } internal static Color PostColor(int i) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) return PostColors[(i % PostColors.Length + PostColors.Length) % PostColors.Length]; } internal static TMP_FontAsset CaseFont() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown if (_fontTried) { return _font; } try { DDSControls instance = DDSControls.Instance; if ((Object)(object)instance == (Object)null) { return null; } _fontTried = true; List<TMP_FontAsset> fonts = instance.fonts; if (fonts != null) { for (int i = 0; i < fonts.Count; i++) { TMP_FontAsset val = fonts[i]; if ((Object)(object)val != (Object)null && ((Object)val).name == "PapaManAOE SDF") { _font = val; break; } } if ((Object)(object)_font == (Object)null && (Object)(object)instance.defaultHandwritingFont != (Object)null) { _font = instance.defaultHandwritingFont; } } } catch (Exception ex) { _fontTried = true; ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(39, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] case font lookup failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } log.LogWarning(val2); } return _font; } internal static Material NewYarnMaterial(Color c) { //IL_00d2: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) Material val = null; try { Shader val2 = Shader.Find("HDRP/Unlit"); if ((Object)(object)val2 != (Object)null) { val = new Material(val2); } } catch { } if ((Object)(object)val == (Object)null) { try { InterfaceControls instance = InterfaceControls.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.arrow != (Object)null) { val = Object.Instantiate<Material>(instance.arrow); } } catch { } } if ((Object)(object)val == (Object)null) { try { val = new Material(Shader.Find("Sprites/Default")); } catch { } } if ((Object)(object)val != (Object)null) { Texture2D val3 = YarnTexture(); try { val.SetTexture("_UnlitColorMap", (Texture)(object)val3); } catch { } try { val.SetTexture("_BaseColorMap", (Texture)(object)val3); } catch { } try { val.SetTexture("_EmissiveColorMap", (Texture)null); } catch { } try { val.SetColor("_EmissiveColor", Color.black); } catch { } TintYarn(val, c); } return val; } internal static void TintYarn(Material m, Color c) { //IL_001c: 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_003b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m == (Object)null) { return; } c.a = 1f; try { m.SetColor("_UnlitColor", c); } catch { } try { m.SetColor("_BaseColor", c); } catch { } try { m.color = c; } catch { } } private static Mesh SphereMesh() { if ((Object)(object)_sphere != (Object)null) { return _sphere; } try { GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0); MeshFilter component = obj.GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null) { _sphere = component.sharedMesh; } Object.DestroyImmediate((Object)(object)obj); } catch { } return _sphere; } internal static YarnVisual BuildYarn(Vector3 a, Vector3 b, Color c, float width, bool withPins = true) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //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_00a2: 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) GameObject val = null; Material val2 = null; try { val = new GameObject("Yarn"); LineRenderer val3 = val.AddComponent<LineRenderer>(); val3.useWorldSpace = true; SetYarnPoints(val3, a, b); val3.widthMultiplier = Mathf.Max(0.001f, width); val3.numCapVertices = 4; val3.numCornerVertices = 2; val3.alignment = (LineAlignment)0; val3.textureMode = (LineTextureMode)1; ((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val3).receiveShadows = false; ((Renderer)val3).sortingOrder = 100; Color startColor = (val3.endColor = Color.white); val3.startColor = startColor; val2 = NewYarnMaterial(c); if ((Object)(object)val2 != (Object)null) { ((Renderer)val3).sharedMaterial = val2; } if (withPins) { AddPin(val, a, c, val2, width); AddPin(val, b, c, val2, width); } return new YarnVisual { go = val, line = val3, mat = val2 }; } catch (Exception ex) { try { if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)val2); } } catch { } try { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } catch { } ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(33, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[PhotoFrames] build yarn failed: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message); } log.LogWarning(val4); return null; } } internal static void SetYarnPoints(LineRenderer lr, Vector3 a, Vector3 b) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) if ((Object)(object)lr == (Object)null) { return; } try { float num = Mathf.Min(Vector3.Distance(a, b) * 0.06f, 0.06f); lr.positionCount = 15; for (int i = 0; i <= 14; i++) { float num2 = (float)i / 14f; Vector3 val = Vector3.Lerp(a, b, num2) + Vector3.down * (num * 4f * num2 * (1f - num2)); lr.SetPosition(i, val); } } catch { } } private static Texture2D YarnTexture() { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_yarnTex != (Object)null) { return _yarnTex; } try { Texture2D val = new Texture2D(32, 8, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)0, filterMode = (FilterMode)1 }; float num = 3.5f; for (int i = 0; i < 8; i++) { float num2 = Mathf.Abs((float)i - num) / num; float num3 = Mathf.Lerp(0.72f, 0.32f, num2 * num2); for (int j = 0; j < 32; j++) { float num4 = 0.5f + 0.5f * Mathf.Sin(((float)j / 32f * 3f + (float)i / 8f) * ((float)Math.PI * 2f)); float num5 = num3 * (0.72f + 0.28f * num4); val.SetPixel(j, i, new Color(num5, num5, num5, 1f)); } } val.Apply(false, true); _yarnTex = val; } catch { } return _yarnTex; } private static void AddPin(GameObject root, Vector3 pos, Color c, Material shared, float width) { //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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0062: Unknown result type (might be due to invalid IL or missing references) try { Mesh val = SphereMesh(); if (!((Object)(object)val == (Object)null)) { GameObject val2 = new GameObject("Pin"); val2.transform.SetParent(root.transform, true); val2.transform.position = pos; float num = Mathf.Max(0.01f, width * 3f); val2.transform.localScale = new Vector3(num, num, num); val2.AddComponent<MeshFilter>().sharedMesh = val; MeshRenderer val3 = val2.AddComponent<MeshRenderer>(); ((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val3).receiveShadows = false; ((Renderer)val3).sortingOrder = 100; if ((Object)(object)shared != (Object)null) { ((Renderer)val3).sharedMaterial = shared; } } } catch { } } internal static PostItVisual BuildPostIt(Vector3 pos, Quaternion rot, string text, Color paper, float sizeMeters) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0013: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0051: 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_0069: 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_00ab: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown GameObject val = null; try { val = new GameObject("PostIt"); val.transform.SetPositionAndRotation(pos, rot); Canvas obj = val.AddComponent<Canvas>(); obj.renderMode = (RenderMode)2; obj.sortingOrder = 20; RectTransform component = val.GetComponent<RectTransform>(); Vector2 val2 = (component.anchorMax = new Vector2(0.5f, 0.5f)); Vector2 pivot = (component.anchorMin = val2); component.pivot = pivot; component.sizeDelta = new Vector2(300f, 300f); float num = Mathf.Max(0.02f, sizeMeters) / 300f; val.transform.localScale = new Vector3(0f - num, num, num); Image obj2 = NewChild(val, "Paper").AddComponent<Image>(); ((Graphic)obj2).color = paper; StretchFull(((Graphic)obj2).rectTransform, 0f); TextMeshProUGUI val5 = NewChild(val, "Text").AddComponent<TextMeshProUGUI>(); try { TMP_FontAsset val6 = CaseFont(); if ((Object)(object)val6 != (Object)null) { ((TMP_Text)val5).font = val6; } } catch { } ((Graphic)val5).color = PostInk; ((TMP_Text)val5).alignment = (TextAlignmentOptions)257; ((TMP_Text)val5).enableWordWrapping = true; ((TMP_Text)val5).richText = false; ((TMP_Text)val5).enableAutoSizing = true; ((TMP_Text)val5).fontSizeMin = 12f; ((TMP_Text)val5).fontSizeMax = 40f; ((TMP_Text)val5).text = text ?? ""; StretchFull(((TMP_Text)val5).rectTransform, 30f); Image darken = AttachDarkOverlay(val); float num2 = sizeMeters * 0.5f; return new PostItVisual { go = val, tmp = val5, darken = darken, halfW = num2, halfH = num2 }; } catch (Exception ex) { try { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } catch { } ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val7 = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("[PhotoFrames] build post-it failed: "); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<string>(ex.Message); } log.LogWarning(val7); return null; } } internal static Image AttachDarkOverlay(GameObject canvasRoot) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)canvasRoot == (Object)null) { return null; } Image obj = NewChild(canvasRoot, "Dark").AddComponent<Image>(); ((Graphic)obj).color = new Color(0f, 0f, 0f, 0f); ((Graphic)obj).raycastTarget = false; StretchFull(((Graphic)obj).rectTransform, 0f); ((Transform)((Graphic)obj).rectTransform).SetAsLastSibling(); return obj; } catch { return null; } } internal static void ApplyDarken(Image overlay, float brightness, float maxDarken) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)overlay == (Object)null) { return; } try { float num = Mathf.Clamp01((1f - Mathf.Clamp01(brightness)) * Mathf.Clamp01(maxDarken)); if (Mathf.Abs(((Graphic)overlay).color.a - num) > 0.01f) { ((Graphic)overlay).color = new Color(0f, 0f, 0f, num); } } catch { } } private static GameObject NewChild(GameObject parent, string name) { //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_0019: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent.transform, false); return val; } private static void StretchFull(RectTransform r, float margin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) r.anchorMin = Vector2.zero; r.anchorMax = Vector2.one; r.offsetMin = new Vector2(margin, margin); r.offsetMax = new Vector2(0f - margin, 0f - margin); ((Transform)r).localScale = Vector3.one; } } [HarmonyPatch(typeof(InputController), "Update")] internal static class EditInputSuppressPatch { private static bool Prefix() { try { if (CaseBoardController.EditGate) { return false; } } catch { } return true; } } internal static class PhotoModel { internal static void Hide(InteractableController ctrl) { try { if ((Object)(object)ctrl == (Object)null) { return; } List<MeshRenderer> meshes = ctrl.meshes; if (meshes != null) { for (int i = 0; i < meshes.Count; i++) { MeshRenderer val = meshes[i]; if ((Object)(object)val != (Object)null && ((Renderer)val).enabled) { ((Renderer)val).enabled = false; } } } if ((Object)(object)ctrl.coll != (Object)null && ctrl.coll.enabled) { ctrl.coll.enabled = false; } if ((Object)(object)ctrl.altColl != (Object)null && ctrl.altColl.enabled) { ctrl.altColl.enabled = false; } } catch { } } internal static void HideIfOwned(Interactable inter) { try { InteractableController val = ((inter != null) ? inter.controller : null); if ((Object)(object)val != (Object)null && val.interactable != null && val.interactable.id == inter.id) { Hide(val); } } catch { } } } [HarmonyPatch(typeof(InteractableController), "Setup")] internal static class HidePhotoModelPatch { internal static bool IsOurAnchor(Interactable it) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected I4, but got Unknown try { List<Passed> val = ((it != null) ? it.pv : null); if (val == null) { return false; } for (int i = 0; i < val.Count; i++) { Passed val2 = val[i]; if (val2 != null) { int num = (int)val2.varType; if (num == 7778 || num == 7779 || num == 7784 || num == 7787) { return true; } } } } catch { } return false; } private static void Postfix(InteractableController __instance, Interactable newInteractable) { try { if (IsOurAnchor(newInteractable)) { PhotoModel.Hide(__instance); } } catch { } } } [HarmonyPatch(typeof(InteractableController), "SetVisible")] internal static class ReHideOnCullPatch { private static void Postfix(InteractableController __instance) { try { if (HidePhotoModelPatch.IsOurAnchor(((Object)(object)__instance != (Object)null) ? __instance.interactable : null)) { PhotoModel.Hide(__instance); } } catch { } } } internal static class PhotoRegistry { internal static readonly HashSet<int> OurPhotoIds = new HashSet<int>(); internal static readonly HashSet<int> CaseBoardIds = new HashSet<int>(); } [HarmonyPatch(typeof(ActionController), "Inspect")] internal static class InspectSuppressPatch { private static bool Prefix(Interactable what) { try { if (what != null && (PhotoRegistry.OurPhotoIds.Contains(what.id) || PhotoRegistry.CaseBoardIds.Contains(what.id))) { return false; } } catch { } return true; } } [HarmonyPatch(typeof(ActionController), "InspectRemove")] internal static class InspectRemoveSuppressPatch { private static bool Prefix(Interactable what) { try { if (what != null && (PhotoRegistry.OurPhotoIds.Contains(what.id) || PhotoRegistry.CaseBoardIds.Contains(what.id))) { return false; } } catch { } return true; } } internal static class NewsClipBuilder { internal static readonly Color Paper = new Color(0.925f, 0.894f, 0.808f, 1f); private static readonly Color Ink = new Color(0.11f, 0.09f, 0.07f, 1f); private const int W = 760; private const int Pad = 46; private const float WidthMeters = 0.4f; internal static GameObject BuildClip(NewsStory s, Vector3 pos, Quaternion rot, out float halfW, out float halfH) { //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_005a: 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_0062: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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) halfW = (halfH = 0f); if (s == null) { return null; } try { GameObject val = new GameObject("NewsClip"); val.transform.SetPositionAndRotation(pos, rot); val.AddComponent<Canvas>().renderMode = (RenderMode)2; RectTransform component = val.GetComponent<RectTransform>(); Vector2 val2 = (component.anchorMax = new Vector2(0.5f, 0.5f)); Vector2 pivot = (component.anchorMin = val2); component.pivot = pivot; float num = 0.0005263158f; val.transform.localScale = new Vector3(0f - num, num, num); Image obj = NewChild(val, "Paper").AddComponent<Image>(); ((Graphic)obj).color = Paper; int innerW = 668; float num2 = 46f; num2 += Place(val, "Masthead", s.Masthead, s.HeadlineFont, 34f, (FontStyles)1, (TextAlignmentOptions)514, innerW, num2); num2 += 6f; Image obj2 = NewChild(val, "Rule").AddComponent<Image>(); ((Graphic)obj2).color = Ink; PlaceRect(((Graphic)obj2).rectTransform, 46f, num2, 714f, num2 + 3f); num2 += 15f; num2 += Place(val, "Date", s.DateLine, s.BodyFont, 22f, (FontStyles)2, (TextAlignmentOptions)514, innerW, num2); num2 += 16f; num2 += Place(val, "Headline", s.Headline, s.HeadlineFont, 46f, (FontStyles)1, (TextAlignmentOptions)257, innerW, num2); num2 += 14f; num2 += Place(val, "Body", s.Body, s.BodyFont, 28f, (FontStyles)0, (TextAlignmentOptions)257, innerW, num2); num2 += 46f; int num3 = Mathf.Max(380, Mathf.CeilToInt(num2)); component.sizeDelta = new Vector2(760f, (float)num3); StretchFull(((Graphic)obj).rectTransform); halfW = 0.2f; halfH = (float)num3 * num * 0.5f; return val; } catch (Exception ex) { ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(33, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[PhotoFrames] build clip failed: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message); } log.LogWarning(val5); return null; } } private static float Place(GameObject root, string name, string text, TMP_FontAsset font, float size, FontStyles style, TextAlignmentOptions align, int innerW, float yTop) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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 (string.IsNullOrWhiteSpace(text)) { return 0f; } TextMeshProUGUI val = NewChild(root, name).AddComponent<TextMeshProUGUI>(); try { if ((Object)(object)font != (Object)null) { ((TMP_Text)val).font = font; } } catch { } ((TMP_Text)val).fontSize = size; ((TMP_Text)val).fontStyle = style; ((TMP_Text)val).alignment = align; ((Graphic)val).color = Ink; ((TMP_Text)val).enableWordWrapping = true; ((TMP_Text)val).richText = false; ((TMP_Text)val).text = text; float num; try { num = ((TMP_Text)val).GetPreferredValues(text, (float)innerW, 0f).y; } catch { num = size * 1.4f; } num = Mathf.Max(size, num); PlaceRect(((TMP_Text)val).rectTransform, 46f, yTop, 714f, yTop + num); return num; } private static void PlaceRect(RectTransform r, float leftX, float yTop, float rightX, float yBot) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 1f); r.anchorMax = val; r.anchorMin = val; r.pivot = new Vector2(0f, 1f); r.anchoredPosition = new Vector2(leftX, 0f - yTop); r.sizeDelta = new Vector2(rightX - leftX, yBot - yTop); ((Transform)r).localScale = Vector3.one; } private static void StretchFull(RectTransform r) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) r.anchorMin = Vector2.zero; r.anchorMax = Vector2.one; r.offsetMin = Vector2.zero; r.offsetMax = Vector2.zero; ((Transform)r).localScale = Vector3.one; } private static GameObject NewChild(GameObject parent, string name) { //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_0019: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent.transform, false); return val; } } internal static class NewspaperMark { private const int PoseVar = 7779; private const int HeadVar = 7780; private const int BodyVar = 7781; private const int MastVar = 7782; private const int DateVar = 7783; internal static bool IsNewspaperFrame(Interactable inter) { return HasVar(inter, 7779); } internal static void SetFrame(Interactable inter, Vector3 pos, Vector3 euler, NewsStory story) { //IL_0028: 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_0044: 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_0060: 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) try { if (inter != null && inter.pv != null) { Clear(inter); string str = string.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3},{4},{5}", pos.x, pos.y, pos.z, euler.x, euler.y, euler.z); Add(inter, 7779, str); if (story != null) { Add(inter, 7780, story.Headline); Add(inter, 7781, story.Body); Add(inter, 7782, story.Masthead); Add(inter, 7783, story.DateLine); } } } catch { } } internal static void Clear(Interactable inter) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected I4, but got Unknown try { List<Passed> val = ((inter != null) ? inter.pv : null); if (val == null) { return; } for (int num = val.Count - 1; num >= 0; num--) { Passed val2 = val[num]; if (val2 != null) { int num2 = (int)val2.varType; if (num2 == 7779 || num2 == 7780 || num2 == 7781 || num2 == 7782 || num2 == 7783) { val.RemoveAt(num); } } } } catch { } } internal static bool TryGetPose(Interactable inter, out Vector3 pos, out Vector3 euler) { //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_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_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) pos = Vector3.zero; euler = Vector3.zero; string text = Get(inter, 7779); if (string.IsNullOrEmpty(text)) { return false; } string[] array = text.Split(','); if (array.Length < 6) { return false; } pos = new Vector3(F(array[0]), F(array[1]), F(array[2])); euler = new Vector3(F(array[3]), F(array[4]), F(array[5])); return true; } internal static NewsStory GetStory(Interactable inter) { return new NewsStory { Headline = Get(inter, 7780), Body = Get(inter, 7781), Masthead = Get(inter, 7782), DateLine = Get(inter, 7783), HeadlineFont = NewspaperText.CachedHeadlineFont, BodyFont = NewspaperText.CachedBodyFont, Label = FirstLine(Get(inter, 7780)) }; } private static void Add(Interactable inter, int varInt, string str) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown try { inter.pv.Add(new Passed((PassedVarType)varInt, 0f, str ?? "")); } catch { } } private static bool HasVar(Interactable inter, int varInt) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 try { List<Passed> val = ((inter != null) ? inter.pv : null); if (val == null) { return false; } for (int i = 0; i < val.Count; i++) { if (val[i] != null && (int)val[i].varType == varInt) { return true; } } } catch { } return false; } private static string Get(Interactable inter, int varInt) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 try { List<Passed> val = ((inter != null) ? inter.pv : null); if (val == null) { return ""; } for (int i = 0; i < val.Count; i++) { Passed val2 = val[i]; if (val2 != null && (int)val2.varType == varInt) { return val2.str ?? ""; } } } catch { } return ""; } private static string FirstLine(string s) { if (string.IsNullOrEmpty(s)) { return "(clipping)"; } int num = s.IndexOf('\n'); string text = ((num >= 0) ? s.Substring(0, num) : s).Trim(); if (!string.IsNullOrEmpty(text)) { return text; } return "(clipping)"; } private static float F(string s) { if (!float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return 0f; } return result; } } internal sealed class NewsStory { public string Headline; public string Body; public TMP_FontAsset HeadlineFont; public TMP_FontAsset BodyFont; public string Masthead; public string DateLine; public string Label; } internal static class NewspaperText { internal static TMP_FontAsset CachedHeadlineFont; internal static TMP_FontAsset CachedBodyFont; internal static List<NewsStory> GetStories() { List<NewsStory> list = new List<NewsStory>(); try { NewspaperController instance = NewspaperController.Instance; if ((Object)(object)instance == (Object)null) { return list; } string masthead = Txt(instance.newspaperTitleText); string dateLine = StripScrollHint(Txt(instance.newspaperDateText)); try { if ((Object)(object)instance.mainArticleHeadline != (Object)null && (Object)(object)((TMP_Text)instance.mainArticleHeadline).font != (Object)null) { CachedHeadlineFont = ((TMP_Text)instance.mainArticleHeadline).font; } } catch { } try { if ((Object)(object)instance.mainArticleColumn1 != (Object)null && (Object)(object)((TMP_Text)instance.mainArticleColumn1).font != (Object)null) { CachedBodyFont = ((TMP_Text)instance.mainArticleColumn1).font; } } catch { } AddArticle(list, masthead, dateLine, instance.mainArticleHeadline, (TextMeshProUGUI[])(object)new TextMeshProUGUI[3] { instance.mainArticleColumn1, instance.mainArticleColumn2, instance.mainArticleColumn3 }); AddArticle(list, masthead, dateLine, instance.article2Headline, (TextMeshProUGUI[])(object)new TextMeshProUGUI[3] { instance.article2Column1, instance.article2Column2, instance.article2Column3 }); AddArticle(list, masthead, dateLine, instance.article3Headline, (TextMeshProUGUI[])(object)new TextMeshProUGUI[2] { instance.article3Column1, instance.article3Column2 }); AddAd(list, masthead, dateLine, instance.ad1Text); AddAd(list, masthead, dateLine, instance.ad2Text); AddAd(list, masthead, dateLine, instance.ad3Text); AddAd(list, masthead, dateLine, instance.ad4Text); } catch { } return list; } private static void AddArticle(List<NewsStory> list, string masthead, string dateLine, TextMeshProUGUI headlineTmp, TextMeshProUGUI[] columns) { try { s