38 lines
937 B
C#
38 lines
937 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class SettingResolutionUI : MonoBehaviour
|
|
{
|
|
[SerializeField] private TMP_Dropdown resDropDown;
|
|
[SerializeField] private Toggle fullScreenToggle;
|
|
|
|
private void Start()
|
|
{
|
|
var manager = SettingsManager.Instance;
|
|
|
|
resDropDown.ClearOptions();
|
|
|
|
var options = new List<string>();
|
|
foreach (var res in manager.FilteredResolutions)
|
|
options.Add($"{res.width} x {res.height}");
|
|
|
|
resDropDown.AddOptions(options);
|
|
|
|
resDropDown.value = manager.resolutionIndex;
|
|
fullScreenToggle.isOn = manager.isFullScreen;
|
|
}
|
|
|
|
public void OnResolutionChanged(int index)
|
|
{
|
|
SettingsManager.Instance.SetResolution(index);
|
|
}
|
|
|
|
public void OnFullScreenChanged(bool value)
|
|
{
|
|
SettingsManager.Instance.SetFullScreen(value);
|
|
}
|
|
}
|