using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zorro.Settings;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Content Warning Animated Face")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Content Warning Animated Face")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("21ece22f-542e-4f99-8159-ec47c0e37652")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Content_Warning_Animated_Face;
[BepInPlugin("Null-Animated", "Animated Face", "1.0")]
public class Main : BaseUnityPlugin
{
private GameObject animatorObject;
public void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
new Harmony("Animater").PatchAll();
Debug.Log((object)"Faces Awoken");
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
Debug.Log((object)("Scene loaded: " + ((Scene)(ref scene)).name));
if ((Object)(object)animatorObject == (Object)null)
{
Debug.Log((object)"Animator object missing, recreating...");
animatorObject = new GameObject("Animator");
animatorObject.SetActive(true);
animatorObject.AddComponent<Code>();
}
}
}
[ContentWarningSetting]
public class EyeSetting : StringSetting, IExposedSetting
{
public override void ApplyValue()
{
Debug.Log((object)("Eye set to: " + ((StringSetting)this).Value));
}
protected override string GetDefaultValue()
{
return "W";
}
public string GetDisplayName()
{
return "Face Eye Symbol";
}
public SettingCategory GetSettingCategory()
{
return (SettingCategory)4;
}
}
[ContentWarningSetting]
public class MouthSetting : StringSetting, IExposedSetting
{
public override void ApplyValue()
{
Debug.Log((object)("Mouth set to: " + ((StringSetting)this).Value));
}
protected override string GetDefaultValue()
{
return "o";
}
public string GetDisplayName()
{
return "Face Mouth Symbol";
}
public SettingCategory GetSettingCategory()
{
return (SettingCategory)4;
}
}
[ContentWarningSetting]
public class SpeakSetting : StringSetting, IExposedSetting
{
public override void ApplyValue()
{
Debug.Log((object)("Speak set to: " + ((StringSetting)this).Value));
}
protected override string GetDefaultValue()
{
return "O";
}
public string GetDisplayName()
{
return "Speaking Mouth Symbol";
}
public SettingCategory GetSettingCategory()
{
return (SettingCategory)4;
}
}
[ContentWarningSetting]
public class VoiceThresholdSetting : FloatSetting, IExposedSetting
{
public override void ApplyValue()
{
Debug.Log((object)$"Voice threshold set to: {((FloatSetting)this).Value}");
}
protected override float GetDefaultValue()
{
return 0.15f;
}
protected override float2 GetMinMaxValue()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
return new float2(0f, 1f);
}
public string GetDisplayName()
{
return "Voice Loudness Threshold";
}
public SettingCategory GetSettingCategory()
{
return (SettingCategory)4;
}
}
public class Code : MonoBehaviour
{
private Dictionary<string, string> Faces = new Dictionary<string, string>();
private string currentFace = "";
private PlayerVisor visor;
private bool FaceOverride = false;
private float micValue;
public void Start()
{
string value = ((StringSetting)GameHandler.Instance.SettingsHandler.GetSetting<EyeSetting>()).Value;
string value2 = ((StringSetting)GameHandler.Instance.SettingsHandler.GetSetting<MouthSetting>()).Value;
string value3 = ((StringSetting)GameHandler.Instance.SettingsHandler.GetSetting<SpeakSetting>()).Value;
float value4 = ((FloatSetting)GameHandler.Instance.SettingsHandler.GetSetting<VoiceThresholdSetting>()).Value;
Faces["Default"] = value + value2 + value;
Faces["Speaking"] = value + value3 + value;
visor = Player.localPlayer?.refs?.visor;
if ((Object)(object)visor != (Object)null)
{
SetFace(Faces["Default"]);
micValue = Player.localPlayer.data.microphoneValue;
}
}
public void Update()
{
if (!((Object)(object)visor == (Object)null) && !Player.localPlayer.data.dead && !FaceOverride)
{
string value = ((StringSetting)GameHandler.Instance.SettingsHandler.GetSetting<EyeSetting>()).Value;
string value2 = ((StringSetting)GameHandler.Instance.SettingsHandler.GetSetting<MouthSetting>()).Value;
string value3 = ((StringSetting)GameHandler.Instance.SettingsHandler.GetSetting<SpeakSetting>()).Value;
float value4 = ((FloatSetting)GameHandler.Instance.SettingsHandler.GetSetting<VoiceThresholdSetting>()).Value;
Faces["Default"] = value + value2 + value;
Faces["Speaking"] = value + value3 + value;
micValue = Player.localPlayer.data.microphoneValue;
string face = ((micValue > value4) ? Faces["Speaking"] : Faces["Default"]);
SetFace(face);
}
}
private void SetFace(string face)
{
currentFace = face;
visor.SetAllFaceSettings(visor.hue.Value, visor.visorColorIndex, face, 0f, visor.FaceSize);
}
}