SHADE_Y3/Assets/Scripts/UI/SC_QuitButton.cs

32 lines
618 B
C#
Raw Normal View History

2023-03-02 16:26:49 +08:00
using System;
using SHADE;
public class QuitButton : Script
{
protected override void start()
{
UIElement ui = GetComponent<UIElement>();
if (ui != null)
{
ui.OnClick.RegisterAction(() =>
{
ui.OnClick.RegisterAction(() =>
{
Audio.StopAllSounds();
Application.Quit();
});
});
}
else
{
Debug.LogError("Failed to register button action for QuitButton.");
}
}
protected override void update()
{
}
}