86 lines
2.0 KiB
C#
86 lines
2.0 KiB
C#
using DG.Tweening.Plugins.Options;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class SettingsMenu : Menu<SettingsMenu>
|
|
{
|
|
private DataManager dataManager;
|
|
|
|
public bool isMusicOn = true;
|
|
public bool isSfxOn = true;
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
dataManager = DataManager.instance;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
}
|
|
|
|
public override void OnBackPressed()
|
|
{
|
|
base.OnBackPressed();
|
|
audioController.Instance.PlaySFX("TombolClose", 0.5f);
|
|
|
|
if (dataManager != null)
|
|
{
|
|
dataManager.Save();
|
|
}
|
|
}
|
|
|
|
public void SwapSoundMusic()
|
|
{
|
|
if (isMusicOn)
|
|
{
|
|
audioController.Instance.PlaySFX("TombolUmum", 0.5f);
|
|
|
|
isMusicOn = false;
|
|
audioController.Instance.bgmSource.mute = true;
|
|
Debug.Log(("Music mati"));
|
|
}
|
|
else if (!isMusicOn)
|
|
{
|
|
audioController.Instance.PlaySFX("TombolUmum", 0.5f);
|
|
|
|
isMusicOn = true;
|
|
audioController.Instance.bgmSource.mute = false;
|
|
Debug.Log(("Music hidup"));
|
|
}
|
|
}
|
|
|
|
public void SwapSoundSfx()
|
|
{
|
|
if (isSfxOn)
|
|
{
|
|
audioController.Instance.PlaySFX("TombolUmum", 0.5f);
|
|
|
|
isSfxOn = false;
|
|
audioController.Instance.sfxSource.mute = true;
|
|
Debug.Log(("Music mati"));
|
|
}
|
|
else if (!isSfxOn)
|
|
{
|
|
audioController.Instance.PlaySFX("TombolUmum", 0.5f);
|
|
|
|
isSfxOn = true;
|
|
audioController.Instance.sfxSource.mute = false;
|
|
Debug.Log(("Music hidup"));
|
|
}
|
|
}
|
|
|
|
//public void LoadData()
|
|
//{
|
|
// if (dataManager == null || sfxSliderVolume == null || musicSliderVolume == null)
|
|
// return;
|
|
|
|
// dataManager.Load();
|
|
|
|
// sfxSliderVolume.enabled = dataManager.sfxVolume;
|
|
// musicSliderVolume.enabled = dataManager.musicVolume;
|
|
//}
|
|
}
|