Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of HJM TruckMonitor v1.0.0
BepInEx\plugins\HJM-TruckMonitor\HJM.TruckMonitor.dll
Decompiled an hour agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("HJM.TruckBodyCam")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HJM.TruckBodyCam")] [assembly: AssemblyTitle("HJM.TruckBodyCam")] [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 HJM.TruckBodyCam { [BepInPlugin("hjm.truckmonitor", "HJM-TruckMonitor", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "hjm.truckmonitor"; public const string PluginName = "HJM-TruckMonitor"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource Log; private static string pluginDir; private static AssetBundle buttonBundle; private static GameObject cachedButtonPrefab; internal static ConfigEntry<int> ResolutionWidth; internal static ConfigEntry<int> ResolutionHeight; internal static ConfigEntry<int> FrameRate; internal static ConfigEntry<float> FieldOfView; internal static ConfigEntry<float> NightVisionIntensity; internal static ConfigEntry<float> MaxInteractDistance; internal static ConfigEntry<bool> IncludeLocalPlayer; private Harmony harmony; private void Awake() { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; pluginDir = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? string.Empty; ResolutionWidth = ((BaseUnityPlugin)this).Config.Bind<int>("Camera", "ResolutionWidth", 256, "监控渲染宽度 (默认 256,越大越清晰但越吃性能)"); ResolutionHeight = ((BaseUnityPlugin)this).Config.Bind<int>("Camera", "ResolutionHeight", 144, "监控渲染高度 (默认 144)"); FrameRate = ((BaseUnityPlugin)this).Config.Bind<int>("Camera", "FrameRate", 0, "监控刷新帧率 (0 为跟随游戏主帧率,设为正数则限帧渲染)"); FieldOfView = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "FieldOfView", 75f, "监控摄像机视野角度 (FOV)"); NightVisionIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "NightVisionIntensity", 0.65f, "监控夜视补光强度 (0 为不补光)"); MaxInteractDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Interaction", "MaxInteractDistance", 4.5f, "按钮最远交互距离 (米)"); IncludeLocalPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera", "IncludeLocalPlayer", true, "是否把本地玩家自己也加入切换列表"); harmony = new Harmony("hjm.truckmonitor"); harmony.PatchAll(typeof(TruckScreenPatches)); Log.LogInfo((object)"HJM-TruckMonitor v1.0.0 loaded."); } internal static GameObject GetConfirmButtonPrefab() { if ((Object)(object)cachedButtonPrefab != (Object)null) { return cachedButtonPrefab; } foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles()) { if ((Object)(object)allLoadedAssetBundle != (Object)null && allLoadedAssetBundle.Contains("ConfirmButton")) { GameObject val = allLoadedAssetBundle.LoadAsset<GameObject>("ConfirmButton"); if ((Object)(object)val != (Object)null) { cachedButtonPrefab = val; return cachedButtonPrefab; } } } string text = Path.Combine(pluginDir, "truckbodycam_button_assets"); if (!File.Exists(text)) { Log.LogError((object)("Button AssetBundle not found at: " + text)); return null; } buttonBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)buttonBundle == (Object)null) { Log.LogError((object)("Failed to load AssetBundle: " + text)); return null; } cachedButtonPrefab = buttonBundle.LoadAsset<GameObject>("ConfirmButton"); return cachedButtonPrefab; } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } if ((Object)(object)buttonBundle != (Object)null) { buttonBundle.Unload(false); buttonBundle = null; } } } internal static class TruckScreenPatches { [HarmonyPatch(typeof(TruckScreenText), "Start")] [HarmonyPostfix] private static void TruckScreenStartPostfix(TruckScreenText __instance) { if (!((Object)(object)__instance == (Object)null) && (Object)(object)((Component)__instance).GetComponent<TruckBodyCamController>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<TruckBodyCamController>(); } } [HarmonyPatch(typeof(TruckScreenOpen), "TruckScreenOpenStartLogic")] [HarmonyPostfix] private static void TruckScreenTakeoffPostfix() { TruckBodyCamController.Instance?.OnTruckTakeoff(); } } public sealed class TruckBodyCamController : MonoBehaviour, IOnEventCallback { private enum HoveredButton { None, Power, Switch } private sealed class ButtonVisual { public GameObject Root; public Transform VisualTransform; public Vector3 BaseVisualScale; public BoxCollider Collider; public float PressTimer; } private const byte SyncEventCode = 177; private TruckScreenText truckScreen; private RectTransform monitorRoot; private GameObject feedContainer; private RawImage feedImage; private RawImage livePillBg; private TextMeshProUGUI nameText; private ButtonVisual powerButton; private ButtonVisual switchButton; private RenderTexture renderTexture; private GameObject camHost; private Camera bodyCam; private Light nightVisionLight; private Texture2D liveBadgeTex; private AudioClip fallbackClickClip; private ExtractionPoint cachedExtractionPoint; private readonly List<PlayerAvatar> candidates = new List<PlayerAvatar>(); private readonly List<Renderer> hiddenRenderers = new List<Renderer>(); private bool isMonitorOn; private bool tookOff; private int targetIndex; private PlayerAvatar currentTarget; private float nextRenderTime; private HoveredButton hoveredButton; private GUIStyle infoTitleStyle; private GUIStyle infoSubStyle; private static readonly FieldRef<PlayerAvatar, bool> IsDisabledRef = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isDisabled"); private static readonly FieldRef<PlayerAvatar, bool> IsLocalRef = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isLocal"); private static readonly FieldRef<PlayerAvatar, string> PlayerNameRef = AccessTools.FieldRefAccess<PlayerAvatar, string>("playerName"); private static readonly FieldRef<PlayerAvatar, PlayerDeathHead> DeathHeadRef = AccessTools.FieldRefAccess<PlayerAvatar, PlayerDeathHead>("playerDeathHead"); private static readonly FieldRef<RoomVolumeCheck, bool> InTruckRef = AccessTools.FieldRefAccess<RoomVolumeCheck, bool>("inTruck"); private static readonly Color LiveRedColor = new Color(0.996f, 0.173f, 0.333f, 0.98f); private static readonly Color DeadGrayColor = new Color(0.35f, 0.36f, 0.4f, 0.95f); private static readonly Color PowerOffCapColor = new Color(0.82f, 0.14f, 0.14f, 1f); private static readonly Color PowerOffHoverColor = new Color(0.98f, 0.26f, 0.22f, 1f); private static readonly Color PowerOnCapColor = new Color(0.14f, 0.76f, 0.3f, 1f); private static readonly Color PowerOnHoverColor = new Color(0.26f, 0.96f, 0.42f, 1f); private static readonly Color SwitchCapColor = new Color(0.16f, 0.48f, 0.86f, 1f); private static readonly Color SwitchHoverColor = new Color(0.3f, 0.68f, 1f, 1f); public static TruckBodyCamController Instance { get; private set; } private void Awake() { Instance = this; truckScreen = ((Component)this).GetComponent<TruckScreenText>(); } private void OnEnable() { PhotonNetwork.AddCallbackTarget((object)this); } private void OnDisable() { PhotonNetwork.RemoveCallbackTarget((object)this); } private void Start() { SetupSharedAssets(); SetupCameraAndTexture(); SetupScreenUI(); RefreshCandidates(); isMonitorOn = true; UpdateVisualState(); } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } if ((Object)(object)powerButton?.Root != (Object)null) { Object.Destroy((Object)(object)powerButton.Root); } if ((Object)(object)switchButton?.Root != (Object)null) { Object.Destroy((Object)(object)switchButton.Root); } if ((Object)(object)camHost != (Object)null) { Object.Destroy((Object)(object)camHost); } if ((Object)(object)renderTexture != (Object)null) { renderTexture.Release(); Object.Destroy((Object)(object)renderTexture); } if ((Object)(object)liveBadgeTex != (Object)null) { Object.Destroy((Object)(object)liveBadgeTex); } if ((Object)(object)fallbackClickClip != (Object)null) { Object.Destroy((Object)(object)fallbackClickClip); } } public void OnTruckTakeoff() { tookOff = true; if (isMonitorOn) { isMonitorOn = false; UpdateVisualState(); Plugin.Log.LogInfo((object)"Truck takeoff detected: monitor turned OFF."); } } public void OnEvent(EventData photonEvent) { if (photonEvent.Code != 177 || !(photonEvent.CustomData is object[] array) || array.Length < 2) { return; } bool flag = (bool)array[0]; int num = (int)array[1]; if (!tookOff) { isMonitorOn = flag; } RefreshCandidates(); if (num > 0) { for (int i = 0; i < candidates.Count; i++) { if ((Object)(object)candidates[i] != (Object)null && (Object)(object)candidates[i].photonView != (Object)null && candidates[i].photonView.ViewID == num) { targetIndex = i; currentTarget = candidates[i]; break; } } } nextRenderTime = 0f; UpdateVisualState(); } private void BroadcastSyncState() { //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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.InRoom) { int num = (((Object)(object)currentTarget != (Object)null && (Object)(object)currentTarget.photonView != (Object)null) ? currentTarget.photonView.ViewID : (-1)); object[] array = new object[2] { isMonitorOn, num }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)177, (object)array, val, SendOptions.SendReliable); } } private void SetupSharedAssets() { liveBadgeTex = LoadEmbeddedPng("HJM.TruckBodyCam.live_badge.png"); fallbackClickClip = BuildFallbackClickClip(); } private static Texture2D LoadEmbeddedPng(string resourceName) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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: Expected O, but got Unknown //IL_004c: Expected O, but got Unknown using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName); if (stream == null) { return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; ImageConversion.LoadImage(val, array); return val; } private static AudioClip BuildFallbackClickClip() { int num = 1212; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 22050f; float num3 = Mathf.Exp((0f - num2) * 65f); float num4 = Mathf.Sin(MathF.PI * 1640f * num2) * 0.45f; array[i] = num4 * num3 * 0.5f; } AudioClip obj = AudioClip.Create("HJM_BtnClick", num, 1, 22050, false); obj.SetData(array, 0); return obj; } private void SetupCameraAndTexture() { //IL_0034: 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_0044: 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_0057: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Clamp(Plugin.ResolutionWidth.Value, 64, 1280); int num2 = Mathf.Clamp(Plugin.ResolutionHeight.Value, 64, 720); renderTexture = new RenderTexture(num, num2, 16, (RenderTextureFormat)0) { name = "HJM_TruckBodyCam_RT", filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; renderTexture.Create(); camHost = new GameObject("HJM_TruckBodyCam_Camera"); Object.DontDestroyOnLoad((Object)(object)camHost); bodyCam = camHost.AddComponent<Camera>(); ((Behaviour)bodyCam).enabled = false; bodyCam.targetTexture = renderTexture; bodyCam.fieldOfView = Mathf.Clamp(Plugin.FieldOfView.Value, 40f, 110f); bodyCam.nearClipPlane = 0.08f; bodyCam.farClipPlane = 65f; bodyCam.useOcclusionCulling = false; bodyCam.allowHDR = true; bodyCam.allowMSAA = false; if ((Object)(object)Camera.main != (Object)null) { bodyCam.cullingMask = Camera.main.cullingMask; bodyCam.backgroundColor = Camera.main.backgroundColor; bodyCam.clearFlags = Camera.main.clearFlags; } nightVisionLight = camHost.AddComponent<Light>(); nightVisionLight.type = (LightType)2; nightVisionLight.range = 10f; nightVisionLight.intensity = Mathf.Clamp(Plugin.NightVisionIntensity.Value, 0f, 3f); nightVisionLight.color = new Color(0.82f, 0.95f, 0.88f, 1f); nightVisionLight.shadows = (LightShadows)0; ((Behaviour)nightVisionLight).enabled = false; } private void SetupScreenUI() { //IL_00a0: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_011f: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Expected O, but got Unknown //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Expected O, but got Unknown //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Expected O, but got Unknown //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)truckScreen == (Object)null || (Object)(object)truckScreen.background == (Object)null) { Plugin.Log.LogWarning((object)"TruckScreenText.background not found; cannot attach monitor UI."); return; } RectTransform rectTransform = ((Graphic)truckScreen.background).rectTransform; Transform parent = ((Transform)rectTransform).parent; TMP_FontAsset font = (((Object)(object)truckScreen.textMesh != (Object)null) ? ((TMP_Text)truckScreen.textMesh).font : null); float num; if (!((Object)(object)truckScreen.textMesh != (Object)null) || !(((TMP_Text)truckScreen.textMesh).fontSize > 0.001f)) { Rect rect = rectTransform.rect; num = Mathf.Max(0.02f, ((Rect)(ref rect)).height * 0.06f); } else { num = ((TMP_Text)truckScreen.textMesh).fontSize; } float fontSize = num * 0.58f; GameObject val = new GameObject("HJM_TruckMonitorRoot", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); val.transform.SetAsLastSibling(); monitorRoot = val.GetComponent<RectTransform>(); monitorRoot.anchorMin = rectTransform.anchorMin; monitorRoot.anchorMax = rectTransform.anchorMax; monitorRoot.anchoredPosition = rectTransform.anchoredPosition; monitorRoot.sizeDelta = rectTransform.sizeDelta; ((Transform)monitorRoot).localRotation = ((Transform)rectTransform).localRotation; ((Transform)monitorRoot).localScale = ((Transform)rectTransform).localScale; ((Transform)monitorRoot).localPosition = new Vector3(((Transform)rectTransform).localPosition.x, ((Transform)rectTransform).localPosition.y, ((Transform)rectTransform).localPosition.z - 0.002f); feedContainer = new GameObject("MonitorFeedPanel", new Type[1] { typeof(RectTransform) }); feedContainer.transform.SetParent((Transform)(object)monitorRoot, false); RectTransform component = feedContainer.GetComponent<RectTransform>(); component.anchorMin = new Vector2(-0.01f, 0.175f); component.anchorMax = new Vector2(1.01f, 1.01f); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; GameObject val2 = new GameObject("FeedRawImage", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(feedContainer.transform, false); RectTransform component2 = val2.GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; feedImage = val2.AddComponent<RawImage>(); feedImage.texture = (Texture)(object)renderTexture; feedImage.uvRect = new Rect(0.01f, 0.01f, 0.98f, 0.98f); ((Graphic)feedImage).color = Color.white; ((Graphic)feedImage).raycastTarget = false; GameObject val3 = new GameObject("LiveBadgeRow", new Type[1] { typeof(RectTransform) }); val3.transform.SetParent(feedContainer.transform, false); RectTransform component3 = val3.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(0.055f, 0.87f); component3.anchorMax = new Vector2(0.75f, 0.918f); component3.offsetMin = Vector2.zero; component3.offsetMax = Vector2.zero; GameObject val4 = new GameObject("LiveBadge", new Type[1] { typeof(RectTransform) }); val4.transform.SetParent(val3.transform, false); RectTransform component4 = val4.GetComponent<RectTransform>(); component4.anchorMin = new Vector2(0f, 0f); component4.anchorMax = new Vector2(0.12f, 1f); component4.offsetMin = Vector2.zero; component4.offsetMax = Vector2.zero; livePillBg = val4.AddComponent<RawImage>(); livePillBg.texture = (Texture)(object)liveBadgeTex; ((Graphic)livePillBg).color = Color.white; ((Graphic)livePillBg).raycastTarget = false; GameObject val5 = new GameObject("NameHolder", new Type[1] { typeof(RectTransform) }); val5.transform.SetParent(val3.transform, false); RectTransform component5 = val5.GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0.14f, 0f); component5.anchorMax = new Vector2(0.95f, 1f); component5.offsetMin = Vector2.zero; component5.offsetMax = Vector2.zero; nameText = CreateLabel(val5.transform, "NameText", font, fontSize, (TextAlignmentOptions)4097); ((TMP_Text)nameText).rectTransform.anchorMin = Vector2.zero; ((TMP_Text)nameText).rectTransform.anchorMax = Vector2.one; ((TMP_Text)nameText).margin = Vector4.zero; Vector3[] array = (Vector3[])(object)new Vector3[4]; rectTransform.GetWorldCorners(array); Vector3 val6 = array[0]; Vector3 val7 = array[1]; Vector3 val8 = array[3]; Vector3 val9 = val8 - val6; Vector3 normalized = ((Vector3)(ref val9)).normalized; val9 = val7 - val6; Vector3 normalized2 = ((Vector3)(ref val9)).normalized; Vector3 val10 = -((Transform)rectTransform).forward; float num2 = Vector3.Distance(val6, val8); float num3 = Vector3.Distance(val6, val7); Quaternion worldRot = Quaternion.LookRotation(-val10, normalized2); Vector3 worldPos = val6 + normalized * (num2 * 0.8f) + normalized2 * (num3 * 0.178f) + val10 * 0.088f; Vector3 worldPos2 = val6 + normalized * (num2 * 0.89f) + normalized2 * (num3 * 0.178f) + val10 * 0.088f; float size = Mathf.Clamp(num3 * 0.115f, 0.085f, 0.16f) * 0.7f; powerButton = CreateWorldBezelButton("HJM_PowerButton", worldPos, worldRot, val10, size, PowerOffCapColor); switchButton = CreateWorldBezelButton("HJM_SwitchButton", worldPos2, worldRot, val10, size, SwitchCapColor); } private ButtonVisual CreateWorldBezelButton(string name, Vector3 worldPos, Quaternion worldRot, Vector3 outDir, float size, Color capColor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0024: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Expected O, but got Unknown //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(((Component)truckScreen).transform, true); val.transform.position = worldPos; val.transform.rotation = worldRot; val.transform.localScale = Vector3.one; GameObject confirmButtonPrefab = Plugin.GetConfirmButtonPrefab(); if ((Object)(object)confirmButtonPrefab == (Object)null) { Plugin.Log.LogError((object)(name + ": ConfirmButtonPrefab is null!")); return null; } GameObject val2 = Object.Instantiate<GameObject>(confirmButtonPrefab); ((Object)val2).name = "ConfirmButtonVisual"; val2.transform.position = worldPos; val2.transform.rotation = Quaternion.identity; val2.transform.localScale = Vector3.one; Transform val3 = null; Transform[] componentsInChildren = val2.GetComponentsInChildren<Transform>(true); foreach (Transform val4 in componentsInChildren) { ((Component)val4).gameObject.SetActive(true); if (((Object)val4).name.Equals("Button Visual", StringComparison.OrdinalIgnoreCase) && (Object)(object)((Component)val4).GetComponent<MeshRenderer>() != (Object)null) { val3 = val4; } else if ((Object)(object)val3 == (Object)null && ((Object)val4).name.Equals("Button", StringComparison.OrdinalIgnoreCase) && (Object)(object)((Component)val4).GetComponent<MeshRenderer>() != (Object)null) { val3 = val4; } } Component[] componentsInChildren2 = val2.GetComponentsInChildren<Component>(true); foreach (Component val5 in componentsInChildren2) { if (!((Object)(object)val5 == (Object)null) && !(val5 is Transform) && !(val5 is MeshFilter) && !(val5 is MeshRenderer) && !(val5 is SkinnedMeshRenderer)) { Object.DestroyImmediate((Object)(object)val5); } } MeshRenderer[] componentsInChildren3 = val2.GetComponentsInChildren<MeshRenderer>(true); if (componentsInChildren3.Length > 2) { MeshRenderer val6 = null; float num = -1f; foreach (MeshRenderer val7 in componentsInChildren3) { if (!((Object)(object)val7 == (Object)null)) { Bounds bounds = ((Renderer)val7).bounds; Vector3 size2 = ((Bounds)(ref bounds)).size; float num2 = size2.x * size2.y * size2.z; if ((Object)(object)((Component)val7).transform != (Object)(object)val3 && ((Object)val7).name.IndexOf("button", StringComparison.OrdinalIgnoreCase) < 0 && num2 > num) { num = num2; val6 = val7; } } } if ((Object)(object)val6 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val6).gameObject); } } Bounds val8 = CalculateMeshBounds(val2); float num3 = Mathf.Max(((Bounds)(ref val8)).size.x, Mathf.Max(((Bounds)(ref val8)).size.y, ((Bounds)(ref val8)).size.z)); float num4 = ((num3 > 0.001f) ? (size / num3) : size); GameObject val9 = new GameObject("CenterPivot"); val9.transform.SetParent(val.transform, false); val9.transform.localPosition = Vector3.zero; val9.transform.localRotation = Quaternion.identity; val9.transform.localScale = Vector3.one; val2.transform.SetParent(val9.transform, true); Transform transform = val2.transform; transform.position += worldPos - ((Bounds)(ref val8)).center; val9.transform.localScale = Vector3.one * num4; if ((Object)(object)val3 != (Object)null) { Vector3 up = val3.up; if (((Vector3)(ref up)).sqrMagnitude > 0.01f) { val9.transform.rotation = Quaternion.FromToRotation(up, outDir) * val9.transform.rotation; } } val9.transform.Rotate(outDir, 180f, (Space)0); BoxCollider val10 = val.AddComponent<BoxCollider>(); ((Collider)val10).isTrigger = true; val10.size = new Vector3(size * 1.3f, size * 1.3f, size * 0.9f); val10.center = Vector3.zero; Transform val11 = (((Object)(object)val3 != (Object)null) ? val3 : val9.transform); return new ButtonVisual { Root = val, VisualTransform = val11, BaseVisualScale = val11.localScale, Collider = val10 }; } private static Renderer FindCapRenderer(GameObject clone) { Renderer[] componentsInChildren = clone.GetComponentsInChildren<Renderer>(true); Renderer result = null; foreach (Renderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { result = val; if (((Object)((Component)val).gameObject).name.IndexOf("button", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)((Component)val).gameObject).name.IndexOf("cap", StringComparison.OrdinalIgnoreCase) >= 0) { return val; } } } return result; } private static Bounds CalculateMeshBounds(GameObject root) { //IL_0025: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] componentsInChildren = root.GetComponentsInChildren<MeshRenderer>(true); if (componentsInChildren.Length == 0) { return new Bounds(root.transform.position, Vector3.one); } Bounds bounds = ((Renderer)componentsInChildren[0]).bounds; for (int i = 1; i < componentsInChildren.Length; i++) { ((Bounds)(ref bounds)).Encapsulate(((Renderer)componentsInChildren[i]).bounds); } return bounds; } private static Material FindCapMaterial(GameObject clone, Color capColor) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = clone.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Renderer val = componentsInChildren[i]; if (!((Object)(object)val == (Object)null) && (((Object)((Component)val).gameObject).name.IndexOf("button", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)((Component)val).gameObject).name.IndexOf("cap", StringComparison.OrdinalIgnoreCase) >= 0 || i == componentsInChildren.Length - 1)) { Material material = val.material; material.color = capColor; return material; } } return null; } private static TextMeshProUGUI CreateLabel(Transform parent, string name, TMP_FontAsset font, float fontSize, TextAlignmentOptions align) { //IL_0014: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0098: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); if ((Object)(object)font != (Object)null) { ((TMP_Text)val2).font = font; } ((TMP_Text)val2).fontSize = fontSize; ((TMP_Text)val2).enableAutoSizing = true; ((TMP_Text)val2).fontSizeMin = fontSize * 0.25f; ((TMP_Text)val2).fontSizeMax = fontSize; ((TMP_Text)val2).alignment = align; ((Graphic)val2).color = Color.white; ((Graphic)val2).raycastTarget = false; return val2; } private void Update() { UpdateButtonInteraction(); AnimateButtonPress(powerButton); AnimateButtonPress(switchButton); if (!isMonitorOn || tookOff || !IsLocalPlayerNearTruck()) { return; } int value = Plugin.FrameRate.Value; if (value <= 0) { RenderCurrentTarget(); return; } float num = Mathf.Clamp(value, 1, 240); if (Time.unscaledTime >= nextRenderTime) { nextRenderTime = Time.unscaledTime + 1f / num; RenderCurrentTarget(); } } private static void AnimateButtonPress(ButtonVisual btn) { //IL_0099: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (btn != null && !((Object)(object)btn.VisualTransform == (Object)null)) { if (btn.PressTimer > 0f) { btn.PressTimer = Mathf.Max(0f, btn.PressTimer - Time.unscaledDeltaTime); float num = 1f - btn.PressTimer / 0.22f; float num2 = Mathf.Lerp(0.48f, 1f, num); btn.VisualTransform.localScale = new Vector3(btn.BaseVisualScale.x, btn.BaseVisualScale.y * num2, btn.BaseVisualScale.z); } else if (btn.VisualTransform.localScale != btn.BaseVisualScale) { btn.VisualTransform.localScale = btn.BaseVisualScale; } } } private void UpdateButtonInteraction() { //IL_007b: 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_0085: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) hoveredButton = HoveredButton.None; Camera main = Camera.main; if ((Object)(object)main == (Object)null || (Object)(object)powerButton?.Collider == (Object)null || (Object)(object)switchButton?.Collider == (Object)null) { UpdateButtonColors(); return; } float num = Mathf.Clamp(Plugin.MaxInteractDistance.Value, 1.5f, 10f); Ray val = main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); RaycastHit val2 = default(RaycastHit); bool num2 = ((Collider)powerButton.Collider).Raycast(val, ref val2, num); RaycastHit val3 = default(RaycastHit); bool flag = ((Collider)switchButton.Collider).Raycast(val, ref val3, num); if (num2 && (!flag || ((RaycastHit)(ref val2)).distance <= ((RaycastHit)(ref val3)).distance)) { hoveredButton = HoveredButton.Power; } else if (flag) { hoveredButton = HoveredButton.Switch; } UpdateButtonColors(); if (hoveredButton != HoveredButton.None && (SemiFunc.InputDown((InputKey)2) || (Mouse.current != null && Mouse.current.leftButton.wasPressedThisFrame))) { if (hoveredButton == HoveredButton.Power) { powerButton.PressTimer = 0.22f; PlayButtonSound(powerButton.Root.transform.position); ToggleMonitor(); } else if (hoveredButton == HoveredButton.Switch) { switchButton.PressTimer = 0.22f; PlayButtonSound(switchButton.Root.transform.position); SwitchNextTarget(); } } } private void ToggleMonitor() { if (tookOff) { isMonitorOn = false; UpdateVisualState(); return; } isMonitorOn = !isMonitorOn; if (isMonitorOn) { RefreshCandidates(); nextRenderTime = 0f; } UpdateVisualState(); BroadcastSyncState(); } private void SwitchNextTarget() { RefreshCandidates(); if (candidates.Count == 0) { currentTarget = null; UpdateVisualState(); BroadcastSyncState(); } else { targetIndex = (targetIndex + 1) % candidates.Count; currentTarget = candidates[targetIndex]; nextRenderTime = 0f; UpdateVisualState(); BroadcastSyncState(); } } private void RefreshCandidates() { candidates.Clear(); List<PlayerAvatar> list = SemiFunc.PlayerGetList(); if (list == null) { currentTarget = null; return; } bool value = Plugin.IncludeLocalPlayer.Value; for (int i = 0; i < list.Count; i++) { PlayerAvatar val = list[i]; if (IsPlayerWatchable(val) && (value || !IsLocalRef.Invoke(val))) { candidates.Add(val); } } if (candidates.Count == 0) { for (int j = 0; j < list.Count; j++) { PlayerAvatar val2 = list[j]; if (IsPlayerWatchable(val2)) { candidates.Add(val2); } } } if (candidates.Count == 0) { currentTarget = null; targetIndex = 0; return; } if ((Object)(object)currentTarget != (Object)null) { int num = candidates.IndexOf(currentTarget); if (num >= 0) { targetIndex = num; return; } } targetIndex = Mathf.Clamp(targetIndex, 0, candidates.Count - 1); currentTarget = candidates[targetIndex]; } private static bool IsPlayerWatchable(PlayerAvatar p) { if ((Object)(object)p == (Object)null) { return false; } if (!IsDisabledRef.Invoke(p)) { return true; } PlayerDeathHead val = DeathHeadRef.Invoke(p); if ((Object)(object)val != (Object)null) { return ((Component)val).gameObject.activeInHierarchy; } return false; } private bool IsLocalPlayerNearTruck() { //IL_003a: 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) PlayerAvatar instance = PlayerAvatar.instance; if ((Object)(object)instance == (Object)null) { return true; } if ((Object)(object)instance.RoomVolumeCheck != (Object)null && InTruckRef.Invoke(instance.RoomVolumeCheck)) { return true; } return Vector3.Distance(((Component)instance).transform.position, ((Component)this).transform.position) <= 16f; } private void RenderCurrentTarget() { //IL_0068: 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_007f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bodyCam == (Object)null || (Object)(object)renderTexture == (Object)null) { return; } if (!IsPlayerWatchable(currentTarget)) { RefreshCandidates(); UpdateVisualState(); } if (!IsPlayerWatchable(currentTarget)) { return; } Vector3 localOffset; Transform val = ResolveCameraMount(currentTarget, out localOffset); if ((Object)(object)val == (Object)null) { return; } ((Component)bodyCam).transform.position = val.TransformPoint(localOffset); ((Component)bodyCam).transform.rotation = val.rotation; hiddenRenderers.Clear(); HideTargetHeadRenderers(currentTarget); bool flag = (Object)(object)nightVisionLight != (Object)null && Plugin.NightVisionIntensity.Value > 0.01f; if (flag) { nightVisionLight.intensity = Mathf.Clamp(Plugin.NightVisionIntensity.Value, 0f, 3f); ((Behaviour)nightVisionLight).enabled = true; } try { bodyCam.Render(); } finally { if (flag) { ((Behaviour)nightVisionLight).enabled = false; } RestoreHiddenRenderers(); } } private static Transform ResolveCameraMount(PlayerAvatar target, out Vector3 localOffset) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) PlayerDeathHead val = DeathHeadRef.Invoke(target); if (IsDisabledRef.Invoke(target) && (Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy) { localOffset = new Vector3(0f, 0.02f, 0.16f); return ((Component)val).transform; } if (IsLocalRef.Invoke(target) && (Object)(object)Camera.main != (Object)null) { localOffset = new Vector3(0f, 0f, 0.12f); return ((Component)Camera.main).transform; } if ((Object)(object)target.playerAvatarVisuals != (Object)null && (Object)(object)target.playerAvatarVisuals.headUpTransform != (Object)null) { localOffset = new Vector3(0f, 0.04f, 0.15f); return target.playerAvatarVisuals.headUpTransform; } if ((Object)(object)target.PlayerVisionTarget != (Object)null && (Object)(object)target.PlayerVisionTarget.VisionTransform != (Object)null) { localOffset = new Vector3(0f, 0.04f, 0.15f); return target.PlayerVisionTarget.VisionTransform; } localOffset = new Vector3(0f, 1.45f, 0.15f); return ((Component)target).transform; } private void HideTargetHeadRenderers(PlayerAvatar target) { PlayerDeathHead val = DeathHeadRef.Invoke(target); if (IsDisabledRef.Invoke(target) && (Object)(object)val != (Object)null) { HideRenderersIn(val.meshParent); HideRenderersIn(val.meshHeadParent); return; } if ((Object)(object)target.playerAvatarVisuals != (Object)null) { HideRenderersIn(target.playerAvatarVisuals.meshParent); } if ((Object)(object)target.flashlightController != (Object)null) { HideSingleRenderer((Renderer)(object)target.flashlightController.mesh); HideSingleRenderer((Renderer)(object)target.flashlightController.meshShadows); } } private void HideSingleRenderer(Renderer r) { if ((Object)(object)r != (Object)null && r.enabled) { r.enabled = false; hiddenRenderers.Add(r); } } private void HideRenderersIn(GameObject root) { if (!((Object)(object)root == (Object)null)) { Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(false); for (int i = 0; i < componentsInChildren.Length; i++) { HideSingleRenderer(componentsInChildren[i]); } } } private void RestoreHiddenRenderers() { for (int i = 0; i < hiddenRenderers.Count; i++) { if ((Object)(object)hiddenRenderers[i] != (Object)null) { hiddenRenderers[i].enabled = true; } } hiddenRenderers.Clear(); } private void PlayButtonSound(Vector3 pos) { //IL_006f: 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) if ((Object)(object)cachedExtractionPoint == (Object)null) { cachedExtractionPoint = Object.FindAnyObjectByType<ExtractionPoint>(); } if ((Object)(object)cachedExtractionPoint != (Object)null && cachedExtractionPoint.soundButton != null) { cachedExtractionPoint.soundButton.Play(pos, 1f, 1f, 1f, 1f); } else if ((Object)(object)fallbackClickClip != (Object)null) { AudioSource.PlayClipAtPoint(fallbackClickClip, pos, 0.7f); } } private void UpdateVisualState() { //IL_0076: 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) if ((Object)(object)feedContainer != (Object)null) { feedContainer.SetActive(isMonitorOn && !tookOff); } bool flag = IsPlayerWatchable(currentTarget); bool flag2 = flag && IsDisabledRef.Invoke(currentTarget); string targetDisplayName = GetTargetDisplayName(); if ((Object)(object)livePillBg != (Object)null) { ((Graphic)livePillBg).color = (flag ? Color.white : DeadGrayColor); } if ((Object)(object)nameText != (Object)null) { ((TMP_Text)nameText).text = ((!flag) ? "等待队友" : (flag2 ? (targetDisplayName + " (阵亡)") : targetDisplayName)); } } private void UpdateButtonColors() { } private string GetTargetDisplayName() { if ((Object)(object)currentTarget == (Object)null) { return "无"; } string text = PlayerNameRef.Invoke(currentTarget); if (string.IsNullOrWhiteSpace(text)) { text = (IsLocalRef.Invoke(currentTarget) ? "自己" : "队友"); } if (text.Length <= 10) { return text; } return text.Substring(0, 10); } private void OnGUI() { //IL_001c: 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_0028: 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_003c: Expected O, but got Unknown //IL_0047: 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: Expected O, but got Unknown //IL_0081: 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_010d: Unknown result type (might be due to invalid IL or missing references) if (hoveredButton != HoveredButton.None) { if (infoTitleStyle == null) { infoTitleStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 18, fontStyle = (FontStyle)1 }; infoTitleStyle.normal.textColor = Color.white; infoSubStyle = new GUIStyle(infoTitleStyle); infoSubStyle.normal.textColor = new Color(0f, 0f, 0f, 0.85f); } string text = ((hoveredButton == HoveredButton.Power) ? "监控开关" : ("切换视角 (" + GetTargetDisplayName() + ")")); float num = 320f; float num2 = 30f; Rect val = default(Rect); ((Rect)(ref val))..ctor(((float)Screen.width - num) * 0.5f, (float)Screen.height * 0.54f, num, num2); GUI.Label(new Rect(((Rect)(ref val)).x + 1f, ((Rect)(ref val)).y + 1f, num, num2), text, infoSubStyle); GUI.Label(val, text, infoTitleStyle); } } private static Texture2D BuildRoundedPillTexture(int width, int height, int radius) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0068: 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_00a2: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(width, height, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; float num = Mathf.Min((float)radius, (float)Mathf.Min(width, height) * 0.5f); for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { float num2 = (float)j + 0.5f; float num3 = (float)i + 0.5f; float num4 = Mathf.Clamp(num2, num, (float)width - num); float num5 = Mathf.Clamp(num3, num, (float)height - num); float num6 = Vector2.Distance(new Vector2(num2, num3), new Vector2(num4, num5)); float num7 = Mathf.Clamp01(num - num6 + 0.5f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num7)); } } val.Apply(); return val; } private static Mesh BuildOctagonPrismMesh(float radius, float height) { //IL_0020: 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_010d: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Expected O, but got Unknown float num = height * 0.5f; List<Vector3> list = new List<Vector3>(); List<int> list2 = new List<int>(); list.Add(new Vector3(0f, num, 0f)); for (int i = 0; i < 8; i++) { float num2 = (float)i * MathF.PI * 2f / 8f; list.Add(new Vector3(Mathf.Cos(num2) * radius, num, Mathf.Sin(num2) * radius)); } for (int j = 0; j < 8; j++) { int num3 = (j + 1) % 8; list2.Add(0); list2.Add(1 + num3); list2.Add(1 + j); } Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); Vector3 item = default(Vector3); Vector3 item2 = default(Vector3); for (int k = 0; k < 8; k++) { int num4 = (k + 1) % 8; float num5 = (float)k * MathF.PI * 2f / 8f; float num6 = (float)num4 * MathF.PI * 2f / 8f; ((Vector3)(ref val))..ctor(Mathf.Cos(num5) * radius, num, Mathf.Sin(num5) * radius); ((Vector3)(ref val2))..ctor(Mathf.Cos(num6) * radius, num, Mathf.Sin(num6) * radius); ((Vector3)(ref item))..ctor(val.x, 0f - num, val.z); ((Vector3)(ref item2))..ctor(val2.x, 0f - num, val2.z); int count = list.Count; list.Add(val); list.Add(val2); list.Add(item2); list.Add(item); list2.Add(count); list2.Add(count + 1); list2.Add(count + 2); list2.Add(count); list2.Add(count + 2); list2.Add(count + 3); } Mesh val3 = new Mesh { name = "HJM_OctagonCap" }; val3.SetVertices(list); val3.SetTriangles(list2, 0); val3.RecalculateNormals(); val3.RecalculateBounds(); return val3; } private static Texture2D BuildPixelHandTexture() { //IL_0095: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00d0: 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) string[] array = new string[16] { "......11........", ".....1111.......", ".....1..1.......", ".....1..1.......", ".....1..111.....", ".....1..1.111...", "..11.1..1.1.11..", ".111.1..1.1.1.1.", ".1.111......1.1.", "..1.1.........1.", "...11.........1.", "....1.........1.", "....1........1..", ".....1.......1..", ".....111111111..", "................" }; Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false) { filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)1 }; for (int i = 0; i < 16; i++) { string text = array[15 - i]; for (int j = 0; j < 16; j++) { val.SetPixel(j, i, (text[j] == '1') ? Color.white : Color.clear); } } val.Apply(); return val; } } }