您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
48 行
1.4 KiB
48 行
1.4 KiB
#if GAME_OPTIONS_HDRP
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Rendering.HighDefinition;
|
|
|
|
namespace GameOptionsUtility.HDRP
|
|
{
|
|
[RequireComponent(typeof(Dropdown))]
|
|
public class HDRPAntiAliasingDropdown : MonoBehaviour
|
|
{
|
|
public bool ApplyImmediately = true;
|
|
private void OnEnable()
|
|
{
|
|
var dropdown = GetComponent<Dropdown>();
|
|
InitializeEntries(dropdown);
|
|
dropdown.onValueChanged.AddListener(UpdateOptions);
|
|
UpdateOptions(dropdown.value);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
GetComponent<Dropdown>().onValueChanged.RemoveListener(UpdateOptions);
|
|
}
|
|
|
|
public void InitializeEntries(Dropdown dropdown)
|
|
{
|
|
dropdown.options.Clear();
|
|
dropdown.options.Add(new Dropdown.OptionData("None"));
|
|
dropdown.options.Add(new Dropdown.OptionData("FXAA"));
|
|
dropdown.options.Add(new Dropdown.OptionData("TAA"));
|
|
dropdown.options.Add(new Dropdown.OptionData("SMAA"));
|
|
dropdown.SetValueWithoutNotify((int)GameOption.Get<HDRPCameraOption>().antiAliasing);
|
|
}
|
|
|
|
void UpdateOptions(int value)
|
|
{
|
|
var option = GameOption.Get<HDRPCameraOption>();
|
|
option.antiAliasing = (HDAdditionalCameraData.AntialiasingMode)value;
|
|
|
|
if (ApplyImmediately)
|
|
option.Apply();
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
|
|
|