2022-11-22 16:18:16 +08:00
|
|
|
|
using System;
|
|
|
|
|
using SHADE;
|
2023-03-02 16:26:49 +08:00
|
|
|
|
using SHADE_Scripting.Audio;
|
2022-11-22 16:18:16 +08:00
|
|
|
|
|
2022-11-22 17:28:48 +08:00
|
|
|
|
public class MainMenu : Script
|
2022-11-22 16:18:16 +08:00
|
|
|
|
{
|
2023-03-02 16:26:49 +08:00
|
|
|
|
public uint sceneID;
|
|
|
|
|
|
|
|
|
|
public GameObject obj;
|
|
|
|
|
private Renderable renderable;
|
|
|
|
|
|
2022-11-22 16:18:16 +08:00
|
|
|
|
protected override void awake()
|
|
|
|
|
{
|
2023-03-02 16:26:49 +08:00
|
|
|
|
AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu");
|
|
|
|
|
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
|
|
|
|
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
|
|
|
|
//Audio.PlayBGMOnce2D("event:/Music/main_menu");
|
|
|
|
|
AudioHandler.audioClipHandlers["BGMMainMenu"].Play();
|
|
|
|
|
|
|
|
|
|
renderable = obj.GetComponent<Renderable>();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void start()
|
|
|
|
|
{
|
2022-11-22 16:18:16 +08:00
|
|
|
|
}
|
|
|
|
|
protected override void update()
|
|
|
|
|
{
|
2023-03-02 16:26:49 +08:00
|
|
|
|
/* if (Input.GetKeyDown(Input.KeyCode.K) && obj)
|
|
|
|
|
{
|
|
|
|
|
if (testRenderable.Material.GetProperty<float>("data.alpha") == 1)
|
|
|
|
|
{
|
|
|
|
|
testRenderable.Material.SetProperty<float>("data.alpha", 0);
|
|
|
|
|
}
|
|
|
|
|
else if (testRenderable.Material.GetProperty<float>("data.alpha") == 0)
|
|
|
|
|
{
|
|
|
|
|
testRenderable.Material.SetProperty<float>("data.alpha", 1);
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
2022-11-25 00:54:45 +08:00
|
|
|
|
if (Input.GetKeyDown(Input.KeyCode.Space))
|
2022-11-22 17:28:48 +08:00
|
|
|
|
{
|
2023-03-02 16:26:49 +08:00
|
|
|
|
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
|
|
|
|
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
2022-11-26 08:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Input.GetKeyUp(Input.KeyCode.Space))
|
|
|
|
|
{
|
2023-03-02 16:26:49 +08:00
|
|
|
|
//Audio.PlaySFXOnce2D("event:/UI/success");
|
|
|
|
|
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
|
|
|
|
SceneManager.ChangeScene(sceneID);
|
2022-11-23 17:37:06 +08:00
|
|
|
|
Audio.StopAllSounds();
|
2022-11-22 17:28:48 +08:00
|
|
|
|
}
|
2022-11-23 00:44:27 +08:00
|
|
|
|
|
2022-11-25 00:54:45 +08:00
|
|
|
|
if (Input.GetKeyDown(Input.KeyCode.Escape))
|
2022-11-23 00:44:27 +08:00
|
|
|
|
{
|
2022-11-23 17:37:06 +08:00
|
|
|
|
Audio.StopAllSounds();
|
2022-11-23 00:44:27 +08:00
|
|
|
|
Application.Quit();
|
|
|
|
|
}
|
2022-11-22 16:18:16 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|