SHADE_Y3/Assets/Scripts/UI/SC_ChangeSceneButton.cs

35 lines
737 B
C#
Raw Normal View History

using System;
using SHADE;
public class ChangeSceneButton : Script
{
public uint sceneID = 0;
protected override void start()
{
UIElement ui = GetComponent<UIElement>();
2023-02-04 00:04:25 +08:00
if (ui != null)
{
ui.OnRelease.RegisterAction(() =>
{
2023-02-04 00:04:25 +08:00
if (sceneID != 0)
{
Audio.PlaySFXOnce2D("event:/UI/success");
SceneManager.ChangeScene(sceneID);
Audio.StopAllSounds();
2023-02-04 00:04:25 +08:00
}
});
}
else
{
Debug.LogError("Failed to register button action for ChangeSceneButton.");
}
}
protected override void update()
{
}
}