using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CardThemeLib")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CardThemeLib")]
[assembly: AssemblyTitle("CardThemeLib")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace CardThemeLib
{
[HarmonyPatch]
internal class Artfix
{
[HarmonyPostfix]
[HarmonyPatch(typeof(CardInfo), "Awake")]
public static void ArtFix(CardInfo __instance)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
((Component)__instance).GetComponentInChildren<GeneralParticleSystem>().particleSettings.randomColor = CardChoice.instance.GetCardColor2(__instance.colorTheme);
((Component)__instance).GetComponentInChildren<GeneralParticleSystem>().Play();
((Component)__instance).GetComponentInChildren<GeneralParticleSystem>().playOnAwake = false;
}
}
[Serializable]
[HarmonyPatch(typeof(CardChoice), "Awake")]
internal class CardChoicePatch
{
public static void Postfix()
{
((MonoBehaviour)CardThemeLib.instance).StartCoroutine(CardThemeLib.instance.SetUpThemes());
}
}
[BepInPlugin("root.cardtheme.lib", "Card Theme Extention Library", "1.1.7")]
[BepInProcess("Rounds.exe")]
public class CardThemeLib : BaseUnityPlugin
{
private const string ModId = "root.cardtheme.lib";
private const string ModName = "Card Theme Extention Library";
public const string Version = "1.1.7";
internal Dictionary<string, CardThemeColor> themes = new Dictionary<string, CardThemeColor>();
internal bool firstRun = true;
public IReadOnlyDictionary<string, CardThemeColor> Themes => themes;
public static CardThemeLib instance { get; private set; }
private void Awake()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
instance = this;
Harmony val = new Harmony("root.cardtheme.lib");
val.PatchAll();
}
public IEnumerator SetUpThemes()
{
for (int _ = 0; _ < 5; _++)
{
yield return null;
}
List<CardThemeColor> cardThemeColors2;
if (firstRun)
{
ThemeAdder[] allObjects = (ThemeAdder[])(object)Resources.FindObjectsOfTypeAll(typeof(ThemeAdder));
ThemeAdder[] array = allObjects;
foreach (ThemeAdder o in array)
{
if (((Behaviour)o).enabled)
{
o.SetUp();
}
}
cardThemeColors2 = CardChoice.instance.cardThemes.ToList();
cardThemeColors2.ForEach(delegate(CardThemeColor theme)
{
themes.Add(((object)(CardThemeColorType)(ref theme.themeType)).ToString(), theme);
});
firstRun = false;
}
cardThemeColors2 = themes.Values.ToList();
cardThemeColors2.Sort((CardThemeColor t1, CardThemeColor t2) => ((Enum)(CardThemeColorType)(ref t1.themeType)).CompareTo((object?)t2.themeType));
CardChoice.instance.cardThemes = cardThemeColors2.ToArray();
}
public CardThemeColorType CreateOrGetType(string name, CardThemeColor themeColor = null)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
name = name.Replace(" ", "");
if (themes.ContainsKey(name))
{
return themes[name].themeType;
}
CardThemeColorType result = (themeColor.themeType = (CardThemeColorType)(themes.Count + 9));
themes.Add(name, themeColor);
return result;
}
}
[Serializable]
[HarmonyPatch(typeof(Enum))]
internal class EnumPatchcs
{
[HarmonyPostfix]
[HarmonyPatch("GetValues")]
private static void Values(Type enumType, ref Array __result)
{
if (enumType == typeof(CardThemeColorType))
{
__result = (from t in CardChoice.instance.cardThemes.ToList()
select t.themeType).ToArray();
}
}
[HarmonyPostfix]
[HarmonyPatch("GetNames")]
private static void Names(Type enumType, ref string[] __result)
{
if (enumType == typeof(CardThemeColorType))
{
__result = (from t in CardChoice.instance.cardThemes.ToList()
select ((object)(CardThemeColorType)(ref t.themeType)).ToString()).ToArray();
}
}
[HarmonyPostfix]
[HarmonyPatch("ToString", new Type[] { })]
private static void String(Enum __instance, ref string __result)
{
Enum __instance2 = __instance;
if (__instance2.GetType() == typeof(CardThemeColorType))
{
string text = CardThemeLib.instance.themes.Keys.ToList().Find((string k) => CardThemeLib.instance.themes[k].themeType == (CardThemeColorType)(object)__instance2);
__result = ((text != null) ? text : __result);
}
}
}
internal class ThemeAdder : MonoBehaviour
{
public string Name;
public Color targetColor;
public Color bgColor;
internal void SetUp()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
((Component)this).GetComponent<CardInfo>().colorTheme = CardThemeLib.instance.CreateOrGetType(Name, new CardThemeColor
{
targetColor = targetColor,
bgColor = bgColor
});
}
}
}