using System;
using System.Collections.Generic;
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 Microsoft.CodeAnalysis;
using RoR2;
using TMPro;
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 = ".NET Standard 2.0")]
[assembly: AssemblyCompany("RoR2Vietnamese")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RoR2Vietnamese")]
[assembly: AssemblyTitle("RoR2Vietnamese")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 RoR2Vietnamese
{
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
[BepInPlugin("Helscarthe.RoR2Vietnamese", "RoR2Vietnamese", "1.0.0")]
public class MainPlugin : BaseUnityPlugin
{
public const string PluginGUID = "Helscarthe.RoR2Vietnamese";
public const string PluginAuthor = "Helscarthe";
public const string PluginName = "RoR2Vietnamese";
public const string PluginVersion = "1.0.0";
public static TMP_FontAsset vietFont;
public static TMP_FontAsset defaultFont;
public static TMP_FontAsset currentFont;
public static AssetBundle mainBundle;
public static string assetBundlePath;
public static PluginInfo PInfo { get; private set; }
public void Awake()
{
Log.Init(((BaseUnityPlugin)this).Logger);
PInfo = ((BaseUnityPlugin)this).Info;
Language.collectLanguageRootFolders += LanguageOnCollectLanguageRootFolders;
assetBundlePath = Path.Combine(Path.GetDirectoryName(PInfo.Location), "AssetBundles", "bombadiervn");
mainBundle = AssetBundle.LoadFromFile(assetBundlePath);
if (Object.op_Implicit((Object)(object)mainBundle))
{
Log.Info("Font bundle loaded!");
}
TMP_FontAsset[] array = mainBundle.LoadAllAssets<TMP_FontAsset>();
vietFont = array[0];
if (Object.op_Implicit((Object)(object)vietFont))
{
Log.Info("Vietnamese Font loaded!");
}
defaultFont = Resources.Load<TMP_FontAsset>("TmpFonts/Bombardier/tmpBombDropShadow");
if (Object.op_Implicit((Object)(object)defaultFont))
{
Log.Info("Default Font loaded!");
}
TMP_Settings.fallbackFontAssets.Add(vietFont);
Log.Info("Plugin RoR2Vietnamese is loaded!");
}
private void LanguageOnCollectLanguageRootFolders(List<string> folders)
{
folders.Add(Path.Combine(Path.GetDirectoryName(PInfo.Location), "Languages"));
}
}
}