using System;
using System.Diagnostics;
using System.IO;
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 PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using SettingsMenu.Models;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
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: AssemblyCompany("bitmotte.StyleVision")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StyleVision")]
[assembly: AssemblyTitle("bitmotte.StyleVision")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 StyleVision
{
public static class BundleTool
{
public static AssetBundle Load(string fileName)
{
return AssetBundle.LoadFromMemory(EmbeddedAccess.AccessFile(fileName));
}
}
public static class Configurator
{
[CompilerGenerated]
private static class <>O
{
public static OnClick <0>__OpenDiscord;
}
public static FloatSliderField curve;
public static BoolField pixel;
public static BoolField dither;
public static BoolField texture;
public static BoolField vertex;
public static BoolField color;
public static ButtonField joinDC;
public static PluginConfigurator CreateConfigurator()
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Expected O, but got Unknown
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Expected O, but got Unknown
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Expected O, but got Unknown
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Expected O, but got Unknown
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Expected O, but got Unknown
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Expected O, but got Unknown
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Expected O, but got Unknown
//IL_015a: 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_0165: Expected O, but got Unknown
PluginConfigurator val = PluginConfigurator.Create("StyleVision", "bitmotte.StyleVision");
curve = new FloatSliderField(val.rootPanel, "Curve ( Higher = More style needed )", "curve", new Tuple<float, float>(1f, 5f), 1.5f);
ConfigSpace val2 = new ConfigSpace(val.rootPanel, 8f);
ConfigHeader val3 = new ConfigHeader(val.rootPanel, "Notice : You need to manually reset a setting after disabling it !!", 12, (TextAlignmentOptions)513);
pixel = new BoolField(val.rootPanel, "Downscaling", "pixel", true);
dither = new BoolField(val.rootPanel, "Dithering", "dither", true);
texture = new BoolField(val.rootPanel, "Texture Warping", "texture", true);
vertex = new BoolField(val.rootPanel, "Vertex Warping", "vertex", true);
color = new BoolField(val.rootPanel, "Color Compression", "color", true);
ConfigSpace val4 = new ConfigSpace(val.rootPanel, 15f);
ConfigHeader val5 = new ConfigHeader(val.rootPanel, "Join my discord for sneak peeks,devlogs,and the possibility to test my mods early ! !", 20, (TextAlignmentOptions)513);
joinDC = new ButtonField(val.rootPanel, "Join my Discord", "joinDC");
ConfigSpace val6 = new ConfigSpace(val.rootPanel, 15f);
ButtonField obj = joinDC;
object obj2 = <>O.<0>__OpenDiscord;
if (obj2 == null)
{
OnClick val7 = OpenDiscord;
<>O.<0>__OpenDiscord = val7;
obj2 = (object)val7;
}
obj.onClick += (OnClick)obj2;
return val;
}
private static void OpenDiscord()
{
Process.Start("http://discord.gg/pVdr9e6hZ8");
}
}
public static class EmbeddedAccess
{
public static byte[] AccessFile(string fileName)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
byte[] array;
using (Stream stream = executingAssembly.GetManifestResourceStream("StyleVision.resources." + fileName))
{
if (stream == null)
{
return null;
}
array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
}
return array;
}
}
[HarmonyPatch(typeof(StyleHUD), "Start")]
public static class patcg
{
private static void Prefix(StyleHUD __instance)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
GameObject val = new GameObject("StyleVision");
StyleVision styleVision = val.AddComponent<StyleVision>();
styleVision.style = __instance;
}
}
[BepInPlugin("bitmotte.StyleVision", "StyleVision", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
public static PluginConfigurator config;
private void Awake()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin bitmotte.StyleVision is loaded!");
Harmony val = new Harmony("bitmotte.StyleVision");
val.PatchAll();
config = Configurator.CreateConfigurator();
SceneManager.sceneLoaded += OnSceneLoad;
}
private void OnSceneLoad(Scene scene, LoadSceneMode mode)
{
}
}
public static class SetupResource
{
public static GameObject FixShader(GameObject gameObject)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: 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_0095: Unknown result type (might be due to invalid IL or missing references)
Shader shader = Addressables.LoadAssetAsync<Material>((object)"Assets/Materials/Environment/Metal/Pattern 1/Metal Pattern 1 8.mat").WaitForCompletion().shader;
SkinnedMeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
foreach (SkinnedMeshRenderer val in componentsInChildren)
{
Material[] materials = ((Renderer)val).materials;
foreach (Material val2 in materials)
{
if (((Object)val2.shader).name == "ULTRAKILL/Master")
{
val2.shader = shader;
}
if (((Object)val2.shader).name == "Hidden/InternalErrorShader")
{
val2.shader = Addressables.LoadAssetAsync<Material>((object)"Assets/Materials/Dev/FadeToWhite.mat").WaitForCompletion().shader;
}
}
}
MeshRenderer[] componentsInChildren2 = gameObject.GetComponentsInChildren<MeshRenderer>();
foreach (MeshRenderer val3 in componentsInChildren2)
{
Material[] materials2 = ((Renderer)val3).materials;
foreach (Material val4 in materials2)
{
val4.shader = shader;
}
}
return gameObject;
}
}
public class StyleVision : MonoBehaviour
{
public StyleHUD style;
private PreferenceKey pixelPref;
private PreferenceKey ditherPref;
private PreferenceKey texturePref;
private PreferenceKey vertexPref;
private PreferenceKey colorPref;
public void Start()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
pixelPref = default(PreferenceKey);
pixelPref.key = "pixelization";
ditherPref = default(PreferenceKey);
ditherPref.key = "dithering";
texturePref = default(PreferenceKey);
texturePref.key = "textureWarping";
vertexPref = default(PreferenceKey);
vertexPref.key = "vertexWarping";
colorPref = default(PreferenceKey);
colorPref.key = "colorCompression";
((PreferenceKey)(ref pixelPref)).SetIntValue(6);
}
public void Update()
{
if ((Object)(object)style == (Object)null)
{
Plugin.Logger.LogInfo((object)"no style hud found, killing myself : - (");
Object.Destroy((Object)(object)((Component)this).gameObject);
}
float num = (float)style.rankIndex / 7f;
num = (float)Math.Pow(Configurator.curve.value, 10f * num - 10f);
if (Configurator.pixel.value)
{
((PreferenceKey)(ref pixelPref)).SetIntValue((int)Math.Round(6f - num * 6f));
}
if (Configurator.dither.value)
{
((PreferenceKey)(ref ditherPref)).SetFloatValue(1f - num);
}
if (Configurator.texture.value)
{
((PreferenceKey)(ref texturePref)).SetFloatValue(1f - num);
}
if (Configurator.vertex.value)
{
((PreferenceKey)(ref vertexPref)).SetIntValue((int)Math.Round(5f - num * 5f));
}
if (Configurator.color.value)
{
((PreferenceKey)(ref colorPref)).SetIntValue((int)Math.Round(5f - num * 5f));
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "bitmotte.StyleVision";
public const string PLUGIN_NAME = "StyleVision";
public const string PLUGIN_VERSION = "1.0.0";
}
}