add initial project files and configurations, including EventBus, systems, and resources
This commit is contained in:
34
Code/UI/MainMenu.cs
Normal file
34
Code/UI/MainMenu.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Godot;
|
||||
|
||||
namespace MaxEffort.Code.UI;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class MainMenu : Control
|
||||
{
|
||||
[Export] private PackedScene _gameScene;
|
||||
[Export] private CheckButton _muteButton;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
AudioServer.SetBusMute(AudioServer.GetBusIndex("Master"), false);
|
||||
}
|
||||
|
||||
public void OnPlayPressed()
|
||||
{
|
||||
if (_gameScene != null)
|
||||
{
|
||||
GetTree().ChangeSceneToPacked(_gameScene);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnQuitPressed()
|
||||
{
|
||||
GetTree().Quit();
|
||||
}
|
||||
|
||||
public void OnMuteToggled(bool toggledOn)
|
||||
{
|
||||
var masterBus = AudioServer.GetBusIndex("Master");
|
||||
AudioServer.SetBusMute(masterBus, toggledOn);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user