Add ChargeProgressBar, Credits, and GameOverScreen components for UI management
This commit is contained in:
1
scripts/Resources/ChargeThrowInputResource.cs.uid
Normal file
1
scripts/Resources/ChargeThrowInputResource.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dtpdh4jp51jis
|
1
scripts/Resources/CollectableResource.cs.uid
Normal file
1
scripts/Resources/CollectableResource.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://gptsgaw3agkf
|
1
scripts/Resources/CollectableType.cs.uid
Normal file
1
scripts/Resources/CollectableType.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://2ql8wj3vfeke
|
1
scripts/Resources/SkillData.cs.uid
Normal file
1
scripts/Resources/SkillData.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d4crrfmbgxnqf
|
1
scripts/Resources/SkillType.cs.uid
Normal file
1
scripts/Resources/SkillType.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://sma20qug2r0q
|
1
scripts/Resources/StatusEffectDataResource.cs.uid
Normal file
1
scripts/Resources/StatusEffectDataResource.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://pw0pu6gb21y2
|
1
scripts/Resources/StatusEffectType.cs.uid
Normal file
1
scripts/Resources/StatusEffectType.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b0a7k7mse3l68
|
1
scripts/Resources/TapThrowInputResource.cs.uid
Normal file
1
scripts/Resources/TapThrowInputResource.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cx7ryqxemgs56
|
1
scripts/Resources/ThrowInputResource.cs.uid
Normal file
1
scripts/Resources/ThrowInputResource.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://mnn5wy5cyr4m
|
1
scripts/Screenshot.cs.uid
Normal file
1
scripts/Screenshot.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://chrhjch4ymfvr
|
1
scripts/SkillManager.cs.uid
Normal file
1
scripts/SkillManager.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://di572axt0c3s8
|
1
scripts/UI/AudioSettings.cs.uid
Normal file
1
scripts/UI/AudioSettings.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://g61qqsymqfxd
|
81
scripts/UI/ChargeProgressBar.cs
Normal file
81
scripts/UI/ChargeProgressBar.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using Godot;
|
||||
using Mr.BrickAdventures.scripts.components;
|
||||
using Mr.BrickAdventures.scripts.Resources;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.UI;
|
||||
|
||||
public partial class ChargeProgressBar : Node
|
||||
{
|
||||
[Export] public ProgressBar ProgressBar { get; set; }
|
||||
[Export] public BrickThrowComponent ThrowComponent { get; set; }
|
||||
|
||||
private ChargeThrowInputResource _throwInput;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Owner.ChildEnteredTree += OnNodeEntered;
|
||||
ProgressBar.Hide();
|
||||
SetupDependencies();
|
||||
}
|
||||
|
||||
private void OnNodeEntered(Node node)
|
||||
{
|
||||
if (node is not BrickThrowComponent throwComponent || ThrowComponent != null) return;
|
||||
ThrowComponent = throwComponent;
|
||||
SetupDependencies();
|
||||
}
|
||||
|
||||
private void SetupDependencies()
|
||||
{
|
||||
if (ThrowComponent.ThrowInputBehavior is ChargeThrowInputResource throwInput)
|
||||
{
|
||||
_throwInput = throwInput;
|
||||
}
|
||||
else
|
||||
{
|
||||
_throwInput = null;
|
||||
}
|
||||
|
||||
if (_throwInput == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_throwInput.SupportsCharging())
|
||||
{
|
||||
ProgressBar.Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
SetupProgressBar();
|
||||
|
||||
_throwInput.ChargeStarted += OnChargeStarted;
|
||||
_throwInput.ChargeStopped += OnChargeStopped;
|
||||
_throwInput.ChargeUpdated += OnChargeUpdated;
|
||||
}
|
||||
|
||||
private void SetupProgressBar()
|
||||
{
|
||||
ProgressBar.MinValue = _throwInput.MinPower;
|
||||
ProgressBar.MaxValue = _throwInput.MaxPower;
|
||||
ProgressBar.Value = _throwInput.MinPower;
|
||||
ProgressBar.Step = 0.01f;
|
||||
ProgressBar.Hide();
|
||||
}
|
||||
|
||||
private void OnChargeStarted()
|
||||
{
|
||||
ProgressBar.Show();
|
||||
}
|
||||
|
||||
private void OnChargeStopped()
|
||||
{
|
||||
ProgressBar.Hide();
|
||||
}
|
||||
|
||||
private void OnChargeUpdated(float chargeRatio)
|
||||
{
|
||||
ProgressBar.Value = chargeRatio;
|
||||
ProgressBar.Show();
|
||||
}
|
||||
}
|
23
scripts/UI/Credits.cs
Normal file
23
scripts/UI/Credits.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Godot;
|
||||
using Mr.BrickAdventures.Autoloads;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.UI;
|
||||
|
||||
public partial class Credits : Control
|
||||
{
|
||||
private UIManager _uiManager;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_uiManager = GetNode<UIManager>("/root/UIManager");
|
||||
}
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (!@event.IsActionPressed("ui_cancel")) return;
|
||||
if (_uiManager != null && _uiManager.IsScreenOnTop(this))
|
||||
{
|
||||
_uiManager.PopScreen();
|
||||
}
|
||||
}
|
||||
}
|
39
scripts/UI/GameOverScreen.cs
Normal file
39
scripts/UI/GameOverScreen.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Godot;
|
||||
using Mr.BrickAdventures.Autoloads;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.UI;
|
||||
|
||||
public partial class GameOverScreen : Node
|
||||
{
|
||||
[Export] public Control GameOverPanel { get; set; }
|
||||
[Export] public Button RestartButton { get; set; }
|
||||
[Export] public Button MainMenuButton { get; set; }
|
||||
[Export] public PackedScene MainMenuScene { get; set; }
|
||||
|
||||
private GameManager _gameManager;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
||||
RestartButton.Pressed += OnRestartClicked;
|
||||
MainMenuButton.Pressed += OnMainMenuClicked;
|
||||
}
|
||||
|
||||
private void OnMainMenuClicked()
|
||||
{
|
||||
_gameManager.ResetPlayerState();
|
||||
GetTree().ChangeSceneToPacked(MainMenuScene);
|
||||
}
|
||||
|
||||
private void OnRestartClicked()
|
||||
{
|
||||
_gameManager.RestartGame();
|
||||
}
|
||||
|
||||
public void OnPlayerDeath()
|
||||
{
|
||||
if (_gameManager == null || _gameManager.GetLives() != 0) return;
|
||||
|
||||
GameOverPanel.Show();
|
||||
}
|
||||
}
|
1
scripts/components/BrickThrowComponent.cs.uid
Normal file
1
scripts/components/BrickThrowComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b0bv8kw5w5037
|
1
scripts/components/BulletComponent.cs.uid
Normal file
1
scripts/components/BulletComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cfw8nbrarex0i
|
1
scripts/components/CageComponent.cs.uid
Normal file
1
scripts/components/CageComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dojn0gw8hsv02
|
1
scripts/components/CanBeLaunchedComponent.cs.uid
Normal file
1
scripts/components/CanBeLaunchedComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cjcc7fia15wu3
|
1
scripts/components/CanPickUpComponent.cs.uid
Normal file
1
scripts/components/CanPickUpComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://mnjg3p0aw1ow
|
1
scripts/components/CannotStompComponent.cs.uid
Normal file
1
scripts/components/CannotStompComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dh67n16bnl838
|
1
scripts/components/ChaseLevelComponent.cs.uid
Normal file
1
scripts/components/ChaseLevelComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dnpj72mfi1ywl
|
1
scripts/components/CleanupComponent.cs.uid
Normal file
1
scripts/components/CleanupComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://v7tt4w6bejux
|
1
scripts/components/CollapsableComponent.cs.uid
Normal file
1
scripts/components/CollapsableComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://xqhrb1c7f6y4
|
1
scripts/components/CollectableComponent.cs.uid
Normal file
1
scripts/components/CollectableComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://r4jybneigfcn
|
1
scripts/components/DamageComponent.cs.uid
Normal file
1
scripts/components/DamageComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://2i7p7v135u7c
|
1
scripts/components/DestroyableComponent.cs.uid
Normal file
1
scripts/components/DestroyableComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ctfrbj52ejay4
|
1
scripts/components/EffectInflictorComponent.cs.uid
Normal file
1
scripts/components/EffectInflictorComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://xjq33vj0rol0
|
1
scripts/components/EnemyDeathComponent.cs.uid
Normal file
1
scripts/components/EnemyDeathComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cfdugoeduudar
|
1
scripts/components/EnemyWaveTriggerComponent.cs.uid
Normal file
1
scripts/components/EnemyWaveTriggerComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d3fpwddc2j41x
|
1
scripts/components/ExitDoorComponent.cs.uid
Normal file
1
scripts/components/ExitDoorComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c5mhwlyvfuaip
|
1
scripts/components/ExplosiveComponent.cs.uid
Normal file
1
scripts/components/ExplosiveComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://7uttgdr6cr5y
|
1
scripts/components/FadeAwayComponent.cs.uid
Normal file
1
scripts/components/FadeAwayComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bjln6jb1sigx2
|
1
scripts/components/FireEffectComponent.cs.uid
Normal file
1
scripts/components/FireEffectComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cxuig4xh8nfov
|
1
scripts/components/FlashingComponent.cs.uid
Normal file
1
scripts/components/FlashingComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dvyd26ricriql
|
1
scripts/components/FlipComponent.cs.uid
Normal file
1
scripts/components/FlipComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dy78ak8eykw6e
|
1
scripts/components/GravityMotionComponent.cs.uid
Normal file
1
scripts/components/GravityMotionComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cwi5qashdag1g
|
1
scripts/components/HealComponent.cs.uid
Normal file
1
scripts/components/HealComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bmx6rk281yim2
|
1
scripts/components/HealthComponent.cs.uid
Normal file
1
scripts/components/HealthComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dgb8bqcri7nsj
|
1
scripts/components/HitComponent.cs.uid
Normal file
1
scripts/components/HitComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bo506l4x0808e
|
1
scripts/components/HomingMissileMotionComponent.cs.uid
Normal file
1
scripts/components/HomingMissileMotionComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c2hplha6af74q
|
1
scripts/components/IceEffectComponent.cs.uid
Normal file
1
scripts/components/IceEffectComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d1388lhp2gpgr
|
1
scripts/components/InvulnerabilityComponent.cs.uid
Normal file
1
scripts/components/InvulnerabilityComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cecelixl41t3j
|
1
scripts/components/JumpPadComponent.cs.uid
Normal file
1
scripts/components/JumpPadComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bgbnof7aeydmq
|
1
scripts/components/KillPlayerOutOfScreenComponent.cs.uid
Normal file
1
scripts/components/KillPlayerOutOfScreenComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://diw6opv6yutgi
|
1
scripts/components/KnockbackComponent.cs.uid
Normal file
1
scripts/components/KnockbackComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cgfynrn68lp12
|
1
scripts/components/LaunchComponent.cs.uid
Normal file
1
scripts/components/LaunchComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cbexrnnj47f87
|
1
scripts/components/LeverComponent.cs.uid
Normal file
1
scripts/components/LeverComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://1oo22ieply7n
|
1
scripts/components/LifetimeComponent.cs.uid
Normal file
1
scripts/components/LifetimeComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://oyf25mpc5etr
|
1
scripts/components/MagneticSkillComponent.cs.uid
Normal file
1
scripts/components/MagneticSkillComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bi5nx8s1gisbd
|
1
scripts/components/OutOfScreenComponent.cs.uid
Normal file
1
scripts/components/OutOfScreenComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cs6u3sh68f43j
|
1
scripts/components/PeriodicShootingComponent.cs.uid
Normal file
1
scripts/components/PeriodicShootingComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bnaxy8cw3wrko
|
1
scripts/components/PlayerDeathComponent.cs.uid
Normal file
1
scripts/components/PlayerDeathComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://byw1legrv1ep2
|
1
scripts/components/ProgressiveDamageComponent.cs.uid
Normal file
1
scripts/components/ProgressiveDamageComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://3qy7rm28q66a
|
1
scripts/components/ProjectileComponent.cs.uid
Normal file
1
scripts/components/ProjectileComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bh31avqjbniik
|
1
scripts/components/ProjectileInitComponent.cs.uid
Normal file
1
scripts/components/ProjectileInitComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c7n6ecsobohjn
|
1
scripts/components/RequirementComponent.cs.uid
Normal file
1
scripts/components/RequirementComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dnh0mekg2vqxi
|
1
scripts/components/ScoreComponent.cs.uid
Normal file
1
scripts/components/ScoreComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ccqb8kd5m0eh7
|
1
scripts/components/ShipMovementComponent.cs.uid
Normal file
1
scripts/components/ShipMovementComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cty54itmnudfm
|
1
scripts/components/ShipShooterComponent.cs.uid
Normal file
1
scripts/components/ShipShooterComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dr3uv0j7n75s
|
1
scripts/components/SideToSideMovementComponent.cs.uid
Normal file
1
scripts/components/SideToSideMovementComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d2hrr8fruho1d
|
1
scripts/components/SkillUnlockedComponent.cs.uid
Normal file
1
scripts/components/SkillUnlockedComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dlh5xcv2sy82s
|
1
scripts/components/SpaceshipEnterComponent.cs.uid
Normal file
1
scripts/components/SpaceshipEnterComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dtv2r7q4elgre
|
1
scripts/components/SpaceshipExitComponent.cs.uid
Normal file
1
scripts/components/SpaceshipExitComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d3gfg05ll8uw3
|
1
scripts/components/SpinComponent.cs.uid
Normal file
1
scripts/components/SpinComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cqw134ewht3hc
|
1
scripts/components/StatusEffectComponent.cs.uid
Normal file
1
scripts/components/StatusEffectComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://t8rsvwdwt8ea
|
1
scripts/components/StompDamageComponent.cs.uid
Normal file
1
scripts/components/StompDamageComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dtg6115je7b5s
|
1
scripts/components/StraightMotionComponent.cs.uid
Normal file
1
scripts/components/StraightMotionComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c7p06t0eax8am
|
1
scripts/components/TerrainHitFx.cs.uid
Normal file
1
scripts/components/TerrainHitFx.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cypxrqoeiihbf
|
1
scripts/components/TooltipComponent.cs.uid
Normal file
1
scripts/components/TooltipComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cvaa6aqyijcp1
|
1
scripts/components/TrailComponent.cs.uid
Normal file
1
scripts/components/TrailComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cqkh5e36p5fj0
|
1
scripts/components/TriggerLeverComponent.cs.uid
Normal file
1
scripts/components/TriggerLeverComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cqau0810tjk4d
|
1
scripts/components/UnlockOnRequirementComponent.cs.uid
Normal file
1
scripts/components/UnlockOnRequirementComponent.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://gwr4eajx8j50
|
1
scripts/components/platform_movement.gd.uid
Normal file
1
scripts/components/platform_movement.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cflncpa377l8l
|
1
scripts/interfaces/IThrowInput.cs.uid
Normal file
1
scripts/interfaces/IThrowInput.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cgscn34soorcp
|
1
scripts/interfaces/IUnlockable.cs.uid
Normal file
1
scripts/interfaces/IUnlockable.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c3dw0fsemrd0f
|
Reference in New Issue
Block a user