using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Card;
using UnityEngine;
[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.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ColoredPortraits")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ColoredPortraits")]
[assembly: AssemblyTitle("ColoredPortraits")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ColoredPortraits;
[BepInPlugin("spapi.inscryption.coloredportraits", "Colored Portraits", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public const string GUID = "spapi.inscryption.coloredportraits";
public const string NAME = "Colored Portraits";
public const string VERSION = "1.0.0";
public static Appearance coloredPortrait;
public void Awake()
{
//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_0029: Unknown result type (might be due to invalid IL or missing references)
coloredPortrait = CardAppearanceBehaviourManager.Add("spapi.inscryption.coloredportraits", "ColoredPortrait", typeof(ColoredPortrait)).Id;
new Harmony("spapi.inscryption.coloredportraits").PatchAll();
}
}
[HarmonyPatch(typeof(CardDisplayer3D), "DisplayInfo")]
public class MakePortraitColored : MonoBehaviour
{
public Material matcache;
[HarmonyPrefix]
public static void Prefix(CardDisplayer3D __instance, CardRenderInfo renderInfo)
{
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
MakePortraitColored component = ((Component)__instance).gameObject.GetComponent<MakePortraitColored>();
if ((Object)(object)component != (Object)null && (Object)(object)component.matcache != (Object)null)
{
((Renderer)((CardDisplayer)__instance).portraitRenderer).material = component.matcache;
}
if ((renderInfo?.baseInfo?.appearanceBehaviour?.Contains(Plugin.coloredPortrait)).GetValueOrDefault())
{
(component ?? ((Component)__instance).gameObject.AddComponent<MakePortraitColored>()).matcache = ((Renderer)((CardDisplayer)__instance).portraitRenderer).material;
((Renderer)((CardDisplayer)__instance).portraitRenderer).material = __instance.decalRenderers[0].material;
}
}
}
public class ColoredPortrait : CardAppearanceBehaviour
{
public override void ApplyAppearance()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
((CardAppearanceBehaviour)this).Card.RenderInfo.portraitColor = Color.white;
}
}