ProjectDDD/Assets/_Datas/SLShared/SLUnity/SLUI/SLUISound.cs
2025-06-17 20:47:57 +09:00

43 lines
1.1 KiB (Stored with Git LFS)
C#

using UnityEngine.EventSystems;
namespace Superlazy.UI
{
public class SLUISound : UIBehaviour
{
public string onSound = "SoundEffect/SE_UI_message";
public string offSound = "SoundEffect/SE_UI_message";
public string loopSound = string.Empty;
public string loopSoundTag = string.Empty;
protected override void OnEnable()
{
base.OnEnable();
if (onSound != string.Empty)
{
SLSound.PlaySound(onSound, "UI", false, false, true, 0.5f);
}
if (loopSound != string.Empty)
{
SLSound.PlaySound(loopSound, loopSoundTag, true, true, true, 0.5f);
}
}
protected override void OnDisable()
{
base.OnEnable();
if (offSound != string.Empty)
{
SLSound.PlaySound(offSound, "UI", false, false, true, 0.5f);
}
if (loopSound != string.Empty)
{
SLSound.StopSound(loopSoundTag);
}
}
}
}