integration
bad other team code on another branch
This commit is contained in:
parent
7925fd966a
commit
521a62973a
278 changed files with 11344 additions and 0 deletions
51
Assets/UI Scripts/Resolution Settings.cs
Executable file
51
Assets/UI Scripts/Resolution Settings.cs
Executable file
|
@ -0,0 +1,51 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
public class ResolutionSettings : MonoBehaviour
|
||||
{
|
||||
[SerializeField] public TMP_Dropdown resolutionDropdown;
|
||||
private Resolution[] resolutions =
|
||||
{
|
||||
new Resolution {width = 1280, height = 720},
|
||||
new Resolution {width = 1920, height = 1080},
|
||||
new Resolution {width = 2560, height = 1440},
|
||||
new Resolution {width = 3840, height = 2160}
|
||||
};
|
||||
private int selectedIndex = 0;
|
||||
[SerializeField] private Button applyButton;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
resolutionDropdown.ClearOptions();
|
||||
List<string> options = new List<string>();
|
||||
|
||||
for (int i = 0; i < resolutions.Length; i++)
|
||||
{
|
||||
string option = resolutions[i].width + " x " + resolutions[i].height;
|
||||
options.Add(option);
|
||||
}
|
||||
|
||||
resolutionDropdown.AddOptions(options);
|
||||
|
||||
int savedResolutionIndex = PlayerPrefs.GetInt("ResolutionIndex", 0);
|
||||
resolutionDropdown.value = savedResolutionIndex;
|
||||
resolutionDropdown.RefreshShownValue();
|
||||
}
|
||||
|
||||
public void SetResolution()
|
||||
{
|
||||
Resolution resolution = resolutions[selectedIndex];
|
||||
Debug.Log(resolution.width + " x " + resolution.height);
|
||||
Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen);
|
||||
|
||||
PlayerPrefs.SetInt("ResolutionIndex", selectedIndex);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
|
||||
public void preSaveResolution()
|
||||
{
|
||||
selectedIndex = resolutionDropdown.value;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue