using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using FNT;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
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("Fffffff")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+744f2c1b6e9544d98b641c99328c21fa8ba5f805")]
[assembly: AssemblyProduct("Fffffff")]
[assembly: AssemblyTitle("Fffffff")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.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;
}
}
[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 Fffffff
{
[BepInPlugin("greycsont.ultrakill.fffffff", "Fffffff", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static List<TMP_FontAsset> fonts = new List<TMP_FontAsset>();
internal static ManualLogSource Logger { get; private set; } = null;
private void Awake()
{
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin greycsont.ultrakill.fffffff is loaded!");
((Object)((Component)this).gameObject).hideFlags = (HideFlags)4;
string pluginDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string[] source = new string[3] { "*.otf", "*.ttc", "*.ttf" };
IOrderedEnumerable<string> orderedEnumerable = source.SelectMany((string ext) => Directory.GetFiles(pluginDir, "font" + ext)).OrderBy(delegate(string f)
{
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(f);
string text = fileNameWithoutExtension;
int length = "font".Length;
int result;
return int.TryParse(text.Substring(length, text.Length - length), out result) ? result : int.MaxValue;
});
foreach (string item in orderedEnumerable)
{
TMP_FontAsset val = FontLoader.CreateFontAssetFromFile(item, 90, 9, 1024, 1024);
if ((Object)(object)val != (Object)null)
{
fonts.Add(val);
Logger.LogInfo((object)("Loaded font: " + Path.GetFileName(item)));
}
}
new Harmony("greycsont.ultrakill.fffffff").PatchAll();
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
AddFallbackFont();
}
private void AddFallbackFont()
{
if (fonts.Count == 0)
{
return;
}
foreach (TMP_FontAsset item in Resources.FindObjectsOfTypeAll<TMP_FontAsset>().Except(fonts))
{
TMP_FontAsset val = item;
if (val.fallbackFontAssetTable == null)
{
List<TMP_FontAsset> list2 = (val.fallbackFontAssetTable = new List<TMP_FontAsset>());
}
if (item.fallbackFontAssetTable.Contains(fonts[0]))
{
continue;
}
foreach (TMP_FontAsset font in fonts)
{
item.fallbackFontAssetTable.Add(font);
}
Logger.LogInfo((object)("Added fallback to " + ((Object)item).name));
}
}
}
internal static class MyPluginInfo
{
public const string PLUGIN_GUID = "greycsont.ultrakill.fffffff";
public const string PLUGIN_NAME = "Fffffff";
public const string PLUGIN_VERSION = "1.0.0";
}
}