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 TheFloppyDisk v1.0.0
AudioParty.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AudioParty")] [assembly: AssemblyTitle("AudioParty")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.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; } } } internal static class ARLog2 { public static void Info(string m) { Debug.Log((object)("[AudioReactive] " + m)); } public static void Warn(string m) { Debug.LogWarning((object)("[AudioReactive] " + m)); } } [RequireComponent(typeof(PhotonView))] public class AudioReactiveValuableDirect : Trap, IPunObservable { public enum EffectMode { RGBTint, EmissionPulse, HueShift, CurvedHorizon, WireframeHint, ScaleBreath } [Header("Audio (global fallback)")] public AudioClip musicClip; [Range(0f, 1f)] public float volume = 0.85f; public bool loop = true; [Header("Reactive Tuning")] [Range(0f, 30f)] public float gain = 9f; [Range(0.5f, 20f)] public float smoothing = 6f; public float rescanInterval = 5f; public bool includeInactiveMeshes = true; [Header("Targeting")] public bool useOldGlobalScan = true; [Header("Effect Toggles (in-game control)")] public bool enableRGBTint = true; public bool enableEmissionPulse = false; public bool enableHueShift = false; public bool enableCurvedHorizon = true; public bool enableWireframeHint = false; public bool enableScaleBreath = true; [Header("Per-Grab Effect Selection")] public bool randomizePerGrab = true; [Header("Per-Effect Music (optional)")] public AudioClip musicRGBTint; [Range(0f, 1f)] public float musicRGBTintVol = 0.85f; public AudioClip musicEmissionPulse; [Range(0f, 1f)] public float musicEmissionPulseVol = 0.85f; public AudioClip musicHueShift; [Range(0f, 1f)] public float musicHueShiftVol = 0.85f; public AudioClip musicCurvedHorizon; [Range(0f, 1f)] public float musicCurvedHorizonVol = 0.85f; public AudioClip musicWireframeHint; [Range(0f, 1f)] public float musicWireframeHintVol = 0.85f; public AudioClip musicScaleBreath; [Range(0f, 1f)] public float musicScaleBreathVol = 0.85f; [Header("Shader Property Hints (optional)")] public string propBaseColor = "_BaseColor"; public string propColor = "_Color"; public string propEmission = "_EmissionColor"; public string propOutlineColor = "_OutlineColor"; public string propOutlineWidth = "_OutlineWidth"; public string propWireframeToggle = "_WireframeOn"; public string propWireframeAmount = "_WireframeVal"; [Header("ScaleBreath Settings (bass-forward)")] [Range(0f, 0.6f)] public float scaleBreathMax = 0.22f; [Range(0.1f, 6f)] public float scaleBreathGain = 2.2f; [Range(1f, 60f)] public float scaleBreathAttack = 18f; [Range(1f, 80f)] public float scaleBreathDecay = 35f; [Header("CurvedHorizon Shader Settings (WorldspaceInfiniteBoxes)")] [Tooltip("Exact name of the shader for fallback if no template is set.")] public string curvedShaderName = "Custom/WorldspaceInfiniteBoxes"; [Tooltip("Template material USING your WorldspaceInfiniteBoxes shader. REQUIRED if you want textures/params to load.")] public Material curvedTemplate; [Header("CurvedHorizon Color Drive (only _CubeColor)")] public string curvedPropCubeColor = "_CubeColor"; [Range(0f, 1f)] public float curvedColorMix = 0.9f; [Range(0f, 4f)] public float curvedEmissionBoost = 0f; [Header("CurvedHorizon Bass Drive")] public string curvedPropBassLevel = "_BassLevel"; [Range(0.1f, 6f)] public float curvedBassGain = 2f; [Range(1f, 80f)] public float curvedBassAttack = 20f; [Range(1f, 80f)] public float curvedBassDecay = 30f; [Header("CurvedHorizon Bass Motion (sent via MPB)")] public string curvedPropBassJumpAmp = "_BassJumpAmp"; public string curvedPropBassStretchY = "_BassStretchY"; public float curvedBassJumpAmpValue = 0.9f; public float curvedBassStretchYValue = 0.5f; [Header("CurvedHorizon Property Names (legacy - unused)")] public string curvedPropCurvature = "_Curvature"; public string curvedPropMaxDown = "_CurveMaxOffset"; public string curvedPropOrigin = "_CurveOrigin"; public string curvedPropUp = "_CurveUp"; [Header("CurvedHorizon Drive & Limits (legacy - unused)")] [Range(0f, 0.01f)] public float curvedCurvatureBase = 0.0002f; [Range(0f, 0.02f)] public float curvedCurvatureMax = 0.0012f; [Range(0f, 50f)] public float curvedMaxDownOffset = 10f; [Range(1f, 80f)] public float curvedAttack = 20f; [Range(1f, 80f)] public float curvedDecay = 30f; public Transform curvedOrigin; public Vector3 curvedUp = Vector3.zero; private readonly List<Renderer> _renderers = new List<Renderer>(); private readonly List<Material[]> _sharedMats = new List<Material[]>(); private readonly List<Color[]> _baseColors = new List<Color[]>(); private readonly List<MaterialPropertyBlock[]> _mpbs = new List<MaterialPropertyBlock[]>(); private AudioSource _src; private bool _ready; private float _nextRescan; private bool _wasGrabbed; private bool _netActive; private double _netStartTime; private const int FFT_SIZE = 64; private readonly float[] _spectrum = new float[64]; private Vector3 _currentRGB = Vector3.zero; private Transform _holderRoot; private object _grabberRef; private PhotonView _pv; private int _lastEffectIdx = -1; private EffectMode _activeEffect = EffectMode.ScaleBreath; private readonly HashSet<Transform> _scaledOnce = new HashSet<Transform>(); private readonly Dictionary<Transform, Vector3> _origScale = new Dictionary<Transform, Vector3>(); private float _scaleBreathSmoothed; private bool _curvedMatsApplied; private Shader _curveShader; private readonly Dictionary<Renderer, Material[]> _origMatsCurve = new Dictionary<Renderer, Material[]>(); private readonly Dictionary<Renderer, Material[]> _curveMats = new Dictionary<Renderer, Material[]>(); private AudioClip _activeClip; private float _activeVolume; private int _PID_Curvature; private int _PID_CurveMax; private int _PID_Origin; private int _PID_Up; private float _curvedBassEnv = 0f; private void CacheCurvePropIDs() { _PID_Curvature = Shader.PropertyToID(curvedPropCurvature); _PID_CurveMax = Shader.PropertyToID(curvedPropMaxDown); _PID_Origin = Shader.PropertyToID(curvedPropOrigin); _PID_Up = Shader.PropertyToID(curvedPropUp); } private void Awake() { _pv = ((Component)this).GetComponent<PhotonView>(); CacheCurvePropIDs(); } private void OnValidate() { CacheCurvePropIDs(); } private void OnDisable() { StopAudio(); ClearAllPropertyBlocks(); RestoreAnyScaledTransforms(); CurvedRestoreMaterials(); ClearTrackingLists(); _holderRoot = null; _grabberRef = null; _netActive = false; _ready = false; _scaleBreathSmoothed = 0f; _curvedBassEnv = 0f; } public override void Update() { //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) ((Trap)this).Update(); bool flag = PhotonNetwork.OfflineMode || PhotonNetwork.IsMasterClient; bool flag2 = (Object)(object)base.physGrabObject != (Object)null && base.physGrabObject.grabbed; if (flag) { if (flag2 && !_wasGrabbed) { int num = PickEffectIndex(); double time = PhotonNetwork.Time; _pv.RPC("AR_PlayRPC", (RpcTarget)0, new object[2] { time, num }); } else if (!flag2 && _wasGrabbed) { _pv.RPC("AR_StopRPC", (RpcTarget)0, Array.Empty<object>()); } } _wasGrabbed = flag2; if (!_netActive) { return; } EnsureAudioReadyDirectSynced(); if (Time.time >= _nextRescan) { _nextRescan = Time.time + Mathf.Max(0.25f, rescanInterval); ClearAllPropertyBlocks(); RestoreAnyScaledTransforms(); ClearTrackingLists(); if (useOldGlobalScan) { CollectRenderers_Global(); } else { CollectRenderersUnder(_holderRoot); } if (_activeEffect == EffectMode.CurvedHorizon && enableCurvedHorizon) { CurvedEnsureMaterials(); } ARLog2.Info("Rescan -> renderers: " + _renderers.Count); } if (!useOldGlobalScan) { GetHolder(out Transform holderRoot, out object grabberRef); if ((Object)(object)holderRoot != (Object)null && ((Object)(object)holderRoot != (Object)(object)_holderRoot || grabberRef != _grabberRef)) { _holderRoot = holderRoot; _grabberRef = grabberRef; ClearAllPropertyBlocks(); RestoreAnyScaledTransforms(); ClearTrackingLists(); CollectRenderersUnder(_holderRoot); if (_activeEffect == EffectMode.CurvedHorizon && enableCurvedHorizon) { CurvedEnsureMaterials(); } } } if (_ready) { _src.GetSpectrumData(_spectrum, 0, (FFTWindow)3); float num2 = SumRange(_spectrum, 0, 8); float num3 = SumRange(_spectrum, 8, 16); float num4 = SumRange(_spectrum, 24, 40); num2 = Mathf.Clamp01(num2 * gain); num3 = Mathf.Clamp01(num3 * gain); num4 = Mathf.Clamp01(num4 * gain); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num2, num3, num4); _currentRGB = Vector3.Lerp(_currentRGB, val, Time.deltaTime * smoothing); ApplyEffectViaMPB(_currentRGB, _activeEffect); } } [PunRPC] private void AR_PlayRPC(double startTime, int effectIdx) { _netActive = true; _netStartTime = startTime; _nextRescan = Time.time; List<EffectMode> enabledEffectsList = GetEnabledEffectsList(); _activeEffect = ((enabledEffectsList.Count == 0) ? EffectMode.ScaleBreath : enabledEffectsList[Mathf.Clamp(effectIdx, 0, enabledEffectsList.Count - 1)]); ChooseActiveClip(_activeEffect); _scaleBreathSmoothed = 0f; _curvedBassEnv = 0f; EnsureAudioReadyDirectSynced(); ClearAllPropertyBlocks(); RestoreAnyScaledTransforms(); CurvedRestoreMaterials(); ClearTrackingLists(); if (useOldGlobalScan) { CollectRenderers_Global(); } else { CollectRenderersUnder(_holderRoot); } if (_activeEffect == EffectMode.CurvedHorizon && enableCurvedHorizon) { CurvedEnsureMaterials(); } } [PunRPC] private void AR_StopRPC() { _netActive = false; StopAudio(); ClearAllPropertyBlocks(); RestoreAnyScaledTransforms(); CurvedRestoreMaterials(); ClearTrackingLists(); _holderRoot = null; _grabberRef = null; _ready = false; _scaleBreathSmoothed = 0f; _curvedBassEnv = 0f; } public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { } private void EnsureAudioReadyDirectSynced() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if ((Object)(object)_src == (Object)null) { GameObject val = new GameObject("__AudioReactiveAudio"); val.transform.SetParent(((Component)this).transform, false); _src = val.AddComponent<AudioSource>(); _src.playOnAwake = false; _src.spatialBlend = 0f; } _src.loop = loop; _src.volume = (((Object)(object)_activeClip != (Object)null) ? _activeVolume : volume); _src.clip = (((Object)(object)_activeClip != (Object)null) ? _activeClip : musicClip); if ((Object)(object)_src.clip == (Object)null) { if (_netActive) { ARLog2.Warn("No AudioClip assigned (global or per-effect). Assign in inspector."); } return; } if (!_src.isPlaying) { double num = (PhotonNetwork.OfflineMode ? (Time.timeAsDouble - _netStartTime) : (PhotonNetwork.Time - _netStartTime)); if (num < 0.0) { num = 0.0; } float num2 = ((_src.clip.length > 0f) ? _src.clip.length : 0.0001f); float time = (float)(num % (double)num2); _src.time = time; _src.Play(); } _ready = (Object)(object)_src.clip != (Object)null && _src.isPlaying; } private void StopAudio() { if ((Object)(object)_src != (Object)null) { try { if (_src.isPlaying) { _src.Stop(); } } catch { } try { _src.clip = null; } catch { } Object.Destroy((Object)(object)((Component)_src).gameObject); _src = null; } _activeClip = null; } private void GetHolder(out Transform holderRoot, out object grabberRef) { holderRoot = null; grabberRef = null; if ((Object)(object)base.physGrabObject == (Object)null || base.physGrabObject.playerGrabbing == null || base.physGrabObject.playerGrabbing.Count == 0) { return; } object obj = (grabberRef = base.physGrabObject.playerGrabbing[0]); Component val = null; Type type = obj.GetType(); FieldInfo field = type.GetField("playerAvatar", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(obj); val = (Component)((value is Component) ? value : null); } if ((Object)(object)val == (Object)null) { PropertyInfo property = type.GetProperty("playerAvatar", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { object value2 = property.GetValue(obj, null); val = (Component)((value2 is Component) ? value2 : null); } } if ((Object)(object)val != (Object)null) { holderRoot = val.transform; } else { Component val2 = (Component)((obj is Component) ? obj : null); if ((Object)(object)val2 != (Object)null) { holderRoot = val2.transform; } } _grabberRef = grabberRef; } private void CollectRenderers_Global() { //IL_0203: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Expected O, but got Unknown int num = 0; Renderer[] array = Resources.FindObjectsOfTypeAll<Renderer>().Where(delegate(Renderer r) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)r != (Object)null && (Object)(object)((Component)r).gameObject != (Object)null) { Scene scene = ((Component)r).gameObject.scene; result = (((Scene)(ref scene)).IsValid() ? 1 : 0); } else { result = 0; } return (byte)result != 0; }).ToArray(); Renderer[] array2 = array; foreach (Renderer val in array2) { if ((Object)(object)val == (Object)null || !val.enabled || !((Component)val).gameObject.activeInHierarchy) { continue; } try { Material[] sharedMaterials = val.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { continue; } _renderers.Add(val); _sharedMats.Add(sharedMaterials); Color[] array3 = (Color[])(object)new Color[sharedMaterials.Length]; MaterialPropertyBlock[] array4 = (MaterialPropertyBlock[])(object)new MaterialPropertyBlock[sharedMaterials.Length]; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (!((Object)(object)val2 == (Object)null)) { string text = (val2.HasProperty(propColor) ? propColor : (val2.HasProperty(propBaseColor) ? propBaseColor : null)); if (!string.IsNullOrEmpty(text)) { array3[j] = val2.GetColor(text); } else if (val2.HasProperty(propEmission)) { array3[j] = val2.GetColor(propEmission); } else { array3[j] = Color.white; } if (val2.HasProperty(propEmission)) { val2.EnableKeyword("_EMISSION"); } array4[j] = new MaterialPropertyBlock(); } } _baseColors.Add(array3); _mpbs.Add(array4); num++; Transform transform = ((Component)val).transform; if (!_origScale.ContainsKey(transform)) { _origScale[transform] = transform.localScale; } } catch (Exception ex) { ARLog2.Warn("Skipped renderer " + ((Object)val).name + ": " + ex.Message); } } ARLog2.Info("Tracked renderers (GLOBAL): " + num); } private void CollectRenderersUnder(Transform root) { //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0193: Expected O, but got Unknown if ((Object)(object)root == (Object)null) { return; } int num = 0; Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(includeInactiveMeshes); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (!includeInactiveMeshes && (!val.enabled || !((Component)val).gameObject.activeInHierarchy)) { continue; } try { Material[] sharedMaterials = val.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { continue; } _renderers.Add(val); _sharedMats.Add(sharedMaterials); Color[] array2 = (Color[])(object)new Color[sharedMaterials.Length]; MaterialPropertyBlock[] array3 = (MaterialPropertyBlock[])(object)new MaterialPropertyBlock[sharedMaterials.Length]; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (!((Object)(object)val2 == (Object)null)) { string text = (val2.HasProperty(propColor) ? propColor : (val2.HasProperty(propBaseColor) ? propBaseColor : null)); if (!string.IsNullOrEmpty(text)) { array2[j] = val2.GetColor(text); } else if (val2.HasProperty(propEmission)) { array2[j] = val2.GetColor(propEmission); } else { array2[j] = Color.white; } if (val2.HasProperty(propEmission)) { val2.EnableKeyword("_EMISSION"); } array3[j] = new MaterialPropertyBlock(); } } _baseColors.Add(array2); _mpbs.Add(array3); num++; Transform transform = ((Component)val).transform; if (!_origScale.ContainsKey(transform)) { _origScale[transform] = transform.localScale; } } catch (Exception ex) { ARLog2.Warn("Skipped renderer " + ((Object)val).name + ": " + ex.Message); } } ARLog2.Info("Tracked holder renderers: " + num); } private List<EffectMode> GetEnabledEffectsList() { List<EffectMode> list = new List<EffectMode>(6); if (enableRGBTint) { list.Add(EffectMode.RGBTint); } if (enableEmissionPulse) { list.Add(EffectMode.EmissionPulse); } if (enableHueShift) { list.Add(EffectMode.HueShift); } if (enableCurvedHorizon) { list.Add(EffectMode.CurvedHorizon); } if (enableWireframeHint) { list.Add(EffectMode.WireframeHint); } if (enableScaleBreath) { list.Add(EffectMode.ScaleBreath); } return list; } private int PickEffectIndex() { List<EffectMode> enabledEffectsList = GetEnabledEffectsList(); if (enabledEffectsList.Count == 0) { return 0; } int num2; if (randomizePerGrab) { int num = 0; do { num2 = Random.Range(0, enabledEffectsList.Count); } while (enabledEffectsList.Count > 1 && num2 == _lastEffectIdx && ++num < 8); } else { num2 = (_lastEffectIdx + 1 + enabledEffectsList.Count) % enabledEffectsList.Count; } _lastEffectIdx = num2; return num2; } private void ChooseActiveClip(EffectMode mode) { _activeClip = null; _activeVolume = volume; switch (mode) { case EffectMode.RGBTint: _activeClip = musicRGBTint; _activeVolume = musicRGBTintVol; break; case EffectMode.EmissionPulse: _activeClip = musicEmissionPulse; _activeVolume = musicEmissionPulseVol; break; case EffectMode.HueShift: _activeClip = musicHueShift; _activeVolume = musicHueShiftVol; break; case EffectMode.CurvedHorizon: _activeClip = musicCurvedHorizon; _activeVolume = musicCurvedHorizonVol; break; case EffectMode.WireframeHint: _activeClip = musicWireframeHint; _activeVolume = musicWireframeHintVol; break; case EffectMode.ScaleBreath: _activeClip = musicScaleBreath; _activeVolume = musicScaleBreathVol; break; } } private static float SumRange(float[] data, int start, int count) { float num = 0f; int num2 = start + count; if (num2 > data.Length) { num2 = data.Length; } for (int i = start; i < num2; i++) { num += data[i]; } return num; } private void ApplyColorsViaMPB(Vector3 rgb) { //IL_0003: 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_0019: 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_00ad: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_010b: 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_0129: 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_0147: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); ((Color)(ref val))..ctor(Mathf.Sqrt(rgb.x), Mathf.Sqrt(rgb.y), Mathf.Sqrt(rgb.z), 1f); for (int i = 0; i < _renderers.Count; i++) { Renderer val2 = _renderers[i]; Material[] array = _sharedMats[i]; Color[] array2 = _baseColors[i]; MaterialPropertyBlock[] array3 = _mpbs[i]; int num = array.Length; for (int j = 0; j < num; j++) { Material val3 = array[j]; MaterialPropertyBlock val4 = array3[j]; if (!((Object)(object)val3 == (Object)null) && val4 != null) { Color val5 = Color.Lerp(array2[j], val, 0.85f); if (val3.HasProperty(propColor)) { val4.SetColor(propColor, val5); } if (val3.HasProperty(propBaseColor)) { val4.SetColor(propBaseColor, val5); } Color val6 = val * 2f; if (val3.HasProperty(propEmission)) { val4.SetColor(propEmission, val6); val4.SetColor("_EmissiveColor", val6); val4.SetColor("_EmissiveColorLDR", val6); } val2.SetPropertyBlock(val4, j); } } } } private void ApplyEffectViaMPB(Vector3 bands, EffectMode mode) { //IL_0026: 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_003a: 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_004e: 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) switch (mode) { default: ApplyColorsViaMPB(bands); break; case EffectMode.EmissionPulse: ApplyEmissionPulse(bands); break; case EffectMode.HueShift: ApplyHueShift(bands); break; case EffectMode.CurvedHorizon: ApplyCurvedHorizon(bands); break; case EffectMode.WireframeHint: ApplyWireframe(bands); break; case EffectMode.ScaleBreath: ApplyScaleBreath(bands); break; } } private static float Luma(Vector3 b) { //IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references) return Mathf.Clamp01((b.x + b.y + b.z) / 3f); } private void ApplyEmissionPulse(Vector3 b) { //IL_0013: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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) if (!enableEmissionPulse) { return; } float num = Mathf.Sqrt(Mathf.Clamp01(b.y * 0.6f + b.z * 0.8f + b.x * 0.3f)) * 3f; Color val = default(Color); ((Color)(ref val))..ctor(num, num, num, 1f); for (int i = 0; i < _renderers.Count; i++) { Renderer val2 = _renderers[i]; Material[] array = _sharedMats[i]; MaterialPropertyBlock[] array2 = _mpbs[i]; for (int j = 0; j < array.Length; j++) { Material val3 = array[j]; MaterialPropertyBlock val4 = array2[j]; if (!((Object)(object)val3 == (Object)null) && val4 != null && val3.HasProperty(propEmission)) { val4.SetColor(propEmission, val); val4.SetColor("_EmissiveColor", val); val4.SetColor("_EmissiveColorLDR", val); val2.SetPropertyBlock(val4, j); } } } } private void ApplyHueShift(Vector3 b) { //IL_001e: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0194: Unknown result type (might be due to invalid IL or missing references) if (!enableHueShift) { return; } float num = (Time.time * 0.1f + b.z * 0.5f) % 1f; float num2 = Mathf.Lerp(0.9f, 1.4f, Mathf.Clamp01(b.y)); float num3 = Mathf.Lerp(0.9f, 1.3f, Mathf.Clamp01(b.x + b.y * 0.5f + b.z * 0.3f)); float num4 = default(float); float num5 = default(float); float num6 = default(float); for (int i = 0; i < _renderers.Count; i++) { Renderer val = _renderers[i]; Material[] array = _sharedMats[i]; Color[] array2 = _baseColors[i]; MaterialPropertyBlock[] array3 = _mpbs[i]; for (int j = 0; j < array.Length; j++) { Material val2 = array[j]; MaterialPropertyBlock val3 = array3[j]; if (!((Object)(object)val2 == (Object)null) && val3 != null) { Color val4 = array2[j]; Color.RGBToHSV(val4, ref num4, ref num5, ref num6); num4 = (num4 + num) % 1f; num5 *= num2; num6 *= num3; Color val5 = Color.HSVToRGB(Mathf.Repeat(num4, 1f), Mathf.Clamp01(num5), Mathf.Clamp01(num6)); bool flag = false; if (val2.HasProperty(propColor)) { val3.SetColor(propColor, val5); flag = true; } if (val2.HasProperty(propBaseColor)) { val3.SetColor(propBaseColor, val5); flag = true; } if (flag) { val.SetPropertyBlock(val3, j); } } } } } private void ApplyCurvedHorizon(Vector3 b) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: 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_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) if (!enableCurvedHorizon) { return; } CurvedEnsureMaterials(); Color val = default(Color); ((Color)(ref val))..ctor(Mathf.Sqrt(Mathf.Clamp01(b.x)), Mathf.Sqrt(Mathf.Clamp01(b.y)), Mathf.Sqrt(Mathf.Clamp01(b.z)), 1f); float num = Mathf.Clamp01(b.x * curvedBassGain); float num2 = ((num >= _curvedBassEnv) ? curvedBassAttack : curvedBassDecay); _curvedBassEnv = Mathf.Lerp(_curvedBassEnv, num, Time.deltaTime * num2); for (int i = 0; i < _renderers.Count; i++) { Renderer val2 = _renderers[i]; if ((Object)(object)val2 == (Object)null) { continue; } Material[] sharedMaterials = val2.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { continue; } MaterialPropertyBlock[] array = _mpbs[i]; if (array == null || array.Length != sharedMaterials.Length) { array = (MaterialPropertyBlock[])(object)new MaterialPropertyBlock[sharedMaterials.Length]; for (int j = 0; j < sharedMaterials.Length; j++) { array[j] = new MaterialPropertyBlock(); } _mpbs[i] = array; } for (int k = 0; k < sharedMaterials.Length; k++) { Material val3 = sharedMaterials[k]; MaterialPropertyBlock val4 = array[k]; if ((Object)(object)val3 == (Object)null || val4 == null) { continue; } Shader shader = val3.shader; if (!((Object)(object)shader == (Object)null) && (((Object)(object)curvedTemplate != (Object)null) ? ((Object)(object)shader == (Object)(object)curvedTemplate.shader) : string.Equals(((Object)shader).name, curvedShaderName, StringComparison.Ordinal))) { bool flag = false; if (val3.HasProperty(curvedPropCubeColor)) { Color color = val3.GetColor(curvedPropCubeColor); Color val5 = Color.Lerp(color, val, Mathf.Clamp01(curvedColorMix)); val4.SetColor(curvedPropCubeColor, val5); flag = true; } if (!string.IsNullOrEmpty(curvedPropBassLevel) && val3.HasProperty(curvedPropBassLevel)) { val4.SetFloat(curvedPropBassLevel, _curvedBassEnv); flag = true; } if (!string.IsNullOrEmpty(curvedPropBassJumpAmp) && val3.HasProperty(curvedPropBassJumpAmp)) { val4.SetFloat(curvedPropBassJumpAmp, curvedBassJumpAmpValue); flag = true; } if (!string.IsNullOrEmpty(curvedPropBassStretchY) && val3.HasProperty(curvedPropBassStretchY)) { val4.SetFloat(curvedPropBassStretchY, curvedBassStretchYValue); flag = true; } if (curvedEmissionBoost > 0f && val3.HasProperty(propEmission)) { Color val6 = val * curvedEmissionBoost; val4.SetColor(propEmission, val6); val4.SetColor("_EmissiveColor", val6); val4.SetColor("_EmissiveColorLDR", val6); flag = true; } if (flag) { val2.SetPropertyBlock(val4, k); } } } } } private void CurvedEnsureMaterials() { //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown if (_curvedMatsApplied) { return; } if ((Object)(object)curvedTemplate != (Object)null) { _curveShader = curvedTemplate.shader; } else { _curveShader = Shader.Find(curvedShaderName); } if ((Object)(object)_curveShader == (Object)null) { ARLog2.Warn("CurvedHorizon: shader not found. Assign 'curvedTemplate' or set 'curvedShaderName'."); return; } _origMatsCurve.Clear(); _curveMats.Clear(); for (int i = 0; i < _renderers.Count; i++) { Renderer val = _renderers[i]; if ((Object)(object)val == (Object)null) { continue; } Material[] sharedMaterials = val.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { continue; } Material[] array = (Material[])(object)new Material[sharedMaterials.Length]; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if ((Object)(object)val2 == (Object)null) { array[j] = null; continue; } Material val3 = (((Object)(object)curvedTemplate != (Object)null) ? new Material(curvedTemplate) : new Material(_curveShader)); CopyIfHasTexture(val2, val3, "_MainTex"); CopyIfHasTexture(val2, val3, "_BaseMap"); CopyIfHasColor(val2, val3, propColor); CopyIfHasColor(val2, val3, propBaseColor); CopyIfHasColor(val2, val3, "_CubeColor"); CopyIfHasColor(val2, val3, "_BgColor"); CopyIfHasFloat(val2, val3, "_Metallic"); CopyIfHasFloat(val2, val3, "_Smoothness"); CopyIfHasFloat(val2, val3, "_Glossiness"); CopyIfHasFloat(val2, val3, "_BassJumpAmp"); CopyIfHasFloat(val2, val3, "_BassStretchY"); CopyIfHasFloat(val2, val3, "_BassLevel"); val3.renderQueue = val2.renderQueue; array[j] = val3; } _origMatsCurve[val] = sharedMaterials; _curveMats[val] = array; val.sharedMaterials = array; MaterialPropertyBlock[] array2 = ((i < _mpbs.Count) ? _mpbs[i] : null); if (array2 == null || array2.Length != array.Length) { while (_mpbs.Count <= i) { _mpbs.Add(null); } array2 = (MaterialPropertyBlock[])(object)new MaterialPropertyBlock[array.Length]; for (int k = 0; k < array.Length; k++) { array2[k] = new MaterialPropertyBlock(); } _mpbs[i] = array2; } } _curvedMatsApplied = true; } private static void CopyIfHasTexture(Material from, Material to, string prop) { //IL_0046: 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) if (from.HasProperty(prop) && to.HasProperty(prop)) { to.SetTexture(prop, from.GetTexture(prop)); try { to.SetTextureScale(prop, from.GetTextureScale(prop)); } catch { } try { to.SetTextureOffset(prop, from.GetTextureOffset(prop)); } catch { } } } private static void CopyIfHasColor(Material from, Material to, string prop) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(prop) && from.HasProperty(prop) && to.HasProperty(prop)) { to.SetColor(prop, from.GetColor(prop)); } } private static void CopyIfHasFloat(Material from, Material to, string prop) { if (from.HasProperty(prop) && to.HasProperty(prop)) { to.SetFloat(prop, from.GetFloat(prop)); } } private void CurvedRestoreMaterials() { if (!_curvedMatsApplied) { return; } foreach (KeyValuePair<Renderer, Material[]> item in _origMatsCurve) { Renderer key = item.Key; if (!((Object)(object)key == (Object)null)) { try { key.sharedMaterials = item.Value; } catch { } } } _origMatsCurve.Clear(); foreach (KeyValuePair<Renderer, Material[]> curveMat in _curveMats) { Material[] value = curveMat.Value; if (value == null) { continue; } for (int i = 0; i < value.Length; i++) { if ((Object)(object)value[i] != (Object)null) { try { Object.Destroy((Object)(object)value[i]); } catch { } } } } _curveMats.Clear(); _curvedMatsApplied = false; } private Transform ResolveCurvedAnchor() { if ((Object)(object)curvedOrigin != (Object)null) { return curvedOrigin; } if ((Object)(object)_holderRoot == (Object)null) { GetHolder(out Transform holderRoot, out object grabberRef); if ((Object)(object)holderRoot != (Object)null) { _holderRoot = holderRoot; } if (grabberRef != null) { _grabberRef = grabberRef; } } if ((Object)(object)_holderRoot != (Object)null) { Camera[] componentsInChildren = ((Component)_holderRoot).GetComponentsInChildren<Camera>(true); Camera val = ((IEnumerable<Camera>)componentsInChildren).FirstOrDefault((Func<Camera, bool>)((Camera c) => Object.op_Implicit((Object)(object)c) && ((Behaviour)c).enabled && ((Behaviour)c).isActiveAndEnabled)) ?? componentsInChildren.FirstOrDefault(); if ((Object)(object)val != (Object)null) { return ((Component)val).transform; } } object grabberRef2 = _grabberRef; if (grabberRef2 != null) { Type type = grabberRef2.GetType(); string[] array = new string[4] { "localCamera", "playerCamera", "headCam", "camera" }; Camera val4 = default(Camera); Camera val7 = default(Camera); foreach (string name in array) { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(grabberRef2); Camera val2 = (Camera)((value is Camera) ? value : null); if (val2 != null) { return ((Component)val2).transform; } Component val3 = (Component)((value is Component) ? value : null); if (val3 != null && val3.TryGetComponent<Camera>(ref val4)) { return ((Component)val4).transform; } } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { object value2 = property.GetValue(grabberRef2, null); Camera val5 = (Camera)((value2 is Camera) ? value2 : null); if (val5 != null) { return ((Component)val5).transform; } Component val6 = (Component)((value2 is Component) ? value2 : null); if (val6 != null && val6.TryGetComponent<Camera>(ref val7)) { return ((Component)val7).transform; } } } } if ((Object)(object)_holderRoot != (Object)null) { return _holderRoot; } if ((Object)(object)Camera.main != (Object)null) { return ((Component)Camera.main).transform; } Camera val8 = ((IEnumerable<Camera>)Object.FindObjectsOfType<Camera>(true)).FirstOrDefault((Func<Camera, bool>)((Camera c) => Object.op_Implicit((Object)(object)c) && ((Behaviour)c).enabled && ((Behaviour)c).isActiveAndEnabled)); if (Object.op_Implicit((Object)(object)val8)) { return ((Component)val8).transform; } return ((Component)this).transform; } private void ApplyWireframe(Vector3 b) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!enableWireframeHint) { return; } float num = Mathf.Clamp01(Luma(b) * 1.5f); for (int i = 0; i < _renderers.Count; i++) { Renderer val = _renderers[i]; Material[] array = _sharedMats[i]; MaterialPropertyBlock[] array2 = _mpbs[i]; for (int j = 0; j < array.Length; j++) { Material val2 = array[j]; MaterialPropertyBlock val3 = array2[j]; if (!((Object)(object)val2 == (Object)null) && val3 != null) { bool flag = false; if (val2.HasProperty(propWireframeToggle)) { val3.SetFloat(propWireframeToggle, 1f); flag = true; } if (val2.HasProperty(propWireframeAmount)) { val3.SetFloat(propWireframeAmount, num); flag = true; } if (flag) { val.SetPropertyBlock(val3, j); } } } } } private void ApplyScaleBreath(Vector3 b) { //IL_0015: 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_002e: 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_00e0: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) if (!enableScaleBreath) { return; } float num = b.x * 1.4f + b.y * 0.5f + b.z * 0.2f; float num2 = Mathf.Clamp01(num * scaleBreathGain); float num3 = ((num2 >= _scaleBreathSmoothed) ? scaleBreathAttack : scaleBreathDecay); _scaleBreathSmoothed = Mathf.Lerp(_scaleBreathSmoothed, num2, Time.deltaTime * num3); float num4 = 1f + _scaleBreathSmoothed * scaleBreathMax; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num4, num4, num4); for (int i = 0; i < _renderers.Count; i++) { Transform transform = ((Component)_renderers[i]).transform; if (!_origScale.TryGetValue(transform, out var value)) { value = transform.localScale; _origScale[transform] = value; } if (_scaledOnce.Add(transform)) { transform.localScale = new Vector3(value.x * val.x, value.y * val.y, value.z * val.z); } } _scaledOnce.Clear(); } private void SetupCameraIfNeeded() { } private void RestoreCameraIfNeeded() { } private Camera GetTargetCamera() { return Camera.main; } private void RestoreAnyScaledTransforms() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<Transform, Vector3> item in _origScale) { Transform key = item.Key; if (Object.op_Implicit((Object)(object)key)) { key.localScale = item.Value; } } } private void ClearAllPropertyBlocks() { for (int i = 0; i < _renderers.Count; i++) { Renderer val = _renderers[i]; if (!((Object)(object)val == (Object)null)) { int num = ((_sharedMats.Count > i && _sharedMats[i] != null) ? _sharedMats[i].Length : val.sharedMaterials.Length); for (int j = 0; j < num; j++) { val.SetPropertyBlock((MaterialPropertyBlock)null, j); } } } } private void ClearTrackingLists() { _renderers.Clear(); _sharedMats.Clear(); _baseColors.Clear(); _mpbs.Clear(); _scaledOnce.Clear(); } } namespace AudioParty { [BepInPlugin("Omniscye.AudioParty", "AudioParty", "1.0")] public class AudioParty : BaseUnityPlugin { internal static AudioParty Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //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_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } } namespace AmazingAssets.CurvedWorldEditor { internal static class AssetInfo { public const string assetName = "Curved World"; public static readonly string assetNameTrimmed = "Curved World".Replace(" ", string.Empty); public const string assetVersion = "2022.4"; public const string assetStorePath = "content/173251"; public const string assetStorePathShortLink = "http://u3d.as/1W8h"; public const string assetForumPath = "https://forum.unity.com/threads/curved-world-2.344041/"; public const string assetManualLocation = "https://docs.google.com/document/d/1nptLK-X8kwUdXWbE_RyqiaPHYd5R96zu7LptWJ2tcf4/edit?usp=sharing"; public const string assetSupportMail = "[email protected]"; public const string publisherPage = "https://assetstore.unity.com/publishers/1295"; } }