mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-23 04:23:04 +00:00
add SoundSettings
This commit is contained in:
parent
b411c1a3de
commit
56d28883cc
3 changed files with 49 additions and 0 deletions
|
@ -15,6 +15,7 @@ GameObject:
|
|||
- component: {fileID: 7056353258879895447}
|
||||
- component: {fileID: 8177288711715647872}
|
||||
- component: {fileID: 2298254865615715979}
|
||||
- component: {fileID: 8776297466843115784}
|
||||
m_Layer: 0
|
||||
m_Name: Settings
|
||||
m_TagString: Untagged
|
||||
|
@ -108,3 +109,16 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 409653cfe36614ceab3cbfbf9ed04fce, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &8776297466843115784
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1743550280859940532}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0c095ea8fdb7ab740a96b2a7ae1cc4b2, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
defaultSoundVolume: 0.5
|
||||
|
|
24
Assets/Scripts/Settings/SoundSettings.cs
Normal file
24
Assets/Scripts/Settings/SoundSettings.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using SanAndreasUnity.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SanAndreasUnity.Settings
|
||||
{
|
||||
public class SoundSettings : MonoBehaviour
|
||||
{
|
||||
[Range(0f, 1f)] public float defaultSoundVolume = 0.5f;
|
||||
|
||||
OptionsWindow.FloatInput m_soundVolume = new OptionsWindow.FloatInput ("Sound volume", 0, 1) {
|
||||
getValue = () => AudioListener.volume,
|
||||
setValue = (value) => { AudioListener.volume = value; },
|
||||
persistType = OptionsWindow.InputPersistType.OnStart
|
||||
};
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// apply default value
|
||||
AudioListener.volume = this.defaultSoundVolume;
|
||||
|
||||
OptionsWindow.RegisterInputs ("SOUND", m_soundVolume);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Settings/SoundSettings.cs.meta
Normal file
11
Assets/Scripts/Settings/SoundSettings.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0c095ea8fdb7ab740a96b2a7ae1cc4b2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in a new issue