Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of RoR2Thai GTranslate v1.0.0
RoR2Thai.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using MaterialHud; using MonoMod.RuntimeDetour; using On.RoR2.UI; using R2API.Utils; using RoR2.UI; 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("RoR2ThaiFont")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RoR2ThaiFont")] [assembly: AssemblyTitle("RoR2ThaiFont")] [assembly: AssemblyVersion("1.0.0.0")] namespace RoR2ThaiFont; [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.thunninoi.ror2thai", "RoR2Thai", "1.0.0")] public class RoR2ThaiFontSupport : BaseUnityPlugin { public static AssetBundle assetBundle = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("RoR2ThaiFont.thaifont_assets")); public static TMP_FontAsset fontRSU; public static TMP_FontAsset fontNotoThai; public static TMP_FontAsset fontBombDefault; public static TMP_FontAsset fontCostDefault; private RiskUIPlugin RiskUiInstance = (RiskUIPlugin)Chainloader.PluginInfos["bubbet.riskui"].Instance; public static TMP_FontAsset riskui_chatfont; public void Awake() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) fontBombDefault = Resources.Load<TMP_FontAsset>("TmpFonts/Bombardier/tmpBombDropShadow"); fontCostDefault = Resources.Load<TMP_FontAsset>("TmpFonts/Traceroute/tmpTRACER_SDFDAMAGENUMBER.asset"); fontRSU = assetBundle.LoadAsset<TMP_FontAsset>("Assets/ThaiFont/RSU_modified.asset"); fontNotoThai = assetBundle.LoadAsset<TMP_FontAsset>("Assets/ThaiFont/NotoSansThai.asset"); riskui_chatfont = RiskUiInstance.assetBundle.LoadAsset<TMP_FontAsset>("Montserrat-Medium SDF"); HGTextMeshProUGUI.OnCurrentLanguageChanged += new hook_OnCurrentLanguageChanged(HGTextMeshProUGUI_OnCurrentLanguageChanged); new Hook((MethodBase)typeof(TextMeshProUGUI).GetMethod("LoadFontAsset", (BindingFlags)(-1)), (Delegate)(Action<Action<TextMeshProUGUI>, TextMeshProUGUI>)delegate(Action<TextMeshProUGUI> orig, TextMeshProUGUI self) { orig(self); if ((Object)(object)((TMP_Text)self).font == (Object)(object)fontBombDefault) { ((TMP_Text)self).font = fontRSU; } if ((Object)(object)((TMP_Text)self).font == (Object)(object)fontCostDefault) { ((TMP_Text)self).font = fontRSU; } if ((Object)(object)((TMP_Text)self).font == (Object)(object)riskui_chatfont) { ((TMP_Text)self).font = fontNotoThai; } }); } public void HGTextMeshProUGUI_OnCurrentLanguageChanged(orig_OnCurrentLanguageChanged orig) { orig.Invoke(); if (Object.op_Implicit((Object)(object)fontRSU)) { HGTextMeshProUGUI.defaultLanguageFont = fontRSU; } } }