diff --git a/Projects/SamSWAT.KoreanFontFix/Patch.cs b/Projects/SamSWAT.KoreanFontFix/Patch.cs new file mode 100644 index 0000000..16dc291 --- /dev/null +++ b/Projects/SamSWAT.KoreanFontFix/Patch.cs @@ -0,0 +1,56 @@ +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; + } + } + } +} \ No newline at end of file diff --git a/Projects/SamSWAT.KoreanFontFix/Plugin.cs b/Projects/SamSWAT.KoreanFontFix/Plugin.cs new file mode 100644 index 0000000..2902eb7 --- /dev/null +++ b/Projects/SamSWAT.KoreanFontFix/Plugin.cs @@ -0,0 +1,13 @@ +using BepInEx; + +namespace SamSWAT.KoreanFontFix +{ + [BepInPlugin("com.samswat.koreanfontfix", "SamSWAT.KoreanFontFix", "1.0.0")] + public class Plugin : BaseUnityPlugin + { + private void Awake() + { + new Patch().Enable(); + } + } +} diff --git a/Projects/SamSWAT.KoreanFontFix/Properties/AssemblyInfo.cs b/Projects/SamSWAT.KoreanFontFix/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c31c817 --- /dev/null +++ b/Projects/SamSWAT.KoreanFontFix/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Общие сведения об этой сборке предоставляются следующим набором +// набора атрибутов. Измените значения этих атрибутов для изменения сведений, +// связанные со сборкой. +[assembly: AssemblyTitle("SamSWAT.KoreanFontFix")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SamSWAT.KoreanFontFix")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми +// для компонентов COM. Если необходимо обратиться к типу в этой сборке через +// COM, задайте атрибуту ComVisible значение TRUE для этого типа. +[assembly: ComVisible(false)] + +// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM +[assembly: Guid("fd131741-042a-4e1b-988c-31374c1feeb9")] + +// Сведения о версии сборки состоят из указанных ниже четырех значений: +// +// Основной номер версии +// Дополнительный номер версии +// Номер сборки +// Редакция +// +// Можно задать все значения или принять номера сборки и редакции по умолчанию +// используя "*", как показано ниже: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Projects/SamSWAT.KoreanFontFix/SamSWAT.KoreanFontFix.csproj b/Projects/SamSWAT.KoreanFontFix/SamSWAT.KoreanFontFix.csproj new file mode 100644 index 0000000..66971ea --- /dev/null +++ b/Projects/SamSWAT.KoreanFontFix/SamSWAT.KoreanFontFix.csproj @@ -0,0 +1,70 @@ + + + + + Debug + AnyCPU + {FD131741-042A-4E1B-988C-31374C1FEEB9} + Library + Properties + SamSWAT.KoreanFontFix + SamSWAT.KoreanFontFix + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\References\Aki.Reflection.dll + + + False + ..\..\References\Assembly-CSharp.dll + + + False + ..\..\References\BepInEx.dll + + + False + ..\..\References\Comfort.dll + + + + False + ..\..\References\Unity.TextMeshPro.dll + + + False + ..\..\References\UnityEngine.dll + + + False + ..\..\References\UnityEngine.CoreModule.dll + + + + + + + + + \ No newline at end of file diff --git a/Projects/SamSWAT.KoreanFontFix/SamSWAT.KoreanFontFix.sln b/Projects/SamSWAT.KoreanFontFix/SamSWAT.KoreanFontFix.sln new file mode 100644 index 0000000..ef1cbb1 --- /dev/null +++ b/Projects/SamSWAT.KoreanFontFix/SamSWAT.KoreanFontFix.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.32002.261 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamSWAT.KoreanFontFix", "SamSWAT.KoreanFontFix.csproj", "{FD131741-042A-4E1B-988C-31374C1FEEB9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FD131741-042A-4E1B-988C-31374C1FEEB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FD131741-042A-4E1B-988C-31374C1FEEB9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FD131741-042A-4E1B-988C-31374C1FEEB9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FD131741-042A-4E1B-988C-31374C1FEEB9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4E4FD03B-958A-4DEE-90DE-6B2526C4D662} + EndGlobalSection +EndGlobal diff --git a/References/Unity.TextMeshPro.dll b/References/Unity.TextMeshPro.dll new file mode 100644 index 0000000..e662b75 Binary files /dev/null and b/References/Unity.TextMeshPro.dll differ