fix playerprefs usage + rename audiobundles

This commit is contained in:
mangorifo
2024-02-04 17:52:19 +08:00
parent b3bb082a6b
commit 4804b2e0e5
12 changed files with 616 additions and 192 deletions
+16 -1
View File
@@ -2,6 +2,7 @@ using TMPro;
using UnityEngine;
using System.Collections.Generic;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.UI;
public class SettingsPanel : MonoBehaviour
{
@@ -9,6 +10,7 @@ public class SettingsPanel : MonoBehaviour
public GameObject settingsPanelDeactivator;
public bool DisableSettingsPanelWhenLinkedGameobjectIsActivated = false;
public TMP_Dropdown GraphicsQualityDropdown;
public Toggle FullscreenToggle;
public PostProcessVolume PostProcessVolume;
public List<PostProcessVolume> PostProcessingVolumes = new() { };
@@ -44,7 +46,19 @@ public class SettingsPanel : MonoBehaviour
}
GraphicsQualityDropdown.AddOptions(Options);
GraphicsQualityDropdown.value = QualitySettings.GetQualityLevel();
if (!PlayerPrefs.HasKey("QualityLevel"))
GraphicsQualityDropdown.value = QualitySettings.GetQualityLevel();
else
{
QualitySettings.SetQualityLevel(PlayerPrefs.GetInt("QualityLevel"));
GraphicsQualityDropdown.value = PlayerPrefs.GetInt("QualityLevel");
}
if (PlayerPrefs.HasKey("FullscreenState") && FullscreenToggle)
{
FullscreenToggle.isOn = bool.Parse(PlayerPrefs.GetString("FullscreenState"));
}
}
}
@@ -52,6 +66,7 @@ public class SettingsPanel : MonoBehaviour
{
if (GraphicsQualityDropdown)
{
PlayerPrefs.SetInt("QualityLevel", index);
QualitySettings.SetQualityLevel(index);
}
}