add initial project files and configurations, including EventBus, systems, and resources
This commit is contained in:
27
Code/UI/LiftProgressBar.cs
Normal file
27
Code/UI/LiftProgressBar.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Godot;
|
||||
using MaxEffort.Code.Core;
|
||||
|
||||
namespace MaxEffort.Code.UI;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class LiftProgressBar : ProgressBar
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
EventBus.OnLiftProgress += UpdateProgress;
|
||||
|
||||
MinValue = 0;
|
||||
MaxValue = 1;
|
||||
Value = 0;
|
||||
}
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
EventBus.OnLiftProgress -= UpdateProgress;
|
||||
}
|
||||
|
||||
private void UpdateProgress(float progress)
|
||||
{
|
||||
Value = progress;
|
||||
}
|
||||
}
|
||||
1
Code/UI/LiftProgressBar.cs.uid
Normal file
1
Code/UI/LiftProgressBar.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bsdan2qixddeg
|
||||
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);
|
||||
}
|
||||
}
|
||||
1
Code/UI/MainMenu.cs.uid
Normal file
1
Code/UI/MainMenu.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b17j8o46gnc0e
|
||||
Reference in New Issue
Block a user