diff --git a/Assets/ResWork/Sound/b001_BGM.mp3 b/Assets/ResWork/Sound/b001_BGM.mp3 new file mode 100644 index 0000000..b656f72 Binary files /dev/null and b/Assets/ResWork/Sound/b001_BGM.mp3 differ diff --git a/Assets/ResWork/Sound/b001_BGM.mp3.meta b/Assets/ResWork/Sound/b001_BGM.mp3.meta new file mode 100644 index 0000000..9f8f499 --- /dev/null +++ b/Assets/ResWork/Sound/b001_BGM.mp3.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: f6114cbd9684c734a86622e924246b10 +AudioImporter: + externalObjects: {} + serializedVersion: 8 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 0.01 + conversionMode: 0 + preloadAudioData: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResWork/Sound/s001_Click.wav.meta b/Assets/ResWork/Sound/s001_Click.wav.meta index 415fdbd..d470e1e 100644 --- a/Assets/ResWork/Sound/s001_Click.wav.meta +++ b/Assets/ResWork/Sound/s001_Click.wav.meta @@ -9,7 +9,7 @@ AudioImporter: sampleRateSetting: 0 sampleRateOverride: 44100 compressionFormat: 1 - quality: 1 + quality: 0.01 conversionMode: 0 preloadAudioData: 0 platformSettingOverrides: {} diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 024ec36..a1e96c1 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -8022,7 +8022,7 @@ BoxCollider2D: drawMode: 0 adaptiveTiling: 0 m_AutoTiling: 0 - m_Size: {x: 1080, y: 50} + m_Size: {x: 720, y: 50} m_EdgeRadius: 0 --- !u!114 &420248623 MonoBehaviour: @@ -9470,7 +9470,8 @@ MonoBehaviour: m_EditorClassIdentifier: arr_clip: - {fileID: 8300000, guid: 566a779851d20d948a663e4cb01b8e7b, type: 3} - arr_bgm: [] + arr_bgm: + - {fileID: 8300000, guid: f6114cbd9684c734a86622e924246b10, type: 3} --- !u!114 &500962030 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/AttachToGameObject/SaveMgr.cs b/Assets/Scripts/AttachToGameObject/SaveMgr.cs index bbcdf08..29eb06a 100644 --- a/Assets/Scripts/AttachToGameObject/SaveMgr.cs +++ b/Assets/Scripts/AttachToGameObject/SaveMgr.cs @@ -25,6 +25,8 @@ public class SaveMgr : MonoBehaviourSingletonTemplate IEnumerator Start() { Load(); + yield return null; + SoundInfo.Ins.Play_BGM(eBGM.b001_BGM); while (!LobbyUI.Ins) yield return null; LobbyUI.Ins.Set_Money(); } diff --git a/Assets/Scripts/AttachToGameObject/SoundInfo.cs b/Assets/Scripts/AttachToGameObject/SoundInfo.cs index ccd9e40..86c27cf 100644 --- a/Assets/Scripts/AttachToGameObject/SoundInfo.cs +++ b/Assets/Scripts/AttachToGameObject/SoundInfo.cs @@ -4,7 +4,7 @@ using UnityEngine; public enum eSound { s001_ButtonClick, Max } -public enum eBGM { Max } +public enum eBGM { b001_BGM, Max } public class SoundInfo : MonoBehaviourSingletonTemplate { @@ -14,15 +14,17 @@ public class SoundInfo : MonoBehaviourSingletonTemplate public AudioClip[] arr_clip, arr_bgm; List list_audiosource = new List(); AudioSource BGM_AudioSource; - eBGM CurBGM; + eBGM CurBGM = eBGM.Max; float minVolume = 0.02f; bool EnablePlay = true; Dictionary dic_clip = new Dictionary(); Dictionary dic_bgmclip = new Dictionary(); - private void Start() + protected override void Awake() { + base.Awake(); + DontDestroy(); for (eSound i = 0; i < eSound.Max; i++) diff --git a/Assets/Scripts/UI/OptionUI.cs b/Assets/Scripts/UI/OptionUI.cs index 554f1c6..963bf9f 100644 --- a/Assets/Scripts/UI/OptionUI.cs +++ b/Assets/Scripts/UI/OptionUI.cs @@ -20,7 +20,13 @@ public class OptionUI : MonoBehaviour SaveMgr.Ins.Set_Option(option); Set(); - if (option == eOption.Bgm && !SaveMgr.Ins.Get_Option(option)) SoundInfo.Ins.Stop_BGM(); + if (option == eOption.Bgm) + { + if (!SaveMgr.Ins.Get_Option(option)) + SoundInfo.Ins.Stop_BGM(); + else + SoundInfo.Ins.RePlay_BGM(); + } } public void OnClick_Game(int index)