2025-09-17 18:56:28 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
using UnityEngine.Rendering;
|
|
|
|
|
using UnityEngine.Rendering.Universal;
|
|
|
|
|
using TMPro;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
2025-09-29 07:45:07 +08:00
|
|
|
public class GraphicsPanel : UIBasePanel, ISettingsPanel
|
2025-09-17 18:56:28 +08:00
|
|
|
{
|
|
|
|
|
[Header("UI References")]
|
|
|
|
|
[SerializeField] private TMP_Dropdown qualityDropdown;
|
|
|
|
|
[SerializeField] private Toggle vsyncToggle;
|
|
|
|
|
[SerializeField] private Slider shadowDistanceSlider;
|
|
|
|
|
[SerializeField] private TMP_Dropdown antiAliasingDropdown;
|
|
|
|
|
[SerializeField] private Toggle bloomToggle;
|
|
|
|
|
[SerializeField] private Slider renderScaleSlider;
|
|
|
|
|
|
2025-09-29 11:03:26 +08:00
|
|
|
public override void OnShow()
|
2025-09-17 18:56:28 +08:00
|
|
|
{
|
2025-09-29 07:45:07 +08:00
|
|
|
var settings = SettingsManager.Inst.CurrentSettings;
|
2025-09-29 11:03:26 +08:00
|
|
|
qualityDropdown.SetValueWithoutNotify(settings.graphicsSettings.qualityLevel);
|
|
|
|
|
vsyncToggle.SetIsOnWithoutNotify(settings.graphicsSettings.vsyncEnabled);
|
|
|
|
|
shadowDistanceSlider.SetValueWithoutNotify(settings.graphicsSettings.shadowDistance);
|
|
|
|
|
antiAliasingDropdown.SetValueWithoutNotify(settings.graphicsSettings.antiAliasing);
|
|
|
|
|
bloomToggle.SetIsOnWithoutNotify(settings.graphicsSettings.bloomEnabled);
|
|
|
|
|
renderScaleSlider.SetValueWithoutNotify(settings.graphicsSettings.renderScale);
|
2025-09-17 18:56:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void OnQualityChanged(int index)
|
|
|
|
|
{
|
2025-09-29 11:03:26 +08:00
|
|
|
GameSystem.Inst.Graphics.graphicsSetting.qualityLevel = index;
|
2025-09-17 18:56:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnVSyncChanged(bool value)
|
|
|
|
|
{
|
2025-09-29 11:03:26 +08:00
|
|
|
GameSystem.Inst.Graphics.graphicsSetting.vsyncEnabled = value;
|
2025-09-17 18:56:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnShadowDistanceChanged(float value)
|
|
|
|
|
{
|
2025-09-29 11:03:26 +08:00
|
|
|
GameSystem.Inst.Graphics.graphicsSetting.shadowDistance = value;
|
2025-09-17 18:56:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnAntiAliasingChanged(int index)
|
|
|
|
|
{
|
2025-09-29 11:03:26 +08:00
|
|
|
GameSystem.Inst.Graphics.graphicsSetting.antiAliasing = index;
|
2025-09-17 18:56:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnBloomChanged(bool value)
|
|
|
|
|
{
|
2025-09-29 11:03:26 +08:00
|
|
|
GameSystem.Inst.Graphics.graphicsSetting.bloomEnabled = value;
|
2025-09-17 18:56:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnRenderScaleChanged(float value)
|
|
|
|
|
{
|
2025-09-29 11:03:26 +08:00
|
|
|
GameSystem.Inst.Graphics.graphicsSetting.renderScale = value;
|
2025-09-17 18:56:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ApplySettings()
|
|
|
|
|
{
|
2025-09-29 11:03:26 +08:00
|
|
|
GameSystem.Inst.Graphics.ApplySettings();
|
2025-09-17 18:56:28 +08:00
|
|
|
}
|
2025-09-29 07:45:07 +08:00
|
|
|
|
|
|
|
|
public void ResetToDefault()
|
|
|
|
|
{
|
|
|
|
|
throw new System.NotImplementedException();
|
|
|
|
|
}
|
2025-09-17 18:56:28 +08:00
|
|
|
}
|