using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using JiggleUtils;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ThiccCoilHeadModelReplasement")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ThiccCoilHeadModelReplasement")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("68e677b1-890a-4f99-9e84-c46b6c771e89")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
public class ModSpringManPlugin : MonoBehaviour
{
private GameObject springManPrefab;
private AudioClip[] springManAudioClips;
private IEnumerable<DynamicBone> dynamicBonesList;
private void Awake()
{
dynamicBonesList = FindDynamicBones();
LoadAssets();
ReplaceSpringManModel();
AddDynamicBonePhysics();
Debug.Log((object)"Mod SpringMan is loaded!");
}
private IEnumerable<DynamicBone> FindDynamicBones()
{
List<DynamicBone> list = new List<DynamicBone>();
DynamicBone[] collection = Object.FindObjectsOfType<DynamicBone>();
list.AddRange(collection);
return list;
}
private void LoadAssets()
{
string text = "Assets/Prefabs/Thicc_Coil_Lady.prefab";
string path = "Assets/Sounds/";
string[] array = new string[1] { "Playerspring.wav" };
springManPrefab = Resources.Load<GameObject>(text);
springManAudioClips = (AudioClip[])(object)new AudioClip[array.Length];
for (int i = 0; i < array.Length; i++)
{
springManAudioClips[i] = Resources.Load<AudioClip>(Path.Combine(path, array[i]));
if ((Object)(object)springManAudioClips[i] == (Object)null)
{
Debug.LogError((object)("No se pudo cargar el clip de audio: " + array[i]));
}
if ((Object)(object)springManPrefab == (Object)null)
{
Debug.LogError((object)("No se pudo cargar el prefab: " + text));
}
}
}
private void ReplaceSpringManModel()
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
SpringManAI val = Object.FindObjectOfType<SpringManAI>();
AudioSource val2 = ((val != null) ? ((Component)val).GetComponent<AudioSource>() : null);
if ((Object)(object)val != (Object)null)
{
if ((Object)(object)val2 != (Object)null)
{
GameObject gameObject = ((Component)val2).gameObject;
GameObject val3 = Object.Instantiate<GameObject>(springManPrefab, gameObject.transform.parent);
val3.transform.position = gameObject.transform.position;
val3.transform.rotation = gameObject.transform.rotation;
AudioSource component = val3.GetComponent<AudioSource>();
if ((Object)(object)component != (Object)null)
{
string audioClipName = ((Object)val2.clip).name;
AudioClip val4 = Array.Find(springManAudioClips, (AudioClip clip) => ((Object)clip).name == audioClipName);
if ((Object)(object)val4 != (Object)null)
{
component.clip = val4;
}
else
{
Debug.LogError((object)("Replacement audio clip for " + audioClipName + " not found."));
}
}
else
{
Debug.LogError((object)"AudioSource component not found in the new SpringMan model.");
}
Object.Destroy((Object)(object)gameObject);
}
else
{
Debug.LogError((object)"AudioSource component not found in the original SpringMan.");
}
}
else
{
Debug.LogError((object)"SpringManAI component not found in the scene.");
}
}
private void AddDynamicBonePhysics()
{
DynamicBone componentInChildren = springManPrefab.GetComponentInChildren<DynamicBone>();
if ((Object)(object)componentInChildren == (Object)null)
{
Debug.LogError((object)"Dynamic Bone component not found in the prefab. Please check your assets.");
}
}
}