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