100 lines
2.2 KiB
C#
100 lines
2.2 KiB
C#
using SHADE;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SHADE_Scripting.UI
|
|
{
|
|
public class Options : Script
|
|
{
|
|
public GameObject masterVolSlider;
|
|
public GameObject sfxVolSlider;
|
|
public GameObject bgmVolSlider;
|
|
public GameObject fovSlider;
|
|
public GameObject sensitivitySlider;
|
|
|
|
|
|
|
|
|
|
protected override void awake()
|
|
{
|
|
Slider mv = masterVolSlider.GetComponent<Slider>();
|
|
Slider sfx = sfxVolSlider.GetComponent<Slider>();
|
|
Slider bgm = bgmVolSlider.GetComponent<Slider>();
|
|
Slider fov = fovSlider.GetComponent<Slider>();
|
|
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
|
|
|
|
|
|
|
if (mv != null)
|
|
{
|
|
mv.ScaledValue = Settings.masterVolume;
|
|
|
|
}
|
|
if (sfx != null)
|
|
{
|
|
sfx.ScaledValue = Settings.sfxVolume;
|
|
|
|
}
|
|
if (bgm != null)
|
|
{
|
|
bgm.ScaledValue = Settings.bgmVolume;
|
|
|
|
}
|
|
if (fov != null)
|
|
{
|
|
fov.ScaledValue = Settings.cameraFOV;
|
|
|
|
}
|
|
if (sens != null)
|
|
{
|
|
sens.ScaledValue = Settings.cameraSensitivity;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
protected override void update()
|
|
{
|
|
Slider mv = masterVolSlider.GetComponent<Slider>();
|
|
Slider sfx = sfxVolSlider.GetComponent<Slider>();
|
|
Slider bgm = bgmVolSlider.GetComponent<Slider>();
|
|
Slider fov = fovSlider.GetComponent<Slider>();
|
|
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
|
|
|
if (mv != null)
|
|
{
|
|
Settings.masterVolume = mv.ScaledValue * 0.01f;
|
|
SHADE.Audio.SetVCAVolume("vca:/MASTER", Settings.masterVolume);
|
|
}
|
|
if (sfx != null)
|
|
{
|
|
Settings.sfxVolume = sfx.ScaledValue;
|
|
SHADE.Audio.SetVCAVolume("vca:/SFX", Settings.sfxVolume);
|
|
SHADE.Audio.SetVCAVolume("vca:/UI", Settings.sfxVolume);
|
|
}
|
|
if (bgm != null)
|
|
{
|
|
Settings.bgmVolume = bgm.ScaledValue;
|
|
SHADE.Audio.SetVCAVolume("vca:/MUSIC", Settings.bgmVolume);
|
|
}
|
|
if (fov != null)
|
|
{
|
|
Settings.cameraFOV = fov.ScaledValue;
|
|
}
|
|
if (sens != null)
|
|
{
|
|
Settings.cameraSensitivity = sens.ScaledValue;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|