refactor
This commit is contained in:
parent
f4a7536862
commit
2580d82e44
@ -44,6 +44,10 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>E:\SPT-AKI\SPT-AKI 3.2.1\EscapeFromTarkov_Data\Managed\ItemComponent.Types.dll</HintPath>
|
<HintPath>E:\SPT-AKI\SPT-AKI 3.2.1\EscapeFromTarkov_Data\Managed\ItemComponent.Types.dll</HintPath>
|
||||||
</Reference>
|
</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" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
@ -63,8 +67,10 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="DisableFOVScaling.cs" />
|
||||||
<Compile Include="Plugin.cs" />
|
<Compile Include="Plugin.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="UpdateScopeResolution.cs" />
|
||||||
<Compile Include="Utils.cs" />
|
<Compile Include="Utils.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<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 Comfort.Common;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System;
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using EFT.UI;
|
||||||
|
|
||||||
namespace CameraResolutionScale
|
namespace CameraResolutionScale
|
||||||
{
|
{
|
||||||
@ -13,13 +15,33 @@ namespace CameraResolutionScale
|
|||||||
{
|
{
|
||||||
ConfigEntry<int> cameraResolutionScale;
|
ConfigEntry<int> cameraResolutionScale;
|
||||||
ConfigEntry<int> scopeCameraResolutionScale;
|
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;
|
public event EventHandler SettingChanged;
|
||||||
|
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
cameraResolutionScale = Config.Bind("General", "Main camera scale %", 80, new ConfigDescription("Main camera resulution sclae", new AcceptableValueRange<int>(50, 100)));
|
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)));
|
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) =>
|
cameraResolutionScale.SettingChanged += (s, args) =>
|
||||||
{
|
{
|
||||||
@ -30,6 +52,18 @@ namespace CameraResolutionScale
|
|||||||
{
|
{
|
||||||
updateSSRatio();
|
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()
|
void updateSSRatio()
|
||||||
@ -82,6 +116,12 @@ namespace CameraResolutionScale
|
|||||||
scopeCamera = GameObject.Find("BaseOpticCamera(Clone)").GetComponent<Camera>();
|
scopeCamera = GameObject.Find("BaseOpticCamera(Clone)").GetComponent<Camera>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var handsController = ((Singleton<GameWorld>.Instance.RegisteredPlayers[0].HandsController));
|
var handsController = ((Singleton<GameWorld>.Instance.RegisteredPlayers[0].HandsController));
|
||||||
isAiming = handsController.IsAiming;
|
isAiming = handsController.IsAiming;
|
||||||
|
|
||||||
@ -104,6 +144,11 @@ namespace CameraResolutionScale
|
|||||||
if (FPSCamera == null) return;
|
if (FPSCamera == null) return;
|
||||||
if (scopeCamera == null || scopeCamera.isActiveAndEnabled == false) 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));
|
_nextSSRation.SetValue(ssaaInstance, (float)(defaultSSRatio * cameraResolutionScale.Value / 100f));
|
||||||
Logger.LogInfo($"Updated to: {_nextSSRation.GetValue(ssaaInstance)}");
|
Logger.LogInfo($"Updated to: {_nextSSRation.GetValue(ssaaInstance)}");
|
||||||
|
|
||||||
@ -116,6 +161,8 @@ namespace CameraResolutionScale
|
|||||||
//Logger.LogInfo("Checking if not isAiming");
|
//Logger.LogInfo("Checking if not isAiming");
|
||||||
if (!isAiming && doneOnce)
|
if (!isAiming && doneOnce)
|
||||||
{
|
{
|
||||||
|
Logger.LogInfo($"Restoring default hipfire FOV: {defaultFOVValue}");
|
||||||
|
fovSliderValue.UpdateValue(defaultFOVValue);
|
||||||
Logger.LogInfo($"Restoring default scale: {defaultSSRatio}");
|
Logger.LogInfo($"Restoring default scale: {defaultSSRatio}");
|
||||||
_nextSSRation.SetValue(ssaaInstance, defaultSSRatio);
|
_nextSSRation.SetValue(ssaaInstance, defaultSSRatio);
|
||||||
doneOnce = false;
|
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