2024-07-26 14:38:18 +00:00
|
|
|
using ColdMint.scripts.map.events;
|
2024-06-03 14:58:59 +00:00
|
|
|
using Godot;
|
|
|
|
|
|
|
|
namespace ColdMint.scripts.loader.uiLoader;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <para>GameOverLoaderMenuLoader</para>
|
|
|
|
/// <para>游戏结束菜单加载器</para>
|
|
|
|
/// </summary>
|
|
|
|
public partial class GameOverLoaderMenuLoader : UiLoaderTemplate
|
|
|
|
{
|
|
|
|
private Label? _deathInfoLabel;
|
|
|
|
|
|
|
|
public override void InitializeUi()
|
|
|
|
{
|
2024-06-08 15:59:24 +00:00
|
|
|
Hide();
|
2024-06-03 14:58:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void InitializeData()
|
|
|
|
{
|
|
|
|
_deathInfoLabel =
|
|
|
|
GetNode<Label>("CenterContainer/VBoxContainer/MarginContainer/CenterContainer2/DeathInfoLabel");
|
2024-09-06 15:36:21 +00:00
|
|
|
EventBus.GameOverEvent += OnGameOver;
|
2024-10-17 09:16:47 +00:00
|
|
|
EventBus.GameReplayEvent += OnGameReplayEvent;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnGameReplayEvent(GameReplayEvent obj)
|
|
|
|
{
|
|
|
|
Hide();
|
2024-06-03 14:58:59 +00:00
|
|
|
}
|
|
|
|
|
2024-06-04 14:23:06 +00:00
|
|
|
public override void LoadUiActions()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2024-06-03 14:58:59 +00:00
|
|
|
private void OnGameOver(GameOverEvent gameOverEvent)
|
|
|
|
{
|
|
|
|
if (_deathInfoLabel == null)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-06-08 15:59:24 +00:00
|
|
|
Show();
|
2024-06-03 14:58:59 +00:00
|
|
|
_deathInfoLabel.Text = gameOverEvent.DeathInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void _ExitTree()
|
|
|
|
{
|
|
|
|
base._ExitTree();
|
2024-09-06 15:36:21 +00:00
|
|
|
EventBus.GameOverEvent -= OnGameOver;
|
2024-10-17 09:16:47 +00:00
|
|
|
EventBus.GameReplayEvent -= OnGameReplayEvent;
|
2024-06-03 14:58:59 +00:00
|
|
|
}
|
2024-10-17 09:16:47 +00:00
|
|
|
}
|