This commit is contained in:
Gerard Gascón 2025-04-24 17:19:36 +02:00
commit 001bb14f16
951 changed files with 270074 additions and 0 deletions

View file

@ -0,0 +1,49 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
public class SettingsMenu : MonoBehaviour{
public AudioMixer audioMixer;
public Dropdown resolutionDropdown;
Resolution[] resolutions;
void Start(){
audioMixer.SetFloat("volume", 0);
resolutions = Screen.resolutions;
List<string> options = new List<string>();
int currentResolutionIndex = 0;
for (int i = 0; i < resolutions.Length; i++){
string option = resolutions[i].width + "x" + resolutions[i].height;
options.Add(option);
if (resolutions[i].width == Screen.currentResolution.width &&
resolutions[i].height == Screen.currentResolution.height){
currentResolutionIndex = i;
}
}
resolutionDropdown.AddOptions(options);
resolutionDropdown.value = currentResolutionIndex;
resolutionDropdown.RefreshShownValue();
}
public void SetResolution(int resolutionIndex){
Resolution resolution = resolutions[resolutionIndex];
Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen);
}
public void SetQuality(int qualityIndex){
QualitySettings.SetQualityLevel(qualityIndex);
}
public void SetFullscreen(bool isFullScreen){
Screen.fullScreen = isFullScreen;
}
}