using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoreGraphics")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreGraphics")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b8fe07aa-c40e-4a05-a730-db7f2a42a6c1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MoreGraphics;
[BepInPlugin("com.lordlakens.moregraphics", "MoreGraphics", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private PostProcessVolume customVolume;
private float timer = 0f;
private float scanInterval = 1f;
private bool isModEnabled = true;
private string notificationText = "";
private float notificationAlpha = 0f;
private float notificationTimer = 0f;
private const float NOTIFICATION_DURATION = 1f;
private const float FADE_SPEED = 2f;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreGraphics: Color-Fix Edition Loaded!");
ShowNotification("MoreGraphics: Enabled");
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)286))
{
isModEnabled = !isModEnabled;
ShowNotification(isModEnabled ? "MoreGraphics: Enabled" : "MoreGraphics: Disabled");
if (isModEnabled)
{
SetupCinematicEnvironment();
}
else
{
DisableCinematicEnvironment();
}
}
if (notificationTimer > 0f)
{
notificationTimer -= Time.deltaTime;
}
else if (notificationAlpha > 0f)
{
notificationAlpha -= Time.deltaTime * 2f;
}
if (isModEnabled)
{
AnimateClothMaterials();
timer += Time.deltaTime;
if (timer >= scanInterval)
{
timer = 0f;
ApplyCinematicOverhaul();
}
}
}
private void ShowNotification(string message)
{
notificationText = message;
notificationAlpha = 1f;
notificationTimer = 1f;
}
private void OnGUI()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_0045: 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 (notificationAlpha > 0f)
{
GUIStyle val = new GUIStyle();
val.fontSize = 20;
val.fontStyle = (FontStyle)1;
val.normal.textColor = new Color(1f, 1f, 1f, notificationAlpha);
float num = 20f;
float num2 = (float)Screen.height - 50f;
GUI.Label(new Rect(num, num2, 300f, 40f), notificationText, val);
}
}
private void ApplyCinematicOverhaul()
{
SetupCinematicEnvironment();
EnhanceMaterialsCinematic();
}
private void SetupCinematicEnvironment()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Invalid comparison between Unknown and I4
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Expected O, but got Unknown
Camera main = Camera.main;
if ((Object)(object)main == (Object)null)
{
return;
}
main.allowHDR = true;
Light[] array = Object.FindObjectsOfType<Light>();
Light[] array2 = array;
foreach (Light val in array2)
{
if ((int)val.type == 1)
{
val.intensity = 1.25f;
val.shadows = (LightShadows)2;
val.shadowStrength = 0.55f;
}
}
PostProcessLayer component = ((Component)main).GetComponent<PostProcessLayer>();
if ((Object)(object)component == (Object)null)
{
component = ((Component)main).gameObject.AddComponent<PostProcessLayer>();
component.volumeTrigger = ((Component)main).transform;
component.volumeLayer = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Everything" }));
}
if ((Object)(object)customVolume == (Object)null)
{
GameObject val2 = new GameObject("MoreGraphics_Volume");
customVolume = val2.AddComponent<PostProcessVolume>();
customVolume.isGlobal = true;
customVolume.priority = 100f;
PostProcessProfile val3 = ScriptableObject.CreateInstance<PostProcessProfile>();
Bloom val4 = val3.AddSettings<Bloom>();
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val4).enabled).Override(true);
((ParameterOverride<float>)(object)val4.intensity).Override(3f);
((ParameterOverride<float>)(object)val4.threshold).Override(0.65f);
ColorGrading val5 = val3.AddSettings<ColorGrading>();
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val5).enabled).Override(true);
((ParameterOverride<float>)(object)val5.saturation).Override(18f);
((ParameterOverride<float>)(object)val5.contrast).Override(12f);
customVolume.profile = val3;
}
if ((Object)(object)customVolume != (Object)null)
{
customVolume.weight = 1f;
}
}
private void DisableCinematicEnvironment()
{
if ((Object)(object)customVolume != (Object)null)
{
customVolume.weight = 0f;
}
}
private void EnhanceMaterialsCinematic()
{
Renderer[] array = Object.FindObjectsOfType<Renderer>();
Renderer[] array2 = array;
foreach (Renderer val in array2)
{
if (((Object)((Component)val).gameObject).name.ToLower().Contains("ground") || ((Object)((Component)val).gameObject).name.ToLower().Contains("terrain"))
{
continue;
}
Material[] materials = val.materials;
foreach (Material val2 in materials)
{
if (val2.HasProperty("_Glossiness"))
{
val2.SetFloat("_Glossiness", 0.5f);
}
if (val2.HasProperty("_Metallic"))
{
val2.SetFloat("_Metallic", 0.25f);
}
}
}
}
private void AnimateClothMaterials()
{
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Sin(Time.time * 2f) * 0.015f;
Renderer[] array = Object.FindObjectsOfType<Renderer>();
Renderer[] array2 = array;
foreach (Renderer val in array2)
{
if (((Object)((Component)val).gameObject).name.ToLower().Contains("ground"))
{
continue;
}
Material[] materials = val.materials;
foreach (Material val2 in materials)
{
if (val2.HasProperty("_MainTex_ST"))
{
Vector4 vector = val2.GetVector("_MainTex_ST");
val2.SetVector("_MainTex_ST", new Vector4(vector.x, vector.y, num, vector.w));
}
}
}
}
}