using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2.UI;
using RoR2;
using RoR2.UI;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("EclipseLevel")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyProduct("EclipseLevel")]
[assembly: AssemblyTitle("EclipseLevel")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 EclipseLevelInCharacterSelection
{
[BepInPlugin("depression_church.EclipseLevelInCharacterSelection", "EclipseLevelInCharacterSelection", "2.0.0")]
public class EclipseLevelInCharacterSelection : BaseUnityPlugin
{
public const string PluginGUID = "depression_church.EclipseLevelInCharacterSelection";
public const string PluginAuthor = "depression_church";
public const string PluginName = "EclipseLevelInCharacterSelection";
public const string PluginVersion = "2.0.0";
private readonly bool showUpcomingLevel = true;
private readonly float iconSizePercentageOfSurvivorIcon = 0.65f;
private readonly bool onlyShowInEclipseMenu = true;
private void Awake()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
Log.Init(((BaseUnityPlugin)this).Logger);
SurvivorIconController.Rebuild += new hook_Rebuild(SurvivorIconController_Rebuild);
Log.LogInfo("Awake done.");
}
private void OnDestroy()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
SurvivorIconController.Rebuild -= new hook_Rebuild(SurvivorIconController_Rebuild);
}
private void SurvivorIconController_Rebuild(orig_Rebuild orig, SurvivorIconController self)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
try
{
Scene activeScene = SceneManager.GetActiveScene();
string name = ((Scene)(ref activeScene)).name;
bool flag = name == "eclipseworld" || ((Object)(object)PreGameController.instance != (Object)null && PreGameController.instance.gameModeIndex == GameModeCatalog.FindGameModeIndex("EclipseRun"));
if ((!onlyShowInEclipseMenu || flag) && !(name == "infinitetowerworld"))
{
int num = EclipseRun.GetLocalUserSurvivorCompletedEclipseLevel(self.GetLocalUser(), self.survivorDef);
if (showUpcomingLevel)
{
num++;
}
DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(EclipseRun.GetEclipseDifficultyIndex(Mathf.Clamp(num, EclipseRun.minEclipseLevel, EclipseRun.maxEclipseLevel)));
if (difficultyDef == null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to get difficultyDef for " + self.survivorDef.cachedName));
return;
}
RawImage orAddEclipseIcon = GetOrAddEclipseIcon(self.survivorIcon);
orAddEclipseIcon.texture = (Texture)(object)difficultyDef.GetIconSprite().texture;
((Component)orAddEclipseIcon).gameObject.SetActive(((Graphic)self.survivorIcon).color != Color.black);
}
}
catch (Exception data)
{
Log.LogError(data);
}
}
private RawImage GetOrAddEclipseIcon(RawImage survivorIcon)
{
//IL_0056: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
RawImage[] componentsInChildren = ((Component)survivorIcon).GetComponentsInChildren<RawImage>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
if ((Object)(object)componentsInChildren[i] != (Object)(object)survivorIcon)
{
return componentsInChildren[i];
}
}
Log.LogDebug("Adding child \"EclipseIcon\" under \"" + ((Object)survivorIcon).name + "\"");
GameObject val = new GameObject("EclipseIcon", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(((Component)survivorIcon).transform);
val.layer = ((Component)survivorIcon).gameObject.layer;
RectTransform component = val.GetComponent<RectTransform>();
((Transform)component).localPosition = Vector3.zero;
((Transform)component).localScale = Vector3.one;
((Transform)component).localRotation = Quaternion.identity;
Vector2 val2 = (component.anchorMax = Vector2.zero);
Vector2 pivot = (component.anchorMin = val2);
component.pivot = pivot;
Vector2 one = Vector2.one;
Rect rect = ((Graphic)survivorIcon).rectTransform.rect;
component.sizeDelta = one * ((Rect)(ref rect)).width * iconSizePercentageOfSurvivorIcon;
return val.AddComponent<RawImage>();
}
}
internal static class Log
{
internal static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void LogDebug(object data)
{
_logSource.LogDebug(data);
}
internal static void LogError(object data)
{
_logSource.LogError(data);
}
internal static void LogFatal(object data)
{
_logSource.LogFatal(data);
}
internal static void LogInfo(object data)
{
_logSource.LogInfo(data);
}
internal static void LogMessage(object data)
{
_logSource.LogMessage(data);
}
internal static void LogWarning(object data)
{
_logSource.LogWarning(data);
}
}
}