调整目录结构

This commit is contained in:
2025-08-29 09:11:08 +08:00
parent efb64ce7bc
commit 1fff9db9ca
351 changed files with 304 additions and 215 deletions

View File

@@ -0,0 +1,41 @@
using System;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace NBF.Setting
{
/// <summary>
/// 全局各向异性纹理过滤模式
/// </summary>
[Sort(7)]
public class AnisotropicModeSetting : MultiOption<AnisotropicFiltering>
{
public override string Name => "AnisotropicMode";
public override string Group => SettingsDef.Group.Graphic;
public override string Tab => SettingsDef.Tab.Graphic;
protected override int DefaultValue => (int)AnisotropicFiltering.Enable;
protected override void OnInitialize()
{
var enumValues = Enum.GetValues(typeof(AnisotropicFiltering));
foreach (var value in enumValues)
{
AddOption(value.ToString(), (AnisotropicFiltering)value);
}
}
protected override void OnApply()
{
// 获取当前URP Asset
UniversalRenderPipelineAsset URPAsset =
QualitySettings.GetRenderPipelineAssetAt(QualitySettings.GetQualityLevel()) as
UniversalRenderPipelineAsset;
if (URPAsset)
{
//全局各向异性纹理过滤模式
QualitySettings.anisotropicFiltering = GetSelectedOption();
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b96e677183324f5d8d01e786a828c0db
timeCreated: 1748590207

View File

@@ -0,0 +1,27 @@
using UnityEngine;
namespace NBF.Setting
{
[Sort(1)]
public class FullScreenModeSetting : MultiOption<FullScreenMode>
{
public override string Name => "FullScreenMode";
public override string Group => SettingsDef.Group.Graphic;
public override string Tab => SettingsDef.Tab.Graphic;
protected override int DefaultValue => (int)FullScreenMode.ExclusiveFullScreen;
protected override void OnInitialize()
{
AddOption(nameof(FullScreenMode.ExclusiveFullScreen), FullScreenMode.ExclusiveFullScreen);
AddOption(nameof(FullScreenMode.Windowed), FullScreenMode.Windowed);
AddOption(nameof(FullScreenMode.FullScreenWindow), FullScreenMode.FullScreenWindow);
AddOption(nameof(FullScreenMode.MaximizedWindow), FullScreenMode.MaximizedWindow);
}
protected override void OnApply()
{
// Screen.fullScreenMode = GetSelectedOption();
// Debug.Log($"FullScreenMode: {Screen.fullScreenMode} value: {GetSelectedOption()}");
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3a6386dea2d44f3fb004905e688b97d5
timeCreated: 1748588770

View File

@@ -0,0 +1,59 @@
using System;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace NBF.Setting
{
public enum AnisotropicLevelEnum
{
Off = -1,
x2 = 2,
x4 = 4,
x8 = 8,
x16 = 16
}
/// <summary>
/// 全局各向异性过滤限制
/// </summary>
[Sort(8)]
public class GlobalAnisotropicFilteringLimitsSetting : MultiOption<AnisotropicLevelEnum>
{
public override string Name => "GlobalAnisotropicFilteringLimits";
public override string Group => SettingsDef.Group.Graphic;
public override string Tab => SettingsDef.Tab.Graphic;
protected override int DefaultValue => (int)AnisotropicLevelEnum.x4;
protected override void OnInitialize()
{
var enumValues = Enum.GetValues(typeof(AnisotropicLevelEnum));
foreach (var value in enumValues)
{
AddOption(value.ToString(), (AnisotropicLevelEnum)value);
}
}
protected override void OnApply()
{
// 获取当前URP Asset
UniversalRenderPipelineAsset URPAsset =
QualitySettings.GetRenderPipelineAssetAt(QualitySettings.GetQualityLevel()) as
UniversalRenderPipelineAsset;
if (URPAsset)
{
var current = QualitySettings.anisotropicFiltering;
var level = GetSelectedOption();
if (current == AnisotropicFiltering.Disable ||
current == AnisotropicFiltering.Enable)
{
Texture.SetGlobalAnisotropicFilteringLimits(-1, -1);
}
else if (current == AnisotropicFiltering.ForceEnable)
{
Texture.SetGlobalAnisotropicFilteringLimits((int)level, (int)level);
}
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6937878e8f61426687c62e26252e9258
timeCreated: 1748590403

View File

@@ -0,0 +1,46 @@
using System;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace NBF.Setting
{
public enum MsaaSampleEnum
{
Off = 1,
x2 = 2,
x4 = 4,
x8 = 8
}
[Sort(6)]
public class MsaaSampleSetting : MultiOption<MsaaSampleEnum>
{
public override string Name => "MsaaSample";
public override string Group => SettingsDef.Group.Graphic;
public override string Tab => SettingsDef.Tab.Graphic;
protected override int DefaultValue => (int)MsaaSampleEnum.Off;
protected override void OnInitialize()
{
var enumValues = Enum.GetValues(typeof(MsaaSampleEnum));
foreach (var value in enumValues)
{
AddOption(value.ToString(), (MsaaSampleEnum)value);
}
}
protected override void OnApply()
{
// 获取当前URP Asset
UniversalRenderPipelineAsset URPAsset =
QualitySettings.GetRenderPipelineAssetAt(QualitySettings.GetQualityLevel()) as
UniversalRenderPipelineAsset;
if (URPAsset)
{
//抗锯齿等级
URPAsset.msaaSampleCount = (int)GetSelectedOption();
URPAsset.supportsHDR = true;
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ae51922900c9429cb0de97b473a3429e
timeCreated: 1748589774

View File

@@ -0,0 +1,34 @@
using UnityEngine;
namespace NBF.Setting
{
/// <summary>
/// 画质设置
/// </summary>
[Sort(3)]
public class QualityLevelSetting : MultiOption<int>
{
private int _defaultQualityLevel;
public override string Name => "QualityLevel";
public override string Group => SettingsDef.Group.Graphic;
public override string Tab => SettingsDef.Tab.Graphic;
protected override int DefaultValue => _defaultQualityLevel;
protected override void OnInitialize()
{
var names = QualitySettings.names;
for (int i = 0; i < names.Length; i++)
{
AddOption(names[i], i);
}
_defaultQualityLevel = QualitySettings.GetQualityLevel();
}
protected override void OnApply()
{
QualitySettings.SetQualityLevel(GetSelectedOption());
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 470180f8a41b4856bf3318bc60f2abf1
timeCreated: 1748588124

View File

@@ -0,0 +1,38 @@
using System;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace NBF.Setting
{
[Sort(5)]
public class RenderScaleSetting : RangeOption
{
public override string Name => "RenderScale";
public override string Group => SettingsDef.Group.Graphic;
public override string Tab => SettingsDef.Tab.Graphic;
public override int MinValue => 1;
public override int MaxValue => 20;
protected override int DefaultValue => 10;
public override int ShowRate => 10;
protected override void OnInitialize()
{
SetValue(10);
}
protected override void OnApply()
{
// 获取当前URP Asset
UniversalRenderPipelineAsset URPAsset =
QualitySettings.GetRenderPipelineAssetAt(QualitySettings.GetQualityLevel()) as
UniversalRenderPipelineAsset;
if (URPAsset)
{
//渲染比例
URPAsset.renderScale = (float)Math.Round(GetValue() / 10f, 1);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e54edac5d4fe4dbda2da5bce433482dc
timeCreated: 1748589449

View File

@@ -0,0 +1,64 @@
using System.Collections.Generic;
using System.Linq;
using NBC;
using UnityEngine;
namespace NBF.Setting
{
/// <summary>
/// 分辨率设置
/// </summary>
[Sort(2)]
public class ResolutionSetting : MultiOption<Resolution>
{
private int _defaultResolution;
public override string Name => "Resolution";
public override string Group => SettingsDef.Group.Graphic;
protected override int DefaultValue => _defaultResolution;
public override string Tab => SettingsDef.Tab.Graphic;
protected override void OnInitialize()
{
var supportedResolutions = Screen.resolutions
.GroupBy(r => $"{r.width}x{r.height}") // 按宽高分组
.Select(g => g.OrderByDescending(r => r.refreshRateRatio).First())
.ToArray();
foreach (var resolution in supportedResolutions)
{
if (resolution.width < 720 || resolution.height < 720) continue;
AddOption($"{resolution.width}x{resolution.height}", resolution);
Log.Info($"Resolution {resolution.width}x{resolution.height}");
}
TryGetIndex(t =>
t.width == Screen.currentResolution.width && t.height == Screen.currentResolution.height,
out _defaultResolution);
if (_defaultResolution < 0)
{
_defaultResolution = 0;
}
}
protected override void OnApply()
{
var resolution = GetSelectedOption();
Log.Info($"Screen.fullScreenMode {Screen.fullScreenMode}");
var mode = FullScreenMode.ExclusiveFullScreen;
var screenMode = Root.GetSettingOption<FullScreenModeSetting>();
if (screenMode != null)
{
mode = screenMode.GetSelectedOption();
}
if (mode == FullScreenMode.ExclusiveFullScreen)
{
Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, mode);
}
else
{
Screen.SetResolution(resolution.width, resolution.height, mode);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 08fa420645764519a7a960565464a708
timeCreated: 1748586208

View File

@@ -0,0 +1,45 @@
using System;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace NBF.Setting
{
public enum TextureQualityEnum
{
FullRes = 0,
HalfRes = 1,
QuarterRes = 2,
EighthRes = 3
}
[Sort(9)]
public class TextureQualitySetting : MultiOption<TextureQualityEnum>
{
public override string Name => "TextureQuality";
public override string Group => SettingsDef.Group.Graphic;
protected override int DefaultValue => (int)TextureQualityEnum.FullRes;
public override string Tab => SettingsDef.Tab.Graphic;
protected override void OnInitialize()
{
var enumValues = Enum.GetValues(typeof(TextureQualityEnum));
foreach (var value in enumValues)
{
AddOption(value.ToString(), (TextureQualityEnum)value);
}
}
protected override void OnApply()
{
// 获取当前URP Asset
UniversalRenderPipelineAsset URPAsset =
QualitySettings.GetRenderPipelineAssetAt(QualitySettings.GetQualityLevel()) as
UniversalRenderPipelineAsset;
if (URPAsset)
{
//纹理质量
QualitySettings.globalTextureMipmapLimit = (int)GetSelectedOption();
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d7ca1e2468b24b6285be9176ae024864
timeCreated: 1748590058

View File

@@ -0,0 +1,23 @@
using UnityEngine;
namespace NBF.Setting
{
/// <summary>
/// 垂直同步
/// </summary>
[Sort(4)]
public class VSyncSetting : ToggleOption
{
public override string Name => "VSync";
public override string Group => SettingsDef.Group.Graphic;
public override string Tab => SettingsDef.Tab.Graphic;
protected override int DefaultValue => 0;
protected override void OnApply()
{
//垂直同步
QualitySettings.vSyncCount = GetSelectedOption() ? 1 : 0;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 00628a08aaac416796a4018119e77cc6
timeCreated: 1748585191