things
This commit is contained in:
parent
a17810ffeb
commit
4e91f448c9
826 changed files with 66 additions and 8 deletions
51
Assets/Scripts/OptionSettings.cs
Normal file
51
Assets/Scripts/OptionSettings.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class OptionSettings : MonoBehaviour
|
||||
{
|
||||
Resolution[] res;
|
||||
public TMP_Dropdown resDropdown;
|
||||
|
||||
void Start()
|
||||
{
|
||||
res = Screen.resolutions;
|
||||
resDropdown.ClearOptions();
|
||||
List<string> resOp = new List<string>();
|
||||
|
||||
int currentRes=0;
|
||||
for (int i = 0; i < res.Length; i++)
|
||||
{
|
||||
string op = res[i].width + " x " + res[i].height;
|
||||
resOp.Add(op);
|
||||
|
||||
if (res[i].width == Screen.currentResolution.width && res[i].height==Screen.currentResolution.height)
|
||||
{
|
||||
currentRes = i;
|
||||
}
|
||||
}
|
||||
|
||||
resDropdown.AddOptions(resOp);
|
||||
resDropdown.value = currentRes;
|
||||
resDropdown.RefreshShownValue();
|
||||
}
|
||||
|
||||
public void CloseMenu()
|
||||
{
|
||||
this.gameObject.SetActive(false);
|
||||
GameObject.Find("Main").SetActive(true);
|
||||
}
|
||||
|
||||
public void ChangeQuality(int qindex)
|
||||
{
|
||||
QualitySettings.SetQualityLevel(qindex);
|
||||
}
|
||||
|
||||
public void ChangeResolution(int resIndex)
|
||||
{
|
||||
Resolution res = Screen.resolutions[resIndex];
|
||||
Screen.SetResolution(res.width, res.height, Screen.fullScreen);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue