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 item in Pinned) { SceneCapture value = item.Value; if (value == null) { continue; } bool flag = false; List 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 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(item.Key); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" that the photo cleanup had pruned."); } log.LogInfo(val2); } } } catch { } } } internal static readonly Dictionary Pinned = new Dictionary(); 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 _yarns = new List(); private readonly List _posts = new List(); private readonly HashSet _registered = new HashSet(); 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 _uiRegistered = new HashSet(); 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(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(_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(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> stringTable = Strings.stringTable; if (stringTable != null && stringTable.ContainsKey("ui.interaction")) { Dictionary 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(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() : 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(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)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(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 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 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 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(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 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(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(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(); 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(); 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(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().sharedMesh = val; MeshRenderer val3 = val2.AddComponent(); ((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(); obj.renderMode = (RenderMode)2; obj.sortingOrder = 20; RectTransform component = val.GetComponent(); 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(); ((Graphic)obj2).color = paper; StretchFull(((Graphic)obj2).rectTransform, 0f); TextMeshProUGUI val5 = NewChild(val, "Text").AddComponent(); 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(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(); ((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 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 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 OurPhotoIds = new HashSet(); internal static readonly HashSet CaseBoardIds = new HashSet(); } [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().renderMode = (RenderMode)2; RectTransform component = val.GetComponent(); 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(); ((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(); ((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(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(); 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 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 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 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 GetStories() { List list = new List(); 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 list, string masthead, string dateLine, TextMeshProUGUI headlineTmp, TextMeshProUGUI[] columns) { try { string text = Txt(headlineTmp); StringBuilder stringBuilder = new StringBuilder(); TMP_FontAsset val = null; foreach (TextMeshProUGUI val2 in columns) { if ((Object)(object)val2 == (Object)null) { continue; } if ((Object)(object)val == (Object)null) { val = ((TMP_Text)val2).font; } string text2 = ((TMP_Text)val2).text; if (!string.IsNullOrEmpty(text2)) { if (stringBuilder.Length > 0) { stringBuilder.Append(' '); } stringBuilder.Append(text2.Trim()); } } string text3 = stringBuilder.ToString().Trim(); if (!string.IsNullOrWhiteSpace(text) || !string.IsNullOrWhiteSpace(text3)) { list.Add(new NewsStory { Headline = text, Body = text3, HeadlineFont = (((Object)(object)headlineTmp != (Object)null) ? ((TMP_Text)headlineTmp).font : val), BodyFont = val, Masthead = masthead, DateLine = dateLine, Label = FirstLine(text) }); } } catch { } } private static void AddAd(List list, string masthead, string dateLine, TextMeshProUGUI adTmp) { try { if ((Object)(object)adTmp == (Object)null) { return; } string text = ((TMP_Text)adTmp).text; if (!string.IsNullOrWhiteSpace(text)) { int num = text.IndexOf('\n'); string text2; string body; if (num > 0) { text2 = text.Substring(0, num).Trim(); body = text.Substring(num + 1).Trim(); } else { text2 = text.Trim(); body = ""; } list.Add(new NewsStory { Headline = text2, Body = body, HeadlineFont = ((TMP_Text)adTmp).font, BodyFont = ((TMP_Text)adTmp).font, Masthead = masthead, DateLine = dateLine, Label = FirstLine(text2) }); } } catch { } } private static string Txt(TextMeshProUGUI t) { try { return ((Object)(object)t != (Object)null && ((TMP_Text)t).text != null) ? ((TMP_Text)t).text : ""; } catch { return ""; } } private static string StripScrollHint(string s) { if (string.IsNullOrEmpty(s)) { return s; } int num = s.IndexOf(" "); string text = ((num > 0) ? s.Substring(0, num) : s); if (text.StartsWith("EARLIER NEWS")) { return ""; } return text.Trim(); } private static string FirstLine(string s) { if (string.IsNullOrEmpty(s)) { return "(untitled)"; } int num = s.IndexOf('\n'); string text = ((num >= 0) ? s.Substring(0, num) : s); text = text.Trim(); if (!string.IsNullOrEmpty(text)) { return text; } return "(untitled)"; } } internal static class PhotoConfig { internal static ConfigEntry PlaceKey; internal static ConfigEntry VerifyKey; internal static ConfigEntry FramePhotos; internal static ConfigEntry FrameToggleKey; internal static ConfigEntry FrameWidth; internal static ConfigEntry MaxFrames; internal static ConfigEntry PickupReach; internal static ConfigEntry PromptText; internal static ConfigEntry HomeOnly; internal static ConfigEntry RingSize; internal static ConfigEntry PlacementPreview; internal static ConfigEntry NewspaperEnabled; internal static ConfigEntry NewsCycleKey; internal static ConfigEntry NewsPrevKey; internal static ConfigEntry NewsClipKey; internal static ConfigEntry Verbose; internal static ConfigEntry YarnEnabled; internal static ConfigEntry YarnKey; internal static ConfigEntry YarnColorKey; internal static ConfigEntry YarnWidth; internal static ConfigEntry YarnWallGap; internal static ConfigEntry PostItEnabled; internal static ConfigEntry PostItKey; internal static ConfigEntry PostItColorKey; internal static ConfigEntry PostItSize; internal static ConfigEntry MaxCaseBoardItems; internal static ConfigEntry AmbientDarken; internal static ConfigEntry MaxDarken; internal static void Init(ConfigFile cfg) { PlaceKey = cfg.Bind("Photos", "PlaceKey", (KeyCode)107, "Print your most recent in-game photo into your inventory as a held item, then right-click while holding it to hang it on the wall you are facing (you can also print any photo from the Photos app on a home cruncher). While reading a newspaper this key steps to the NEXT story instead."); VerifyKey = cfg.Bind("Photos", "VerifyKey", (KeyCode)108, "While reading a newspaper, clip the selected story into your inventory. Outside the newspaper this is an optional developer re-check of hung photos, active only when Verbose is on."); FramePhotos = cfg.Bind("Photos", "FrameWithBorder", true, "Hang printed photos WITH a dark frame around them by default. You can flip this per-session while holding a photo (see FrameToggleKey); each photo remembers how it was hung and rebuilds that way on load."); FrameToggleKey = cfg.Bind("Photos", "FrameToggleKey", (KeyCode)103, "While holding a printed photo, toggle whether it will be hung framed or as a bare print. The indicator by the held-photo thumbnail shows the current mode."); FrameWidth = cfg.Bind("Photos", "FrameWidth", 0.6f, "Width of a placed photo in metres. Height follows the photo's own aspect ratio."); MaxFrames = cfg.Bind("Photos", "MaxFrames", 0, "Maximum number of hung PHOTOS (0 = unlimited, the default). Each hung photo holds one image texture (~1-3 MB), so set a limit only to cap photo memory on a constrained machine. Clippings and case-board items are not counted (they hold no texture)."); PickupReach = cfg.Bind("Photos", "PickupReach", 1.85f, "How close (metres) you must be aiming at a hung photo for the take-down prompt to appear. 1.85 matches the vanilla interaction range; the mod also clamps to the game's live reach so it always feels native."); PromptText = cfg.Bind("Photos", "PromptText", "Pick up photo", "The on-screen prompt shown when you look at a hung photo you can take back down with right-click."); HomeOnly = cfg.Bind("Cruncher", "HomeOnly", true, "Show the Photos app only on crunchers inside apartments you own (your home). Set false to show it on every cruncher you use."); RingSize = cfg.Bind("Cruncher", "RingSize", 20, "How many of your most recent photos the cruncher Photos app lists for preview and printing."); PlacementPreview = cfg.Bind("Placement", "PlacementPlusPreview", true, "If you also run the PlacementPlus mod: while precision-placing a held photo/clipping with its 'V' function, preview the actual image/article (following the item) instead of the blank paper, and turn it into a proper content frame when you confirm the placement."); NewspaperEnabled = cfg.Bind("Newspaper", "Enabled", true, "Enable framing newspaper stories: while reading a newspaper, cycle a selected story and clip it into a hangable wall item."); NewsCycleKey = cfg.Bind("Newspaper", "CycleKey", (KeyCode)107, "While the newspaper is equipped, cycle to the NEXT story (headline shown on-screen) to clip. Contextual: these keys drive the clipping only while reading; otherwise they stay the photo print/verify keys."); NewsPrevKey = cfg.Bind("Newspaper", "PrevKey", (KeyCode)106, "While the newspaper is equipped, cycle to the PREVIOUS story (in case you cycle past the one you wanted)."); NewsClipKey = cfg.Bind("Newspaper", "ClipKey", (KeyCode)108, "While the newspaper is equipped, clip the selected story into your inventory as a hangable clipping. Contextual with the photo verify key (only active while reading)."); Verbose = cfg.Bind("Photos", "Verbose", false, "Extra logging for placement, capture pinning, and texture handling."); YarnEnabled = cfg.Bind("CaseBoard", "YarnEnabled", true, "Enable yarn mode: press the yarn key, pick a colour, then left-click a start pin and left-click again to stretch a string to a second pin. Connect your wall photos and clippings into a case board."); YarnKey = cfg.Bind("CaseBoard", "YarnKey", (KeyCode)121, "Toggle yarn placement mode on/off. While it is on, movement still works so you can walk between walls; left/right-click place and remove string, the mouse wheel or the colour key changes colour, and this key exits."); YarnColorKey = cfg.Bind("CaseBoard", "YarnColorKey", (KeyCode)0, "Optional key to cycle the yarn colour while in yarn mode. Unbound by default (the mouse wheel cycles colour) -- bind it to something that is NOT already a game action if you want a key too."); YarnWidth = cfg.Bind("CaseBoard", "YarnWidth", 0.004f, "Thickness of the yarn string in metres."); YarnWallGap = cfg.Bind("CaseBoard", "YarnWallGap", 0.04f, "How far (metres) the string is held off the wall. Also keeps the string in FRONT of hung photos/clippings/notes (which sit ~0.02m off the wall) so it doesn't flicker behind them; keep this above 0.03."); PostItEnabled = cfg.Bind("CaseBoard", "PostItEnabled", true, "Enable writeable wall post-it notes."); PostItKey = cfg.Bind("CaseBoard", "PostItKey", (KeyCode)112, "Aim at a wall and press to place a new post-it note and start typing on it; aim at an existing note and press to edit it. While typing, Enter saves and Esc cancels."); PostItColorKey = cfg.Bind("CaseBoard", "PostItColorKey", (KeyCode)98, "Change post-it paper colour: aim at a note to recolour it, or press with no note aimed at to change the colour the next new note will use."); PostItSize = cfg.Bind("CaseBoard", "PostItSize", 0.12f, "Size of a post-it note (square) in metres."); MaxCaseBoardItems = cfg.Bind("CaseBoard", "MaxCaseBoardItems", 0, "Maximum combined yarn strings + post-it notes (0 = unlimited, the default). They cost only a few hundred bytes of save data each and share their textures/meshes, so there is no real reason to cap them; set a number only if you want a hard limit."); AmbientDarken = cfg.Bind("Lighting", "AmbientDarken", true, "Dim wall photos, clippings, and post-its to match how dark the room is, so they no longer glow at full brightness in an unlit room. Turn off to keep them always fully lit."); MaxDarken = cfg.Bind("Lighting", "MaxDarken", 0.96f, "How dark a fully unlit room makes the items (0 = no dimming, 1 = fully black). Higher = harder to read in the dark, like real paper. 0.96 leaves only the faintest hint; set 1 to hide them almost completely in the dark."); } } public class PhotoFrameController : MonoBehaviour { private enum FrameKind { Photo, Newspaper } private sealed class Placed { public GameObject go; public RawImage img; public Texture2D tex; public int captureID; public int interactableID; public float halfW; public float halfH; public FrameKind kind; public NewsStory story; public Image darken; public bool framed = true; } private sealed class Preview { public GameObject go; public Texture2D tex; } private readonly List _placed = new List(); private readonly HashSet _registeredIds = new HashSet(); private readonly Dictionary _heldPhotos = new Dictionary(); private Player _lastPlayer; private bool _loadSweepDone; private float _darkTimer; private bool _frameMode = true; private TextMeshProUGUI _heldFrameText; private readonly HashSet _uiRegistered = new HashSet(); private Placed _hovered; private static readonly Color BorderColour = new Color(0.07f, 0.06f, 0.05f, 1f); private const float BorderUnits = 5f; private const float CanvasUnits = 100f; private GameObject _heldCanvasGo; private RectTransform _heldBorderRt; private RawImage _heldImg; private Texture2D _heldTex; private int _heldShownCapId = -1; private List _clipStories = new List(); private int _clipSel; private readonly Dictionary _heldClips = new Dictionary(); private GameObject _newsHudGo; private TextMeshProUGUI _newsHudText; private readonly Dictionary _previews = new Dictionary(); private readonly List _tmpIds = new List(); internal static bool HoldingOurItem; private const string HangText = "Hang on the wall"; private static int _ppState; internal static PhotoFrameController Instance { get; private set; } private void Awake() { Instance = this; _frameMode = PhotoConfig.FramePhotos?.Value ?? true; } private void Update() { //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) 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 busy = CaseBoardController.Busy; HoldingOurItem = IsHoldingOurPhoto() || IsHoldingOurClip(); _hovered = null; if (!busy && FpsInteractive()) { if (IsHoldingOurPhoto() || IsHoldingOurClip()) { ShowInteractionPrompt("Hang on the wall"); } else if (!CaseBoardController.IsAimingAtPost()) { _hovered = FindHoveredFrame(); if (_hovered != null) { ShowInteractionPrompt((_hovered.kind == FrameKind.Newspaper) ? "Pick up clipping" : PhotoConfig.PromptText.Value); } } } bool flag = !busy && IsReadingNewspaper(); if (!busy) { if (IsHoldingOurPhoto() && Input.GetKeyDown(PhotoConfig.FrameToggleKey.Value)) { _frameMode = !_frameMode; } if (!flag && Input.GetKeyDown(PhotoConfig.PlaceKey.Value)) { PrintLatestPhoto(); } else { if (!flag) { ConfigEntry verbose = PhotoConfig.Verbose; if (verbose != null && verbose.Value && Input.GetKeyDown(PhotoConfig.VerifyKey.Value)) { VerifyPins(); goto IL_01b9; } } if (Input.GetMouseButtonDown(1) && CaseBoardController.RmbConsumedFrame != Time.frameCount) { if (IsHoldingOurPhoto()) { TryPlaceHeldPhoto(); } else if (IsHoldingOurClip()) { TryPlaceHeldClip(); } else if (_hovered != null) { PickUpHovered(_hovered); } } } } goto IL_01b9; IL_01b9: UpdateHeldIndicator(); UpdateNewspaper(flag); UpdatePlacementPreview(); KeepAnchorsHidden(); _darkTimer -= Time.unscaledDeltaTime; if (_darkTimer <= 0f) { _darkTimer = 0.3f; UpdateDarkening(); } } catch (Exception ex) { ManualLogSource log = Plugin.Log2; bool flag2 = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(28, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PhotoFrames] update error: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex.Message); } log.LogWarning(val); } } private static bool FpsInteractive() { try { if ((Object)(object)SessionData.Instance == (Object)null || !SessionData.Instance.play) { return false; } if ((Object)(object)Player.Instance == (Object)null || Player.Instance.computerInteractable != null) { return false; } InteractionController instance = InteractionController.Instance; if ((Object)(object)instance != (Object)null && ((Object)(object)instance.currentLookingAtInteractable != (Object)null || (Object)(object)instance.carryingObject != (Object)null)) { return false; } if ((Object)(object)CutSceneController.Instance != (Object)null && CutSceneController.Instance.cutSceneActive) { return false; } if ((Object)(object)BioScreenController.Instance != (Object)null && BioScreenController.Instance.isOpen) { return false; } return true; } catch { return false; } } private void ShowInteractionPrompt(string text) { RegisterUiString(text); try { ControlsDisplayController.Instance.DisplayControlIcon((InteractionKey)2, text, 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> stringTable = Strings.stringTable; if (stringTable != null && stringTable.ContainsKey("ui.interaction")) { Dictionary 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 bool IsHoldingOurPhoto() { try { if (_heldPhotos.Count == 0) { return false; } InventorySlot val = (((Object)(object)BioScreenController.Instance != (Object)null) ? BioScreenController.Instance.selectedSlot : null); Interactable val2 = ((val != null) ? val.GetInteractable() : null); return val2 != null && _heldPhotos.ContainsKey(val2.id); } catch { return false; } } private void UpdateHeldIndicator() { //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) try { SceneCapture value = null; bool flag = false; if (_heldPhotos.Count > 0 && (Object)(object)SessionData.Instance != (Object)null && SessionData.Instance.play && (Object)(object)Player.Instance != (Object)null && Player.Instance.computerInteractable == null && (!((Object)(object)CutSceneController.Instance != (Object)null) || !CutSceneController.Instance.cutSceneActive)) { InventorySlot val = (((Object)(object)BioScreenController.Instance != (Object)null) ? BioScreenController.Instance.selectedSlot : null); Interactable val2 = ((val != null) ? val.GetInteractable() : null); if (val2 != null && _heldPhotos.TryGetValue(val2.id, out value) && value != null) { flag = true; } } if (!flag) { if ((Object)(object)_heldCanvasGo != (Object)null && _heldCanvasGo.activeSelf) { _heldCanvasGo.SetActive(false); } if (_heldShownCapId != -1) { ReleaseHeldTex(); } return; } EnsureHeldIndicator(); if ((Object)(object)_heldCanvasGo == (Object)null) { return; } if (value.id != _heldShownCapId) { ReleaseHeldTex(); Texture2D val3 = ResolveOwnTexture(value); if ((Object)(object)val3 != (Object)null) { _heldTex = val3; _heldShownCapId = value.id; if ((Object)(object)_heldImg != (Object)null) { _heldImg.texture = (Texture)(object)val3; } if ((Object)(object)_heldBorderRt != (Object)null) { float num = 190f; float num2 = (float)((Texture)val3).height / (float)Mathf.Max(1, ((Texture)val3).width); _heldBorderRt.sizeDelta = new Vector2(num, num * num2); } } } if (!_heldCanvasGo.activeSelf) { _heldCanvasGo.SetActive(true); } if ((Object)(object)_heldFrameText != (Object)null) { ((TMP_Text)_heldFrameText).text = "Frame: " + (_frameMode ? "ON" : "off") + " [" + ((object)PhotoConfig.FrameToggleKey.Value/*cast due to .constrained prefix*/).ToString() + "]"; if ((Object)(object)_heldBorderRt != (Object)null) { ((TMP_Text)_heldFrameText).rectTransform.anchoredPosition = new Vector2(-24f, 24f + _heldBorderRt.sizeDelta.y + 6f); } } } catch { } } private void EnsureHeldIndicator() { //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //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_0083: 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_00bc: 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_00d8: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Expected O, but got Unknown //IL_0209: 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_023b: 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_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_heldCanvasGo != (Object)null) { return; } try { _heldCanvasGo = new GameObject("PhotoFrames_HeldIndicator"); Object.DontDestroyOnLoad((Object)(object)_heldCanvasGo); Canvas obj = _heldCanvasGo.AddComponent(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 500; GameObject val = new GameObject("Border"); val.transform.SetParent(_heldCanvasGo.transform, false); Image val2 = val.AddComponent(); ((Graphic)val2).color = new Color(0.05f, 0.05f, 0.05f, 0.85f); ((Graphic)val2).raycastTarget = false; _heldBorderRt = ((Graphic)val2).rectTransform; RectTransform heldBorderRt = _heldBorderRt; Vector2 anchorMin = (_heldBorderRt.anchorMax = new Vector2(1f, 0f)); heldBorderRt.anchorMin = anchorMin; _heldBorderRt.pivot = new Vector2(1f, 0f); _heldBorderRt.anchoredPosition = new Vector2(-24f, 24f); _heldBorderRt.sizeDelta = new Vector2(190f, 130f); GameObject val4 = new GameObject("HeldPhoto"); val4.transform.SetParent((Transform)(object)_heldBorderRt, false); _heldImg = val4.AddComponent(); ((Graphic)_heldImg).raycastTarget = false; RectTransform rectTransform = ((Graphic)_heldImg).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = new Vector2(5f, 5f); rectTransform.offsetMax = new Vector2(-5f, -5f); GameObject val5 = new GameObject("FrameText"); val5.transform.SetParent(_heldCanvasGo.transform, false); _heldFrameText = val5.AddComponent(); ((Graphic)_heldFrameText).raycastTarget = false; ((TMP_Text)_heldFrameText).alignment = (TextAlignmentOptions)1028; ((TMP_Text)_heldFrameText).fontSize = 15f; ((Graphic)_heldFrameText).color = new Color(0.95f, 0.93f, 0.85f, 1f); ((TMP_Text)_heldFrameText).richText = false; RectTransform rectTransform2 = ((TMP_Text)_heldFrameText).rectTransform; anchorMin = (rectTransform2.anchorMax = new Vector2(1f, 0f)); rectTransform2.anchorMin = anchorMin; rectTransform2.pivot = new Vector2(1f, 0f); rectTransform2.anchoredPosition = new Vector2(-24f, 160f); rectTransform2.sizeDelta = new Vector2(260f, 22f); _heldCanvasGo.SetActive(false); } catch (Exception ex) { ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val7 = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("[PhotoFrames] held indicator build failed: "); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted(ex.Message); } log.LogWarning(val7); _heldCanvasGo = null; _heldImg = null; _heldBorderRt = null; _heldFrameText = null; } } private void ReleaseHeldTex() { try { if ((Object)(object)_heldImg != (Object)null) { _heldImg.texture = null; } if ((Object)(object)_heldTex != (Object)null) { Object.Destroy((Object)(object)_heldTex); } } catch { } _heldTex = null; _heldShownCapId = -1; } private static bool IsReadingNewspaper() { try { if ((Object)(object)SessionData.Instance == (Object)null || !SessionData.Instance.play) { return false; } Player instance = Player.Instance; if ((Object)(object)instance == (Object)null || instance.computerInteractable != null) { return false; } FirstPersonItemController instance2 = FirstPersonItemController.Instance; FirstPersonItem val = (((Object)(object)instance2 != (Object)null) ? instance2.currentItem : null); if ((SoCustomComparison)(object)val == (SoCustomComparison)null) { return false; } InteriorControls instance3 = InteriorControls.Instance; if ((Object)(object)instance3 != (Object)null && (SoCustomComparison)(object)instance3.FPNewspaper != (SoCustomComparison)null && ((Il2CppObjectBase)val).Pointer == ((Il2CppObjectBase)instance3.FPNewspaper).Pointer) { return true; } string name = ((Object)val).name; return !string.IsNullOrEmpty(name) && name.ToLowerInvariant().Contains("newspaper"); } catch { return false; } } private void UpdateNewspaper(bool reading) { //IL_0098: 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_00e0: Unknown result type (might be due to invalid IL or missing references) try { ConfigEntry newspaperEnabled = PhotoConfig.NewspaperEnabled; if (newspaperEnabled != null && !newspaperEnabled.Value) { HideNewsHud(); return; } if (!reading) { if (_clipStories.Count > 0) { _clipStories.Clear(); } HideNewsHud(); return; } _clipStories = NewspaperText.GetStories(); if (_clipStories.Count == 0) { HideNewsHud(); return; } _clipSel = Mathf.Clamp(_clipSel, 0, _clipStories.Count - 1); int count = _clipStories.Count; if (Input.GetKeyDown(PhotoConfig.NewsCycleKey.Value)) { _clipSel = (_clipSel + 1) % count; } else if (Input.GetKeyDown(PhotoConfig.NewsPrevKey.Value)) { _clipSel = (_clipSel - 1 + count) % count; } else if (Input.GetKeyDown(PhotoConfig.NewsClipKey.Value)) { ClipSelectedStory(); } ShowNewsHud(_clipStories[Mathf.Clamp(_clipSel, 0, _clipStories.Count - 1)]); } catch { } } private void ClipSelectedStory() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_005b: 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_0060: 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_007c: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); try { if (_clipSel < 0 || _clipSel >= _clipStories.Count) { return; } NewsStory newsStory = _clipStories[_clipSel]; if (newsStory == null) { return; } Interactable val = null; BepInExWarningLogInterpolatedStringHandler val3; try { Vector3 val2 = (((Object)(object)Player.Instance != (Object)null) ? ((Component)Player.Instance).transform.position : Vector3.zero); val = InteractableCreator.Instance.CreateWorldInteractable(InteriorControls.Instance.surveillancePrintout, (Human)(object)Player.Instance, (Human)(object)Player.Instance, (Human)null, val2, Vector3.zero, (List)null, (Object)null, ""); } catch (Exception ex) { ManualLogSource log = Plugin.Log2; val3 = new BepInExWarningLogInterpolatedStringHandler(38, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PhotoFrames] clip item spawn failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex.Message); } log.LogWarning(val3); } if (val == null) { return; } bool flag2 = false; try { flag2 = FirstPersonItemController.Instance.PickUpItem(val, false, false, true, true, true); } catch (Exception ex2) { ManualLogSource log2 = Plugin.Log2; val3 = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PhotoFrames] clip pickup failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex2.Message); } log2.LogWarning(val3); } if (!flag2) { try { val.Delete(); } catch { } Plugin.Log2.LogWarning((object)"[PhotoFrames] inventory full -- could not clip."); return; } _heldClips[val.id] = newsStory; PhotoRegistry.OurPhotoIds.Add(val.id); ManualLogSource log3 = Plugin.Log2; val3 = new BepInExWarningLogInterpolatedStringHandler(69, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PhotoFrames] clipped '"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(newsStory.Label); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("'. Equip it and right-click a wall to hang it."); } log3.LogWarning(val3); } catch (Exception ex3) { ManualLogSource log4 = Plugin.Log2; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(27, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PhotoFrames] clip failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex3.Message); } log4.LogWarning(val3); } } private bool IsHoldingOurClip() { try { if (_heldClips.Count == 0) { return false; } InventorySlot val = (((Object)(object)BioScreenController.Instance != (Object)null) ? BioScreenController.Instance.selectedSlot : null); Interactable val2 = ((val != null) ? val.GetInteractable() : null); return val2 != null && _heldClips.ContainsKey(val2.id); } catch { return false; } } private void TryPlaceHeldClip() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_0108: 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_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) if (_heldClips.Count == 0 || (Object)(object)SessionData.Instance == (Object)null || !SessionData.Instance.play) { return; } InventorySlot val = (((Object)(object)BioScreenController.Instance != (Object)null) ? BioScreenController.Instance.selectedSlot : null); Interactable val2 = ((val != null) ? val.GetInteractable() : null); if (val2 == null || !_heldClips.ContainsKey(val2.id)) { return; } NewsStory newsStory = _heldClips[val2.id]; if (newsStory == null || AtFrameCap()) { return; } if (!TryGetWallAim(out var pos, out var rot)) { Plugin.Log2.LogWarning((object)"[PhotoFrames] no wall in front to hang the clipping on."); return; } Vector3 eulerAngles = ((Quaternion)(ref rot)).eulerAngles; bool flag = default(bool); try { FirstPersonItemController.Instance.EmptySlot(val, false, false, false, false); } catch (Exception ex) { ManualLogSource log = Plugin.Log2; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PhotoFrames] could not put the clipping down: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex.Message); } log.LogWarning(val3); } _heldClips.Remove(val2.id); try { val2.MoveInteractable(pos, eulerAngles, true); } catch { } try { val2.SetSpawnPositionRelevent(true); } catch { } try { if ((Object)(object)val2.controller != (Object)null) { val2.controller.SetPhysics(false, (Actor)null); } } catch { } try { val2.force = true; } catch { } try { val2.MarkAsTrash(false, false, 0f); } catch { } NewspaperMark.SetFrame(val2, pos, eulerAngles, newsStory); try { PhotoModel.Hide(val2.controller); } catch { } float halfW; float halfH; GameObject val4 = NewsClipBuilder.BuildClip(newsStory, pos, rot, out halfW, out halfH); if (!((Object)(object)val4 == (Object)null)) { Placed placed = new Placed { go = val4, img = null, tex = null, captureID = -1, interactableID = val2.id, halfW = halfW, halfH = halfH, kind = FrameKind.Newspaper, story = newsStory }; Register(placed); PhotoRegistry.OurPhotoIds.Add(val2.id); ManualLogSource log2 = Plugin.Log2; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(58, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PhotoFrames] hung a newspaper clipping. Total on walls: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(_placed.Count); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("."); } log2.LogWarning(val3); } } private void UpdatePlacementPreview() { try { ConfigEntry placementPreview = PhotoConfig.PlacementPreview; if ((placementPreview != null && !placementPreview.Value) || !PlacementPlusPresent()) { if (_previews.Count > 0) { ClearPreviews(); } } else { if ((Object)(object)SessionData.Instance == (Object)null || !SessionData.Instance.play || (_heldPhotos.Count == 0 && _heldClips.Count == 0 && _previews.Count == 0)) { return; } _tmpIds.Clear(); foreach (int key in _heldPhotos.Keys) { _tmpIds.Add(key); } foreach (int key2 in _heldClips.Keys) { _tmpIds.Add(key2); } foreach (int key3 in _previews.Keys) { if (!_tmpIds.Contains(key3)) { _tmpIds.Add(key3); } } for (int i = 0; i < _tmpIds.Count; i++) { int num = _tmpIds[i]; Interactable val = null; try { CityData.Instance.savableInteractableDictionary.TryGetValue(num, ref val); } catch { } if (val == null) { RemovePreview(num); } else if (!_heldPhotos.ContainsKey(num) && !_heldClips.ContainsKey(num)) { RemovePreview(num); } else if (IsPlacementFrozen(val)) { FinalizeFromPlacement(val, num); } else if (!IsInInventory(num) && (Object)(object)val.controller != (Object)null) { EnsurePreview(num, val); } else { RemovePreview(num); } } } } catch { } } private void EnsurePreview(int id, Interactable inter) { //IL_0001: 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_0026: 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_0064: Unknown result type (might be due to invalid IL or missing references) try { if (!OrientToNearWall(ItemWorldPos(inter), out var cPos, out var cRot)) { return; } if (!_previews.TryGetValue(id, out var value)) { value = BuildContentCanvas(id, cPos, cRot); if (value == null) { return; } _previews[id] = value; try { PhotoModel.HideIfOwned(inter); } catch { } } if ((Object)(object)value.go != (Object)null) { value.go.transform.SetPositionAndRotation(cPos, cRot); } } catch { } } private Preview BuildContentCanvas(int id, Vector3 pos, Quaternion rot) { //IL_00cc: 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_005f: 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) try { if (_heldPhotos.TryGetValue(id, out var value) && value != null) { Texture2D val = ResolveOwnTexture(value); if ((Object)(object)val == (Object)null) { return null; } float num = (float)((Texture)val).height / (float)Mathf.Max(1, ((Texture)val).width); float num2 = Mathf.Max(0.05f, PhotoConfig.FrameWidth.Value); Placed placed = BuildFrame(val, pos, rot, num2, num2 * num, value.id, id, _frameMode); if (placed == null) { Object.Destroy((Object)(object)val); return null; } return new Preview { go = placed.go, tex = placed.tex }; } if (_heldClips.TryGetValue(id, out var value2) && value2 != null) { float halfW; float halfH; GameObject val2 = NewsClipBuilder.BuildClip(value2, pos, rot, out halfW, out halfH); return ((Object)(object)val2 != (Object)null) ? new Preview { go = val2, tex = null } : null; } } catch { } return null; } private void RemovePreview(int id) { if (!_previews.TryGetValue(id, out var value)) { return; } try { if ((Object)(object)value.go != (Object)null) { Object.Destroy((Object)(object)value.go); } } catch { } try { if ((Object)(object)value.tex != (Object)null) { Object.Destroy((Object)(object)value.tex); } } catch { } _previews.Remove(id); } private void ClearPreviews() { foreach (KeyValuePair preview in _previews) { try { if ((Object)(object)preview.Value.go != (Object)null) { Object.Destroy((Object)(object)preview.Value.go); } } catch { } try { if ((Object)(object)preview.Value.tex != (Object)null) { Object.Destroy((Object)(object)preview.Value.tex); } } catch { } } _previews.Clear(); } private void FinalizeFromPlacement(Interactable inter, int id) { //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0043: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) RemovePreview(id); if (AtFrameCap()) { return; } try { ClearPlacementFrozen(inter); Vector3 val = ItemWorldPos(inter); if (!OrientToNearWall(val, out var cPos, out var cRot)) { cPos = val; cRot = Quaternion.LookRotation(Vector3.forward, Vector3.up); } Vector3 eulerAngles = ((Quaternion)(ref cRot)).eulerAngles; try { if ((Object)(object)inter.controller != (Object)null) { inter.controller.SetPhysics(false, (Actor)null); } } catch { } try { inter.force = true; } catch { } try { inter.MarkAsTrash(false, false, 0f); } catch { } if (_heldPhotos.TryGetValue(id, out var value) && value != null) { Texture2D val2 = ResolveOwnTexture(value); if ((Object)(object)val2 == (Object)null) { return; } float num = (float)((Texture)val2).height / (float)Mathf.Max(1, ((Texture)val2).width); float num2 = Mathf.Max(0.05f, PhotoConfig.FrameWidth.Value); Placed placed = BuildFrame(val2, cPos, cRot, num2, num2 * num, value.id, id, _frameMode); if (placed == null) { Object.Destroy((Object)(object)val2); return; } PhotoMark.SetPhotoFrame(inter, cPos, eulerAngles, _frameMode); try { PhotoModel.Hide(inter.controller); } catch { } CapturePin.Pin(value); Register(placed); PhotoRegistry.OurPhotoIds.Add(id); _heldPhotos.Remove(id); Plugin.Log2.LogWarning((object)"[PhotoFrames] finalized a placed photo (via PlacementPlus)."); } else { if (!_heldClips.TryGetValue(id, out var value2) || value2 == null) { return; } float halfW; float halfH; GameObject val3 = NewsClipBuilder.BuildClip(value2, cPos, cRot, out halfW, out halfH); if (!((Object)(object)val3 == (Object)null)) { Placed placed2 = new Placed { go = val3, img = null, tex = null, captureID = -1, interactableID = id, halfW = halfW, halfH = halfH, kind = FrameKind.Newspaper, story = value2 }; NewspaperMark.SetFrame(inter, cPos, eulerAngles, value2); try { PhotoModel.Hide(inter.controller); } catch { } Register(placed2); PhotoRegistry.OurPhotoIds.Add(id); _heldClips.Remove(id); Plugin.Log2.LogWarning((object)"[PhotoFrames] finalized a placed clipping (via PlacementPlus)."); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(31, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[PhotoFrames] finalize failed: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(ex.Message); } log.LogWarning(val4); } } private static bool OrientToNearWall(Vector3 pos, out Vector3 cPos, out Quaternion cRot) { //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_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_001a: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0043: 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_004f: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //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_0077: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_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_00fe: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) cPos = pos; cRot = Quaternion.identity; try { Vector3[] array = (Vector3[])(object)new Vector3[6] { Vector3.forward, Vector3.back, Vector3.left, Vector3.right, Vector3.up, Vector3.down }; float num = 0.35f; bool flag = false; Vector3 val = Vector3.zero; Vector3 val2 = pos; RaycastHit val3 = default(RaycastHit); for (int i = 0; i < array.Length; i++) { if (Physics.Raycast(pos, array[i], ref val3, 0.35f, 536870912) && ((RaycastHit)(ref val3)).distance < num) { num = ((RaycastHit)(ref val3)).distance; val = ((RaycastHit)(ref val3)).normal; val2 = ((RaycastHit)(ref val3)).point; flag = true; } } if (flag) { cPos = val2 + val * 0.02f; Vector3 val4 = ((Mathf.Abs(Vector3.Dot(val, Vector3.up)) > 0.95f) ? Vector3.forward : Vector3.up); cRot = Quaternion.LookRotation(val, val4); return true; } Camera main = Camera.main; if ((Object)(object)main != (Object)null) { Vector3 val5 = ((Component)main).transform.position - pos; Vector3 normalized = ((Vector3)(ref val5)).normalized; cRot = Quaternion.LookRotation(normalized, Vector3.up); return true; } } catch { } return false; } private static Vector3 ItemWorldPos(Interactable inter) { //IL_0059: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_004a: 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) try { InteractableController val = ((inter != null) ? inter.controller : null); if ((Object)(object)val == (Object)null) { return (inter != null) ? inter.wPos : Vector3.zero; } return (((Object)(object)val.alternativePhysicsParent != (Object)null) ? val.alternativePhysicsParent : ((Component)val).transform).position; } catch { return (inter != null) ? inter.wPos : Vector3.zero; } } private static bool PlacementPlusPresent() { if (_ppState != 0) { return _ppState == 1; } bool flag = false; try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { if (assemblies[i].GetName().Name == "PlacementPlus") { flag = true; break; } } } catch { } _ppState = (flag ? 1 : 2); Plugin.Log2.LogInfo((object)(flag ? "[PhotoFrames] PlacementPlus detected -- placement preview integration active." : "[PhotoFrames] PlacementPlus not present -- placement preview integration off.")); return flag; } private static bool IsPlacementFrozen(Interactable inter) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 try { List 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 == 7777) { return true; } } } catch { } return false; } private static void ClearPlacementFrozen(Interactable inter) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 try { List val = ((inter != null) ? inter.pv : null); if (val == null) { return; } for (int num = val.Count - 1; num >= 0; num--) { if (val[num] != null && (int)val[num].varType == 7777) { val.RemoveAt(num); } } } catch { } } private static bool IsInInventory(int id) { try { FirstPersonItemController instance = FirstPersonItemController.Instance; List val = (((Object)(object)instance != (Object)null) ? instance.slots : null); if (val == null) { return false; } for (int i = 0; i < val.Count; i++) { Interactable val2 = ((val[i] != null) ? val[i].GetInteractable() : null); if (val2 != null && val2.id == id) { return true; } } } catch { } return false; } private void ShowNewsHud(NewsStory story) { //IL_00a3: 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_00dd: Unknown result type (might be due to invalid IL or missing references) try { EnsureNewsHud(); if ((Object)(object)_newsHudGo == (Object)null || (Object)(object)_newsHudText == (Object)null) { return; } if ((Object)(object)((TMP_Text)_newsHudText).font == (Object)null) { TMP_FontAsset val = story?.HeadlineFont; if ((Object)(object)val != (Object)null) { ((TMP_Text)_newsHudText).font = val; } } string value = ((story != null) ? story.Label : ""); ((TMP_Text)_newsHudText).text = $"SELECTED: {value}\n[{PhotoConfig.NewsCycleKey.Value}] next [{PhotoConfig.NewsPrevKey.Value}] previous [{PhotoConfig.NewsClipKey.Value}] frame this clipping"; if (!_newsHudGo.activeSelf) { _newsHudGo.SetActive(true); } } catch { } } private void HideNewsHud() { try { if ((Object)(object)_newsHudGo != (Object)null && _newsHudGo.activeSelf) { _newsHudGo.SetActive(false); } } catch { } } private void EnsureNewsHud() { //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00b1: 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_00d7: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_newsHudGo != (Object)null) { return; } try { _newsHudGo = new GameObject("PhotoFrames_NewsHud"); Object.DontDestroyOnLoad((Object)(object)_newsHudGo); Canvas obj = _newsHudGo.AddComponent(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 500; GameObject val = new GameObject("Panel"); val.transform.SetParent(_newsHudGo.transform, false); Image obj2 = val.AddComponent(); ((Graphic)obj2).color = new Color(0.05f, 0.05f, 0.05f, 0.72f); ((Graphic)obj2).raycastTarget = false; RectTransform rectTransform = ((Graphic)obj2).rectTransform; Vector2 anchorMin = (rectTransform.anchorMax = new Vector2(0.5f, 1f)); rectTransform.anchorMin = anchorMin; rectTransform.pivot = new Vector2(0.5f, 1f); rectTransform.anchoredPosition = new Vector2(0f, -70f); rectTransform.sizeDelta = new Vector2(820f, 88f); GameObject val3 = new GameObject("Text"); val3.transform.SetParent((Transform)(object)rectTransform, false); _newsHudText = val3.AddComponent(); ((Graphic)_newsHudText).raycastTarget = false; ((TMP_Text)_newsHudText).alignment = (TextAlignmentOptions)514; ((TMP_Text)_newsHudText).fontSize = 22f; ((Graphic)_newsHudText).color = new Color(0.95f, 0.93f, 0.85f, 1f); ((TMP_Text)_newsHudText).richText = false; RectTransform rectTransform2 = ((TMP_Text)_newsHudText).rectTransform; rectTransform2.anchorMin = Vector2.zero; rectTransform2.anchorMax = Vector2.one; rectTransform2.offsetMin = new Vector2(14f, 8f); rectTransform2.offsetMax = new Vector2(-14f, -8f); _newsHudGo.SetActive(false); } catch (Exception ex) { ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(37, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[PhotoFrames] news HUD build failed: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(ex.Message); } log.LogWarning(val4); _newsHudGo = null; _newsHudText = null; } } private Placed FindHoveredFrame() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_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_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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_014c: 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_0150: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_018e: 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; } Transform transform = ((Component)val).transform; Vector3 position = transform.position; Vector3 forward = transform.forward; float num = Mathf.Max(0.5f, PhotoConfig.PickupReach.Value); try { if ((Object)(object)GameplayControls.Instance != (Object)null) { num = Mathf.Min(num, GameplayControls.Instance.interactionRange + 0.1f); } } catch { } float num2 = float.PositiveInfinity; try { RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(position, forward, ref val2, num + 0.5f, Toolbox.Instance.interactionRayLayerMask)) { num2 = ((RaycastHit)(ref val2)).distance; } } catch { } Placed result = null; float num3 = float.PositiveInfinity; for (int i = 0; i < _placed.Count; i++) { Placed placed = _placed[i]; if (placed == null || (Object)(object)placed.go == (Object)null) { continue; } Transform transform2 = placed.go.transform; Vector3 forward2 = transform2.forward; float num4 = Vector3.Dot(forward, forward2); if (num4 >= -0.0001f) { continue; } float num5 = Vector3.Dot(transform2.position - position, forward2) / num4; if (!(num5 <= 0.05f) && !(num5 > num) && !(num5 >= num2 + 0.03f)) { Vector3 val3 = position + forward * num5 - transform2.position; if (!(Mathf.Abs(Vector3.Dot(val3, transform2.right)) > placed.halfW * 1.15f) && !(Mathf.Abs(Vector3.Dot(val3, transform2.up)) > placed.halfH * 1.15f) && num5 < num3) { num3 = num5; result = placed; } } } return result; } catch { return null; } } private void PickUpHovered(Placed p) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_00d0: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown if (p == null) { return; } Interactable val = null; try { CityData.Instance.savableInteractableDictionary.TryGetValue(p.interactableID, ref val); } catch { } if (val == null) { RemovePlaced(p); return; } try { if (!FirstPersonItemController.Instance.IsSlotAvailable()) { Plugin.Log2.LogWarning((object)"[PhotoFrames] inventory full -- cannot take it down."); return; } } catch { } bool flag2 = default(bool); BepInExWarningLogInterpolatedStringHandler val2; if (p.kind == FrameKind.Newspaper) { NewspaperMark.Clear(val); try { val.force = false; } catch { } bool flag = false; try { flag = FirstPersonItemController.Instance.PickUpItem(val, true, false, true, true, true); } catch (Exception ex) { ManualLogSource log = Plugin.Log2; val2 = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] clip pickup failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log.LogWarning(val2); } if (!flag) { try { NewspaperMark.SetFrame(val, p.go.transform.position, p.go.transform.eulerAngles, p.story); return; } catch { return; } } NewsStory story = p.story; RemovePlaced(p); if (story != null) { _heldClips[val.id] = story; } Plugin.Log2.LogWarning((object)"[PhotoFrames] took down clipping -- right-click to hang it again."); return; } SceneCapture val3 = null; try { val3 = Toolbox.Instance.GetSceneCaptureFromID(p.captureID); } catch { } PhotoMark.Clear(val); try { val.force = false; } catch { } bool flag3 = false; try { flag3 = FirstPersonItemController.Instance.PickUpItem(val, true, false, true, true, true); } catch (Exception ex2) { ManualLogSource log2 = Plugin.Log2; val2 = new BepInExWarningLogInterpolatedStringHandler(29, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] pickup failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex2.Message); } log2.LogWarning(val2); } if (!flag3) { try { PhotoMark.SetPhotoFrame(val, p.go.transform.position, p.go.transform.eulerAngles, p.framed); return; } catch { return; } } RemovePlaced(p); if (val3 != null) { _heldPhotos[val.id] = val3; CapturePin.Pin(val3); } ManualLogSource log3 = Plugin.Log2; val2 = new BepInExWarningLogInterpolatedStringHandler(73, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] took down photo (capture "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(p.captureID); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") -- right-click to hang it again."); } log3.LogWarning(val2); } private void RemovePlaced(Placed p) { try { if ((Object)(object)p.go != (Object)null) { Object.Destroy((Object)(object)p.go); } } catch { } try { if ((Object)(object)p.tex != (Object)null) { Object.Destroy((Object)(object)p.tex); } } catch { } _placed.Remove(p); _registeredIds.Remove(p.interactableID); if (_hovered == p) { _hovered = null; } } private void OnWorldChanged() { foreach (Placed item in _placed) { try { if ((Object)(object)item.go != (Object)null) { Object.Destroy((Object)(object)item.go); } } catch { } try { if ((Object)(object)item.tex != (Object)null) { Object.Destroy((Object)(object)item.tex); } } catch { } } _placed.Clear(); _registeredIds.Clear(); _heldPhotos.Clear(); _hovered = null; try { if ((Object)(object)_heldCanvasGo != (Object)null) { _heldCanvasGo.SetActive(false); } } catch { } try { ReleaseHeldTex(); } catch { } _heldClips.Clear(); try { ClearPreviews(); } catch { } _clipStories.Clear(); _clipSel = 0; try { HideNewsHud(); } catch { } try { CapturePin.Clear(); } catch { } try { PhotoRegistry.OurPhotoIds.Clear(); } catch { } _loadSweepDone = false; } private void LoadSweep() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Expected O, but got Unknown //IL_01c7: 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_01cb: Unknown result type (might be due to invalid IL or missing references) CityData instance = CityData.Instance; List val = (((Object)(object)instance != (Object)null) ? instance.interactableDirectory : null); if (val == null) { return; } int num = 0; bool flag = default(bool); for (int i = 0; i < val.Count; i++) { Interactable val2; try { val2 = val[i]; } catch { continue; } if (val2 == null || _registeredIds.Contains(val2.id)) { continue; } try { if (PhotoMark.IsPhotoFrame(val2)) { if (!PhotoMark.TryGetPose(val2, out var pos, out var euler)) { continue; } int captureID = PhotoMark.GetCaptureID(val2); if (captureID < 0) { continue; } SceneCapture val3 = null; try { val3 = Toolbox.Instance.GetSceneCaptureFromID(captureID); } catch { } if (val3 == null) { ManualLogSource log = Plugin.Log2; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(57, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[PhotoFrames] wall photo capture "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(captureID); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" not resolvable on load."); } log.LogWarning(val4); continue; } CapturePin.Pin(val3); Texture2D val5 = ResolveOwnTexture(val3); if (!((Object)(object)val5 == (Object)null)) { float num2 = (float)((Texture)val5).height / (float)Mathf.Max(1, ((Texture)val5).width); float num3 = Mathf.Max(0.05f, PhotoConfig.FrameWidth.Value); bool frame = PhotoMark.GetFrame(val2); Placed placed = BuildFrame(val5, pos, Quaternion.Euler(euler), num3, num3 * num2, captureID, val2.id, frame); if (placed == null) { Object.Destroy((Object)(object)val5); continue; } Register(placed); PhotoRegistry.OurPhotoIds.Add(val2.id); num++; } continue; } if (NewspaperMark.IsNewspaperFrame(val2) && NewspaperMark.TryGetPose(val2, out var pos2, out var euler2)) { NewsStory story = NewspaperMark.GetStory(val2); float halfW; float halfH; GameObject val6 = NewsClipBuilder.BuildClip(story, pos2, Quaternion.Euler(euler2), out halfW, out halfH); if (!((Object)(object)val6 == (Object)null)) { Placed placed2 = new Placed { go = val6, img = null, tex = null, captureID = -1, interactableID = val2.id, halfW = halfW, halfH = halfH, kind = FrameKind.Newspaper, story = story }; Register(placed2); PhotoRegistry.OurPhotoIds.Add(val2.id); num++; } } } catch { } } if (num > 0) { ManualLogSource log2 = Plugin.Log2; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(58, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[PhotoFrames] restored "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" wall photo(s)/clipping(s) on load."); } log2.LogWarning(val4); } } private void PrintLatestPhoto() { if (!((Object)(object)Player.Instance == (Object)null) && Player.Instance.sceneRecorder != null) { Interactable interactable = Player.Instance.sceneRecorder.interactable; if (interactable == null || interactable.sCap == null || interactable.sCap.Count == 0) { Plugin.Log2.LogWarning((object)"[PhotoFrames] no photos taken yet -- take one with the camera first."); return; } SceneCapture cap = interactable.sCap[interactable.sCap.Count - 1]; PrintCapture(cap); } } internal bool PrintCapture(SceneCapture cap) { return PrintCapture(cap, switchToNew: true); } internal bool PrintCapture(SceneCapture cap, bool switchToNew) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_003e: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_0043: 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) if (cap == null) { return false; } bool flag2 = default(bool); try { List val = new List(); val.Add(new Passed((PassedVarType)6, (float)cap.id, (string)null)); Vector3 val2 = (((Object)(object)Player.Instance != (Object)null) ? ((Component)Player.Instance).transform.position : Vector3.zero); Interactable val3 = InteractableCreator.Instance.CreateWorldInteractable(InteriorControls.Instance.surveillancePrintout, (Human)(object)Player.Instance, (Human)(object)Player.Instance, (Human)null, val2, Vector3.zero, val, (Object)null, ""); if (val3 == null) { Plugin.Log2.LogWarning((object)"[PhotoFrames] could not create the photo item."); return false; } bool flag = false; BepInExWarningLogInterpolatedStringHandler val4; try { flag = FirstPersonItemController.Instance.PickUpItem(val3, switchToNew, false, true, true, true); } catch (Exception ex) { ManualLogSource log = Plugin.Log2; val4 = new BepInExWarningLogInterpolatedStringHandler(29, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[PhotoFrames] pickup failed: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(ex.Message); } log.LogWarning(val4); } if (!flag) { try { val3.Delete(); } catch { } Plugin.Log2.LogWarning((object)"[PhotoFrames] could not print -- inventory full? Free a slot and try again."); return false; } _heldPhotos[val3.id] = cap; PhotoRegistry.OurPhotoIds.Add(val3.id); CapturePin.Pin(cap); ManualLogSource log2 = Plugin.Log2; val4 = new BepInExWarningLogInterpolatedStringHandler(105, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[PhotoFrames] printed photo (capture "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(cap.id); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(") into inventory. Right-click while holding it to hang it on a wall."); } log2.LogWarning(val4); return true; } catch (Exception ex2) { ManualLogSource log3 = Plugin.Log2; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(28, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[PhotoFrames] print failed: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(ex2.Message); } log3.LogWarning(val4); return false; } } private void TryPlaceHeldPhoto() { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if (_heldPhotos.Count == 0 || (Object)(object)SessionData.Instance == (Object)null || !SessionData.Instance.play) { return; } InventorySlot val = (((Object)(object)BioScreenController.Instance != (Object)null) ? BioScreenController.Instance.selectedSlot : null); Interactable val2 = ((val != null) ? val.GetInteractable() : null); if (val2 == null || !_heldPhotos.ContainsKey(val2.id)) { return; } SceneCapture val3 = _heldPhotos[val2.id]; if (val3 == null || AtFrameCap()) { return; } if (!TryGetWallAim(out var pos, out var rot)) { Plugin.Log2.LogWarning((object)"[PhotoFrames] no wall in front to hang the photo on."); return; } Texture2D val4 = ResolveOwnTexture(val3); if ((Object)(object)val4 == (Object)null) { Plugin.Log2.LogWarning((object)"[PhotoFrames] could not resolve the photo texture."); return; } Vector3 eulerAngles = ((Quaternion)(ref rot)).eulerAngles; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val5; try { FirstPersonItemController.Instance.EmptySlot(val, false, false, false, false); } catch (Exception ex) { ManualLogSource log = Plugin.Log2; val5 = new BepInExWarningLogInterpolatedStringHandler(44, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[PhotoFrames] could not put the photo down: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(ex.Message); } log.LogWarning(val5); } _heldPhotos.Remove(val2.id); try { val2.MoveInteractable(pos, eulerAngles, true); } catch { } try { val2.SetSpawnPositionRelevent(true); } catch { } try { if ((Object)(object)val2.controller != (Object)null) { val2.controller.SetPhysics(false, (Actor)null); } } catch { } try { val2.force = true; } catch { } try { val2.MarkAsTrash(false, false, 0f); } catch { } PhotoMark.SetPhotoFrame(val2, pos, eulerAngles, _frameMode); try { PhotoModel.Hide(val2.controller); } catch { } CapturePin.Pin(val3); float num = (float)((Texture)val4).height / (float)Mathf.Max(1, ((Texture)val4).width); float num2 = Mathf.Max(0.05f, PhotoConfig.FrameWidth.Value); Placed placed = BuildFrame(val4, pos, rot, num2, num2 * num, val3.id, val2.id, _frameMode); if (placed == null) { Object.Destroy((Object)(object)val4); return; } Register(placed); ManualLogSource log2 = Plugin.Log2; val5 = new BepInExWarningLogInterpolatedStringHandler(66, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[PhotoFrames] hung photo (capture "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(val3.id); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(") on the wall. Total on walls: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(_placed.Count); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("."); } log2.LogWarning(val5); } private static Texture2D ResolveOwnTexture(SceneCapture cap) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown Texture val = null; try { val = (Texture)(object)SceneCapture.Instance.GetSurveillanceScene(cap, true); } catch (Exception ex) { ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] GetSurveillanceScene failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log.LogWarning(val2); } if ((Object)(object)val == (Object)null) { return null; } return PhotoTexture.Copy(val); } private void VerifyPins() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown if (_placed.Count == 0) { Plugin.Log2.LogWarning((object)"[PhotoFrames] nothing on walls to verify."); return; } int num = 0; int num2 = 0; bool flag = default(bool); foreach (Placed item in _placed) { if (item == null || item.kind == FrameKind.Newspaper) { continue; } SceneCapture val = null; try { val = Toolbox.Instance.GetSceneCaptureFromID(item.captureID); } catch { } if (val == null) { num2++; ManualLogSource log = Plugin.Log2; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(41, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] capture "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(item.captureID); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" LOST (pin failed)."); } log.LogError(val2); continue; } Texture2D val3 = ResolveOwnTexture(val); if ((Object)(object)val3 == (Object)null) { num2++; continue; } if ((Object)(object)item.img != (Object)null) { item.img.texture = (Texture)(object)val3; } if ((Object)(object)item.tex != (Object)null) { Object.Destroy((Object)(object)item.tex); } item.tex = val3; num++; } ManualLogSource log2 = Plugin.Log2; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(47, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[PhotoFrames] verify: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" still resolvable, "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(num2); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" lost."); } log2.LogWarning(val4); } private static bool TryGetWallAim(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_003e: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0082: 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_0091: Unknown result type (might be due to invalid IL or missing references) pos = Vector3.zero; rot = Quaternion.identity; Camera main = Camera.main; if ((Object)(object)main == (Object)null) { Plugin.Log2.LogWarning((object)"[PhotoFrames] no main camera found."); return false; } Transform transform = ((Component)main).transform; RaycastHit val = default(RaycastHit); if (Physics.Raycast(transform.position, transform.forward, ref val, 4f, 536870912)) { pos = ((RaycastHit)(ref val)).point + ((RaycastHit)(ref val)).normal * 0.02f; rot = Quaternion.LookRotation(((RaycastHit)(ref val)).normal, Vector3.up); return true; } return false; } private Placed BuildFrame(Texture2D tex, Vector3 pos, Quaternion rot, float w, float h, int captureID, int interactableID, bool border = true, Color? paperColor = null, bool flipX = false) { //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0069: 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_0071: 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_00af: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) GameObject val = null; try { val = new GameObject((border ? "PhotoFrame_" : "NewsClip_") + captureID); val.transform.SetPositionAndRotation(pos, rot); val.AddComponent().renderMode = (RenderMode)2; RectTransform component = val.GetComponent(); component.pivot = new Vector2(0.5f, 0.5f); Vector2 anchorMin = (component.anchorMax = new Vector2(0.5f, 0.5f)); component.anchorMin = anchorMin; component.sizeDelta = new Vector2(100f, 100f * (h / Mathf.Max(0.0001f, w))); float num = w / 100f; val.transform.localScale = new Vector3(0f - num, num, num); float margin = 0f; if (paperColor.HasValue) { GameObject val3 = new GameObject("Paper"); val3.transform.SetParent(val.transform, false); Image obj = val3.AddComponent(); ((Graphic)obj).color = paperColor.Value; StretchFull(((Graphic)obj).rectTransform, 0f); margin = 7f; } else if (border) { GameObject val4 = new GameObject("Border"); val4.transform.SetParent(val.transform, false); Image obj2 = val4.AddComponent(); ((Graphic)obj2).color = BorderColour; StretchFull(((Graphic)obj2).rectTransform, 0f); margin = 5f; } GameObject val5 = new GameObject("Photo"); val5.transform.SetParent(val.transform, false); RawImage val6 = val5.AddComponent(); val6.texture = (Texture)(object)tex; if (flipX) { val6.uvRect = new Rect(1f, 0f, -1f, 1f); } StretchFull(((Graphic)val6).rectTransform, margin); return new Placed { go = val, img = val6, tex = tex, captureID = captureID, interactableID = interactableID, halfW = w * 0.5f, halfH = h * 0.5f, framed = border }; } 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(34, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("[PhotoFrames] build frame failed: "); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted(ex.Message); } log.LogWarning(val7); return null; } } private static void StretchFull(RectTransform rt, 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) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.offsetMin = new Vector2(margin, margin); rt.offsetMax = new Vector2(0f - margin, 0f - margin); ((Transform)rt).localScale = Vector3.one; } private void Register(Placed placed) { try { if (placed != null && (Object)(object)placed.go != (Object)null && (Object)(object)placed.darken == (Object)null) { ConfigEntry ambientDarken = PhotoConfig.AmbientDarken; if (ambientDarken == null || ambientDarken.Value) { placed.darken = CaseBoardVisuals.AttachDarkOverlay(placed.go); } } } catch { } _placed.Add(placed); _registeredIds.Add(placed.interactableID); EnforceCap(); } private void KeepAnchorsHidden() { try { CityData instance = CityData.Instance; Dictionary val = (((Object)(object)instance != (Object)null) ? instance.savableInteractableDictionary : null); if (val == null) { return; } for (int i = 0; i < _placed.Count; i++) { Placed placed = _placed[i]; if (placed != null) { Interactable val2 = null; try { val.TryGetValue(placed.interactableID, ref val2); } catch { } if (val2 != null) { PhotoModel.HideIfOwned(val2); } } } } catch { } } private void UpdateDarkening() { try { bool flag = PhotoConfig.AmbientDarken?.Value ?? true; float maxDarken = PhotoConfig.MaxDarken?.Value ?? 0.8f; CityData instance = CityData.Instance; Dictionary val = (((Object)(object)instance != (Object)null) ? instance.savableInteractableDictionary : null); for (int i = 0; i < _placed.Count; i++) { Placed placed = _placed[i]; if (placed == null || (Object)(object)placed.darken == (Object)null) { continue; } float brightness = 1f; if (flag && val != null) { Interactable anchor = null; try { val.TryGetValue(placed.interactableID, ref anchor); } catch { } brightness = AmbientLight.Brightness(anchor); } CaseBoardVisuals.ApplyDarken(placed.darken, brightness, maxDarken); } } catch { } } private bool AtFrameCap() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown int num = PhotoConfig.MaxFrames?.Value ?? 0; if (num <= 0) { return false; } int num2 = 0; for (int i = 0; i < _placed.Count; i++) { if (_placed[i] != null && _placed[i].kind == FrameKind.Photo) { num2++; } } if (num2 >= num) { ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(88, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PhotoFrames] photo cap ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") reached; raise or clear MaxFrames in the config to hang more."); } log.LogWarning(val); return true; } return false; } private void EnforceCap() { int num = PhotoConfig.MaxFrames?.Value ?? 0; if (num <= 0) { return; } while (true) { Placed placed = null; int num2 = 0; for (int i = 0; i < _placed.Count; i++) { Placed placed2 = _placed[i]; if (placed2 != null && placed2.kind == FrameKind.Photo) { num2++; if (placed == null) { placed = placed2; } } } if (num2 <= num || placed == null) { break; } _placed.Remove(placed); _registeredIds.Remove(placed.interactableID); try { Interactable val = null; try { CityData.Instance.savableInteractableDictionary.TryGetValue(placed.interactableID, ref val); } catch { } if (val != null) { PhotoMark.Clear(val); try { val.Delete(); } catch { } } } catch { } try { PhotoRegistry.OurPhotoIds.Remove(placed.interactableID); } catch { } try { if ((Object)(object)placed.go != (Object)null) { Object.Destroy((Object)(object)placed.go); } } catch { } try { if ((Object)(object)placed.tex != (Object)null) { Object.Destroy((Object)(object)placed.tex); } } catch { } } } } internal static class PhotoMark { private const int PhotoVarInt = 7778; internal static bool IsPhotoFrame(Interactable inter) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 try { List 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 == 7778) { return true; } } } catch { } return false; } internal static void SetPhotoFrame(Interactable inter, Vector3 pos, Vector3 euler, bool framed = true) { //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) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown try { if (inter != null && inter.pv != null) { Clear(inter); string text = string.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3},{4},{5},{6}", pos.x, pos.y, pos.z, euler.x, euler.y, euler.z, framed ? 1 : 0); inter.pv.Add(new Passed((PassedVarType)7778, 0f, text)); } } catch { } } internal static bool GetFrame(Interactable inter) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 try { List val = ((inter != null) ? inter.pv : null); if (val == null) { return true; } for (int i = 0; i < val.Count; i++) { Passed val2 = val[i]; if (val2 != null && (int)val2.varType == 7778) { string[] array = (val2.str ?? "").Split(','); return array.Length < 7 || array[6].Trim() != "0"; } } } catch { } return true; } internal static void Clear(Interactable inter) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 try { List val = ((inter != null) ? inter.pv : null); if (val == null) { return; } for (int num = val.Count - 1; num >= 0; num--) { if (val[num] != null && (int)val[num].varType == 7778) { 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Invalid comparison between Unknown and I4 //IL_0097: 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_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) pos = Vector3.zero; euler = Vector3.zero; try { List val = ((inter != null) ? inter.pv : null); if (val == null) { return false; } for (int i = 0; i < val.Count; i++) { Passed val2 = val[i]; if (val2 != null && (int)val2.varType == 7778) { string str = val2.str; if (string.IsNullOrEmpty(str)) { return false; } string[] array = str.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; } } } catch { } return false; } internal static int GetCaptureID(Interactable inter) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 try { List val = ((inter != null) ? inter.pv : null); if (val == null) { return -1; } for (int i = 0; i < val.Count; i++) { Passed val2 = val[i]; if (val2 != null && (int)val2.varType == 6) { return (int)val2.value; } } } catch { } return -1; } private static float F(string s) { if (!float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return 0f; } return result; } } internal static class PhotoTexture { internal static Texture2D Copy(Texture src) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_0045: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown if ((Object)(object)src == (Object)null) { return null; } int width = src.width; int height = src.height; if (width <= 0 || height <= 0) { return null; } RenderTexture temporary = RenderTexture.GetTemporary(width, height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); RenderTexture active = RenderTexture.active; try { Graphics.Blit(src, temporary); RenderTexture.active = temporary; Texture2D val = new Texture2D(width, height, (TextureFormat)4, false); val.ReadPixels(new Rect(0f, 0f, (float)width, (float)height), 0, 0, false); val.Apply(false, true); ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; 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] texture copy failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log.LogWarning(val2); return null; } finally { RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); } } } [BepInPlugin("Kropath.PhotoFrames", "PhotoFrames", "1.1.1")] public class Plugin : BasePlugin { internal static ManualLogSource Log2; internal static Harmony HarmonyInstance; public override void Load() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown Log2 = ((BasePlugin)this).Log; PhotoConfig.Init(((BasePlugin)this).Config); Log2.LogWarning((object)"[PhotoFrames] loading -- printable pictures + newspaper clippings."); HarmonyInstance = new Harmony("Kropath.PhotoFrames"); bool flag = default(bool); try { HarmonyInstance.PatchAll(typeof(Plugin).Assembly); } catch (Exception ex) { ManualLogSource log = Log2; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PhotoFrames] Harmony patch FAILED: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex.Message); } log.LogError(val); } try { ClassInjector.RegisterTypeInIl2Cpp(); ((BasePlugin)this).AddComponent(); } catch (Exception ex2) { ManualLogSource log2 = Log2; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PhotoFrames] controller injection FAILED: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex2.Message); } log2.LogError(val); } try { ClassInjector.RegisterTypeInIl2Cpp(); ((BasePlugin)this).AddComponent(); } catch (Exception ex3) { ManualLogSource log3 = Log2; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(54, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PhotoFrames] case-board controller injection FAILED: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex3.Message); } log3.LogError(val); } try { ClassInjector.RegisterTypeInIl2Cpp(); } catch (Exception ex4) { ManualLogSource log4 = Log2; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(51, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PhotoFrames] Photos app content injection FAILED: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex4.Message); } log4.LogError(val); } Log2.LogWarning((object)"[PhotoFrames] loaded. Print photos from a home cruncher (Photos app), and clip newspaper stories while reading; right-click to hang them on a wall."); } } internal static class PostItMark { private const int PoseVar = 7784; private const int TextVar = 7785; internal static bool IsPostIt(Interactable inter) { return Has(inter, 7784); } internal static void Set(Interactable inter, Vector3 pos, Vector3 euler, int colourIndex, string text) { //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) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown try { if (inter != null && inter.pv != null) { Clear(inter); string text2 = string.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3},{4},{5},{6}", pos.x, pos.y, pos.z, euler.x, euler.y, euler.z, colourIndex); inter.pv.Add(new Passed((PassedVarType)7784, 0f, text2)); inter.pv.Add(new Passed((PassedVarType)7785, 0f, text ?? "")); } } catch { } } internal static void SetText(Interactable inter, string text) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown try { List val = ((inter != null) ? inter.pv : null); if (val == null) { return; } for (int num = val.Count - 1; num >= 0; num--) { if (val[num] != null && (int)val[num].varType == 7785) { val.RemoveAt(num); } } val.Add(new Passed((PassedVarType)7785, 0f, text ?? "")); } 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 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 == 7784 || num2 == 7785) { val.RemoveAt(num); } } } } catch { } } internal static bool TryGetPose(Interactable inter, out Vector3 pos, out Vector3 euler, out int colourIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) pos = (euler = Vector3.zero); colourIndex = 0; try { string text = Get(inter, 7784); if (string.IsNullOrEmpty(text)) { return false; } string[] array = text.Split(','); if (array.Length < 7) { 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])); colourIndex = (int)F(array[6]); return true; } catch { return false; } } internal static string GetText(Interactable inter) { return Get(inter, 7785); } private static bool Has(Interactable inter, int v) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 try { List 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 == v) { return true; } } } catch { } return false; } private static string Get(Interactable inter, int v) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 try { List 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 == v) { return val2.str ?? ""; } } } catch { } return ""; } private static float F(string s) { if (!float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return 0f; } return result; } } internal static class YarnMark { private const int DataVar = 7787; internal static bool IsYarn(Interactable inter) { return Has(inter, 7787); } internal static void Set(Interactable inter, Vector3 a, Vector3 b, int colourIndex) { //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) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown try { if (inter != null && inter.pv != null) { Clear(inter); string text = string.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3},{4},{5},{6}", a.x, a.y, a.z, b.x, b.y, b.z, colourIndex); inter.pv.Add(new Passed((PassedVarType)7787, 0f, text)); } } catch { } } internal static void Clear(Interactable inter) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 try { List val = ((inter != null) ? inter.pv : null); if (val == null) { return; } for (int num = val.Count - 1; num >= 0; num--) { if (val[num] != null && (int)val[num].varType == 7787) { val.RemoveAt(num); } } } catch { } } internal static bool TryGet(Interactable inter, out Vector3 a, out Vector3 b, out int colourIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) a = (b = Vector3.zero); colourIndex = 0; try { string text = Get(inter, 7787); if (string.IsNullOrEmpty(text)) { return false; } string[] array = text.Split(','); if (array.Length < 7) { return false; } a = new Vector3(F(array[0]), F(array[1]), F(array[2])); b = new Vector3(F(array[3]), F(array[4]), F(array[5])); colourIndex = (int)F(array[6]); return true; } catch { return false; } } private static bool Has(Interactable inter, int v) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 try { List 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 == v) { return true; } } } catch { } return false; } private static string Get(Interactable inter, int v) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 try { List 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 == v) { return val2.str ?? ""; } } } catch { } return ""; } private static float F(string s) { if (!float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return 0f; } return result; } } } namespace PhotoFrames.CruncherApp { [HarmonyPatch(typeof(MainMenuController), "Start")] internal static class MainMenuController_Start_BuildPhotosApp { [HarmonyPostfix] private static void Postfix() { PhotosAppBuilder.EnsureBuilt(); } } [HarmonyPatch(typeof(DesktopIconController), "Setup")] internal static class DesktopIcon_Setup_PhotosLabel { [HarmonyPostfix] private static void Postfix(DesktopIconController __instance, CruncherAppPreset newApp) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown try { if (!((SoCustomComparison)(object)newApp == (SoCustomComparison)null) && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.iconText == (Object)null)) { CruncherAppPreset preset = PhotosAppBuilder.Preset; if ((SoCustomComparison)(object)preset != (SoCustomComparison)null && ((Il2CppObjectBase)newApp).Pointer == ((Il2CppObjectBase)preset).Pointer) { ((TMP_Text)__instance.iconText).text = "Photos"; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(37, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PhotoFrames] icon label set failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex.Message); } log.LogWarning(val); } } } [HarmonyPatch(typeof(DesktopApp), "UpdateIcons")] internal static class DesktopApp_UpdateIcons_PhotosGate { [HarmonyPrefix] private static void Prefix(DesktopApp __instance) { //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown try { PhotosAppBuilder.EnsureBuilt(); CruncherAppPreset preset = PhotosAppBuilder.Preset; if ((SoCustomComparison)(object)preset == (SoCustomComparison)null) { return; } ComputerController controller = ((CruncherAppContent)__instance).controller; if ((Object)(object)controller == (Object)null || (Object)(object)controller.ic == (Object)null) { return; } Interactable interactable = controller.ic.interactable; if (interactable == null || (SoCustomComparison)(object)interactable.preset == (SoCustomComparison)null) { return; } List additionalApps = interactable.preset.additionalApps; if (additionalApps == null) { return; } NewAddress addr = null; NewNode node = interactable.node; if (node != null && (Object)(object)node.gameLocation != (Object)null) { addr = node.gameLocation.thisAsAddress; } ConfigEntry homeOnly = PhotoConfig.HomeOnly; bool flag = (homeOnly != null && !homeOnly.Value) || IsOwnedHome(addr); int num = -1; for (int i = 0; i < additionalApps.Count; i++) { CruncherAppPreset val = additionalApps[i]; if ((SoCustomComparison)(object)val != (SoCustomComparison)null && ((Il2CppObjectBase)val).Pointer == ((Il2CppObjectBase)preset).Pointer) { num = i; break; } } if (flag && num < 0) { int num2 = Math.Max(0, additionalApps.Count - 2); additionalApps.Insert(num2, preset); } else if (!flag && num >= 0) { additionalApps.RemoveAt(num); } } catch (Exception ex) { ManualLogSource log = Plugin.Log2; bool flag2 = default(bool); BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(39, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] UpdateIcons gate failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex); } log.LogError(val2); } } private static bool IsOwnedHome(NewAddress addr) { try { Player instance = Player.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)addr == (Object)null) { return false; } if ((Object)(object)((Human)instance).home != (Object)null && ((Il2CppObjectBase)((Human)instance).home).Pointer == ((Il2CppObjectBase)addr).Pointer) { return true; } List apartmentsOwned = instance.apartmentsOwned; if (apartmentsOwned != null) { for (int i = 0; i < apartmentsOwned.Count; i++) { NewAddress val = apartmentsOwned[i]; if ((Object)(object)val != (Object)null && ((Il2CppObjectBase)val).Pointer == ((Il2CppObjectBase)addr).Pointer) { return true; } } } } catch { } return false; } } internal static class PhotosAppBuilder { internal const string PresetName = "PhotoFramesPhotos"; internal static CruncherAppPreset Preset; private static GameObject _holder; private static bool _done; internal static void EnsureBuilt() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if (_done) { return; } _done = true; bool flag = default(bool); try { Build(); ManualLogSource log = Plugin.Log2; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(72, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PhotoFrames] cruncher app build complete: preset '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("PhotoFramesPhotos"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' ready (donor=VMail)"); } log.LogInfo(val); } catch (Exception ex) { Preset = null; ManualLogSource log2 = Plugin.Log2; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(41, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] cruncher app build FAILED: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex); } log2.LogError(val2); } } private static void Build() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) CruncherAppPreset val = null; foreach (CruncherAppPreset item in Resources.FindObjectsOfTypeAll()) { if ((SoCustomComparison)(object)item != (SoCustomComparison)null && ((SoCustomComparison)item).presetName == "VMail") { val = item; break; } } if ((SoCustomComparison)(object)val == (SoCustomComparison)null) { throw new Exception("VMail CruncherAppPreset not found (too early?)"); } if (val.appContent == null || val.appContent.Count == 0) { throw new Exception("VMail preset has empty appContent"); } ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(46, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] donor: appContent[0]='"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Object)val.appContent[0]).name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("', icon='"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Object)(object)val.desktopIcon != (Object)null) ? ((Object)val.desktopIcon).name : "null"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'"); } log.LogInfo(val2); _holder = new GameObject("PhotoFrames_CruncherAppHolder"); _holder.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_holder); GameObject val3 = ((Il2CppObjectBase)Object.Instantiate((Object)(object)val.appContent[0], _holder.transform)).Cast(); ((Object)val3).name = "PhotoFramesPhotosContent"; VMailApp component = val3.GetComponent(); if ((Object)(object)component == (Object)null) { throw new Exception("clone carries no VMailApp -- wrong donor object?"); } Object.DestroyImmediate((Object)(object)component); val3.AddComponent(); ManualLogSource log2 = Plugin.Log2; val2 = new BepInExInfoLogInterpolatedStringHandler(90, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PhotoFrames] template ready: VMailApp stripped, PhotosAppContent added, MultiSelect kept="); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted((Object)(object)val3.GetComponentInChildren(true) != (Object)null); } log2.LogInfo(val2); CruncherAppPreset obj = ((Il2CppObjectBase)ScriptableObject.CreateInstance(Il2CppType.Of())).Cast(); ((Object)obj).name = "PhotoFramesPhotos"; ((SoCustomComparison)obj).presetName = "PhotoFramesPhotos"; ((Object)obj).hideFlags = (HideFlags)32; obj.desktopIcon = FindIconSprite("surveillence") ?? FindIconSprite("textdocument") ?? val.desktopIcon; obj.loadBackground = val.loadBackground; obj.loadedBackground = val.loadedBackground; obj.useCursor = val.useCursor; obj.cursorSprite = val.cursorSprite; obj.loadTime = val.loadTime; obj.loadDemand = val.loadDemand; obj.screenLightColourOnLoad = val.screenLightColourOnLoad; obj.screenLightColourOnFinishLoad = val.screenLightColourOnFinishLoad; obj.onStartSound = val.onStartSound; obj.onExitSound = val.onExitSound; obj.onFinishedLoadingSound = val.onFinishedLoadingSound; obj.alwaysInstalled = true; obj.installationConditions = new List(); obj.onlyInAddresses = new List(); List val4 = new List(); val4.Add(val3); obj.appContent = val4; Preset = obj; } private static Sprite FindIconSprite(string spriteName) { try { foreach (CruncherAppPreset item in Resources.FindObjectsOfTypeAll()) { if ((SoCustomComparison)(object)item != (SoCustomComparison)null && (Object)(object)item.desktopIcon != (Object)null && ((Object)item.desktopIcon).name == spriteName) { return item.desktopIcon; } } } catch { } return null; } } public class PhotosAppContent : CruncherAppContent { private struct Shot { public int id; public float t; } private bool _didSetup; private int _lastActionFrame = -1; private ComputerOSMultiSelect _list; private TextMeshProUGUI _title; private TextMeshProUGUI _caption; private TextMeshProUGUI _body; private Button _printButton; private Button _scrollUpButton; private Button _scrollDownButton; private RawImage _preview; private AspectRatioFitter _previewFitter; private Texture2D _previewTex; private int _previewShotId = -1; private Shot[] _shots = Array.Empty(); private int _selected; private int _page; private NewSelection _onNewSelection; private void Awake() { Plugin.Log2.LogInfo((object)"[PhotoFrames] Photos app content Awake"); } private void OnDestroy() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown try { if ((Object)(object)_list != (Object)null && (Delegate)(object)_onNewSelection != (Delegate)null) { ComputerOSMultiSelect list = _list; list.OnNewSelection -= _onNewSelection; } } catch (Exception ex) { ManualLogSource log = Plugin.Log2; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(37, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PhotoFrames] OnDestroy unsubscribe: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex.Message); } log.LogWarning(val); } ReleasePreviewTex(); Plugin.Log2.LogInfo((object)"[PhotoFrames] Photos app content destroyed (exit / desktop switch)"); } public override void Setup(ComputerController cc) { ((CruncherAppContent)this).controller = cc; DoSetup(); } public override void OnSetup() { DoSetup(); } public override void PrintButton() { } private void DoSetup() { //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Expected O, but got Unknown //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown if (_didSetup) { return; } _didSetup = true; bool flag = default(bool); try { _title = FindTmp("AppTitleText"); _caption = FindTmp("VmailDisplay/ToFromText"); _body = FindTmp("VmailDisplay/VmaiDisplay/ElementParent/VmailText"); _list = ((Component)this).GetComponentInChildren(true); if ((Object)(object)_list == (Object)null) { Plugin.Log2.LogError((object)"[PhotoFrames] no ComputerOSMultiSelect in clone -- photo list cannot render"); } SetTextHard(_title, "PHOTOS"); SetTextHard(_body, ""); Il2CppArrayBase