using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class CharacterCreationVolume : MonoBehaviour { [SerializeField] private string iniPath; [SerializeField] private Slider Volume; [SerializeField] private Slider UIVolume; // Start is called before the first frame update void OnEnable() { iniPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments)+@"\My Games\Firstborn\"; INIParser ini = new INIParser(); ini.Open(iniPath+@"\Settings.ini"); string Value = ini.ReadValue("Sound Settings", "MusicVolume", "1"); string UIValue = ini.ReadValue("Sound Settings", "UIVolume", "1"); Volume.value = float.Parse(Value); UIVolume.value = float.Parse(UIValue); ini.Close(); } public void SaveVolume() { iniPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments)+@"\My Games\Firstborn\"; INIParser ini = new INIParser(); ini.Open(iniPath+@"\Settings.ini"); ini.WriteValue("Sound Settings", "MusicVolume", Volume.value.ToString()); ini.Close(); } public void SaveUIVolume() { iniPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments)+@"\My Games\Firstborn\"; INIParser ini = new INIParser(); ini.Open(iniPath+@"\Settings.ini"); ini.WriteValue("Sound Settings", "UIVolume", UIVolume.value.ToString()); ini.Close(); } }