using Aki.Reflection.Patching; using Aki.Reflection.Utils; using Bsg.GameSettings; using Comfort.Common; using EFT; using EFT.UI; using EFT.UI.DragAndDrop; using System.Linq; using System.Reflection; using System.Threading.Tasks; using UnityEngine; using TMPro; namespace SamSWAT.KoreanFontFix { public class Patch : ModulePatch { protected override MethodBase GetTargetMethod() { return typeof(UiPools).GetMethod("Init"); } [PatchPostfix] public static async void PatchPostfix(Task __result) { var settingsManagerType = PatchConstants.EftTypes.Single(x => x.GetMethod("ClearSettings") != null); var settingsSingletonType = typeof(Singleton<>).MakeGenericType(settingsManagerType); object settingsManagerInstance = settingsSingletonType.GetProperty("Instance").GetValue(settingsManagerType); object gameThingInstance = settingsManagerInstance.GetType().GetField("Game").GetValue(settingsManagerInstance); object settingsInstance = gameThingInstance.GetType().GetField("Settings").GetValue(gameThingInstance); string language = (GameSetting)settingsInstance.GetType().GetField("Language").GetValue(settingsInstance); await __result; if (language == "kr" || language == "jp") { var instance = Singleton.Instance as MainApplication; RectTransform gridLayout = instance.GetComponentInChildren(true).GetComponentsInChildren().Single(a => a.name == "Caption").GetComponent(); RectTransform slotLayout = instance.GetComponentInChildren(true).GetComponentsInChildren().Single(a => a.name == "Name").GetComponent(); gridLayout.offsetMax = new Vector2(-2, 0); gridLayout.offsetMin = new Vector2(2, -18); slotLayout.offsetMax = new Vector2(-2, 2.85f); slotLayout.offsetMin = new Vector2(2, -15.15f); await Task.Delay(7000); RectTransform itemInfoWindow = Resources.FindObjectsOfTypeAll()[0].GetComponentsInChildren().Single(a => a.name == "Caption").GetComponent(); CustomTextMeshProUGUI gridWindow = Resources.FindObjectsOfTypeAll()[0].GetComponentsInChildren().Single(a => a.name == "Caption").GetComponent(); itemInfoWindow.offsetMax = new Vector2(-30, 1); itemInfoWindow.offsetMin = new Vector2(25, -1); gridWindow.overflowMode = TextOverflowModes.Overflow; } } } }