Firstborn/Assets/Scripts/CharacterCreationVolume.cs

30 lines
878 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CharacterCreationVolume : MonoBehaviour
{
[SerializeField] private string iniPath;
[SerializeField] private Slider Volume;
// 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");
Volume.value = float.Parse(Value);
ini.Close();
}
public void SaveVolume() {
INIParser ini = new INIParser();
ini.Open(iniPath+@"\Settings.ini");
ini.WriteValue("Sound Settings", "MusicVolume", Volume.value.ToString());
ini.Close();
}
}