diff --git a/src/ShittyUIScaler.sln b/src/ShittyUIScaler.sln new file mode 100644 index 0000000..3b67fa9 --- /dev/null +++ b/src/ShittyUIScaler.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShittyUIScaler", "ShittyUIScaler\ShittyUIScaler.csproj", "{1E1FF26A-0C0A-4E53-A30B-EB9B94780EFA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1E1FF26A-0C0A-4E53-A30B-EB9B94780EFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E1FF26A-0C0A-4E53-A30B-EB9B94780EFA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E1FF26A-0C0A-4E53-A30B-EB9B94780EFA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E1FF26A-0C0A-4E53-A30B-EB9B94780EFA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BE04100A-7236-41F1-A32C-393294AEDBB3} + EndGlobalSection +EndGlobal diff --git a/src/ShittyUIScaler/Plugin.cs b/src/ShittyUIScaler/Plugin.cs new file mode 100644 index 0000000..a14ac01 --- /dev/null +++ b/src/ShittyUIScaler/Plugin.cs @@ -0,0 +1,87 @@ +using BepInEx; +using Comfort.Common; +using EFT.UI; +using System.Linq; +using UnityEngine.UI; + +namespace UIScaler +{ + [BepInPlugin("com.ShittyUIScaler", "Shitty UI Scaler", "1.0.0")] + public class Plugin : BaseUnityPlugin + { + private bool commonUiScaled = false; + private bool preloaderUiScaled = false; + private bool menuUiScaled = false; + private bool battleUiScaled = false; + + private void Awake() + { + Logger.LogInfo("ShittyUIScaler is loaded!"); + } + + private void OnDestroy() + { + Logger.LogInfo("ShittyUIScaler is loaded!"); + } + + private void FixedUpdate() + { + ScaleUI(); + } + + private void ScaleUI() + { + if (Singleton.Instance != null && !commonUiScaled) + { + Singleton.Instance.transform.GetChildren().ToList().ForEach(x => + { + if (x.GetComponent() != null) + { + x.GetComponent().scaleFactor = 1f; + } + }); + + commonUiScaled = true; + } + + if (Singleton.Instance != null && !preloaderUiScaled) + { + Singleton.Instance.transform.GetChildren().ToList().ForEach(x => + { + if (x.GetComponent() != null) + { + x.GetComponent().scaleFactor = 1f; + } + }); + + preloaderUiScaled = true; + } + + if (Singleton.Instance != null && !menuUiScaled) + { + Singleton.Instance.transform.GetChildren().ToList().ForEach(x => + { + if (x.GetComponent() != null) + { + x.GetComponent().scaleFactor = 1f; + } + }); + + menuUiScaled = true; + } + + if (Singleton.Instance != null && !battleUiScaled) + { + Singleton.Instance.transform.GetChildren().ToList().ForEach(x => + { + if (x.GetComponent() != null) + { + x.GetComponent().scaleFactor = 1f; + } + }); + + battleUiScaled = true; + } + } + } +} diff --git a/src/ShittyUIScaler/ShittyUIScaler.csproj b/src/ShittyUIScaler/ShittyUIScaler.csproj new file mode 100644 index 0000000..847b3ce --- /dev/null +++ b/src/ShittyUIScaler/ShittyUIScaler.csproj @@ -0,0 +1,75 @@ + + + + + Debug + AnyCPU + {1E1FF26A-0C0A-4E53-A30B-EB9B94780EFA} + Library + Properties + UIScaler + UIScaler + v4.7.1 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + deps\0Harmony.dll + + + deps\Aki.Reflection.dll + + + deps\Assembly-CSharp.dll + + + deps\Assembly-CSharp-firstpass.dll + + + deps\BepInEx.dll + + + deps\Comfort.dll + + + + + + + + + + + deps\UnityEngine.dll + + + deps\UnityEngine.CoreModule.dll + + + deps\UnityEngine.UI.dll + + + + + + + + \ No newline at end of file