This commit is contained in:
papershredder432 2024-07-02 12:53:14 -04:00
parent 2f76eb7984
commit b9ba33f4a5
3 changed files with 187 additions and 0 deletions

25
src/ShittyUIScaler.sln Normal file
View File

@ -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

View File

@ -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<CommonUI>.Instance != null && !commonUiScaled)
{
Singleton<CommonUI>.Instance.transform.GetChildren().ToList().ForEach(x =>
{
if (x.GetComponent<CanvasScaler>() != null)
{
x.GetComponent<CanvasScaler>().scaleFactor = 1f;
}
});
commonUiScaled = true;
}
if (Singleton<PreloaderUI>.Instance != null && !preloaderUiScaled)
{
Singleton<PreloaderUI>.Instance.transform.GetChildren().ToList().ForEach(x =>
{
if (x.GetComponent<CanvasScaler>() != null)
{
x.GetComponent<CanvasScaler>().scaleFactor = 1f;
}
});
preloaderUiScaled = true;
}
if (Singleton<MenuUI>.Instance != null && !menuUiScaled)
{
Singleton<MenuUI>.Instance.transform.GetChildren().ToList().ForEach(x =>
{
if (x.GetComponent<CanvasScaler>() != null)
{
x.GetComponent<CanvasScaler>().scaleFactor = 1f;
}
});
menuUiScaled = true;
}
if (Singleton<BattleUIScreen>.Instance != null && !battleUiScaled)
{
Singleton<BattleUIScreen>.Instance.transform.GetChildren().ToList().ForEach(x =>
{
if (x.GetComponent<CanvasScaler>() != null)
{
x.GetComponent<CanvasScaler>().scaleFactor = 1f;
}
});
battleUiScaled = true;
}
}
}
}

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1E1FF26A-0C0A-4E53-A30B-EB9B94780EFA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UIScaler</RootNamespace>
<AssemblyName>UIScaler</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>deps\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Aki.Reflection">
<HintPath>deps\Aki.Reflection.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>deps\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>deps\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>deps\BepInEx.dll</HintPath>
</Reference>
<Reference Include="Comfort">
<HintPath>deps\Comfort.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>deps\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>deps\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>deps\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>