refactor
This commit is contained in:
parent
f4a7536862
commit
2580d82e44
@ -44,6 +44,10 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>E:\SPT-AKI\SPT-AKI 3.2.1\EscapeFromTarkov_Data\Managed\ItemComponent.Types.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Sirenix.Serialization, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>E:\SPT-AKI\SPT-AKI 3.2.1\EscapeFromTarkov_Data\Managed\Sirenix.Serialization.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@ -63,8 +67,10 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DisableFOVScaling.cs" />
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="UpdateScopeResolution.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
12
CameraResolutionScale/DisableFOVScaling.cs
Normal file
12
CameraResolutionScale/DisableFOVScaling.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CameraResolutionScale
|
||||
{
|
||||
internal class DisableFOVScaling
|
||||
{
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ using UnityEngine;
|
||||
using Comfort.Common;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using EFT.UI;
|
||||
|
||||
namespace CameraResolutionScale
|
||||
{
|
||||
@ -13,13 +15,33 @@ namespace CameraResolutionScale
|
||||
{
|
||||
ConfigEntry<int> cameraResolutionScale;
|
||||
ConfigEntry<int> scopeCameraResolutionScale;
|
||||
ConfigEntry<fovScalingMode> disableFOVScaling;
|
||||
|
||||
GameObject rootObject;
|
||||
string rootObjectPath = "Common UI/Common UI/SettingScreen";
|
||||
GameObject fovObject;
|
||||
string fovObjectPath = "Game Settings/Image/Other Settings/FOV/FOV";
|
||||
int defaultFOVValue = 50;
|
||||
|
||||
SelectSlider fovSliderValue;
|
||||
|
||||
enum fovScalingMode
|
||||
{
|
||||
Disabled,
|
||||
[Description("Only magnified optics")]
|
||||
ScopeOnly,
|
||||
Enabled
|
||||
}
|
||||
|
||||
|
||||
public event EventHandler SettingChanged;
|
||||
|
||||
|
||||
void Awake()
|
||||
{
|
||||
cameraResolutionScale = Config.Bind("General", "Main camera scale %", 80, new ConfigDescription("Main camera resulution sclae", new AcceptableValueRange<int>(50, 100)));
|
||||
scopeCameraResolutionScale = Config.Bind("General", "Scope camera scale %", 40, new ConfigDescription("Scope camera resulution scale", new AcceptableValueRange<int>(25, 100)));
|
||||
|
||||
disableFOVScaling = Config.Bind("Experimental", "Disable ADS FOV scaling", fovScalingMode.Disabled);
|
||||
|
||||
cameraResolutionScale.SettingChanged += (s, args) =>
|
||||
{
|
||||
@ -29,7 +51,19 @@ namespace CameraResolutionScale
|
||||
scopeCameraResolutionScale.SettingChanged += (s, args) =>
|
||||
{
|
||||
updateSSRatio();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Logger.LogInfo("Setting up game settings references");
|
||||
rootObject = GameObject.Find(rootObjectPath);
|
||||
fovObject = rootObject.transform.Find(fovObjectPath).gameObject;
|
||||
fovSliderValue = fovObject.GetComponent<SelectSlider>();
|
||||
defaultFOVValue = fovSliderValue.CurrentValue();
|
||||
|
||||
Logger.LogInfo($"Default camera FOV: {defaultFOVValue}");
|
||||
}
|
||||
|
||||
void updateSSRatio()
|
||||
@ -82,6 +116,12 @@ namespace CameraResolutionScale
|
||||
scopeCamera = GameObject.Find("BaseOpticCamera(Clone)").GetComponent<Camera>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var handsController = ((Singleton<GameWorld>.Instance.RegisteredPlayers[0].HandsController));
|
||||
isAiming = handsController.IsAiming;
|
||||
|
||||
@ -104,6 +144,11 @@ namespace CameraResolutionScale
|
||||
if (FPSCamera == null) return;
|
||||
if (scopeCamera == null || scopeCamera.isActiveAndEnabled == false) return;
|
||||
|
||||
|
||||
Logger.LogInfo("Updating settings FOV to 50");
|
||||
fovSliderValue.UpdateValue(50);
|
||||
|
||||
|
||||
_nextSSRation.SetValue(ssaaInstance, (float)(defaultSSRatio * cameraResolutionScale.Value / 100f));
|
||||
Logger.LogInfo($"Updated to: {_nextSSRation.GetValue(ssaaInstance)}");
|
||||
|
||||
@ -116,6 +161,8 @@ namespace CameraResolutionScale
|
||||
//Logger.LogInfo("Checking if not isAiming");
|
||||
if (!isAiming && doneOnce)
|
||||
{
|
||||
Logger.LogInfo($"Restoring default hipfire FOV: {defaultFOVValue}");
|
||||
fovSliderValue.UpdateValue(defaultFOVValue);
|
||||
Logger.LogInfo($"Restoring default scale: {defaultSSRatio}");
|
||||
_nextSSRation.SetValue(ssaaInstance, defaultSSRatio);
|
||||
doneOnce = false;
|
||||
|
12
CameraResolutionScale/UpdateScopeResolution.cs
Normal file
12
CameraResolutionScale/UpdateScopeResolution.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CameraResolutionScale
|
||||
{
|
||||
internal class UpdateScopeResolution
|
||||
{
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user